From c272f2f5f53a2d9de1510b68e4b43fcad2a4a4c0 Mon Sep 17 00:00:00 2001 From: Brian Miller Date: Wed, 20 Nov 2024 14:20:26 -0600 Subject: [PATCH 1/5] @parameter1/base-cms dep upgrades 4.80.0 From 54a52b8acff08b65bb389f2faa2edce7bb74888e Mon Sep 17 00:00:00 2001 From: Brian Miller Date: Wed, 20 Nov 2024 14:41:01 -0600 Subject: [PATCH 2/5] Upgrade MIndfulPost routeing/Middleware --- packages/global/routes/native-x.js | 14 ++++++++------ packages/global/start-server.js | 4 ++++ ...native-x-story.marko => advertising-post.marko} | 4 ++-- packages/overdrive/config/site.js | 3 +++ sites/ccjdigital.com/config/site.js | 3 +++ sites/cleantrucking.com/config/site.js | 3 +++ sites/equipmentworld.com/config/site.js | 3 +++ sites/hardworkingtrucks.com/config/site.js | 3 +++ sites/totallandscapecare.com/config/site.js | 3 +++ sites/truckersnews.com/config/site.js | 3 +++ sites/truckpartsandservice.com/config/site.js | 3 +++ 11 files changed, 38 insertions(+), 8 deletions(-) rename packages/global/templates/content/{native-x-story.marko => advertising-post.marko} (95%) diff --git a/packages/global/routes/native-x.js b/packages/global/routes/native-x.js index bfddded12..5319ac922 100644 --- a/packages/global/routes/native-x.js +++ b/packages/global/routes/native-x.js @@ -1,13 +1,15 @@ -const withNativeXStory = require('@parameter1/base-cms-marko-web-native-x/middleware/with-story'); -const { getAsObject } = require('@parameter1/base-cms-object-path'); -const queryFragment = require('@parameter1/base-cms-marko-web-theme-monorail/graphql/fragments/native-x-story'); +const getAdvertisingPostAsNativeStory = require('@parameter1/base-cms-mindful/marko-web/middleware/get-advertising-post-as-native-story'); +const advertisingPostTemplate = require('../templates/content/advertising-post'); const { newsletterState } = require('../middleware/newsletter-state'); -const template = require('../templates/content/native-x-story'); const partnerInsights = require('../templates/partner-insights'); module.exports = (app) => { - const config = getAsObject(app, 'locals.nativeX'); - app.get('/sponsored/:section/:slug/:id', withNativeXStory({ config, template, queryFragment })); + // Mindful|NativeX (Story rendering) + getAdvertisingPostAsNativeStory(app, { + route: '/sponsored/:section/:slug/:id', + tenant: 'randallreilly', + template: advertisingPostTemplate, + }); app.get('/partner-insights', newsletterState(), (_, res) => { res.marko(partnerInsights, { name: 'Partner Insights', diff --git a/packages/global/start-server.js b/packages/global/start-server.js index 26ad2cee3..80eca3c8d 100644 --- a/packages/global/start-server.js +++ b/packages/global/start-server.js @@ -7,6 +7,7 @@ const htmlSitemapPagination = require('@parameter1/base-cms-marko-web-html-sitem const omedaIdentityX = require('@parameter1/base-cms-marko-web-omeda-identity-x'); const omedaCookie = require('@parameter1/base-cms-marko-web-omeda/olytics/customer-cookie'); const fetch = require('node-fetch'); +const MindfulMarkoWebService = require('@parameter1/base-cms-mindful/marko-web/middleware/service'); const document = require('./components/document'); const components = require('./components'); @@ -51,6 +52,9 @@ module.exports = (options = {}) => { if (typeof onStart === 'function') await onStart(app); app.set('trust proxy', 'loopback, linklocal, uniquelocal'); + const { namespace } = getAsObject(options, 'siteConfig.mindful'); + app.use(MindfulMarkoWebService({ namespace })); + // Use HWT redirect handler app.use((req, res, next) => hwtRedirectHandler({ req, res, next })); diff --git a/packages/global/templates/content/native-x-story.marko b/packages/global/templates/content/advertising-post.marko similarity index 95% rename from packages/global/templates/content/native-x-story.marko rename to packages/global/templates/content/advertising-post.marko index 0aa65e2c9..3c2c1b352 100644 --- a/packages/global/templates/content/native-x-story.marko +++ b/packages/global/templates/content/advertising-post.marko @@ -3,11 +3,11 @@ import convert from "@parameter1/base-cms-marko-web-native-x/utils/convert-story $ const { nativeX } = out.global; $ const { story } = input; -$ const content = convert(story); +$ const content = convert(story, { sectionName: 'Brand Insights'}); $ const { id, type } = content; $ const { primarySection } = content; - + <@head> diff --git a/packages/overdrive/config/site.js b/packages/overdrive/config/site.js index dc93091e6..0923be323 100644 --- a/packages/overdrive/config/site.js +++ b/packages/overdrive/config/site.js @@ -16,6 +16,9 @@ module.exports = { useLinkInjectedBody: process.env.USE_LINK_INJECTED_BODY === 'true', identityX, identityXOptInHooks, + mindful: { + namespace: 'rr/default', + }, nativeX, navigation, newsletter, diff --git a/sites/ccjdigital.com/config/site.js b/sites/ccjdigital.com/config/site.js index 1709fe9f0..51e18b74f 100644 --- a/sites/ccjdigital.com/config/site.js +++ b/sites/ccjdigital.com/config/site.js @@ -17,6 +17,9 @@ module.exports = { useLinkInjectedBody: process.env.USE_LINK_INJECTED_BODY === 'true', identityX, identityXOptInHooks, + mindful: { + namespace: 'rr/default', + }, nativeX, navigation, newsletter, diff --git a/sites/cleantrucking.com/config/site.js b/sites/cleantrucking.com/config/site.js index adb049b0c..4fc54a96a 100644 --- a/sites/cleantrucking.com/config/site.js +++ b/sites/cleantrucking.com/config/site.js @@ -16,6 +16,9 @@ module.exports = { useLinkInjectedBody: process.env.USE_LINK_INJECTED_BODY === 'true', identityX, // identityXOptInHooks, + mindful: { + namespace: 'rr/default', + }, nativeX, navigation, newsletter, diff --git a/sites/equipmentworld.com/config/site.js b/sites/equipmentworld.com/config/site.js index 11c49e0bd..b4e4e1de9 100644 --- a/sites/equipmentworld.com/config/site.js +++ b/sites/equipmentworld.com/config/site.js @@ -16,6 +16,9 @@ module.exports = { useLinkInjectedBody: process.env.USE_LINK_INJECTED_BODY === 'true', identityX, identityXOptInHooks, + mindful: { + namespace: 'rr/default', + }, nativeX, navigation, newsletter, diff --git a/sites/hardworkingtrucks.com/config/site.js b/sites/hardworkingtrucks.com/config/site.js index 5c1f0f515..bfc8e2c36 100644 --- a/sites/hardworkingtrucks.com/config/site.js +++ b/sites/hardworkingtrucks.com/config/site.js @@ -16,6 +16,9 @@ module.exports = { useLinkInjectedBody: process.env.USE_LINK_INJECTED_BODY === 'true', identityX, // identityXOptInHooks, + mindful: { + namespace: 'rr/default', + }, nativeX, navigation, newsletter, diff --git a/sites/totallandscapecare.com/config/site.js b/sites/totallandscapecare.com/config/site.js index 230a40cdc..a0685d2e9 100644 --- a/sites/totallandscapecare.com/config/site.js +++ b/sites/totallandscapecare.com/config/site.js @@ -16,6 +16,9 @@ module.exports = { useLinkInjectedBody: process.env.USE_LINK_INJECTED_BODY === 'true', identityX, // identityXOptInHooks, + mindful: { + namespace: 'rr/default', + }, nativeX, navigation, newsletter, diff --git a/sites/truckersnews.com/config/site.js b/sites/truckersnews.com/config/site.js index c0ffb33b1..2c8c5e326 100644 --- a/sites/truckersnews.com/config/site.js +++ b/sites/truckersnews.com/config/site.js @@ -17,6 +17,9 @@ module.exports = { useLinkInjectedBody: process.env.USE_LINK_INJECTED_BODY === 'true', identityX, // identityXOptInHooks, + mindful: { + namespace: 'rr/default', + }, nativeX, navigation, newsletter, diff --git a/sites/truckpartsandservice.com/config/site.js b/sites/truckpartsandservice.com/config/site.js index b7da3ebd7..f7f69808f 100644 --- a/sites/truckpartsandservice.com/config/site.js +++ b/sites/truckpartsandservice.com/config/site.js @@ -16,6 +16,9 @@ module.exports = { useLinkInjectedBody: process.env.USE_LINK_INJECTED_BODY === 'true', identityX, identityXOptInHooks, + mindful: { + namespace: 'rr/default', + }, nativeX, navigation, newsletter, From 84c1b0fa1785c866da3aaf23ad3de92198e2aac3 Mon Sep 17 00:00:00 2001 From: Brian Miller Date: Thu, 5 Dec 2024 11:15:29 -0600 Subject: [PATCH 3/5] ensure missing pacakge is included missed it in my rebase cleanup. :( --- packages/global/package.json | 1 + yarn.lock | 42 +++++++++++++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/packages/global/package.json b/packages/global/package.json index ac4a0c5ca..31676fd9d 100644 --- a/packages/global/package.json +++ b/packages/global/package.json @@ -32,6 +32,7 @@ "@parameter1/base-cms-marko-web-search": "^4.80.4", "@parameter1/base-cms-marko-web-social-sharing": "^4.74.0", "@parameter1/base-cms-marko-web-theme-monorail": "^4.81.0", + "@parameter1/base-cms-mindful": "^4.78.2", "@parameter1/base-cms-object-path": "^4.74.0", "@parameter1/base-cms-utils": "^4.74.0", "@parameter1/base-cms-web-cli": "^4.74.0", diff --git a/yarn.lock b/yarn.lock index db42a56c9..793fc2cac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -376,12 +376,12 @@ protobufjs "^7.0.0" yargs "^16.2.0" -"@hapi/hoek@^9.0.0": +"@hapi/hoek@^9.0.0", "@hapi/hoek@^9.3.0": version "9.3.0" resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb" integrity sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ== -"@hapi/topo@^5.0.0": +"@hapi/topo@^5.0.0", "@hapi/topo@^5.1.0": version "5.1.0" resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-5.1.0.tgz#dc448e332c6c6e37a4dc02fd84ba8d44b9afb012" integrity sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg== @@ -1286,6 +1286,24 @@ vue "^2.7.14" vue-server-renderer "^2.7.14" +"@parameter1/base-cms-mindful@^4.78.2": + version "4.78.2" + resolved "https://registry.yarnpkg.com/@parameter1/base-cms-mindful/-/base-cms-mindful-4.78.2.tgz#3b924d205dc0077b3bc98749a7d532b2eff094d3" + integrity sha512-VF7RCenzC9rTx5I/jpMlKKFk+2dWxBqNdz+N/ZlLTEOACintvPLNhdeSIoinb9b/FqeevTtU55eocZLTZC2weg== + dependencies: + "@parameter1/base-cms-env" "^4.74.0" + "@parameter1/base-cms-object-path" "^4.74.0" + "@parameter1/base-cms-utils" "^4.74.0" + "@parameter1/joi" "^1.2.10" + debug "^4.1.1" + express "^4.17.1" + graphql "^14.5.4" + graphql-tag "^2.12.6" + http-errors "^1.8.1" + joi "^17.7.0" + newrelic "^9.10.2" + node-fetch "^2.6.1" + "@parameter1/base-cms-object-path@^4.74.0": version "4.74.0" resolved "https://registry.yarnpkg.com/@parameter1/base-cms-object-path/-/base-cms-object-path-4.74.0.tgz#1fa3eec1b630a7b6bf27bac73d6391904dc2ea5c" @@ -1501,6 +1519,13 @@ dependencies: "@hapi/hoek" "^9.0.0" +"@sideway/address@^4.1.5": + version "4.1.5" + resolved "https://registry.yarnpkg.com/@sideway/address/-/address-4.1.5.tgz#4bc149a0076623ced99ca8208ba780d65a99b9d5" + integrity sha512-IqO/DUQHUkPeixNQ8n0JA6102hT9CmaljNTPmQ1u8MEhBo/R4Q8eKLN/vGZxuebwOroDB4cbpjheD4+/sKFK4Q== + dependencies: + "@hapi/hoek" "^9.0.0" + "@sideway/formula@^3.0.1": version "3.0.1" resolved "https://registry.yarnpkg.com/@sideway/formula/-/formula-3.0.1.tgz#80fcbcbaf7ce031e0ef2dd29b1bfc7c3f583611f" @@ -5052,6 +5077,17 @@ joi@^17.4.2: "@sideway/formula" "^3.0.1" "@sideway/pinpoint" "^2.0.0" +joi@^17.7.0: + version "17.13.3" + resolved "https://registry.yarnpkg.com/joi/-/joi-17.13.3.tgz#0f5cc1169c999b30d344366d384b12d92558bcec" + integrity sha512-otDA4ldcIx+ZXsKHWmp0YizCweVRZG96J10b0FevjfuncLO1oX59THoAmHkNubYJ+9gWsYsp5k8v4ib6oDv1fA== + dependencies: + "@hapi/hoek" "^9.3.0" + "@hapi/topo" "^5.1.0" + "@sideway/address" "^4.1.5" + "@sideway/formula" "^3.0.1" + "@sideway/pinpoint" "^2.0.0" + jquery@^3.6.3: version "3.6.3" resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.6.3.tgz#23ed2ffed8a19e048814f13391a19afcdba160e6" @@ -6804,7 +6840,7 @@ postcss-convert-values@^5.1.3: browserslist "^4.21.4" postcss-value-parser "^4.2.0" -"postcss-critical-split@github:mrnocreativity/postcss-critical-split#51bb6d62bc75d635e32dcce90f30ba3ef6299081": +postcss-critical-split@mrnocreativity/postcss-critical-split#51bb6d62bc75d635e32dcce90f30ba3ef6299081: version "2.5.3" resolved "https://codeload.github.com/mrnocreativity/postcss-critical-split/tar.gz/51bb6d62bc75d635e32dcce90f30ba3ef6299081" From e7e822eea006def3c76301b5267166be247a8144 Mon Sep 17 00:00:00 2001 From: Brian Miller Date: Thu, 5 Dec 2024 11:53:24 -0600 Subject: [PATCH 4/5] Correctly name the section Partner Insights Not Brand Insights. :( --- packages/global/templates/content/advertising-post.marko | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/global/templates/content/advertising-post.marko b/packages/global/templates/content/advertising-post.marko index 3c2c1b352..95032fec7 100644 --- a/packages/global/templates/content/advertising-post.marko +++ b/packages/global/templates/content/advertising-post.marko @@ -3,7 +3,7 @@ import convert from "@parameter1/base-cms-marko-web-native-x/utils/convert-story $ const { nativeX } = out.global; $ const { story } = input; -$ const content = convert(story, { sectionName: 'Brand Insights'}); +$ const content = convert(story, { sectionName: 'Partner Insights'}); $ const { id, type } = content; $ const { primarySection } = content; From 9457fe8b7c9d0f10dfcd87b1f83853095f4fa320 Mon Sep 17 00:00:00 2001 From: Brian Miller Date: Thu, 5 Dec 2024 11:57:20 -0600 Subject: [PATCH 5/5] Update breadcrumb to Sponsored --- packages/global/templates/content/advertising-post.marko | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/global/templates/content/advertising-post.marko b/packages/global/templates/content/advertising-post.marko index 95032fec7..bbfd200b3 100644 --- a/packages/global/templates/content/advertising-post.marko +++ b/packages/global/templates/content/advertising-post.marko @@ -3,7 +3,7 @@ import convert from "@parameter1/base-cms-marko-web-native-x/utils/convert-story $ const { nativeX } = out.global; $ const { story } = input; -$ const content = convert(story, { sectionName: 'Partner Insights'}); +$ const content = convert(story, { sectionName: 'Sponsored'}); $ const { id, type } = content; $ const { primarySection } = content;