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.

281 lines (280 loc) 13.2 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 { ProfileViewMode } from './interfaces/profile-view-mode'; import { RestSdkTypes } from '../../rest-sdk/rest-client'; import { ProfilePostUpdateAction } from './interfaces/profile-post-update-action'; import { ContentSectionTitles, KnownFieldTypes } from '@progress/sitefinity-widget-designers-sdk/common'; import { ContentSection } from '@progress/sitefinity-widget-designers-sdk/decorators/content-section'; import { DisplayName } from '@progress/sitefinity-widget-designers-sdk/decorators/display-name'; import { DataModel, 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 { SectionsOrder, 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 { KeysValues } from '@progress/sitefinity-widget-designers-sdk/decorators/attributes'; import { Content } from '@progress/sitefinity-widget-designers-sdk/decorators/content'; import { ConditionalVisibility } from '@progress/sitefinity-widget-designers-sdk/decorators/conditional-visibility'; import { Margins } from '@progress/sitefinity-widget-designers-sdk/decorators/margins'; import { LengthDependsOn } from '@progress/sitefinity-widget-designers-sdk/decorators/length-depends-on'; let ProfileEntity = class ProfileEntity { SfViewName = 'Default'; // Advanced SfWidgetLabel = 'Profile'; Margins; ViewMode = ProfileViewMode.Edit; ReadEditModeRedirectPage; EditModeRedirectPage; ReadEditModeAction = ProfilePostUpdateAction.ViewMessage; EditModeAction = ProfilePostUpdateAction.ViewMessage; CssClass; EditProfileLinkLabel = 'Edit profile'; EditProfileHeaderLabel = 'Edit profile'; FirstNameLabel = 'First name'; LastNameLabel = 'Last name'; NicknameLabel = 'Nickname'; AboutLabel = 'About'; EmailLabel = 'Email'; PasswordLabel = 'Password'; SaveButtonLabel = 'Save changes'; ChangePhotoLabel = 'Change photo'; InvalidPhotoErrorMessage = 'Select image no larger than {0} B and in one of the following formats {1}.'; ValidationRequiredMessage = 'Field is required.'; InvalidEmailErrorMessage = 'Invalid email format.'; ChangeEmailLabel = 'To change your email address, you are required to enter your password.'; InvalidPasswordErrorMessage = 'Incorrect password.'; SuccessNotification = 'Your changes are saved.'; ConfirmEmailChangeTitleLabel = 'Confirm email change'; ConfirmEmailChangeDescriptionLabel = 'To confirm email change for your account a message has been sent to your new email'; ConfirmEmailChangeTitleExpiredLabel = 'Activation link has expired'; ConfirmEmailChangeDescriptionExpiredLabel = 'To access your account resend activation link to {0}.'; SendActivationLink = 'Send activation link'; SendAgainActivationLink = 'Send again'; SendConfirmationLinkSuccessTitle = 'Please check your email'; SendConfirmationLinkSuccessMessage = 'An activation link has been sent to {0}'; ConfirmEmailChangeTitleErrorLabel = 'Error has occurred'; ConfirmEmailChangeDescriptionErrorLabel = 'We could not change your email'; Attributes; }; __decorate([ ContentSection(ContentSectionTitles.DisplaySettings, 1), ViewSelector([{ Value: 'Default' }]), DisplayName('Profile template') ], ProfileEntity.prototype, "SfViewName", void 0); __decorate([ WidgetLabel() ], ProfileEntity.prototype, "SfWidgetLabel", void 0); __decorate([ ContentSection(ContentSectionTitles.DisplaySettings, 1), Margins('Profile') ], ProfileEntity.prototype, "Margins", void 0); __decorate([ ContentSection('Select mode', 1), DisplayName('Mode'), DataType(KnownFieldTypes.RadioChoice), Choice([ { Title: 'Edit mode only', Value: ProfileViewMode.Edit }, { Title: 'Read mode only', Value: ProfileViewMode.Read }, { Title: 'Both - read and edit mode', Value: ProfileViewMode.ReadEdit } ]) ], ProfileEntity.prototype, "ViewMode", void 0); __decorate([ ContentSection('Select pages', 1), DisplayName(''), Content({ Type: RestSdkTypes.Pages, AllowMultipleItemsSelection: false }), ConditionalVisibility({ conditions: [{ fieldName: 'ReadEditModeAction', operator: 'Equals', value: 'RedirectToPage' }], inline: true }) ], ProfileEntity.prototype, "ReadEditModeRedirectPage", void 0); __decorate([ ContentSection('Select pages', 1), DisplayName(''), Content({ Type: RestSdkTypes.Pages, AllowMultipleItemsSelection: false }), ConditionalVisibility({ conditions: [{ fieldName: 'EditModeAction', operator: 'Equals', value: 'RedirectToPage' }], inline: true }) ], ProfileEntity.prototype, "EditModeRedirectPage", void 0); __decorate([ ContentSection('Select mode', 1), DisplayName('After saving changes...'), DataType(KnownFieldTypes.RadioChoice), Choice([ { Title: 'View a message', Value: ProfilePostUpdateAction.ViewMessage }, { Title: 'Switch to Read mode', Value: ProfilePostUpdateAction.SwitchToReadMode }, { Title: 'Redirect to page...', Value: ProfilePostUpdateAction.RedirectToPage } ]), ConditionalVisibility({ conditions: [{ fieldName: 'ViewMode', operator: 'Equals', value: 'ReadEdit' }] }) ], ProfileEntity.prototype, "ReadEditModeAction", void 0); __decorate([ ContentSection('Select mode', 1), DisplayName('After saving changes...'), DataType(KnownFieldTypes.RadioChoice), Choice([ { Title: 'View a message', Value: ProfilePostUpdateAction.ViewMessage }, { Title: 'Redirect to page...', Value: ProfilePostUpdateAction.RedirectToPage } ]), ConditionalVisibility({ conditions: [{ fieldName: 'ViewMode', operator: 'Equals', value: 'Edit' }] }) ], ProfileEntity.prototype, "EditModeAction", void 0); __decorate([ Category(PropertyCategory.Advanced), DisplayName('CSS class') ], ProfileEntity.prototype, "CssClass", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Edit profile link label') ], ProfileEntity.prototype, "EditProfileLinkLabel", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Edit profile header') ], ProfileEntity.prototype, "EditProfileHeaderLabel", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('First name field label') ], ProfileEntity.prototype, "FirstNameLabel", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Last name field label') ], ProfileEntity.prototype, "LastNameLabel", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Username field label') ], ProfileEntity.prototype, "NicknameLabel", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('About field label') ], ProfileEntity.prototype, "AboutLabel", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Email field label') ], ProfileEntity.prototype, "EmailLabel", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Password field label') ], ProfileEntity.prototype, "PasswordLabel", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Save button') ], ProfileEntity.prototype, "SaveButtonLabel", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Change photo link label') ], ProfileEntity.prototype, "ChangePhotoLabel", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Invalid photo error message') ], ProfileEntity.prototype, "InvalidPhotoErrorMessage", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Required field error message') ], ProfileEntity.prototype, "ValidationRequiredMessage", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Invalid email error message') ], ProfileEntity.prototype, "InvalidEmailErrorMessage", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Change email label') ], ProfileEntity.prototype, "ChangeEmailLabel", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Invalid password error message') ], ProfileEntity.prototype, "InvalidPasswordErrorMessage", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Success notification') ], ProfileEntity.prototype, "SuccessNotification", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Confirm email change title') ], ProfileEntity.prototype, "ConfirmEmailChangeTitleLabel", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Confirm email change message') ], ProfileEntity.prototype, "ConfirmEmailChangeDescriptionLabel", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Expired activation link title') ], ProfileEntity.prototype, "ConfirmEmailChangeTitleExpiredLabel", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Expired activation link message') ], ProfileEntity.prototype, "ConfirmEmailChangeDescriptionExpiredLabel", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Send activation link') ], ProfileEntity.prototype, "SendActivationLink", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Send activation link label') ], ProfileEntity.prototype, "SendAgainActivationLink", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Activation link header') ], ProfileEntity.prototype, "SendConfirmationLinkSuccessTitle", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Activation link label') ], ProfileEntity.prototype, "SendConfirmationLinkSuccessMessage", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Activation error title') ], ProfileEntity.prototype, "ConfirmEmailChangeTitleErrorLabel", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection(ContentSectionTitles.LabelsAndMessages), DisplayName('Activation error message') ], ProfileEntity.prototype, "ConfirmEmailChangeDescriptionErrorLabel", void 0); __decorate([ Category(PropertyCategory.Advanced), ContentSection('Attributes'), DisplayName('Attributes for...'), DataType(KnownFieldTypes.Attributes), DataModel(KeysValues), LengthDependsOn(null, '', ' ', '[{"Name": "Profile", "Title": "Profile"}]') ], ProfileEntity.prototype, "Attributes", void 0); ProfileEntity = __decorate([ WidgetEntity('SitefinityProfile', 'Profile'), SectionsOrder(['Select mode', ContentSectionTitles.DisplaySettings]) ], ProfileEntity); export { ProfileEntity };