Skip to content

Commit

Permalink
Merge pull request #788 from B77Mills/allBaseUpdates
Browse files Browse the repository at this point in the history
 Upgrade Mindful Post routing middleware to shared base-cms package
  • Loading branch information
B77Mills authored Dec 5, 2024
2 parents a78ce13 + 9457fe8 commit e39f575
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 11 deletions.
1 change: 1 addition & 0 deletions packages/global/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 8 additions & 6 deletions packages/global/routes/native-x.js
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
4 changes: 4 additions & 0 deletions packages/global/start-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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 }));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: 'Sponsored'});
$ const { id, type } = content;
$ const { primarySection } = content;

<theme-default-page title=story.title description=story.teaser>
<theme-default-page title=story.title description=story.teaser canonical-url=story.url>
<@head>
<marko-web-gtm-native-x-story-context|{ context }| obj=content>
<marko-web-gtm-push data=context />
Expand Down
3 changes: 3 additions & 0 deletions packages/overdrive/config/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ module.exports = {
useLinkInjectedBody: process.env.USE_LINK_INJECTED_BODY === 'true',
identityX,
identityXOptInHooks,
mindful: {
namespace: 'rr/default',
},
nativeX,
navigation,
newsletter,
Expand Down
3 changes: 3 additions & 0 deletions sites/ccjdigital.com/config/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ module.exports = {
useLinkInjectedBody: process.env.USE_LINK_INJECTED_BODY === 'true',
identityX,
identityXOptInHooks,
mindful: {
namespace: 'rr/default',
},
nativeX,
navigation,
newsletter,
Expand Down
3 changes: 3 additions & 0 deletions sites/cleantrucking.com/config/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ module.exports = {
useLinkInjectedBody: process.env.USE_LINK_INJECTED_BODY === 'true',
identityX,
// identityXOptInHooks,
mindful: {
namespace: 'rr/default',
},
nativeX,
navigation,
newsletter,
Expand Down
3 changes: 3 additions & 0 deletions sites/equipmentworld.com/config/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ module.exports = {
useLinkInjectedBody: process.env.USE_LINK_INJECTED_BODY === 'true',
identityX,
identityXOptInHooks,
mindful: {
namespace: 'rr/default',
},
nativeX,
navigation,
newsletter,
Expand Down
3 changes: 3 additions & 0 deletions sites/hardworkingtrucks.com/config/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ module.exports = {
useLinkInjectedBody: process.env.USE_LINK_INJECTED_BODY === 'true',
identityX,
// identityXOptInHooks,
mindful: {
namespace: 'rr/default',
},
nativeX,
navigation,
newsletter,
Expand Down
3 changes: 3 additions & 0 deletions sites/totallandscapecare.com/config/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ module.exports = {
useLinkInjectedBody: process.env.USE_LINK_INJECTED_BODY === 'true',
identityX,
// identityXOptInHooks,
mindful: {
namespace: 'rr/default',
},
nativeX,
navigation,
newsletter,
Expand Down
3 changes: 3 additions & 0 deletions sites/truckersnews.com/config/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ module.exports = {
useLinkInjectedBody: process.env.USE_LINK_INJECTED_BODY === 'true',
identityX,
// identityXOptInHooks,
mindful: {
namespace: 'rr/default',
},
nativeX,
navigation,
newsletter,
Expand Down
3 changes: 3 additions & 0 deletions sites/truckpartsandservice.com/config/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ module.exports = {
useLinkInjectedBody: process.env.USE_LINK_INJECTED_BODY === 'true',
identityX,
identityXOptInHooks,
mindful: {
namespace: 'rr/default',
},
nativeX,
navigation,
newsletter,
Expand Down
42 changes: 39 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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==
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"

Expand Down

0 comments on commit e39f575

Please sign in to comment.