Update Koenig packages

no issue

- added passthrough of `feature.contentVisibility` when rendering Lexical to HTML to allow for labs-feature specific rendering of HTML cards
- updated golden post email render test to account for labs flags being on/off
This commit is contained in:
renovate[bot] 2024-08-14 13:47:02 +00:00 committed by Kevin Ansfield
parent f3e1ec7ddf
commit b2d5304c3c
9 changed files with 2451 additions and 41 deletions

View File

@ -49,7 +49,7 @@
"@tryghost/helpers": "1.1.90", "@tryghost/helpers": "1.1.90",
"@tryghost/kg-clean-basic-html": "4.1.3", "@tryghost/kg-clean-basic-html": "4.1.3",
"@tryghost/kg-converters": "1.0.6", "@tryghost/kg-converters": "1.0.6",
"@tryghost/koenig-lexical": "1.3.16", "@tryghost/koenig-lexical": "1.3.18",
"@tryghost/limit-service": "1.2.14", "@tryghost/limit-service": "1.2.14",
"@tryghost/members-csv": "0.0.0", "@tryghost/members-csv": "0.0.0",
"@tryghost/nql": "0.12.3", "@tryghost/nql": "0.12.3",

View File

@ -2,6 +2,7 @@ const path = require('path');
const errors = require('@tryghost/errors'); const errors = require('@tryghost/errors');
const urlUtils = require('../../shared/url-utils'); const urlUtils = require('../../shared/url-utils');
const config = require('../../shared/config'); const config = require('../../shared/config');
const labs = require('../../shared/labs');
const storage = require('../adapters/storage'); const storage = require('../adapters/storage');
let nodes; let nodes;
@ -99,7 +100,10 @@ module.exports = {
&& imageTransform.shouldResizeFileExtension(ext) && imageTransform.shouldResizeFileExtension(ext)
&& typeof storage.getStorage('images').saveRaw === 'function'; && typeof storage.getStorage('images').saveRaw === 'function';
}, },
getCollectionPosts getCollectionPosts,
feature: {
contentVisibility: labs.isSet('contentVisibility')
}
}, userOptions); }, userOptions);
return await this.lexicalHtmlRenderer.render(lexical, options); return await this.lexicalHtmlRenderer.render(lexical, options);

View File

@ -110,10 +110,10 @@
"@tryghost/kg-card-factory": "5.0.5", "@tryghost/kg-card-factory": "5.0.5",
"@tryghost/kg-converters": "1.0.6", "@tryghost/kg-converters": "1.0.6",
"@tryghost/kg-default-atoms": "5.0.3", "@tryghost/kg-default-atoms": "5.0.3",
"@tryghost/kg-default-cards": "10.0.8", "@tryghost/kg-default-cards": "10.0.9",
"@tryghost/kg-default-nodes": "1.1.12", "@tryghost/kg-default-nodes": "1.1.14",
"@tryghost/kg-html-to-lexical": "1.1.13", "@tryghost/kg-html-to-lexical": "1.1.15",
"@tryghost/kg-lexical-html-renderer": "1.1.15", "@tryghost/kg-lexical-html-renderer": "1.1.17",
"@tryghost/kg-mobiledoc-html-renderer": "7.0.6", "@tryghost/kg-mobiledoc-html-renderer": "7.0.6",
"@tryghost/limit-service": "1.2.14", "@tryghost/limit-service": "1.2.14",
"@tryghost/link-redirects": "0.0.0", "@tryghost/link-redirects": "0.0.0",

View File

@ -1,5 +1,7 @@
const sinon = require('sinon');
const {agentProvider, fixtureManager, mockManager} = require('../../../utils/e2e-framework'); const {agentProvider, fixtureManager, mockManager} = require('../../../utils/e2e-framework');
const models = require('../../../../core/server/models'); const models = require('../../../../core/server/models');
const labs = require('../../../../core/shared/labs');
const assert = require('assert/strict'); const assert = require('assert/strict');
const configUtils = require('../../../utils/configUtils'); const configUtils = require('../../../utils/configUtils');
const {sendEmail, matchEmailSnapshot} = require('../../../utils/batch-email-utils'); const {sendEmail, matchEmailSnapshot} = require('../../../utils/batch-email-utils');
@ -76,6 +78,7 @@ describe('Can send cards via email', function () {
value: false value: false
}], {context: {internal: true}}); }], {context: {internal: true}});
mockManager.restore(); mockManager.restore();
sinon.restore();
}); });
before(async function () { before(async function () {
@ -143,7 +146,26 @@ describe('Can send cards via email', function () {
await matchEmailSnapshot(); await matchEmailSnapshot();
}); });
it('renders the golden post correctly', async function () { it('renders the golden post correctly (no labs flags)', async function () {
sinon.stub(labs, 'isSet').returns(false);
const data = await sendEmail(agent, {
lexical: JSON.stringify(goldenPost)
});
splitPreheader(data);
await matchEmailSnapshot();
});
it('renders the golden post correctly (labs flag: contentVisibility)', async function () {
sinon.stub(labs, 'isSet').callsFake((key) => {
if (key === 'contentVisibility') {
return true;
}
return false;
});
const data = await sendEmail(agent, { const data = await sendEmail(agent, {
lexical: JSON.stringify(goldenPost) lexical: JSON.stringify(goldenPost)
}); });

View File

@ -353,7 +353,7 @@ describe('Unit: endpoints/utils/serializers/input/posts', function () {
serializers.input.posts.edit(apiConfig, frame); serializers.input.posts.edit(apiConfig, frame);
let postData = frame.data.posts[0]; let postData = frame.data.posts[0];
postData.lexical.should.equal('{"root":{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"this is great feature","type":"extended-text","version":1}],"direction":null,"format":"","indent":0,"type":"paragraph","version":1},{"type":"html","version":1,"html":"<div class=\\"custom\\">My Custom HTML</div>","visibility":{"emailOnly":false,"segment":""}},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"custom html preserved!","type":"extended-text","version":1}],"direction":null,"format":"","indent":0,"type":"paragraph","version":1}],"direction":null,"format":"","indent":0,"type":"root","version":1}}'); postData.lexical.should.equal('{"root":{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"this is great feature","type":"extended-text","version":1}],"direction":null,"format":"","indent":0,"type":"paragraph","version":1},{"type":"html","version":1,"html":"<div class=\\"custom\\">My Custom HTML</div>","visibility":{"showOnEmail":true,"showOnWeb":true,"segment":""}},{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":"custom html preserved!","type":"extended-text","version":1}],"direction":null,"format":"","indent":0,"type":"paragraph","version":1}],"direction":null,"format":"","indent":0,"type":"root","version":1}}');
}); });
it('throws error when HTML conversion fails', function () { it('throws error when HTML conversion fails', function () {

View File

@ -29,7 +29,7 @@
"@tryghost/email-events": "0.0.0", "@tryghost/email-events": "0.0.0",
"@tryghost/errors": "1.3.5", "@tryghost/errors": "1.3.5",
"@tryghost/html-to-plaintext": "0.0.0", "@tryghost/html-to-plaintext": "0.0.0",
"@tryghost/kg-default-cards": "10.0.8", "@tryghost/kg-default-cards": "10.0.9",
"@tryghost/logging": "2.4.18", "@tryghost/logging": "2.4.18",
"@tryghost/tpl": "0.1.32", "@tryghost/tpl": "0.1.32",
"@tryghost/validator": "0.2.14", "@tryghost/validator": "0.2.14",

View File

@ -22,7 +22,7 @@
}, },
"dependencies": { "dependencies": {
"@tryghost/debug": "0.1.32", "@tryghost/debug": "0.1.32",
"@tryghost/kg-default-cards": "10.0.8", "@tryghost/kg-default-cards": "10.0.9",
"@tryghost/string": "0.2.12", "@tryghost/string": "0.2.12",
"lodash": "4.17.21", "lodash": "4.17.21",
"papaparse": "5.3.2", "papaparse": "5.3.2",

View File

@ -7834,10 +7834,10 @@
resolved "https://registry.yarnpkg.com/@tryghost/kg-default-atoms/-/kg-default-atoms-5.0.3.tgz#7d0e5af2191f2e0c61ae11d1666905bf924f67ac" resolved "https://registry.yarnpkg.com/@tryghost/kg-default-atoms/-/kg-default-atoms-5.0.3.tgz#7d0e5af2191f2e0c61ae11d1666905bf924f67ac"
integrity sha512-uPE69rKxaiiMEa1vFsEbfX+LCBG2H5D/nqTkuIPAslEGIHYjQUruaXpBfnwtyVHn+dMLuWcO+wDJl5qET8gKEQ== integrity sha512-uPE69rKxaiiMEa1vFsEbfX+LCBG2H5D/nqTkuIPAslEGIHYjQUruaXpBfnwtyVHn+dMLuWcO+wDJl5qET8gKEQ==
"@tryghost/kg-default-cards@10.0.8": "@tryghost/kg-default-cards@10.0.9":
version "10.0.8" version "10.0.9"
resolved "https://registry.yarnpkg.com/@tryghost/kg-default-cards/-/kg-default-cards-10.0.8.tgz#ed67a90c1b5fe045c3e2822be8e14f43ccc2ee3a" resolved "https://registry.yarnpkg.com/@tryghost/kg-default-cards/-/kg-default-cards-10.0.9.tgz#6ea967c3270c4fd895f9f3b7773bc1203370fb45"
integrity sha512-yLao7TDpDDDHjiTqbl+6wmISpx//iuXY00gS7JqNrZ8X7hZ6IvxUdXu1Hq9AZuyzZ6+nqvyqRYgvZ1VycSVtTQ== integrity sha512-y5P5ybNX846PZ7N+z3Gs5curkqKSU0qNVjve0TVwQe5J3kHPwTKH4eMFcqrEQj9Tu3XgIqx0XWxXL3bSN6uWiw==
dependencies: dependencies:
"@tryghost/kg-markdown-html-renderer" "7.0.7" "@tryghost/kg-markdown-html-renderer" "7.0.7"
"@tryghost/string" "0.2.12" "@tryghost/string" "0.2.12"
@ -7847,10 +7847,10 @@
lodash "^4.17.21" lodash "^4.17.21"
luxon "^3.5.0" luxon "^3.5.0"
"@tryghost/kg-default-nodes@1.1.12": "@tryghost/kg-default-nodes@1.1.14":
version "1.1.12" version "1.1.14"
resolved "https://registry.yarnpkg.com/@tryghost/kg-default-nodes/-/kg-default-nodes-1.1.12.tgz#40be11e6a898f14e4249f05142e14e72ab956068" resolved "https://registry.yarnpkg.com/@tryghost/kg-default-nodes/-/kg-default-nodes-1.1.14.tgz#39039072451df411972e68ffa798ce1df768269d"
integrity sha512-zBeCgpcFZibehWzo10HjzKFS2RSW8AvSakShpX3h4skSDG9Tkki60b5ATczxiLFswHerEvnBacHEgZO1xzzbNQ== integrity sha512-X+aTPHgB6OuJeuQPK9xPNNcYgtL9pUIwOam0+RYzlsGswYMo0fAhxijPAo8oIgDyJ9gQRmMexHM0qWBNUvmHaA==
dependencies: dependencies:
"@lexical/clipboard" "0.13.1" "@lexical/clipboard" "0.13.1"
"@lexical/rich-text" "0.13.1" "@lexical/rich-text" "0.13.1"
@ -7864,21 +7864,21 @@
lodash "^4.17.21" lodash "^4.17.21"
luxon "^3.5.0" luxon "^3.5.0"
"@tryghost/kg-default-transforms@1.1.13": "@tryghost/kg-default-transforms@1.1.15":
version "1.1.13" version "1.1.15"
resolved "https://registry.yarnpkg.com/@tryghost/kg-default-transforms/-/kg-default-transforms-1.1.13.tgz#6d38f687f2f363d4b85a615216e1b83aff417954" resolved "https://registry.yarnpkg.com/@tryghost/kg-default-transforms/-/kg-default-transforms-1.1.15.tgz#054231b5b72934d65e694e5d81730d13594424ec"
integrity sha512-AvTpBNpUzpTI4EYtJ+xZapKxfz7mu/ZbdTgxCnuMkWRe0Cw3uOl838gaKHTMNuP76k7HCxNVW61gGm/FVofo5g== integrity sha512-iw4G3iq1X8Rc+6Fbcd9LWZWFt/VBQrdWW5klE4IMXii98saYdSnBcy2/mo+F7UWH81edHENfX1S4Zwd2zuA9eg==
dependencies: dependencies:
"@lexical/list" "0.13.1" "@lexical/list" "0.13.1"
"@lexical/rich-text" "0.13.1" "@lexical/rich-text" "0.13.1"
"@lexical/utils" "0.13.1" "@lexical/utils" "0.13.1"
"@tryghost/kg-default-nodes" "1.1.12" "@tryghost/kg-default-nodes" "1.1.14"
lexical "0.13.1" lexical "0.13.1"
"@tryghost/kg-html-to-lexical@1.1.13": "@tryghost/kg-html-to-lexical@1.1.15":
version "1.1.13" version "1.1.15"
resolved "https://registry.yarnpkg.com/@tryghost/kg-html-to-lexical/-/kg-html-to-lexical-1.1.13.tgz#83f9a24b30ba0a40f07ab1c8c66eb9c99904f049" resolved "https://registry.yarnpkg.com/@tryghost/kg-html-to-lexical/-/kg-html-to-lexical-1.1.15.tgz#c3ba3c96051a46bce4d7c6c42cdc33570d5d6e72"
integrity sha512-lVb0V5ckZ1SPjMzTfxzZ61ABN9koCNLQd1nCYHyNLunLH5IVVY2yRFNLt2CHtbfUMcjvGv4Egfi/g9oRwJkBiQ== integrity sha512-KOeBy56zjMPEjk2yUd3f2UnbPv/tic0g07vkCXuOFrz2wKJFX9MILQlmuVK5lHULnqKTGiZZ0yY6SmmKiLGYIA==
dependencies: dependencies:
"@lexical/clipboard" "0.13.1" "@lexical/clipboard" "0.13.1"
"@lexical/headless" "0.13.1" "@lexical/headless" "0.13.1"
@ -7886,15 +7886,15 @@
"@lexical/link" "0.13.1" "@lexical/link" "0.13.1"
"@lexical/list" "0.13.1" "@lexical/list" "0.13.1"
"@lexical/rich-text" "0.13.1" "@lexical/rich-text" "0.13.1"
"@tryghost/kg-default-nodes" "1.1.12" "@tryghost/kg-default-nodes" "1.1.14"
"@tryghost/kg-default-transforms" "1.1.13" "@tryghost/kg-default-transforms" "1.1.15"
jsdom "^24.1.0" jsdom "^24.1.0"
lexical "0.13.1" lexical "0.13.1"
"@tryghost/kg-lexical-html-renderer@1.1.15": "@tryghost/kg-lexical-html-renderer@1.1.17":
version "1.1.15" version "1.1.17"
resolved "https://registry.yarnpkg.com/@tryghost/kg-lexical-html-renderer/-/kg-lexical-html-renderer-1.1.15.tgz#9512fc14a3ed83baf7ce5577bbf3b33cde78292b" resolved "https://registry.yarnpkg.com/@tryghost/kg-lexical-html-renderer/-/kg-lexical-html-renderer-1.1.17.tgz#3628aa45f30b8355638bda91ba5ced908e116882"
integrity sha512-hCx7iizJvmbwUWtrQKOEOmH+lPmxzcoOf+gpxOL3actEcfFYHO9lYWTVg9x8s6Q8eyzLQ3lIh9mpdktzmz+x9g== integrity sha512-DSVQadD+N/67mhK4UzAChXPk5l5dqnOASqldY0CTzB0LhKUMRMKjZIDLpU4coo0Q8ckSqdYPqeSCP6s7I4F77Q==
dependencies: dependencies:
"@lexical/clipboard" "0.13.1" "@lexical/clipboard" "0.13.1"
"@lexical/code" "0.13.1" "@lexical/code" "0.13.1"
@ -7902,8 +7902,8 @@
"@lexical/link" "0.13.1" "@lexical/link" "0.13.1"
"@lexical/list" "0.13.1" "@lexical/list" "0.13.1"
"@lexical/rich-text" "0.13.1" "@lexical/rich-text" "0.13.1"
"@tryghost/kg-default-nodes" "1.1.12" "@tryghost/kg-default-nodes" "1.1.14"
"@tryghost/kg-default-transforms" "1.1.13" "@tryghost/kg-default-transforms" "1.1.15"
jsdom "^24.1.0" jsdom "^24.1.0"
lexical "0.13.1" lexical "0.13.1"
@ -7950,10 +7950,10 @@
dependencies: dependencies:
semver "^7.6.2" semver "^7.6.2"
"@tryghost/koenig-lexical@1.3.16": "@tryghost/koenig-lexical@1.3.18":
version "1.3.16" version "1.3.18"
resolved "https://registry.yarnpkg.com/@tryghost/koenig-lexical/-/koenig-lexical-1.3.16.tgz#b1f317e969dcfa6b01f3a7f6dce55c872bb6f833" resolved "https://registry.yarnpkg.com/@tryghost/koenig-lexical/-/koenig-lexical-1.3.18.tgz#b48b1edf8485df7f196e19b37fe6dc1e77a7fdba"
integrity sha512-jyLZL5QiMF+GjUIAHD/h69cb+PZrvC+9fA05lFTyBPlgVRc1L2qTu99Xo6YH+ZrE+mIBfmNfKRfmIRJRD5AR5w== integrity sha512-UmzdzDIV44yUq3C/dhlVdQtUybimLaDXt9E6cywc33b2USR3NN3k9fta02RWZab7nhiLFwm5Dt6CedpZTE70Ag==
"@tryghost/limit-service@1.2.14": "@tryghost/limit-service@1.2.14":
version "1.2.14" version "1.2.14"