@mindful-web/marko-web-theme-monorail 1.98.0 → 1.98.3

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.
Files changed (157) hide show
  1. package/components/ads/fixed-ad-bottom.marko.js +2 -2
  2. package/components/ads/reveal-ad-handler.marko.js +2 -2
  3. package/components/blocks/author-bios.marko.js +2 -2
  4. package/components/blocks/callout-cards.marko.js +2 -2
  5. package/components/blocks/company-inquiry-form.marko.js +2 -2
  6. package/components/blocks/company-search.marko.js +2 -2
  7. package/components/blocks/content-card-deck.marko.js +2 -2
  8. package/components/blocks/content-meter.marko.js +2 -2
  9. package/components/blocks/full-width-native-ad.marko.js +2 -2
  10. package/components/blocks/geo-summary.marko +10 -21
  11. package/components/blocks/geo-summary.marko.js +13 -42
  12. package/components/blocks/header-announcement.marko.js +2 -2
  13. package/components/blocks/hero-card.marko.js +2 -2
  14. package/components/blocks/latest-content-list.marko.js +2 -2
  15. package/components/blocks/latest-podcast.marko.js +2 -2
  16. package/components/blocks/latest-products-feed.marko.js +2 -2
  17. package/components/blocks/more-products.marko.js +2 -2
  18. package/components/blocks/most-popular-list.marko.js +2 -2
  19. package/components/blocks/most-popular.marko.js +2 -2
  20. package/components/blocks/native-x-card-deck.marko.js +2 -2
  21. package/components/blocks/native-x-promo-card.marko.js +2 -2
  22. package/components/blocks/newsletter-signup-banner-external.marko.js +2 -2
  23. package/components/blocks/newsletter-signup-banner-large.marko.js +2 -2
  24. package/components/blocks/newsletter-signup-banner.marko.js +2 -2
  25. package/components/blocks/opinion.marko.js +2 -2
  26. package/components/blocks/primary-image.marko.js +2 -2
  27. package/components/blocks/products.marko.js +2 -2
  28. package/components/blocks/read-next.marko.js +2 -2
  29. package/components/blocks/related-stories.marko.js +2 -2
  30. package/components/blocks/resource-library.marko.js +2 -2
  31. package/components/blocks/section-body-feed.marko.js +2 -2
  32. package/components/blocks/section-card-deck-featured.marko.js +2 -2
  33. package/components/blocks/section-card-deck.marko.js +2 -2
  34. package/components/blocks/section-card-list.marko.js +2 -2
  35. package/components/blocks/section-feed.marko.js +2 -2
  36. package/components/blocks/section-forbes.marko.js +2 -2
  37. package/components/blocks/section-list-deck.marko.js +2 -2
  38. package/components/blocks/section-list.marko.js +2 -2
  39. package/components/blocks/section-search.marko.js +2 -2
  40. package/components/blocks/section-title-feed.marko.js +2 -2
  41. package/components/blocks/top-stories-menu.marko.js +2 -2
  42. package/components/blocks/top-stories.marko.js +2 -2
  43. package/components/blocks/white-papers.marko.js +2 -2
  44. package/components/breadcrumbs/content-page.marko.js +2 -2
  45. package/components/breadcrumbs/index.marko.js +2 -2
  46. package/components/breadcrumbs/website-section.marko.js +2 -2
  47. package/components/breadcrumbs/with-home.marko.js +2 -2
  48. package/components/client-side-block-loader.marko.js +2 -2
  49. package/components/client-side-blocks/most-popular-list.marko.js +2 -2
  50. package/components/client-side-blocks/most-popular.marko.js +2 -2
  51. package/components/content/body-with-injection.marko.js +2 -2
  52. package/components/content/contact-details/index.marko.js +2 -2
  53. package/components/content/contact-details/section.marko.js +2 -2
  54. package/components/content/download/form-dot-com.marko.js +2 -2
  55. package/components/content/download/identity-x.marko.js +2 -2
  56. package/components/content/download/index.marko.js +2 -2
  57. package/components/content/download/link.marko.js +2 -2
  58. package/components/content/download/wufoo.marko.js +2 -2
  59. package/components/content/link-url/index.marko.js +2 -2
  60. package/components/content/sections-listed-in.marko.js +2 -2
  61. package/components/content-attribution/attribution.marko.js +2 -2
  62. package/components/content-attribution/components/authors.marko.js +2 -2
  63. package/components/content-attribution/components/byline.marko.js +2 -2
  64. package/components/content-attribution/components/company.marko.js +2 -2
  65. package/components/content-attribution/components/contributors.marko.js +2 -2
  66. package/components/content-attribution/components/photographers.marko.js +2 -2
  67. package/components/content-attribution/components/source.marko.js +2 -2
  68. package/components/content-attribution/components/speakers.marko.js +2 -2
  69. package/components/content-attribution/components/sponsors.marko.js +2 -2
  70. package/components/content-attribution/index.marko.js +2 -2
  71. package/components/directory-facets/facet-container/facet-container.marko.js +2 -2
  72. package/components/directory-facets/facet-list/facet-list.marko.js +2 -2
  73. package/components/directory-facets/facet.marko.js +2 -2
  74. package/components/directory-facets/index.marko.js +2 -2
  75. package/components/facebook-connect.marko.js +2 -2
  76. package/components/flows/card-deck.marko.js +2 -2
  77. package/components/flows/content/card-deck-col.marko.js +2 -2
  78. package/components/flows/content/directory-section.marko.js +2 -2
  79. package/components/flows/content/list.marko.js +2 -2
  80. package/components/flows/section-feed.marko.js +2 -2
  81. package/components/gam/components/define-display-ad.marko.js +2 -2
  82. package/components/gam/define-display-ad.marko.js +2 -2
  83. package/components/gam/inject-ads.marko.js +2 -2
  84. package/components/gam/wallpaper-ad.marko.js +2 -2
  85. package/components/google-preferred-source/index.marko.js +2 -2
  86. package/components/google-preferred-source/init.marko.js +2 -2
  87. package/components/identity-x/comment-stream.marko.js +2 -2
  88. package/components/identity-x/content-page-gate.marko.js +2 -2
  89. package/components/identity-x/newsletter-footer.marko.js +2 -2
  90. package/components/identity-x/newsletter-inline.marko.js +2 -2
  91. package/components/identity-x/newsletter-modal.marko.js +2 -2
  92. package/components/identity-x/newsletter-pushdown.marko.js +2 -2
  93. package/components/identity-x/progressive-profile-gate.marko.js +2 -2
  94. package/components/layouts/ad-preview.marko.js +2 -2
  95. package/components/menu-toggle-button.marko.js +2 -2
  96. package/components/native-x/render.marko.js +2 -2
  97. package/components/nodes/author-bio.marko.js +2 -2
  98. package/components/nodes/author-card.marko.js +2 -2
  99. package/components/nodes/author-published.marko.js +2 -2
  100. package/components/nodes/author.marko.js +2 -2
  101. package/components/nodes/components/attribution.marko.js +2 -2
  102. package/components/nodes/components/authors.marko.js +2 -2
  103. package/components/nodes/components/company-name.marko.js +2 -2
  104. package/components/nodes/components/dates.marko.js +2 -2
  105. package/components/nodes/components/section-sponsor.marko.js +2 -2
  106. package/components/nodes/content-published.marko.js +2 -2
  107. package/components/nodes/content.marko.js +2 -2
  108. package/components/nodes/directory-section-feed-content.marko.js +2 -2
  109. package/components/nodes/featured-products-card.marko.js +2 -2
  110. package/components/nodes/product-feed-content.marko.js +2 -2
  111. package/components/nodes/section-feed-content.marko.js +2 -2
  112. package/components/nodes/standard-promo.marko.js +2 -2
  113. package/components/nodes/youtube-card.marko.js +2 -2
  114. package/components/page/attribution.marko.js +2 -2
  115. package/components/page/contact-details.marko.js +2 -2
  116. package/components/page/content.marko.js +2 -2
  117. package/components/page/contents.marko.js +2 -2
  118. package/components/page/dates.marko.js +2 -2
  119. package/components/page/default.marko.js +2 -2
  120. package/components/page/website-section.marko.js +2 -2
  121. package/components/pagination-controls.marko.js +2 -2
  122. package/components/query-total-count.marko.js +2 -2
  123. package/components/reveal-ad-handler.marko.js +2 -2
  124. package/components/site-footer/container.marko.js +2 -2
  125. package/components/site-footer/copyright.marko.js +2 -2
  126. package/components/site-footer/index.marko.js +2 -2
  127. package/components/site-footer/social-icons.marko.js +2 -2
  128. package/components/site-header.marko.js +2 -2
  129. package/components/site-menu/components/search.marko.js +2 -2
  130. package/components/site-menu/components/social-icons.marko.js +2 -2
  131. package/components/site-menu/header.marko.js +2 -2
  132. package/components/site-menu/index.marko.js +2 -2
  133. package/components/site-menu/section.marko.js +2 -2
  134. package/components/site-navbar/brand.marko.js +2 -2
  135. package/components/site-navbar/index.marko.js +2 -2
  136. package/components/site-navbar/item.marko.js +2 -2
  137. package/components/site-navbar/items.marko.js +2 -2
  138. package/components/site-navbar/logo.marko.js +2 -2
  139. package/components/site-navbar/search.marko.js +2 -2
  140. package/components/site-newsletter-menu.marko.js +2 -2
  141. package/components/social/icon-link.marko.js +2 -2
  142. package/components/social/icons.marko.js +2 -2
  143. package/components/social-follow.marko.js +2 -2
  144. package/components/sponsored-label-logo.marko.js +2 -2
  145. package/components/sponsored-section-logo.marko.js +2 -2
  146. package/components/sponsored-section-name-logo.marko.js +2 -2
  147. package/components/ssr-html-inject.marko.js +2 -2
  148. package/package.json +2 -2
  149. package/templates/ad-preview.marko.js +2 -2
  150. package/templates/content/components/presented-by.marko.js +2 -2
  151. package/templates/content/native-x-story.marko.js +2 -2
  152. package/templates/content/print.marko.js +2 -2
  153. package/templates/email-preview.marko.js +2 -2
  154. package/templates/search.marko.js +2 -2
  155. package/templates/taxonomy.marko.js +2 -2
  156. package/test/utils/geo-summary-visible.spec.js +82 -0
  157. package/utils/geo-summary-visible.js +41 -0
@@ -0,0 +1,82 @@
1
+ const { describe, it } = require('mocha');
2
+ const { expect } = require('chai');
3
+ const geoSummaryVisible = require('../../utils/geo-summary-visible');
4
+
5
+ const words = (n) => `<p>${Array(n).fill('word').join(' ')}</p>`;
6
+ const make = (overrides = {}) => ({
7
+ type: 'article',
8
+ geoSummary: 'A summary.',
9
+ geoSummaryDisplay: 'DEFAULT',
10
+ body: words(301),
11
+ ...overrides,
12
+ });
13
+
14
+ describe('utils/geo-summary-visible', () => {
15
+ it('shows a long article with a summary', () => {
16
+ expect(geoSummaryVisible(make())).to.equal(true);
17
+ });
18
+
19
+ it('hides when there is no summary, even when VISIBLE', () => {
20
+ expect(geoSummaryVisible(make({ geoSummary: null, geoSummaryDisplay: 'VISIBLE' }))).to.equal(false);
21
+ });
22
+
23
+ it('hides when HIDDEN', () => {
24
+ expect(geoSummaryVisible(make({ geoSummaryDisplay: 'HIDDEN' }))).to.equal(false);
25
+ });
26
+
27
+ it('defaults to article and news only', () => {
28
+ expect(geoSummaryVisible(make({ type: 'news' }))).to.equal(true);
29
+ expect(geoSummaryVisible(make({ type: 'product' }))).to.equal(false);
30
+ });
31
+
32
+ it('honors includeContentTypes', () => {
33
+ const content = make({ type: 'product' });
34
+ expect(geoSummaryVisible(content, { includeContentTypes: ['product'] })).to.equal(true);
35
+ });
36
+
37
+ it('requires more than minBodyWordCount words of body text', () => {
38
+ expect(geoSummaryVisible(make({ body: words(300) }))).to.equal(false);
39
+ expect(geoSummaryVisible(make({ body: null }))).to.equal(false);
40
+ expect(geoSummaryVisible(make({ body: words(51) }), { minBodyWordCount: 50 })).to.equal(true);
41
+ });
42
+
43
+ it('ignores markup when counting words', () => {
44
+ const body = `<div><img src="x.jpg"></div>${words(150)}<p>&nbsp; -- </p>${words(150)}`;
45
+ expect(geoSummaryVisible(make({ body }))).to.equal(false);
46
+ });
47
+
48
+ it('reads geoSummaryDisplay in any case', () => {
49
+ expect(geoSummaryVisible(make({ geoSummaryDisplay: 'hidden' }))).to.equal(false);
50
+ expect(geoSummaryVisible(make({ type: 'product', body: '', geoSummaryDisplay: 'Visible' }))).to.equal(true);
51
+ expect(geoSummaryVisible(make({ geoSummaryDisplay: 'default' }), { defaultDisplay: 'HIDDEN' })).to.equal(false);
52
+ });
53
+
54
+ it('applies the normal rules when geoSummaryDisplay is unset', () => {
55
+ expect(geoSummaryVisible(make({ geoSummaryDisplay: null }))).to.equal(true);
56
+ expect(geoSummaryVisible(make({ geoSummaryDisplay: undefined, type: 'product' }))).to.equal(false);
57
+ });
58
+
59
+ it('lets VISIBLE override the type and length rules', () => {
60
+ const content = make({ type: 'product', body: '', geoSummaryDisplay: 'VISIBLE' });
61
+ expect(geoSummaryVisible(content)).to.equal(true);
62
+ });
63
+
64
+ it('suppresses DEFAULT content when defaultDisplay is hidden, in any case', () => {
65
+ ['hidden', 'HIDDEN', 'Hidden'].forEach((defaultDisplay) => {
66
+ expect(geoSummaryVisible(make(), { defaultDisplay })).to.equal(false);
67
+ });
68
+ });
69
+
70
+ it('still shows VISIBLE content when defaultDisplay is hidden', () => {
71
+ const content = make({ geoSummaryDisplay: 'VISIBLE' });
72
+ expect(geoSummaryVisible(content, { defaultDisplay: 'hidden' })).to.equal(true);
73
+ });
74
+
75
+ it('applies the normal rules when defaultDisplay is visible, in any case', () => {
76
+ ['visible', 'VISIBLE'].forEach((defaultDisplay) => {
77
+ expect(geoSummaryVisible(make(), { defaultDisplay })).to.equal(true);
78
+ expect(geoSummaryVisible(make({ type: 'product' }), { defaultDisplay })).to.equal(false);
79
+ expect(geoSummaryVisible(make({ body: words(10) }), { defaultDisplay })).to.equal(false);
80
+ });
81
+ });
82
+ });
@@ -0,0 +1,41 @@
1
+ const { get } = require('@mindful-web/object-path');
2
+ const { stripHtml } = require('@mindful-web/html');
3
+
4
+ /**
5
+ * Whether the GEO "Article Summary" card (`<theme-content-geo-summary-block>`) renders for
6
+ * this content. The block uses this for its own show/hide decision, so layouts can call it
7
+ * with the same options to adjust around the card (e.g. un-float the primary image).
8
+ *
9
+ * `geoSummaryDisplay` governs the card: HIDDEN suppresses it (the summary may still feed the
10
+ * head meta tag + JSON-LD); VISIBLE forces it on and overrides both the content-type and
11
+ * body-length restrictions; DEFAULT uses the `defaultDisplay` setting.
12
+ *
13
+ * `defaultDisplay` is case-insensitive: "hidden" suppresses DEFAULT content; "visible" (the
14
+ * default) applies the normal content-type and body-length rules -- it never forces the card on.
15
+ *
16
+ * @param {object} content The content node (needs geoSummary, geoSummaryDisplay, type, body).
17
+ * @param {object} [options]
18
+ * @param {string[]} [options.includeContentTypes] Content types the card may show on.
19
+ * @param {number} [options.minBodyWordCount] Body must have more words than this.
20
+ * @param {string} [options.defaultDisplay] "visible" or "hidden" (any case); applies when
21
+ * geoSummaryDisplay is DEFAULT.
22
+ * @returns {boolean}
23
+ */
24
+ module.exports = (content, {
25
+ includeContentTypes = ['article', 'news'],
26
+ minBodyWordCount = 300,
27
+ defaultDisplay = 'visible',
28
+ } = {}) => {
29
+ if (!get(content, 'geoSummary')) return false;
30
+ // The API types geoSummaryDisplay as a plain String, so don't rely on its casing.
31
+ const contentDisplay = `${get(content, 'geoSummaryDisplay') || ''}`.toUpperCase();
32
+ if (contentDisplay === 'HIDDEN') return false;
33
+ if (contentDisplay === 'VISIBLE') return true;
34
+ if (contentDisplay === 'DEFAULT' && `${defaultDisplay}`.toUpperCase() === 'HIDDEN') return false;
35
+ if (!includeContentTypes.includes(get(content, 'type'))) return false;
36
+ // Only surface the summary on long-form content: require more than `minBodyWordCount`
37
+ // words of body prose once all HTML and embeds are stripped (stripHtml -> plain text).
38
+ const bodyText = stripHtml(get(content, 'body') || '');
39
+ const bodyWordCount = bodyText ? bodyText.split(/\s+/).filter((w) => /\w/.test(w)).length : 0;
40
+ return bodyWordCount > minBodyWordCount;
41
+ };