chore: remove unused field & make role field required
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { ComponentPermission } from '../Component/ComponentPermission'
|
||||
import { ContentType, SubscriptionName } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import { ComponentArea } from '../Component/ComponentArea'
|
||||
import { PermissionName } from '../Permission/PermissionName'
|
||||
import { FeatureIdentifier } from './FeatureIdentifier'
|
||||
@@ -12,7 +12,6 @@ type RoleFields = {
|
||||
role_name?: string
|
||||
|
||||
/** Statically populated. Non-influencing; used as a reference by other static consumers (such as email service) */
|
||||
availableInSubscriptions: SubscriptionName[]
|
||||
availableInRoles: string[]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { SubscriptionName } from '@standardnotes/common'
|
||||
import { GetFeatures, GetFeaturesForSubscription } from './Features'
|
||||
import { GetFeatures } from './Features'
|
||||
|
||||
describe('features', () => {
|
||||
it('all features should have availableInRoles populated', () => {
|
||||
@@ -9,11 +8,4 @@ describe('features', () => {
|
||||
expect(feature.availableInRoles !== undefined && feature.availableInRoles.length > 0).toBeTruthy()
|
||||
}
|
||||
})
|
||||
it('gets features for plus plan', () => {
|
||||
const features = GetFeaturesForSubscription(SubscriptionName.PlusPlan)
|
||||
|
||||
for (const feature of features) {
|
||||
expect(feature.availableInSubscriptions.includes(SubscriptionName.PlusPlan))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -4,16 +4,11 @@ import { serverFeatures } from '../Lists/ServerFeatures'
|
||||
import { clientFeatures } from '../Lists/ClientFeatures'
|
||||
import { GetDeprecatedFeatures } from '../Lists/DeprecatedFeatures'
|
||||
import { experimentalFeatures } from '../Lists/ExperimentalFeatures'
|
||||
import { SubscriptionName } from '@standardnotes/common'
|
||||
|
||||
export function GetFeatures(): FeatureDescription[] {
|
||||
return [...serverFeatures(), ...clientFeatures(), ...experimentalFeatures(), ...GetDeprecatedFeatures()]
|
||||
}
|
||||
|
||||
export function GetFeaturesForSubscription(subscription: SubscriptionName): FeatureDescription[] {
|
||||
return GetFeatures().filter((feature) => feature.availableInSubscriptions.includes(subscription))
|
||||
}
|
||||
|
||||
export function FindNativeFeature(identifier: FeatureIdentifier): FeatureDescription | undefined {
|
||||
return GetFeatures().find((f) => f.identifier === identifier)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { FeatureDescription } from '../Feature/FeatureDescription'
|
||||
import { PermissionName } from '../Permission/PermissionName'
|
||||
import { FeatureIdentifier } from '../Feature/FeatureIdentifier'
|
||||
import { SubscriptionName } from '@standardnotes/common'
|
||||
import { RoleName } from '@standardnotes/domain-core'
|
||||
import { themes } from './Themes'
|
||||
import { editors } from './Editors'
|
||||
@@ -12,7 +11,6 @@ export function clientFeatures(): FeatureDescription[] {
|
||||
...editors(),
|
||||
{
|
||||
name: 'Tag Nesting',
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser],
|
||||
identifier: FeatureIdentifier.TagNesting,
|
||||
permission_name: PermissionName.TagNesting,
|
||||
@@ -21,7 +19,6 @@ export function clientFeatures(): FeatureDescription[] {
|
||||
{
|
||||
name: 'Super Notes',
|
||||
identifier: FeatureIdentifier.SuperEditor,
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser],
|
||||
permission_name: PermissionName.SuperEditor,
|
||||
description:
|
||||
@@ -29,7 +26,6 @@ export function clientFeatures(): FeatureDescription[] {
|
||||
},
|
||||
{
|
||||
name: 'Smart Filters',
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser],
|
||||
identifier: FeatureIdentifier.SmartFilters,
|
||||
permission_name: PermissionName.SmartFilters,
|
||||
@@ -37,7 +33,6 @@ export function clientFeatures(): FeatureDescription[] {
|
||||
},
|
||||
{
|
||||
name: 'Encrypted files',
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser],
|
||||
identifier: FeatureIdentifier.Files,
|
||||
permission_name: PermissionName.Files,
|
||||
@@ -45,7 +40,6 @@ export function clientFeatures(): FeatureDescription[] {
|
||||
},
|
||||
{
|
||||
name: 'Extension',
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser],
|
||||
identifier: FeatureIdentifier.Extension,
|
||||
permission_name: PermissionName.Extension,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ContentType, SubscriptionName } from '@standardnotes/common'
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import {
|
||||
EditorFeatureDescription,
|
||||
IframeComponentFeatureDescription,
|
||||
@@ -14,7 +14,6 @@ import { RoleName } from '@standardnotes/domain-core'
|
||||
|
||||
export function GetDeprecatedFeatures(): FeatureDescription[] {
|
||||
const bold: EditorFeatureDescription = FillEditorComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Alternative Rich Text',
|
||||
identifier: FeatureIdentifier.DeprecatedBoldEditor,
|
||||
note_type: NoteType.RichText,
|
||||
@@ -42,7 +41,6 @@ export function GetDeprecatedFeatures(): FeatureDescription[] {
|
||||
})
|
||||
|
||||
const markdownBasic: EditorFeatureDescription = FillEditorComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Basic Markdown',
|
||||
identifier: FeatureIdentifier.DeprecatedMarkdownBasicEditor,
|
||||
note_type: NoteType.Markdown,
|
||||
@@ -56,7 +54,6 @@ export function GetDeprecatedFeatures(): FeatureDescription[] {
|
||||
})
|
||||
|
||||
const markdownAlt: EditorFeatureDescription = FillEditorComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Markdown Alternative',
|
||||
identifier: FeatureIdentifier.DeprecatedMarkdownVisualEditor,
|
||||
note_type: NoteType.Markdown,
|
||||
@@ -71,7 +68,6 @@ export function GetDeprecatedFeatures(): FeatureDescription[] {
|
||||
})
|
||||
|
||||
const markdownMinimist: EditorFeatureDescription = FillEditorComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Minimal Markdown',
|
||||
identifier: FeatureIdentifier.DeprecatedMarkdownMinimistEditor,
|
||||
note_type: NoteType.Markdown,
|
||||
@@ -86,7 +82,6 @@ export function GetDeprecatedFeatures(): FeatureDescription[] {
|
||||
})
|
||||
|
||||
const markdownMath: EditorFeatureDescription = FillEditorComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Markdown with Math',
|
||||
identifier: FeatureIdentifier.DeprecatedMarkdownMathEditor,
|
||||
spellcheckControl: true,
|
||||
@@ -101,7 +96,6 @@ export function GetDeprecatedFeatures(): FeatureDescription[] {
|
||||
})
|
||||
|
||||
const filesafe: IframeComponentFeatureDescription = FillEditorComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'FileSafe',
|
||||
identifier: FeatureIdentifier.DeprecatedFileSafe,
|
||||
component_permissions: [
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { SubscriptionName } from '@standardnotes/common'
|
||||
import { EditorFeatureDescription } from '../Feature/FeatureDescription'
|
||||
import { PermissionName } from '../Permission/PermissionName'
|
||||
import { FeatureIdentifier } from '../Feature/FeatureIdentifier'
|
||||
@@ -8,7 +7,6 @@ import { RoleName } from '@standardnotes/domain-core'
|
||||
|
||||
export function editors(): EditorFeatureDescription[] {
|
||||
const code: EditorFeatureDescription = FillEditorComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Code',
|
||||
spellcheckControl: true,
|
||||
identifier: FeatureIdentifier.CodeEditor,
|
||||
@@ -25,7 +23,6 @@ export function editors(): EditorFeatureDescription[] {
|
||||
})
|
||||
|
||||
const plus: EditorFeatureDescription = FillEditorComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Rich Text',
|
||||
note_type: NoteType.RichText,
|
||||
file_type: 'html',
|
||||
@@ -39,7 +36,6 @@ export function editors(): EditorFeatureDescription[] {
|
||||
})
|
||||
|
||||
const markdown: EditorFeatureDescription = FillEditorComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Markdown',
|
||||
identifier: FeatureIdentifier.MarkdownProEditor,
|
||||
note_type: NoteType.Markdown,
|
||||
@@ -53,7 +49,6 @@ export function editors(): EditorFeatureDescription[] {
|
||||
})
|
||||
|
||||
const task: EditorFeatureDescription = FillEditorComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Checklist',
|
||||
identifier: FeatureIdentifier.TaskEditor,
|
||||
note_type: NoteType.Task,
|
||||
@@ -68,7 +63,6 @@ export function editors(): EditorFeatureDescription[] {
|
||||
})
|
||||
|
||||
const tokenvault: EditorFeatureDescription = FillEditorComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Authenticator',
|
||||
note_type: NoteType.Authentication,
|
||||
file_type: 'json',
|
||||
@@ -82,7 +76,6 @@ export function editors(): EditorFeatureDescription[] {
|
||||
})
|
||||
|
||||
const spreadsheets: EditorFeatureDescription = FillEditorComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Spreadsheet',
|
||||
identifier: FeatureIdentifier.SheetsEditor,
|
||||
note_type: NoteType.Spreadsheet,
|
||||
|
||||
@@ -1,73 +1,62 @@
|
||||
import { ServerFeatureDescription } from '../Feature/FeatureDescription'
|
||||
import { PermissionName } from '../Permission/PermissionName'
|
||||
import { FeatureIdentifier } from '../Feature/FeatureIdentifier'
|
||||
import { SubscriptionName } from '@standardnotes/common'
|
||||
import { RoleName } from '@standardnotes/domain-core'
|
||||
|
||||
export function serverFeatures(): ServerFeatureDescription[] {
|
||||
return [
|
||||
{
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Two factor authentication',
|
||||
identifier: FeatureIdentifier.TwoFactorAuth,
|
||||
permission_name: PermissionName.TwoFactorAuth,
|
||||
availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser],
|
||||
},
|
||||
{
|
||||
availableInSubscriptions: [SubscriptionName.ProPlan],
|
||||
name: 'U2F authentication',
|
||||
identifier: FeatureIdentifier.UniversalSecondFactor,
|
||||
permission_name: PermissionName.UniversalSecondFactor,
|
||||
availableInRoles: [RoleName.NAMES.ProUser],
|
||||
},
|
||||
{
|
||||
availableInSubscriptions: [SubscriptionName.ProPlan],
|
||||
name: 'Unlimited note history',
|
||||
identifier: FeatureIdentifier.NoteHistoryUnlimited,
|
||||
permission_name: PermissionName.NoteHistoryUnlimited,
|
||||
availableInRoles: [RoleName.NAMES.ProUser],
|
||||
},
|
||||
{
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan],
|
||||
name: '365 days note history',
|
||||
identifier: FeatureIdentifier.NoteHistory365Days,
|
||||
permission_name: PermissionName.NoteHistory365Days,
|
||||
availableInRoles: [RoleName.NAMES.PlusUser],
|
||||
},
|
||||
{
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Email backups',
|
||||
identifier: FeatureIdentifier.DailyEmailBackup,
|
||||
permission_name: PermissionName.DailyEmailBackup,
|
||||
availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser],
|
||||
},
|
||||
{
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Sign-in email alerts',
|
||||
identifier: FeatureIdentifier.SignInAlerts,
|
||||
permission_name: PermissionName.SignInAlerts,
|
||||
availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser],
|
||||
},
|
||||
{
|
||||
availableInSubscriptions: [SubscriptionName.ProPlan],
|
||||
identifier: FeatureIdentifier.FilesMaximumStorageTier,
|
||||
permission_name: PermissionName.FilesMaximumStorageTier,
|
||||
availableInRoles: [RoleName.NAMES.ProUser],
|
||||
},
|
||||
{
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan],
|
||||
identifier: FeatureIdentifier.FilesLowStorageTier,
|
||||
permission_name: PermissionName.FilesLowStorageTier,
|
||||
availableInRoles: [RoleName.NAMES.PlusUser],
|
||||
},
|
||||
{
|
||||
availableInSubscriptions: [SubscriptionName.ProPlan],
|
||||
identifier: FeatureIdentifier.SubscriptionSharing,
|
||||
permission_name: PermissionName.SubscriptionSharing,
|
||||
availableInRoles: [RoleName.NAMES.ProUser],
|
||||
},
|
||||
{
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Listed Custom Domain',
|
||||
identifier: FeatureIdentifier.ListedCustomDomain,
|
||||
permission_name: PermissionName.ListedCustomDomain,
|
||||
|
||||
@@ -2,12 +2,10 @@ import { ThemeFeatureDescription } from '../Feature/FeatureDescription'
|
||||
import { PermissionName } from '../Permission/PermissionName'
|
||||
import { FeatureIdentifier } from '../Feature/FeatureIdentifier'
|
||||
import { FillThemeComponentDefaults } from './Utilities/FillThemeComponentDefaults'
|
||||
import { SubscriptionName } from '@standardnotes/common'
|
||||
import { RoleName } from '@standardnotes/domain-core'
|
||||
|
||||
export function themes(): ThemeFeatureDescription[] {
|
||||
const midnight: ThemeFeatureDescription = FillThemeComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
name: 'Midnight',
|
||||
identifier: FeatureIdentifier.MidnightTheme,
|
||||
permission_name: PermissionName.MidnightTheme,
|
||||
@@ -22,7 +20,6 @@ export function themes(): ThemeFeatureDescription[] {
|
||||
})
|
||||
|
||||
const futura: ThemeFeatureDescription = FillThemeComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser],
|
||||
name: 'Futura',
|
||||
identifier: FeatureIdentifier.FuturaTheme,
|
||||
@@ -37,7 +34,6 @@ export function themes(): ThemeFeatureDescription[] {
|
||||
})
|
||||
|
||||
const solarizedDark: ThemeFeatureDescription = FillThemeComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser],
|
||||
name: 'Solarized Dark',
|
||||
identifier: FeatureIdentifier.SolarizedDarkTheme,
|
||||
@@ -52,7 +48,6 @@ export function themes(): ThemeFeatureDescription[] {
|
||||
})
|
||||
|
||||
const autobiography: ThemeFeatureDescription = FillThemeComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser],
|
||||
name: 'Autobiography',
|
||||
identifier: FeatureIdentifier.AutobiographyTheme,
|
||||
@@ -66,7 +61,7 @@ export function themes(): ThemeFeatureDescription[] {
|
||||
})
|
||||
|
||||
const dark: ThemeFeatureDescription = FillThemeComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
availableInRoles: [RoleName.NAMES.CoreUser, RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser],
|
||||
name: 'Dark',
|
||||
identifier: FeatureIdentifier.DarkTheme,
|
||||
permission_name: PermissionName.FocusedTheme,
|
||||
@@ -81,7 +76,6 @@ export function themes(): ThemeFeatureDescription[] {
|
||||
})
|
||||
|
||||
const titanium: ThemeFeatureDescription = FillThemeComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser],
|
||||
name: 'Titanium',
|
||||
identifier: FeatureIdentifier.TitaniumTheme,
|
||||
@@ -95,7 +89,6 @@ export function themes(): ThemeFeatureDescription[] {
|
||||
})
|
||||
|
||||
const dynamic: ThemeFeatureDescription = FillThemeComponentDefaults({
|
||||
availableInSubscriptions: [SubscriptionName.PlusPlan, SubscriptionName.ProPlan],
|
||||
availableInRoles: [RoleName.NAMES.PlusUser, RoleName.NAMES.ProUser],
|
||||
name: 'Dynamic Panels',
|
||||
identifier: FeatureIdentifier.DynamicTheme,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ContentType } from '@standardnotes/common'
|
||||
import { EditorFeatureDescription } from '../../Feature/FeatureDescription'
|
||||
import { ComponentArea } from '../../Component/ComponentArea'
|
||||
|
||||
export type RequiredEditorFields = Pick<EditorFeatureDescription, 'availableInSubscriptions'>
|
||||
export type RequiredEditorFields = Pick<EditorFeatureDescription, 'availableInRoles'>
|
||||
|
||||
export function FillEditorComponentDefaults(
|
||||
component: Partial<EditorFeatureDescription> & RequiredEditorFields,
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ContentType } from '@standardnotes/common'
|
||||
import { ThemeFeatureDescription } from '../../Feature/FeatureDescription'
|
||||
import { ComponentArea } from '../../Component/ComponentArea'
|
||||
|
||||
type RequiredThemeFields = Pick<ThemeFeatureDescription, 'availableInSubscriptions'>
|
||||
type RequiredThemeFields = Pick<ThemeFeatureDescription, 'availableInRoles'>
|
||||
|
||||
export function FillThemeComponentDefaults(
|
||||
theme: Partial<ThemeFeatureDescription> & RequiredThemeFields,
|
||||
|
||||
Reference in New Issue
Block a user