diff --git a/examples/getstarted/config/features.js b/examples/getstarted/config/features.js index 222170aee6..817d6e26de 100644 --- a/examples/getstarted/config/features.js +++ b/examples/getstarted/config/features.js @@ -1,5 +1,5 @@ module.exports = ({ env }) => ({ future: { - contentReleasesScheduling: env.bool('STRAPI_FUTURE_CONTENT_RELEASES_SCHEDULING', false), + preview: env.bool('STRAPI_FUTURE_PREVIEW', false), }, }); diff --git a/packages/core/content-manager/admin/src/index.ts b/packages/core/content-manager/admin/src/index.ts index cae1019bed..753a67cd57 100644 --- a/packages/core/content-manager/admin/src/index.ts +++ b/packages/core/content-manager/admin/src/index.ts @@ -4,6 +4,7 @@ import { PLUGIN_ID } from './constants/plugin'; import { ContentManagerPlugin } from './content-manager'; import { historyAdmin } from './history'; import { reducer } from './modules/reducers'; +import { previewAdmin } from './preview'; import { routes } from './router'; import { prefixPluginTranslations } from './utils/translations'; @@ -45,6 +46,9 @@ export default { if (typeof historyAdmin.bootstrap === 'function') { historyAdmin.bootstrap(app); } + if (typeof previewAdmin.bootstrap === 'function') { + previewAdmin.bootstrap(app); + } }, async registerTrads({ locales }: { locales: string[] }) { const importedTrads = await Promise.all( diff --git a/packages/core/content-manager/admin/src/preview/LICENSE b/packages/core/content-manager/admin/src/preview/LICENSE new file mode 100644 index 0000000000..7ef3aabf5f --- /dev/null +++ b/packages/core/content-manager/admin/src/preview/LICENSE @@ -0,0 +1,17 @@ +Copyright (c) 2015-present Strapi Solutions SAS + +* All software that resides within this directory and its subdirectories, is licensed under the license defined below. + +Enterprise License + +If you or the company you represent has entered into a written agreement referencing the Enterprise Edition of the Strapi source code available at +https://github.com/strapi/strapi, then such agreement applies to your use of the Enterprise Edition of the Strapi Software. If you or the company you +represent is using the Enterprise Edition of the Strapi Software in connection with a subscription to our cloud offering, then the agreement you have +agreed to with respect to our cloud offering and the licenses included in such agreement apply to your use of the Enterprise Edition of the Strapi Software. +Otherwise, the Strapi Enterprise Software License Agreement (found here https://strapi.io/enterprise-terms) applies to your use of the Enterprise Edition of the Strapi Software. + +BY ACCESSING OR USING THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE RELEVANT REFERENCED AGREEMENT. +IF YOU ARE NOT AUTHORIZED TO ACCEPT THESE TERMS ON BEHALF OF THE COMPANY YOU REPRESENT OR IF YOU DO NOT AGREE TO ALL OF THE RELEVANT TERMS AND CONDITIONS REFERENCED AND YOU +HAVE NOT OTHERWISE EXECUTED A WRITTEN AGREEMENT WITH STRAPI, YOU ARE NOT AUTHORIZED TO ACCESS OR USE OR ALLOW ANY USER TO ACCESS OR USE ANY PART OF +THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE. YOUR ACCESS RIGHTS ARE CONDITIONAL ON YOUR CONSENT TO THE RELEVANT REFERENCED TERMS TO THE EXCLUSION OF ALL OTHER TERMS; +IF THE RELEVANT REFERENCED TERMS ARE CONSIDERED AN OFFER BY YOU, ACCEPTANCE IS EXPRESSLY LIMITED TO THE RELEVANT REFERENCED TERMS. diff --git a/packages/core/content-manager/admin/src/preview/constants.ts b/packages/core/content-manager/admin/src/preview/constants.ts new file mode 100644 index 0000000000..4d7e03781c --- /dev/null +++ b/packages/core/content-manager/admin/src/preview/constants.ts @@ -0,0 +1 @@ +export const FEATURE_ID = 'preview'; diff --git a/packages/core/content-manager/admin/src/preview/index.ts b/packages/core/content-manager/admin/src/preview/index.ts new file mode 100644 index 0000000000..a8de7baa76 --- /dev/null +++ b/packages/core/content-manager/admin/src/preview/index.ts @@ -0,0 +1,18 @@ +/* eslint-disable check-file/no-index */ + +import { FEATURE_ID } from './constants'; + +import type { PluginDefinition } from '@strapi/admin/strapi-admin'; + +const previewAdmin = { + bootstrap(app) { + // TODO: Add license registry check when it's available + if (!window.strapi.future.isEnabled(FEATURE_ID)) { + return {}; + } + // eslint-disable-next-line no-console -- TODO remove when we have real functionality + console.log('Bootstrapping preview admin'); + }, +} satisfies Partial; + +export { previewAdmin }; diff --git a/packages/core/content-manager/server/src/bootstrap.ts b/packages/core/content-manager/server/src/bootstrap.ts index e6565e1a55..c3e1a5c11d 100644 --- a/packages/core/content-manager/server/src/bootstrap.ts +++ b/packages/core/content-manager/server/src/bootstrap.ts @@ -1,6 +1,7 @@ import { getService } from './utils'; import { ALLOWED_WEBHOOK_EVENTS } from './constants'; import history from './history'; +import preview from './preview'; export default async () => { Object.entries(ALLOWED_WEBHOOK_EVENTS).forEach(([key, value]) => { @@ -13,4 +14,5 @@ export default async () => { await getService('permission').registerPermissions(); await history.bootstrap?.({ strapi }); + await preview.bootstrap?.({ strapi }); }; diff --git a/packages/core/content-manager/server/src/preview/LICENSE b/packages/core/content-manager/server/src/preview/LICENSE new file mode 100644 index 0000000000..7ef3aabf5f --- /dev/null +++ b/packages/core/content-manager/server/src/preview/LICENSE @@ -0,0 +1,17 @@ +Copyright (c) 2015-present Strapi Solutions SAS + +* All software that resides within this directory and its subdirectories, is licensed under the license defined below. + +Enterprise License + +If you or the company you represent has entered into a written agreement referencing the Enterprise Edition of the Strapi source code available at +https://github.com/strapi/strapi, then such agreement applies to your use of the Enterprise Edition of the Strapi Software. If you or the company you +represent is using the Enterprise Edition of the Strapi Software in connection with a subscription to our cloud offering, then the agreement you have +agreed to with respect to our cloud offering and the licenses included in such agreement apply to your use of the Enterprise Edition of the Strapi Software. +Otherwise, the Strapi Enterprise Software License Agreement (found here https://strapi.io/enterprise-terms) applies to your use of the Enterprise Edition of the Strapi Software. + +BY ACCESSING OR USING THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE RELEVANT REFERENCED AGREEMENT. +IF YOU ARE NOT AUTHORIZED TO ACCEPT THESE TERMS ON BEHALF OF THE COMPANY YOU REPRESENT OR IF YOU DO NOT AGREE TO ALL OF THE RELEVANT TERMS AND CONDITIONS REFERENCED AND YOU +HAVE NOT OTHERWISE EXECUTED A WRITTEN AGREEMENT WITH STRAPI, YOU ARE NOT AUTHORIZED TO ACCESS OR USE OR ALLOW ANY USER TO ACCESS OR USE ANY PART OF +THE ENTERPRISE EDITION OF THE STRAPI SOFTWARE. YOUR ACCESS RIGHTS ARE CONDITIONAL ON YOUR CONSENT TO THE RELEVANT REFERENCED TERMS TO THE EXCLUSION OF ALL OTHER TERMS; +IF THE RELEVANT REFERENCED TERMS ARE CONSIDERED AN OFFER BY YOU, ACCEPTANCE IS EXPRESSLY LIMITED TO THE RELEVANT REFERENCED TERMS. diff --git a/packages/core/content-manager/server/src/preview/constants.ts b/packages/core/content-manager/server/src/preview/constants.ts new file mode 100644 index 0000000000..4d7e03781c --- /dev/null +++ b/packages/core/content-manager/server/src/preview/constants.ts @@ -0,0 +1 @@ +export const FEATURE_ID = 'preview'; diff --git a/packages/core/content-manager/server/src/preview/index.ts b/packages/core/content-manager/server/src/preview/index.ts new file mode 100644 index 0000000000..8096d4c101 --- /dev/null +++ b/packages/core/content-manager/server/src/preview/index.ts @@ -0,0 +1,22 @@ +import type { Plugin } from '@strapi/types'; +import { FEATURE_ID } from './constants'; + +/** + * Check once if the feature is enabled before loading it, + * so that we can assume it is enabled in the other files. + */ +const getFeature = (): Partial => { + // TODO: Add license registry check when it's available + if (!strapi.features.future.isEnabled(FEATURE_ID)) { + return {}; + } + + return { + bootstrap() { + // eslint-disable-next-line no-console -- TODO remove when we have real functionality + console.log('Bootstrapping preview server'); + }, + }; +}; + +export default getFeature(); diff --git a/packages/core/types/src/modules/features.ts b/packages/core/types/src/modules/features.ts index 097ca9229b..4fae21d01b 100644 --- a/packages/core/types/src/modules/features.ts +++ b/packages/core/types/src/modules/features.ts @@ -1,6 +1,6 @@ export interface FeaturesConfig { future?: { - contentReleases?: boolean; + preview?: boolean; }; }