From 44a10e7ab3e5b6cd7c85e89d98a101d949310bc5 Mon Sep 17 00:00:00 2001 From: Bartek Biedrzycki Date: Mon, 16 Dec 2024 13:43:41 +0100 Subject: [PATCH 1/5] Docs: key update. [short flow] --- docs/getting-started/licensing/license-key-and-activation.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/getting-started/licensing/license-key-and-activation.md b/docs/getting-started/licensing/license-key-and-activation.md index 72db1cf12dd..32a90e3807a 100644 --- a/docs/getting-started/licensing/license-key-and-activation.md +++ b/docs/getting-started/licensing/license-key-and-activation.md @@ -117,8 +117,7 @@ This key grants access to your subscription features. It does not consume editor * **Features**: Grants access to subscription features. * **Functionality**: - * Similar to the trial license, the editor is limited functionally, including session time and the number of changes allowed. - * Additionally, there are limitations on development domains. The editor can be used in the following domains: `localhost`, `*.test`, `*.localhost`, `*.local`, and IP addresses: `127.0.0.1`, `192.168.*.*`, `10.*.*.*`, `172.*.*.*`. + * Limitations on development domains apply on usage-based plans. The editor can be used in the following domains: `localhost`, `*.test`, `*.localhost`, `*.local`, and IP addresses: `127.0.0.1`, `192.168.*.*`, `10.*.*.*`, `172.*.*.*`. * The editor will show a banner informing it was launched for development purposes. * **Intended use**: Designed for development environments such as local work, continuous integration (CI), and end-to-end (E2E) tests. * **Usage limitation**: Must not be used for production environments. From 6ea4ae7333a51431306a16aedd7763ab7d74bbd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gorzeli=C5=84ski?= Date: Mon, 16 Dec 2024 14:26:02 +0100 Subject: [PATCH 2/5] Other: Update the logic of the check. --- packages/ckeditor5-core/src/editor/editor.ts | 23 ++++++++----------- .../tests/editor/licensecheck.js | 15 ++++++------ 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/packages/ckeditor5-core/src/editor/editor.ts b/packages/ckeditor5-core/src/editor/editor.ts index b6f1ab010bc..e713b34cc33 100644 --- a/packages/ckeditor5-core/src/editor/editor.ts +++ b/packages/ckeditor5-core/src/editor/editor.ts @@ -525,8 +525,8 @@ export default abstract class Editor extends /* #__PURE__ */ ObservableMixin() { return; } - if ( [ 'evaluation', 'trial', 'development' ].includes( licensePayload.licenseType ) ) { - const licenseType: 'evaluation' | 'trial' | 'development' = licensePayload.licenseType; + if ( [ 'evaluation', 'trial' ].includes( licensePayload.licenseType ) ) { + const licenseType: 'evaluation' | 'trial' = licensePayload.licenseType; console.info( `You are using the ${ licenseType } version of CKEditor 5 with limited usage. ` + @@ -542,6 +542,13 @@ export default abstract class Editor extends /* #__PURE__ */ ObservableMixin() { } ); } + if ( licensePayload.licenseType === 'development' ) { + console.info( + 'You are using the development version of CKEditor 5. ' + + 'Make sure you will not use it in the production environment.' + ); + } + if ( licensePayload.usageEndpoint ) { editor.once( 'ready', () => { const request = { @@ -986,17 +993,6 @@ export default abstract class Editor extends /* #__PURE__ */ ObservableMixin() { throw new CKEditorError( 'license-key-trial-limit' ); } - if ( reason == 'developmentLimit' ) { - /** - * You have exceeded the operation limit for your development license key within the editor. - * Please restart the editor to continue using it. - * {@glink getting-started/licensing/license-key-and-activation#license-key-types Read more about license key types}. - * - * @error license-key-development-limit - */ - throw new CKEditorError( 'license-key-development-limit' ); - } - if ( reason == 'usageLimit' ) { /** * You have reached the usage limit of your license key. This can occur in the following situations: @@ -1103,7 +1099,6 @@ type LicenseErrorReason = 'featureNotAllowed' | 'evaluationLimit' | 'trialLimit' | - 'developmentLimit' | 'usageLimit' | 'distributionChannel'; diff --git a/packages/ckeditor5-core/tests/editor/licensecheck.js b/packages/ckeditor5-core/tests/editor/licensecheck.js index b5a2701f2de..383725b8446 100644 --- a/packages/ckeditor5-core/tests/editor/licensecheck.js +++ b/packages/ckeditor5-core/tests/editor/licensecheck.js @@ -441,8 +441,8 @@ describe( 'Editor - license check', () => { expect( editor.isReadOnly ).to.be.false; sinon.assert.calledOnce( consoleInfoStub ); - sinon.assert.calledWith( consoleInfoStub, 'You are using the development version of CKEditor 5 with ' + - 'limited usage. Make sure you will not use it in the production environment.' ); + sinon.assert.calledWith( consoleInfoStub, 'You are using the development version of CKEditor 5. ' + + 'Make sure you will not use it in the production environment.' ); } ); it( 'should not block the editor if 10 minutes have not passed (development license)', () => { @@ -466,7 +466,7 @@ describe( 'Editor - license check', () => { dateNow.restore(); } ); - it( 'should block editor after 10 minutes (development license)', () => { + it( 'also should not block editor after 10 minutes (development license)', () => { const { licenseKey, todayTimestamp } = generateKey( { licenseType: 'development' } ); @@ -480,13 +480,13 @@ describe( 'Editor - license check', () => { sinon.clock.tick( 600100 ); - sinon.assert.calledWithMatch( showErrorStub, 'developmentLimit' ); - expect( editor.isReadOnly ).to.be.true; + sinon.assert.notCalled( showErrorStub ); + expect( editor.isReadOnly ).to.be.false; dateNow.restore(); } ); - it( 'should clear timer on editor destroy', done => { + it( 'should not interact with timers', done => { const { licenseKey, todayTimestamp } = generateKey( { licenseType: 'development' } ); @@ -497,7 +497,7 @@ describe( 'Editor - license check', () => { editor.fire( 'ready' ); editor.on( 'destroy', () => { - sinon.assert.calledOnce( clearTimeoutSpy ); + sinon.assert.notCalled( clearTimeoutSpy ); done(); } ); @@ -688,7 +688,6 @@ describe( 'Editor - license check', () => { { reason: 'featureNotAllowed', error: 'license-key-plugin-not-allowed', pluginName: 'PluginABC' }, { reason: 'evaluationLimit', error: 'license-key-evaluation-limit' }, { reason: 'trialLimit', error: 'license-key-trial-limit' }, - { reason: 'developmentLimit', error: 'license-key-development-limit' }, { reason: 'usageLimit', error: 'license-key-usage-limit' }, { reason: 'distributionChannel', error: 'license-key-invalid-distribution-channel' } ]; From fd0bc395847eab3a19e9abc8b58bbbbcee1fd269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gorzeli=C5=84ski?= Date: Tue, 17 Dec 2024 09:37:27 +0100 Subject: [PATCH 3/5] Fix: Bring back error code. --- packages/ckeditor5-core/src/editor/editor.ts | 12 ++++++++++++ packages/ckeditor5-core/tests/editor/licensecheck.js | 1 + 2 files changed, 13 insertions(+) diff --git a/packages/ckeditor5-core/src/editor/editor.ts b/packages/ckeditor5-core/src/editor/editor.ts index e713b34cc33..1334a7974e3 100644 --- a/packages/ckeditor5-core/src/editor/editor.ts +++ b/packages/ckeditor5-core/src/editor/editor.ts @@ -993,6 +993,17 @@ export default abstract class Editor extends /* #__PURE__ */ ObservableMixin() { throw new CKEditorError( 'license-key-trial-limit' ); } + if ( reason == 'developmentLimit' ) { + /** + * You have exceeded the operation limit for your development license key within the editor. + * Please restart the editor to continue using it. + * {@glink getting-started/licensing/license-key-and-activation#license-key-types Read more about license key types}. + * + * @error license-key-development-limit + */ + throw new CKEditorError( 'license-key-development-limit' ); + } + if ( reason == 'usageLimit' ) { /** * You have reached the usage limit of your license key. This can occur in the following situations: @@ -1100,6 +1111,7 @@ type LicenseErrorReason = 'evaluationLimit' | 'trialLimit' | 'usageLimit' | + 'developmentLimit' | 'distributionChannel'; /** diff --git a/packages/ckeditor5-core/tests/editor/licensecheck.js b/packages/ckeditor5-core/tests/editor/licensecheck.js index 383725b8446..1b09c0264dc 100644 --- a/packages/ckeditor5-core/tests/editor/licensecheck.js +++ b/packages/ckeditor5-core/tests/editor/licensecheck.js @@ -688,6 +688,7 @@ describe( 'Editor - license check', () => { { reason: 'featureNotAllowed', error: 'license-key-plugin-not-allowed', pluginName: 'PluginABC' }, { reason: 'evaluationLimit', error: 'license-key-evaluation-limit' }, { reason: 'trialLimit', error: 'license-key-trial-limit' }, + { reason: 'developmentLimit', error: 'license-key-development-limit' }, { reason: 'usageLimit', error: 'license-key-usage-limit' }, { reason: 'distributionChannel', error: 'license-key-invalid-distribution-channel' } ]; From ebf1afc7c8828b8a534ecc4d3a25799afe0452e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gorzeli=C5=84ski?= Date: Tue, 17 Dec 2024 09:41:02 +0100 Subject: [PATCH 4/5] Fix: Order. --- packages/ckeditor5-core/src/editor/editor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ckeditor5-core/src/editor/editor.ts b/packages/ckeditor5-core/src/editor/editor.ts index 1334a7974e3..55f75d65be9 100644 --- a/packages/ckeditor5-core/src/editor/editor.ts +++ b/packages/ckeditor5-core/src/editor/editor.ts @@ -1110,8 +1110,8 @@ type LicenseErrorReason = 'featureNotAllowed' | 'evaluationLimit' | 'trialLimit' | - 'usageLimit' | 'developmentLimit' | + 'usageLimit' | 'distributionChannel'; /** From 49b8326bc4a36acd771d47f084a522c03c9be017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Gorzeli=C5=84ski?= Date: Tue, 17 Dec 2024 13:38:46 +0100 Subject: [PATCH 5/5] Fix: Wording in the unit test. --- packages/ckeditor5-core/tests/editor/licensecheck.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ckeditor5-core/tests/editor/licensecheck.js b/packages/ckeditor5-core/tests/editor/licensecheck.js index 1b09c0264dc..74be3944912 100644 --- a/packages/ckeditor5-core/tests/editor/licensecheck.js +++ b/packages/ckeditor5-core/tests/editor/licensecheck.js @@ -466,7 +466,7 @@ describe( 'Editor - license check', () => { dateNow.restore(); } ); - it( 'also should not block editor after 10 minutes (development license)', () => { + it( 'should not block editor after 10 minutes (development license)', () => { const { licenseKey, todayTimestamp } = generateKey( { licenseType: 'development' } );