@mindful-web/marko-web-theme-monorail 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +1 -0
- package/LICENSE +21 -0
- package/README.md +103 -0
- package/browser/.eslintrc.js +1 -0
- package/browser/block-loader.vue +64 -0
- package/browser/comment-toggle-button.vue +89 -0
- package/browser/company-search.vue +78 -0
- package/browser/content-meter-track.vue +90 -0
- package/browser/i18n-vue.js +11 -0
- package/browser/idx-newsletter-form/index.js +61 -0
- package/browser/idx-newsletter-form/inline.vue +243 -0
- package/browser/idx-newsletter-form/pushdown.vue +249 -0
- package/browser/idx-newsletter-form/toggle-button.vue +65 -0
- package/browser/index.js +170 -0
- package/browser/inline-newsletter-form/step1.vue +159 -0
- package/browser/inline-newsletter-form.vue +129 -0
- package/browser/menu-toggle-button.vue +150 -0
- package/browser/newsletter-close-button.vue +44 -0
- package/browser/newsletter-signup-form/check-icon.vue +13 -0
- package/browser/newsletter-signup-form/form-group.vue +50 -0
- package/browser/newsletter-signup-form/input-form-group.vue +57 -0
- package/browser/newsletter-signup-form/newsletter-checkbox.vue +63 -0
- package/browser/newsletter-signup-form/privacy-policy.vue +38 -0
- package/browser/newsletter-signup-form/select-form-group.vue +59 -0
- package/browser/newsletter-signup-form/sign-up-button.vue +49 -0
- package/browser/newsletter-signup-form/step2.vue +284 -0
- package/browser/newsletter-signup-modal-listener.vue +59 -0
- package/browser/newsletter-toggle-button.vue +42 -0
- package/browser/reveal-ad-handler.vue +195 -0
- package/browser/section-search.vue +89 -0
- package/browser/site-newsletter-menu/step1.vue +189 -0
- package/browser/site-newsletter-menu.vue +176 -0
- package/browser/ssr.js +15 -0
- package/browser/top-stories-menu.vue +58 -0
- package/browser/translations-vue.js +50 -0
- package/browser/wufoo-form.vue +62 -0
- package/components/ads/fixed-ad-bottom.marko +7 -0
- package/components/ads/fixed-ad-bottom.marko.js +36 -0
- package/components/ads/marko.json +20 -0
- package/components/ads/reveal-ad-handler.marko +9 -0
- package/components/ads/reveal-ad-handler.marko.js +38 -0
- package/components/blocks/author-bios.marko +28 -0
- package/components/blocks/author-bios.marko.js +76 -0
- package/components/blocks/callout-cards.marko +15 -0
- package/components/blocks/callout-cards.marko.js +74 -0
- package/components/blocks/company-inquiry-form.marko +30 -0
- package/components/blocks/company-inquiry-form.marko.js +93 -0
- package/components/blocks/company-search.marko +1 -0
- package/components/blocks/company-search.marko.js +29 -0
- package/components/blocks/content-card-deck.marko +142 -0
- package/components/blocks/content-card-deck.marko.js +325 -0
- package/components/blocks/content-meter.marko +85 -0
- package/components/blocks/content-meter.marko.js +132 -0
- package/components/blocks/full-width-native-ad.marko +21 -0
- package/components/blocks/full-width-native-ad.marko.js +62 -0
- package/components/blocks/hero-card.marko +91 -0
- package/components/blocks/hero-card.marko.js +207 -0
- package/components/blocks/latest-content-list.marko +89 -0
- package/components/blocks/latest-content-list.marko.js +146 -0
- package/components/blocks/latest-podcast.marko +64 -0
- package/components/blocks/latest-podcast.marko.js +172 -0
- package/components/blocks/latest-products-feed.marko +58 -0
- package/components/blocks/latest-products-feed.marko.js +166 -0
- package/components/blocks/marko.json +204 -0
- package/components/blocks/more-products.marko +49 -0
- package/components/blocks/more-products.marko.js +135 -0
- package/components/blocks/most-popular-list.marko +75 -0
- package/components/blocks/most-popular-list.marko.js +146 -0
- package/components/blocks/most-popular.marko +97 -0
- package/components/blocks/most-popular.marko.js +190 -0
- package/components/blocks/native-x-card-deck.marko +85 -0
- package/components/blocks/native-x-card-deck.marko.js +221 -0
- package/components/blocks/native-x-promo-card.marko +55 -0
- package/components/blocks/native-x-promo-card.marko.js +135 -0
- package/components/blocks/newsletter-signup-banner-external.marko +33 -0
- package/components/blocks/newsletter-signup-banner-external.marko.js +103 -0
- package/components/blocks/newsletter-signup-banner-large.marko +36 -0
- package/components/blocks/newsletter-signup-banner-large.marko.js +93 -0
- package/components/blocks/newsletter-signup-banner.marko +39 -0
- package/components/blocks/newsletter-signup-banner.marko.js +69 -0
- package/components/blocks/opinion.marko +34 -0
- package/components/blocks/opinion.marko.js +95 -0
- package/components/blocks/primary-image.marko +125 -0
- package/components/blocks/primary-image.marko.js +228 -0
- package/components/blocks/products.marko +57 -0
- package/components/blocks/products.marko.js +157 -0
- package/components/blocks/read-next.marko +42 -0
- package/components/blocks/read-next.marko.js +113 -0
- package/components/blocks/related-stories.marko +74 -0
- package/components/blocks/related-stories.marko.js +165 -0
- package/components/blocks/resource-library.marko +77 -0
- package/components/blocks/resource-library.marko.js +194 -0
- package/components/blocks/section-body-feed.marko +39 -0
- package/components/blocks/section-body-feed.marko.js +99 -0
- package/components/blocks/section-card-deck-featured.marko +37 -0
- package/components/blocks/section-card-deck-featured.marko.js +105 -0
- package/components/blocks/section-card-deck.marko +13 -0
- package/components/blocks/section-card-deck.marko.js +44 -0
- package/components/blocks/section-card-list.marko +102 -0
- package/components/blocks/section-card-list.marko.js +236 -0
- package/components/blocks/section-feed.marko +46 -0
- package/components/blocks/section-feed.marko.js +94 -0
- package/components/blocks/section-forbes.marko +102 -0
- package/components/blocks/section-forbes.marko.js +221 -0
- package/components/blocks/section-list-deck.marko +38 -0
- package/components/blocks/section-list-deck.marko.js +109 -0
- package/components/blocks/section-list.marko +89 -0
- package/components/blocks/section-list.marko.js +179 -0
- package/components/blocks/section-search.marko +14 -0
- package/components/blocks/section-search.marko.js +57 -0
- package/components/blocks/section-title-feed.marko +40 -0
- package/components/blocks/section-title-feed.marko.js +100 -0
- package/components/blocks/top-stories-menu.marko +40 -0
- package/components/blocks/top-stories-menu.marko.js +98 -0
- package/components/blocks/top-stories.marko +76 -0
- package/components/blocks/top-stories.marko.js +186 -0
- package/components/blocks/white-papers.marko +80 -0
- package/components/blocks/white-papers.marko.js +205 -0
- package/components/breadcrumbs/content-page.marko +7 -0
- package/components/breadcrumbs/content-page.marko.js +35 -0
- package/components/breadcrumbs/index.marko +21 -0
- package/components/breadcrumbs/index.marko.js +59 -0
- package/components/breadcrumbs/marko.json +32 -0
- package/components/breadcrumbs/scss/_breadcrumbs.scss +35 -0
- package/components/breadcrumbs/website-section.marko +31 -0
- package/components/breadcrumbs/website-section.marko.js +107 -0
- package/components/breadcrumbs/with-home.marko +13 -0
- package/components/breadcrumbs/with-home.marko.js +65 -0
- package/components/client-side-block-loader.marko +6 -0
- package/components/client-side-block-loader.marko.js +36 -0
- package/components/client-side-blocks/marko.json +8 -0
- package/components/client-side-blocks/most-popular-list.marko +1 -0
- package/components/client-side-blocks/most-popular-list.marko.js +31 -0
- package/components/client-side-blocks/most-popular.marko +1 -0
- package/components/client-side-blocks/most-popular.marko.js +31 -0
- package/components/content/body-with-injection.marko +116 -0
- package/components/content/body-with-injection.marko.js +190 -0
- package/components/content/contact-details/index.marko +95 -0
- package/components/content/contact-details/index.marko.js +274 -0
- package/components/content/contact-details/marko.json +27 -0
- package/components/content/contact-details/section.marko +9 -0
- package/components/content/contact-details/section.marko.js +37 -0
- package/components/content/download/form-dot-com.marko +23 -0
- package/components/content/download/form-dot-com.marko.js +59 -0
- package/components/content/download/identity-x.marko +73 -0
- package/components/content/download/identity-x.marko.js +149 -0
- package/components/content/download/index.marko +43 -0
- package/components/content/download/index.marko.js +113 -0
- package/components/content/download/link.marko +12 -0
- package/components/content/download/link.marko.js +45 -0
- package/components/content/download/marko.json +26 -0
- package/components/content/download/wufoo.marko +23 -0
- package/components/content/download/wufoo.marko.js +59 -0
- package/components/content/link-url/index.marko +16 -0
- package/components/content/link-url/index.marko.js +48 -0
- package/components/content/link-url/marko.json +9 -0
- package/components/content/marko.json +18 -0
- package/components/content/sections-listed-in.marko +26 -0
- package/components/content/sections-listed-in.marko.js +89 -0
- package/components/content-attribution/attribution.marko +1 -0
- package/components/content-attribution/attribution.marko.js +33 -0
- package/components/content-attribution/components/authors.marko +3 -0
- package/components/content-attribution/components/authors.marko.js +42 -0
- package/components/content-attribution/components/byline.marko +1 -0
- package/components/content-attribution/components/byline.marko.js +30 -0
- package/components/content-attribution/components/company.marko +7 -0
- package/components/content-attribution/components/company.marko.js +43 -0
- package/components/content-attribution/components/contributors.marko +3 -0
- package/components/content-attribution/components/contributors.marko.js +42 -0
- package/components/content-attribution/components/photographers.marko +3 -0
- package/components/content-attribution/components/photographers.marko.js +42 -0
- package/components/content-attribution/components/source.marko +1 -0
- package/components/content-attribution/components/source.marko.js +30 -0
- package/components/content-attribution/components/sponsors.marko +3 -0
- package/components/content-attribution/components/sponsors.marko.js +42 -0
- package/components/content-attribution/index.marko +34 -0
- package/components/content-attribution/index.marko.js +81 -0
- package/components/content-attribution/marko.json +27 -0
- package/components/directory-facets/facet-container/facet-container.marko +32 -0
- package/components/directory-facets/facet-container/facet-container.marko.js +65 -0
- package/components/directory-facets/facet-container/marko.json +26 -0
- package/components/directory-facets/facet-list/facet-list.marko +66 -0
- package/components/directory-facets/facet-list/facet-list.marko.js +140 -0
- package/components/directory-facets/facet-list/marko.json +23 -0
- package/components/directory-facets/facet.marko +15 -0
- package/components/directory-facets/facet.marko.js +44 -0
- package/components/directory-facets/find-active-facet.js +22 -0
- package/components/directory-facets/index.marko +29 -0
- package/components/directory-facets/index.marko.js +77 -0
- package/components/directory-facets/marko.json +40 -0
- package/components/facebook-connect.marko +52 -0
- package/components/facebook-connect.marko.js +59 -0
- package/components/flows/card-deck.marko +63 -0
- package/components/flows/card-deck.marko.js +159 -0
- package/components/flows/content/card-deck-col.marko +49 -0
- package/components/flows/content/card-deck-col.marko.js +98 -0
- package/components/flows/content/directory-section.marko +41 -0
- package/components/flows/content/directory-section.marko.js +107 -0
- package/components/flows/content/list.marko +51 -0
- package/components/flows/content/list.marko.js +98 -0
- package/components/flows/content/marko.json +39 -0
- package/components/flows/marko.json +42 -0
- package/components/flows/section-feed.marko +66 -0
- package/components/flows/section-feed.marko.js +118 -0
- package/components/gam/components/define-display-ad.marko +106 -0
- package/components/gam/components/define-display-ad.marko.js +171 -0
- package/components/gam/define-display-ad.marko +27 -0
- package/components/gam/define-display-ad.marko.js +60 -0
- package/components/gam/inject-ads.marko +28 -0
- package/components/gam/inject-ads.marko.js +56 -0
- package/components/gam/marko.json +17 -0
- package/components/gam/utils/increment-pos.js +13 -0
- package/components/gam/wallpaper-ad.marko +18 -0
- package/components/gam/wallpaper-ad.marko.js +75 -0
- package/components/identity-x/comment-stream.marko +33 -0
- package/components/identity-x/comment-stream.marko.js +71 -0
- package/components/identity-x/content-page-gate.marko +85 -0
- package/components/identity-x/content-page-gate.marko.js +171 -0
- package/components/identity-x/marko.json +38 -0
- package/components/identity-x/newsletter-footer.marko +56 -0
- package/components/identity-x/newsletter-footer.marko.js +100 -0
- package/components/identity-x/newsletter-inline.marko +22 -0
- package/components/identity-x/newsletter-inline.marko.js +55 -0
- package/components/identity-x/newsletter-modal.marko +42 -0
- package/components/identity-x/newsletter-modal.marko.js +88 -0
- package/components/identity-x/newsletter-pushdown.marko +66 -0
- package/components/identity-x/newsletter-pushdown.marko.js +113 -0
- package/components/layouts/ad-preview.marko +84 -0
- package/components/layouts/ad-preview.marko.js +166 -0
- package/components/layouts/marko.json +15 -0
- package/components/marko.json +58 -0
- package/components/menu-toggle-button.marko +19 -0
- package/components/menu-toggle-button.marko.js +45 -0
- package/components/native-x/marko.json +5 -0
- package/components/native-x/render.marko +13 -0
- package/components/native-x/render.marko.js +45 -0
- package/components/nodes/author-bio.marko +39 -0
- package/components/nodes/author-bio.marko.js +121 -0
- package/components/nodes/author-card.marko +42 -0
- package/components/nodes/author-card.marko.js +115 -0
- package/components/nodes/author-published.marko +41 -0
- package/components/nodes/author-published.marko.js +105 -0
- package/components/nodes/author.marko +28 -0
- package/components/nodes/author.marko.js +92 -0
- package/components/nodes/components/attribution.marko +13 -0
- package/components/nodes/components/attribution.marko.js +49 -0
- package/components/nodes/components/authors.marko +7 -0
- package/components/nodes/components/authors.marko.js +43 -0
- package/components/nodes/components/company-name.marko +1 -0
- package/components/nodes/components/company-name.marko.js +33 -0
- package/components/nodes/components/dates.marko +11 -0
- package/components/nodes/components/dates.marko.js +58 -0
- package/components/nodes/components/section-sponsor.marko +14 -0
- package/components/nodes/components/section-sponsor.marko.js +56 -0
- package/components/nodes/content-published.marko +46 -0
- package/components/nodes/content-published.marko.js +89 -0
- package/components/nodes/content.marko +175 -0
- package/components/nodes/content.marko.js +327 -0
- package/components/nodes/directory-section-feed-content.marko +161 -0
- package/components/nodes/directory-section-feed-content.marko.js +387 -0
- package/components/nodes/featured-products-card.marko +52 -0
- package/components/nodes/featured-products-card.marko.js +110 -0
- package/components/nodes/marko.json +83 -0
- package/components/nodes/product-feed-content.marko +52 -0
- package/components/nodes/product-feed-content.marko.js +137 -0
- package/components/nodes/section-feed-content.marko +256 -0
- package/components/nodes/section-feed-content.marko.js +624 -0
- package/components/nodes/standard-promo.marko +39 -0
- package/components/nodes/standard-promo.marko.js +111 -0
- package/components/nodes/youtube-card.marko +53 -0
- package/components/nodes/youtube-card.marko.js +120 -0
- package/components/page/attribution.marko +1 -0
- package/components/page/attribution.marko.js +33 -0
- package/components/page/contact-details.marko +1 -0
- package/components/page/contact-details.marko.js +33 -0
- package/components/page/content.marko +27 -0
- package/components/page/content.marko.js +68 -0
- package/components/page/contents.marko +1 -0
- package/components/page/contents.marko.js +33 -0
- package/components/page/dates.marko +1 -0
- package/components/page/dates.marko.js +33 -0
- package/components/page/default.marko +25 -0
- package/components/page/default.marko.js +67 -0
- package/components/page/marko.json +51 -0
- package/components/page/website-section.marko +30 -0
- package/components/page/website-section.marko.js +83 -0
- package/components/pagination-controls.marko +53 -0
- package/components/pagination-controls.marko.js +122 -0
- package/components/query-total-count.marko +8 -0
- package/components/query-total-count.marko.js +45 -0
- package/components/reveal-ad-handler.marko +9 -0
- package/components/reveal-ad-handler.marko.js +38 -0
- package/components/site-footer/container.marko +11 -0
- package/components/site-footer/container.marko.js +39 -0
- package/components/site-footer/copyright.marko +21 -0
- package/components/site-footer/copyright.marko.js +66 -0
- package/components/site-footer/index.marko +130 -0
- package/components/site-footer/index.marko.js +338 -0
- package/components/site-footer/marko.json +14 -0
- package/components/site-footer/social-icons.marko +24 -0
- package/components/site-footer/social-icons.marko.js +64 -0
- package/components/site-header.marko +104 -0
- package/components/site-header.marko.js +221 -0
- package/components/site-menu/components/search.marko +27 -0
- package/components/site-menu/components/search.marko.js +80 -0
- package/components/site-menu/components/social-icons.marko +1 -0
- package/components/site-menu/components/social-icons.marko.js +32 -0
- package/components/site-menu/header.marko +10 -0
- package/components/site-menu/header.marko.js +38 -0
- package/components/site-menu/index.marko +117 -0
- package/components/site-menu/index.marko.js +201 -0
- package/components/site-menu/marko.json +11 -0
- package/components/site-menu/section.marko +26 -0
- package/components/site-menu/section.marko.js +67 -0
- package/components/site-navbar/brand.marko +8 -0
- package/components/site-navbar/brand.marko.js +43 -0
- package/components/site-navbar/index.marko +13 -0
- package/components/site-navbar/index.marko.js +49 -0
- package/components/site-navbar/item.marko +96 -0
- package/components/site-navbar/item.marko.js +182 -0
- package/components/site-navbar/items.marko +27 -0
- package/components/site-navbar/items.marko.js +80 -0
- package/components/site-navbar/logo.marko +15 -0
- package/components/site-navbar/logo.marko.js +41 -0
- package/components/site-navbar/marko.json +20 -0
- package/components/site-navbar/search.marko +20 -0
- package/components/site-navbar/search.marko.js +73 -0
- package/components/site-navbar/utils/get-nav-items.js +21 -0
- package/components/site-navbar/utils/is-active-link.js +1 -0
- package/components/site-newsletter-menu.marko +11 -0
- package/components/site-newsletter-menu.marko.js +37 -0
- package/components/social/get-provider.js +5 -0
- package/components/social/icon-link.marko +22 -0
- package/components/social/icon-link.marko.js +63 -0
- package/components/social/icons.marko +22 -0
- package/components/social/icons.marko.js +62 -0
- package/components/social/marko.json +15 -0
- package/components/social-follow.marko +32 -0
- package/components/social-follow.marko.js +95 -0
- package/components/ssr-html-inject.marko +102 -0
- package/components/ssr-html-inject.marko.js +133 -0
- package/graphql/fragments/category-sections.js +25 -0
- package/graphql/fragments/company-search.js +13 -0
- package/graphql/fragments/content-card-deck-block.js +27 -0
- package/graphql/fragments/content-list.js +45 -0
- package/graphql/fragments/content-meter.js +20 -0
- package/graphql/fragments/content-page.js +192 -0
- package/graphql/fragments/dynamic-page.js +15 -0
- package/graphql/fragments/featured-companies.js +16 -0
- package/graphql/fragments/latest-podcast-block.js +14 -0
- package/graphql/fragments/latest-products-feed-block.js +28 -0
- package/graphql/fragments/mindful-advertising-post-by-id.js +55 -0
- package/graphql/fragments/most-popular-block.js +21 -0
- package/graphql/fragments/native-x-image.js +12 -0
- package/graphql/fragments/native-x-story.js +28 -0
- package/graphql/fragments/opinion-block.js +41 -0
- package/graphql/fragments/products-block.js +27 -0
- package/graphql/fragments/read-next-block.js +28 -0
- package/graphql/fragments/related-stories-block.js +27 -0
- package/graphql/fragments/resource-library-block.js +20 -0
- package/graphql/fragments/section-body-feed-block.js +30 -0
- package/graphql/fragments/section-card-deck-featured-block.js +21 -0
- package/graphql/fragments/section-card-list-block.js +22 -0
- package/graphql/fragments/section-feed-block.js +86 -0
- package/graphql/fragments/section-info.js +13 -0
- package/graphql/fragments/section-list-block.js +21 -0
- package/graphql/fragments/section-list-card-block.js +27 -0
- package/graphql/fragments/sections-search.js +46 -0
- package/graphql/fragments/top-stories-block.js +34 -0
- package/graphql/fragments/top-stories-menu-block.js +21 -0
- package/graphql/fragments/website-section-page.js +16 -0
- package/graphql/fragments/white-papers-block.js +27 -0
- package/i18n.js +11 -0
- package/marko.json +5 -0
- package/middleware/content-gating.js +13 -0
- package/middleware/content-metering.js +156 -0
- package/middleware/i18n.js +12 -0
- package/middleware/newsletter-modal-state.js +11 -0
- package/middleware/newsletter-state.js +22 -0
- package/middleware/pagination.js +24 -0
- package/package.json +56 -0
- package/routes/ad-preview.js +11 -0
- package/routes/advertising-post.js +25 -0
- package/routes/company-search.js +27 -0
- package/routes/native-x.js +9 -0
- package/routes/print.js +11 -0
- package/routes/render-block.js +32 -0
- package/routes/search.js +28 -0
- package/routes/taxonomy.js +29 -0
- package/scss/_functions.scss +164 -0
- package/scss/_mixins.scss +503 -0
- package/scss/_variables.scss +328 -0
- package/scss/components/_ad-container.scss +237 -0
- package/scss/components/_author-bio-node.scss +47 -0
- package/scss/components/_author-node.scss +23 -0
- package/scss/components/_author-published-node.scss +43 -0
- package/scss/components/_bootstrap.scss +19 -0
- package/scss/components/_breadcrumbs.scss +1 -0
- package/scss/components/_comments.scss +275 -0
- package/scss/components/_content-meter.scss +147 -0
- package/scss/components/_content-page-gate.scss +37 -0
- package/scss/components/_content-page.scss +351 -0
- package/scss/components/_default-theme.scss +1 -0
- package/scss/components/_embedded-media.scss +100 -0
- package/scss/components/_identity-x.scss +71 -0
- package/scss/components/_lazyload.scss +15 -0
- package/scss/components/_load-more.scss +65 -0
- package/scss/components/_magazine-publication-buttons.scss +65 -0
- package/scss/components/_newsletter-signup-modal.scss +133 -0
- package/scss/components/_node-list.scss +26 -0
- package/scss/components/_node.scss +173 -0
- package/scss/components/_page-attribution.scss +102 -0
- package/scss/components/_page-contact-details.scss +23 -0
- package/scss/components/_page-dates.scss +24 -0
- package/scss/components/_page-image.scss +92 -0
- package/scss/components/_page-rail.scss +7 -0
- package/scss/components/_page-wrapper.scss +146 -0
- package/scss/components/_page.scss +3 -0
- package/scss/components/_pagination-controls.scss +38 -0
- package/scss/components/_reveal-ad.scss +28 -0
- package/scss/components/_search-page.scss +188 -0
- package/scss/components/_site-footer.scss +247 -0
- package/scss/components/_site-header.scss +9 -0
- package/scss/components/_site-menu.scss +327 -0
- package/scss/components/_site-navbar-b.scss +128 -0
- package/scss/components/_site-navbar.scss +107 -0
- package/scss/components/_site-newsletter-menu.scss +561 -0
- package/scss/components/_social-icons.scss +12 -0
- package/scss/components/_spec-guide.scss +79 -0
- package/scss/components/_sponsor-logo.scss +31 -0
- package/scss/components/_sticky-top.scss +8 -0
- package/scss/components/_wallpaper-ad.scss +36 -0
- package/scss/components/blocks/_callout-cards.scss +19 -0
- package/scss/components/blocks/_company-inquiry-form.scss +41 -0
- package/scss/components/blocks/_company-search.scss +57 -0
- package/scss/components/blocks/_content-card-deck.scss +143 -0
- package/scss/components/blocks/_directory-facets.scss +112 -0
- package/scss/components/blocks/_hero-card.scss +59 -0
- package/scss/components/blocks/_latest-content-list.scss +13 -0
- package/scss/components/blocks/_latest-podcast.scss +69 -0
- package/scss/components/blocks/_latest-products-feed.scss +97 -0
- package/scss/components/blocks/_magazine-publication-card.scss +30 -0
- package/scss/components/blocks/_more-products.scss +35 -0
- package/scss/components/blocks/_most-popular.scss +70 -0
- package/scss/components/blocks/_newsletter-signup-banner-large.scss +51 -0
- package/scss/components/blocks/_newsletter-signup-banner.scss +99 -0
- package/scss/components/blocks/_newsletter-signup-site-footer.scss +11 -0
- package/scss/components/blocks/_node-author.scss +27 -0
- package/scss/components/blocks/_opinion.scss +76 -0
- package/scss/components/blocks/_primary-image.scss +98 -0
- package/scss/components/blocks/_products.scss +71 -0
- package/scss/components/blocks/_promo-card.scss +67 -0
- package/scss/components/blocks/_read-next.scss +53 -0
- package/scss/components/blocks/_related-native-x-stories.scss +14 -0
- package/scss/components/blocks/_related-stories.scss +102 -0
- package/scss/components/blocks/_resource-library.scss +79 -0
- package/scss/components/blocks/_section-card-deck-featured.scss +22 -0
- package/scss/components/blocks/_section-card-list.scss +81 -0
- package/scss/components/blocks/_section-feed.scss +253 -0
- package/scss/components/blocks/_section-forbes.scss +32 -0
- package/scss/components/blocks/_section-list.scss +80 -0
- package/scss/components/blocks/_section-search.scss +40 -0
- package/scss/components/blocks/_social-follow.scss +28 -0
- package/scss/components/blocks/_top-stories-menu.scss +38 -0
- package/scss/components/blocks/_top-stories.scss +179 -0
- package/scss/components/blocks/_white-papers.scss +60 -0
- package/scss/components/default-theme/site-navbar.scss +187 -0
- package/scss/components/flows/_card-deck.scss +47 -0
- package/scss/components/flows/_column-list.scss +28 -0
- package/scss/components/flows/_featured.scss +29 -0
- package/scss/components/flows/_hero.scss +44 -0
- package/scss/components/flows/_incremented-nodes.scss +21 -0
- package/scss/core.scss +125 -0
- package/scss/critical/_bootstrap.scss +15 -0
- package/scss/critical/_core.scss +27 -0
- package/scss/critical/_theme.scss +23 -0
- package/scss/variables/_buttons.scss +66 -0
- package/scss/variables/_default-theme.scss +715 -0
- package/scss/variables/_inputs.scss +24 -0
- package/scss/variables/_typography.scss +525 -0
- package/templates/ad-preview.marko +79 -0
- package/templates/ad-preview.marko.js +151 -0
- package/templates/content/components/presented-by.marko +22 -0
- package/templates/content/components/presented-by.marko.js +72 -0
- package/templates/content/native-x-story.marko +82 -0
- package/templates/content/native-x-story.marko.js +248 -0
- package/templates/content/print.marko +188 -0
- package/templates/content/print.marko.js +434 -0
- package/templates/search.marko +136 -0
- package/templates/search.marko.js +335 -0
- package/templates/taxonomy.marko +71 -0
- package/templates/taxonomy.marko.js +194 -0
- package/translations.js +14 -0
- package/utils/content-iframe.js +34 -0
- package/utils/content-meter-helpers.js +58 -0
- package/utils/convert-mindful-ad-preview.js +34 -0
- package/utils/get-child-sections-by-id.js +11 -0
- package/utils/get-content-preview.js +7 -0
- package/utils/get-sections-from-schedules.js +10 -0
- package/utils/has-omeda-id.js +11 -0
- package/utils/query-total-count.js +90 -0
- package/utils/render-site-idx-newsletter-menu.js +26 -0
- package/utils/render-site-newsletter-menu.js +16 -0
- package/utils/set-section-name-from-label.js +14 -0
- package/utils/shuffle-array.js +9 -0
- package/utils/site-idx-newsletter-menu-props.js +61 -0
- package/utils/site-newsletter-menu-props.js +41 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const gql = require('graphql-tag');
|
|
2
|
+
|
|
3
|
+
module.exports = gql`
|
|
4
|
+
|
|
5
|
+
fragment SectionListBlockContentFragment on Content {
|
|
6
|
+
id
|
|
7
|
+
type
|
|
8
|
+
shortName
|
|
9
|
+
labels
|
|
10
|
+
siteContext {
|
|
11
|
+
path
|
|
12
|
+
}
|
|
13
|
+
primarySection {
|
|
14
|
+
id
|
|
15
|
+
name
|
|
16
|
+
fullName
|
|
17
|
+
canonicalPath
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
`;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const gql = require('graphql-tag');
|
|
2
|
+
|
|
3
|
+
module.exports = gql`
|
|
4
|
+
|
|
5
|
+
fragment SectionListCardBlockContentFragment on Content {
|
|
6
|
+
id
|
|
7
|
+
type
|
|
8
|
+
shortName
|
|
9
|
+
labels
|
|
10
|
+
siteContext {
|
|
11
|
+
path
|
|
12
|
+
}
|
|
13
|
+
primarySection {
|
|
14
|
+
id
|
|
15
|
+
name
|
|
16
|
+
fullName
|
|
17
|
+
canonicalPath
|
|
18
|
+
}
|
|
19
|
+
primaryImage {
|
|
20
|
+
id
|
|
21
|
+
src(input: { options: { auto: "format,compress" } })
|
|
22
|
+
alt
|
|
23
|
+
isLogo
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
`;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const gql = require('graphql-tag');
|
|
2
|
+
|
|
3
|
+
module.exports = gql`
|
|
4
|
+
fragment WebsiteSectionSearchFragment on WebsiteSection {
|
|
5
|
+
id
|
|
6
|
+
alias
|
|
7
|
+
name
|
|
8
|
+
children(input: { pagination: { limit: 0 } }) {
|
|
9
|
+
edges {
|
|
10
|
+
node {
|
|
11
|
+
id
|
|
12
|
+
alias
|
|
13
|
+
name
|
|
14
|
+
children(input: { pagination: { limit: 0 } }) {
|
|
15
|
+
edges {
|
|
16
|
+
node {
|
|
17
|
+
id
|
|
18
|
+
alias
|
|
19
|
+
name
|
|
20
|
+
children(input: { pagination: { limit: 0 } }) {
|
|
21
|
+
edges {
|
|
22
|
+
node {
|
|
23
|
+
id
|
|
24
|
+
alias
|
|
25
|
+
name
|
|
26
|
+
children(input: { pagination: { limit: 0 } }) {
|
|
27
|
+
edges {
|
|
28
|
+
node {
|
|
29
|
+
id
|
|
30
|
+
alias
|
|
31
|
+
name
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
`;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const gql = require('graphql-tag');
|
|
2
|
+
|
|
3
|
+
module.exports = gql`
|
|
4
|
+
|
|
5
|
+
fragment TopStoriesBlockFragment on Content {
|
|
6
|
+
id
|
|
7
|
+
type
|
|
8
|
+
shortName
|
|
9
|
+
labels
|
|
10
|
+
teaser(input: { useFallback: false, maxLength: null })
|
|
11
|
+
siteContext {
|
|
12
|
+
path
|
|
13
|
+
}
|
|
14
|
+
primarySection {
|
|
15
|
+
id
|
|
16
|
+
name
|
|
17
|
+
fullName
|
|
18
|
+
canonicalPath
|
|
19
|
+
}
|
|
20
|
+
primaryImage {
|
|
21
|
+
id
|
|
22
|
+
src(input: { options: { auto: "format,compress" } })
|
|
23
|
+
alt
|
|
24
|
+
isLogo
|
|
25
|
+
}
|
|
26
|
+
... on ContentWebinar {
|
|
27
|
+
externalContentUrl: linkUrl
|
|
28
|
+
}
|
|
29
|
+
... on ContentEvent {
|
|
30
|
+
externalContentUrl: website
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
`;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const gql = require('graphql-tag');
|
|
2
|
+
|
|
3
|
+
module.exports = gql`
|
|
4
|
+
|
|
5
|
+
fragment TopStoriesMenuBlockContentFragment on Content {
|
|
6
|
+
id
|
|
7
|
+
type
|
|
8
|
+
shortName
|
|
9
|
+
labels
|
|
10
|
+
siteContext {
|
|
11
|
+
path
|
|
12
|
+
}
|
|
13
|
+
primarySection {
|
|
14
|
+
id
|
|
15
|
+
name
|
|
16
|
+
fullName
|
|
17
|
+
canonicalPath
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
`;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const gql = require('graphql-tag');
|
|
2
|
+
|
|
3
|
+
module.exports = gql`
|
|
4
|
+
|
|
5
|
+
fragment WhitePapersBlockFragment on Content {
|
|
6
|
+
id
|
|
7
|
+
type
|
|
8
|
+
shortName
|
|
9
|
+
teaser(input: { useFallback: false, maxLength: null })
|
|
10
|
+
siteContext {
|
|
11
|
+
path
|
|
12
|
+
}
|
|
13
|
+
company {
|
|
14
|
+
id
|
|
15
|
+
type
|
|
16
|
+
name
|
|
17
|
+
siteContext {
|
|
18
|
+
path
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
primarySection {
|
|
22
|
+
id
|
|
23
|
+
name
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
`;
|
package/i18n.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const translations = require('./translations');
|
|
2
|
+
|
|
3
|
+
module.exports = (lang, fieldLabelKey) => {
|
|
4
|
+
if (!translations[lang]) {
|
|
5
|
+
throw new Error(`No translations available for requested language ${lang}!`);
|
|
6
|
+
}
|
|
7
|
+
if (!translations[lang][fieldLabelKey]) {
|
|
8
|
+
throw new Error(`No translations available in ${lang} for requested key ${fieldLabelKey}!`);
|
|
9
|
+
}
|
|
10
|
+
return translations[lang][fieldLabelKey];
|
|
11
|
+
};
|
package/marko.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const { get, set } = require('@mindful-web/object-path');
|
|
2
|
+
|
|
3
|
+
const isFn = (f) => typeof f === 'function';
|
|
4
|
+
const defaultFn = ({ content }) => get(content, 'userRegistration.isCurrentlyRequired', false);
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Installs the configured content gating handler in the Express app instance.
|
|
8
|
+
* If not customized, content will only be gated when set as gated in the CMS.
|
|
9
|
+
*/
|
|
10
|
+
module.exports = (app, enabled = true, fn) => { // eslint-disable-line
|
|
11
|
+
const contentGatingHandler = enabled && isFn(fn) ? fn : defaultFn;
|
|
12
|
+
set(app.locals, 'contentGatingHandler', contentGatingHandler);
|
|
13
|
+
};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
const debug = require('debug')('content-meter');
|
|
2
|
+
const parser = require('ua-parser-js');
|
|
3
|
+
const Joi = require('@parameter1/joi');
|
|
4
|
+
const { validate } = require('@parameter1/joi/utils');
|
|
5
|
+
const { asyncRoute, isFunction } = require('@mindful-web/utils');
|
|
6
|
+
const { content: loader } = require('@mindful-web/web-common/page-loaders');
|
|
7
|
+
const { get, getAsArray } = require('@mindful-web/object-path');
|
|
8
|
+
const buildContentInput = require('@mindful-web/marko-web/utils/build-content-input');
|
|
9
|
+
const queryFragment = require('../graphql/fragments/content-meter');
|
|
10
|
+
const hasOmedaId = require('../utils/has-omeda-id');
|
|
11
|
+
|
|
12
|
+
const configSchema = Joi.object({
|
|
13
|
+
enabled: Joi.boolean().default(false)
|
|
14
|
+
.description('Should content metering be enabled?'),
|
|
15
|
+
viewLimit: Joi.number().min(0).default(3)
|
|
16
|
+
.description('The number of views allowed within the timeframe before restricting access.'),
|
|
17
|
+
timeframe: Joi.number().min(0).default(30 * 24 * 60 * 60 * 1000) // 30 days
|
|
18
|
+
.description('Milliseconds to consider content accesses within.'),
|
|
19
|
+
excludeLabels: Joi.array().items(Joi.string())
|
|
20
|
+
.description('Content labels that should be excluded from metering.'),
|
|
21
|
+
excludeContentTypes: Joi.array().items(Joi.string())
|
|
22
|
+
.description('Content types that should be excluded from metering.'),
|
|
23
|
+
excludePrimarySectionIds: Joi.array().items(Joi.number())
|
|
24
|
+
.description('Sections whose primary content should be excluded from metering.'),
|
|
25
|
+
excludePrimarySectionAlias: Joi.array().items(Joi.string())
|
|
26
|
+
.description('Sections whose primary content should be excluded from metering.'),
|
|
27
|
+
displayOverlay: Joi.boolean().default(false)
|
|
28
|
+
.description('If the metering overlay should be displayed.'),
|
|
29
|
+
promoCode: Joi.string().default('registration_meter')
|
|
30
|
+
.description('If present, the Omeda promo code to use with content metering events.'),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const cookieName = 'contentMeter';
|
|
34
|
+
const now = new Date().getTime();
|
|
35
|
+
const { error } = console;
|
|
36
|
+
|
|
37
|
+
const defaultRegFn = ({ content }) => get(content, 'userRegistration.isCurrentlyRequired', false);
|
|
38
|
+
const shouldMeter = async (req, config) => {
|
|
39
|
+
const { apollo, params } = req;
|
|
40
|
+
const { id } = params;
|
|
41
|
+
const additionalInput = buildContentInput({ req });
|
|
42
|
+
// @todo error handling!
|
|
43
|
+
const content = await loader(apollo, { id, additionalInput, queryFragment });
|
|
44
|
+
if (!content) return false;
|
|
45
|
+
|
|
46
|
+
// Check for local contentGatingHandler and use it or use the defaultRegFn
|
|
47
|
+
const localFn = req.app.locals.contentGatingHandler;
|
|
48
|
+
// Get the globally avaiable one if set and is function
|
|
49
|
+
const contentGatingHandler = (localFn && isFunction(localFn)) ? localFn : defaultRegFn;
|
|
50
|
+
// bypass if content is already gated by reg of some sort
|
|
51
|
+
if (contentGatingHandler({ content })) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// excludeContentTypes: Excludes content metering on page if type matches exclusions
|
|
56
|
+
if (getAsArray(config, 'excludeContentTypes').includes(content.type)) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
// excludePrimarySectionIds: Excludes content metering on page that matches primarySection
|
|
60
|
+
if (getAsArray(config, 'excludePrimarySectionIds').includes(content.primarySection.id)) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
// excludePrimarySectionAliass: Excludes content metering on page that matches primarySection
|
|
64
|
+
if (getAsArray(config, 'excludePrimarySectionAliass').includes(content.primarySection.alias)) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
// excludeLabels: Excludes content metering on page that matches labels
|
|
68
|
+
if (getAsArray(config, 'excludeLabels').some((r) => getAsArray(content, 'labels').includes(r))) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
return true;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Installs the configured content metering handler in the Express app instance.
|
|
76
|
+
* To utilize, chain this middleware on a content route.
|
|
77
|
+
*/
|
|
78
|
+
module.exports = (params = {}) => asyncRoute(async (req, res, next) => {
|
|
79
|
+
const config = validate(configSchema, params);
|
|
80
|
+
|
|
81
|
+
const { identityX, params: { id } } = req;
|
|
82
|
+
const { enabled, viewLimit, timeframe } = config;
|
|
83
|
+
|
|
84
|
+
if (!enabled) return next();
|
|
85
|
+
|
|
86
|
+
if (!identityX) {
|
|
87
|
+
error('IdentityX middleware must be loaded before content metering middleware!');
|
|
88
|
+
return next();
|
|
89
|
+
}
|
|
90
|
+
const idxObj = { isEnabled: true, requiredAccessLevelIds: [] };
|
|
91
|
+
const { isLoggedIn, requiresUserInput } = await identityX.checkContentAccess(idxObj);
|
|
92
|
+
|
|
93
|
+
const bypassOmeda = hasOmedaId(req);
|
|
94
|
+
const bypassQuery = ['1', 'true'].includes(get(req, 'query.bypassContentMetering'));
|
|
95
|
+
const bypassFacebook = get(parser(req.headers['user-agent']), 'browser.name') === 'Facebook';
|
|
96
|
+
const bypassPushdown = Boolean(get(res, 'locals.newsletterState.canBeInitiallyExpanded'));
|
|
97
|
+
|
|
98
|
+
debug({
|
|
99
|
+
config,
|
|
100
|
+
isLoggedIn,
|
|
101
|
+
requiresUserInput,
|
|
102
|
+
bypassOmeda,
|
|
103
|
+
bypassQuery,
|
|
104
|
+
bypassFacebook,
|
|
105
|
+
bypassPushdown,
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// Facebook UA or query parameter present
|
|
109
|
+
if (bypassQuery || bypassFacebook) return next();
|
|
110
|
+
// Logged in and all required fields are present.
|
|
111
|
+
if (isLoggedIn && !requiresUserInput) return next();
|
|
112
|
+
// Not logged in, but identified.
|
|
113
|
+
if (!isLoggedIn && bypassOmeda) return next();
|
|
114
|
+
|
|
115
|
+
res.locals.contentMeterState = {
|
|
116
|
+
...config,
|
|
117
|
+
isLoggedIn,
|
|
118
|
+
requiresUserInput,
|
|
119
|
+
displayGate: false,
|
|
120
|
+
displayOverlay: true,
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// Fall back to inline gate form for user data collection
|
|
124
|
+
if (isLoggedIn && requiresUserInput) return next();
|
|
125
|
+
|
|
126
|
+
const shouldShowMeter = await shouldMeter(req, config);
|
|
127
|
+
|
|
128
|
+
debug({ shouldShowMeter });
|
|
129
|
+
|
|
130
|
+
if (shouldShowMeter) {
|
|
131
|
+
const hasCookie = Boolean(get(req, `cookies.${cookieName}`));
|
|
132
|
+
const value = (hasCookie) ? JSON.parse(get(req, `cookies.${cookieName}`)) : [];
|
|
133
|
+
let valid = value.filter((pageView) => pageView.viewed > now - timeframe);
|
|
134
|
+
|
|
135
|
+
if (valid.find((v) => v.id === id)) {
|
|
136
|
+
valid = valid.map((pageview) => {
|
|
137
|
+
const { id: viewId } = pageview;
|
|
138
|
+
if (viewId === id) return { id, viewed: now };
|
|
139
|
+
return pageview;
|
|
140
|
+
});
|
|
141
|
+
} else if (valid.length < viewLimit) {
|
|
142
|
+
valid.push({ id, viewed: now });
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const displayOverlay = (valid.length >= viewLimit && !valid.find((v) => v.id === id));
|
|
146
|
+
|
|
147
|
+
res.locals.contentMeterState = {
|
|
148
|
+
...res.locals.contentMeterState,
|
|
149
|
+
views: valid.length,
|
|
150
|
+
displayGate: !bypassPushdown,
|
|
151
|
+
displayOverlay,
|
|
152
|
+
};
|
|
153
|
+
res.cookie(cookieName, JSON.stringify(valid), { maxAge: timeframe });
|
|
154
|
+
}
|
|
155
|
+
return next();
|
|
156
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const { set } = require('@mindful-web/object-path');
|
|
2
|
+
|
|
3
|
+
const isFn = (f) => typeof f === 'function';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Installs the configured translation function in the Express app instance
|
|
7
|
+
*/
|
|
8
|
+
module.exports = (app, fn) => {
|
|
9
|
+
const defaultFn = (v) => v;
|
|
10
|
+
const i18n = isFn(fn) ? fn : defaultFn;
|
|
11
|
+
set(app.locals, 'i18n', i18n);
|
|
12
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const { get } = require('@mindful-web/object-path');
|
|
2
|
+
|
|
3
|
+
const cookieName = 'identity-x-newsletter-modal-viewed';
|
|
4
|
+
|
|
5
|
+
module.exports = () => (req, res, next) => {
|
|
6
|
+
const hasCookie = Boolean(get(req, `cookies.${cookieName}`));
|
|
7
|
+
const cookieValue = get(req, `cookies.${cookieName}`);
|
|
8
|
+
|
|
9
|
+
res.locals.newsletterModalState = { cookieName, cookieValue, hasCookie };
|
|
10
|
+
next();
|
|
11
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const { get } = require('@mindful-web/object-path');
|
|
2
|
+
|
|
3
|
+
const cookieName = 'enlPrompted';
|
|
4
|
+
|
|
5
|
+
module.exports = () => (req, res, next) => {
|
|
6
|
+
const hasCookie = Boolean(get(req, `cookies.${cookieName}`));
|
|
7
|
+
const utmMedium = get(req, 'query.utm_medium');
|
|
8
|
+
const olyEncId = get(req, 'query.oly_enc_id');
|
|
9
|
+
const disabled = get(req, 'query.newsletterDisabled');
|
|
10
|
+
const fromEmail = utmMedium === 'email' || olyEncId || false;
|
|
11
|
+
const initiallyExpanded = !(hasCookie || fromEmail || disabled);
|
|
12
|
+
|
|
13
|
+
if (!hasCookie) {
|
|
14
|
+
// Expire in 14 days (2yr if already signed up)
|
|
15
|
+
const days = fromEmail ? 365 * 2 : 14;
|
|
16
|
+
const maxAge = days * 24 * 60 * 60 * 1000;
|
|
17
|
+
res.cookie(cookieName, true, { maxAge });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
res.locals.newsletterState = { hasCookie, fromEmail, initiallyExpanded };
|
|
21
|
+
next();
|
|
22
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module.exports = ({ param = 'page' } = {}) => (req, res, next) => {
|
|
2
|
+
const page = parseInt(req.query[param], 10) || 1;
|
|
3
|
+
|
|
4
|
+
const totalPages = ({ perPage, totalCount }) => Math.ceil(totalCount / perPage);
|
|
5
|
+
|
|
6
|
+
res.locals.pagination = {
|
|
7
|
+
page,
|
|
8
|
+
skip: ({ skip = 0, perPage } = {}) => {
|
|
9
|
+
if (page < 1) return skip;
|
|
10
|
+
return (perPage * (page - 1)) + skip;
|
|
11
|
+
},
|
|
12
|
+
totalPages,
|
|
13
|
+
nextPage: ({ perPage, totalCount }) => {
|
|
14
|
+
const total = totalPages({ perPage, totalCount });
|
|
15
|
+
if (page < total) return page + 1;
|
|
16
|
+
return null;
|
|
17
|
+
},
|
|
18
|
+
prevPage: () => {
|
|
19
|
+
if (page > 1) return page - 1;
|
|
20
|
+
return null;
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
next();
|
|
24
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mindful-web/marko-web-theme-monorail",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"author": "Brian Miller <brian@parameter1.com>",
|
|
5
|
+
"repository": "https://github.com/parameter1/mindful-web/tree/main/packages/marko-web-theme-monorail",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"lint:fix": "yarn lint --fix",
|
|
9
|
+
"lint": "eslint --ext .js --ext .vue --max-warnings 5 --ignore-path ../../.eslintignore ./",
|
|
10
|
+
"compile": "mindful-web-marko-compile compile",
|
|
11
|
+
"prepublish": "yarn compile --silent",
|
|
12
|
+
"test": "yarn compile --no-clean && yarn lint"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@mindful-web/dayjs": "^1.0.0",
|
|
16
|
+
"@mindful-web/image": "^1.0.0",
|
|
17
|
+
"@mindful-web/inflector": "^1.0.0",
|
|
18
|
+
"@mindful-web/marko-web-deferred-script-loader": "^1.0.0",
|
|
19
|
+
"@mindful-web/marko-web-gam": "^1.0.0",
|
|
20
|
+
"@mindful-web/marko-web-gtm": "^1.0.0",
|
|
21
|
+
"@mindful-web/marko-web-html-sitemap": "^1.0.0",
|
|
22
|
+
"@mindful-web/marko-web-icons": "^1.0.0",
|
|
23
|
+
"@mindful-web/marko-web-identity-x": "^1.0.0",
|
|
24
|
+
"@mindful-web/marko-web-inquiry": "^1.0.0",
|
|
25
|
+
"@mindful-web/marko-web-native-x": "^1.0.0",
|
|
26
|
+
"@mindful-web/marko-web-omeda": "^1.0.0",
|
|
27
|
+
"@mindful-web/marko-web-omeda-identity-x": "^1.0.0",
|
|
28
|
+
"@mindful-web/marko-web-p1-events": "^1.0.0",
|
|
29
|
+
"@mindful-web/marko-web-recaptcha": "^1.0.0",
|
|
30
|
+
"@mindful-web/marko-web-reveal-ad": "^1.0.0",
|
|
31
|
+
"@mindful-web/marko-web-search": "^1.0.0",
|
|
32
|
+
"@mindful-web/marko-web-social-sharing": "^1.0.0",
|
|
33
|
+
"@mindful-web/object-path": "^1.0.0",
|
|
34
|
+
"@mindful-web/utils": "^1.0.0",
|
|
35
|
+
"@mindful-web/web-common": "^1.0.0",
|
|
36
|
+
"@parameter1/joi": "^1.2.10",
|
|
37
|
+
"@trevoreyre/autocomplete-vue": "^2.4.1",
|
|
38
|
+
"bootstrap": "^4.6.2",
|
|
39
|
+
"cheerio": "^1.0.0-rc.12",
|
|
40
|
+
"debug": "^4.3.4",
|
|
41
|
+
"graphql-tag": "^2.12.6",
|
|
42
|
+
"http-errors": "^1.8.1",
|
|
43
|
+
"js-cookie": "^2.2.1",
|
|
44
|
+
"moment": "^2.29.1",
|
|
45
|
+
"node-fetch": "^2.6.9",
|
|
46
|
+
"ua-parser-js": "^1.0.33"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@mindful-web/marko-core": "^0.0.0",
|
|
50
|
+
"@mindful-web/marko-web": "^0.0.0"
|
|
51
|
+
},
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
54
|
+
},
|
|
55
|
+
"gitHead": "0b77cab713eb5841202bb86c7119949866bc68b5"
|
|
56
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const adPreview = require('../templates/ad-preview');
|
|
2
|
+
|
|
3
|
+
module.exports = (app, namespace) => {
|
|
4
|
+
if (namespace) {
|
|
5
|
+
app.get('/ad-preview/:creativeId([a-z0-9-/_]+)', (req, res) => {
|
|
6
|
+
const { creativeId } = req.params;
|
|
7
|
+
// @todo: Look into API to get title & description to send to template as well
|
|
8
|
+
return res.marko(adPreview, { creativeId, namespace });
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const { asyncRoute } = require('@mindful-web/utils');
|
|
2
|
+
const { get } = require('@mindful-web/object-path');
|
|
3
|
+
const advertisingPostById = require('../graphql/fragments/mindful-advertising-post-by-id');
|
|
4
|
+
// const template = require('../templates/content/advertising-post');
|
|
5
|
+
|
|
6
|
+
module.exports = (app, { path = 'sponsored', template }) => {
|
|
7
|
+
app.get(`/${path}/:section/:slug/:id`, asyncRoute(async (req, res) => {
|
|
8
|
+
const { service } = req.mindful;
|
|
9
|
+
const { path: p, url } = req;
|
|
10
|
+
if (p.substr(-1) === '/' && p.length > 1) {
|
|
11
|
+
const queryParams = url.slice(p.length);
|
|
12
|
+
const safe = p.slice(0, -1).replace(/\/+/g, '/');
|
|
13
|
+
res.redirect(301, `${safe}${queryParams}`);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const { id: _id } = req.params;
|
|
18
|
+
const result = await service.getAdvertisingPostById({ _id }, advertisingPostById);
|
|
19
|
+
const story = service.convertAdvertisingPostToNativeStory({
|
|
20
|
+
advertisingPost: get(result, 'data.advertisingPostById'),
|
|
21
|
+
preview: Boolean(req.query.preview),
|
|
22
|
+
});
|
|
23
|
+
res.marko(template, { story });
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const loader = require('@mindful-web/marko-web-search/loaders/search');
|
|
2
|
+
const jsonErrorHandler = require('@mindful-web/marko-web/express/json-error-handler');
|
|
3
|
+
const { asyncRoute } = require('@mindful-web/utils');
|
|
4
|
+
|
|
5
|
+
const queryFragment = require('../graphql/fragments/company-search');
|
|
6
|
+
|
|
7
|
+
module.exports = (app) => {
|
|
8
|
+
app.get('/__company-search', asyncRoute(async (req, res) => {
|
|
9
|
+
const { searchQuery } = req.query;
|
|
10
|
+
const { apollo, $baseBrowse } = res.locals;
|
|
11
|
+
|
|
12
|
+
const response = await loader(
|
|
13
|
+
{
|
|
14
|
+
apolloMindfulWebCMS: apollo,
|
|
15
|
+
apolloBaseBrowse: $baseBrowse,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
status: 1,
|
|
19
|
+
contentTypes: ['COMPANY'],
|
|
20
|
+
assignedToWebsiteSiteIds: [req.app.locals.config.websiteContext.id],
|
|
21
|
+
searchQuery,
|
|
22
|
+
queryFragment,
|
|
23
|
+
},
|
|
24
|
+
);
|
|
25
|
+
res.json(response);
|
|
26
|
+
}), jsonErrorHandler());
|
|
27
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const withNativeXStory = require('@mindful-web/marko-web-native-x/middleware/with-story');
|
|
2
|
+
const { getAsObject } = require('@mindful-web/object-path');
|
|
3
|
+
const queryFragment = require('../graphql/fragments/native-x-story');
|
|
4
|
+
const template = require('../templates/content/native-x-story');
|
|
5
|
+
|
|
6
|
+
module.exports = (app) => {
|
|
7
|
+
const config = getAsObject(app, 'locals.nativeX');
|
|
8
|
+
app.get('/sponsored/:section/:slug/:id', withNativeXStory({ config, template, queryFragment }));
|
|
9
|
+
};
|
package/routes/print.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const { withContent } = require('@mindful-web/marko-web/middleware');
|
|
2
|
+
const template = require('../templates/content/print');
|
|
3
|
+
|
|
4
|
+
module.exports = (app, queryFragment) => {
|
|
5
|
+
if (!queryFragment) throw new Error('Missing queryFragment for the print content route!');
|
|
6
|
+
app.get('/print/content/:id(\\d{8})', withContent({
|
|
7
|
+
template,
|
|
8
|
+
queryFragment,
|
|
9
|
+
redirectOnPathMismatch: false,
|
|
10
|
+
}));
|
|
11
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const createError = require('http-errors');
|
|
2
|
+
const MostPopular = require('../components/blocks/most-popular');
|
|
3
|
+
const MostPopularList = require('../components/blocks/most-popular-list');
|
|
4
|
+
const TopStoriesMenu = require('../components/blocks/top-stories-menu');
|
|
5
|
+
|
|
6
|
+
const blocks = {
|
|
7
|
+
'most-popular': MostPopular,
|
|
8
|
+
'most-popular-list': MostPopularList,
|
|
9
|
+
'top-stories-menu': TopStoriesMenu,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const parseJSON = (value) => {
|
|
13
|
+
try {
|
|
14
|
+
return JSON.parse(value);
|
|
15
|
+
} catch (e) {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
module.exports = (app) => {
|
|
21
|
+
app.get('/__render-block/:name', (req, res) => {
|
|
22
|
+
const { name } = req.params;
|
|
23
|
+
const input = parseJSON(req.query.input);
|
|
24
|
+
const Component = blocks[name];
|
|
25
|
+
if (!Component) throw createError(404, `No block component found for '${name}'`);
|
|
26
|
+
return res.marko(Component, input);
|
|
27
|
+
}, (err, req, res, next) => { // eslint-disable-line
|
|
28
|
+
res.set({ 'content-type': 'text/html; charset=utf-8' });
|
|
29
|
+
res.status(err.status || err.statusCode || 500);
|
|
30
|
+
res.send(`Unable to render marko component. ${err.message}`);
|
|
31
|
+
});
|
|
32
|
+
};
|
package/routes/search.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const { get, getAsObject } = require('@mindful-web/object-path');
|
|
2
|
+
const MarkoWebSearchConfig = require('@mindful-web/marko-web-search/config');
|
|
3
|
+
const middleware = require('@mindful-web/marko-web-search/middleware');
|
|
4
|
+
const template = require('../templates/search');
|
|
5
|
+
|
|
6
|
+
module.exports = (app, siteConfig) => {
|
|
7
|
+
const {
|
|
8
|
+
contentTypes = ['Article', 'Blog', 'Company', 'Podcast', 'Product', 'Video', 'Whitepaper'],
|
|
9
|
+
assignedToWebsiteSectionIds,
|
|
10
|
+
defaultSortField,
|
|
11
|
+
} = getAsObject(siteConfig, 'search');
|
|
12
|
+
const config = new MarkoWebSearchConfig({
|
|
13
|
+
resultsPerPage: { default: 18 },
|
|
14
|
+
contentTypes,
|
|
15
|
+
assignedToWebsiteSectionIds,
|
|
16
|
+
defaultSortField,
|
|
17
|
+
});
|
|
18
|
+
app.get('/search', (req, res, next) => {
|
|
19
|
+
if (!get(req, 'query.searchQuery') && get(req, 'query.sortField')) {
|
|
20
|
+
const params = new URLSearchParams(get(req, 'query'));
|
|
21
|
+
params.delete('sortField');
|
|
22
|
+
params.delete('searchQuery');
|
|
23
|
+
if (`${params}`) res.redirect(301, `${get(req, 'route.path')}?${params}`);
|
|
24
|
+
else res.redirect(301, '/search');
|
|
25
|
+
}
|
|
26
|
+
next();
|
|
27
|
+
}, middleware({ config, template }));
|
|
28
|
+
};
|