@scalemule/news-publication 0.0.19 → 0.0.20

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/dist/index.cjs CHANGED
@@ -82,7 +82,7 @@ var walnutCreekTimes = definePublication({
82
82
  regionLabel: "Walnut Creek",
83
83
  towns: ["Walnut Creek", "Rossmoor", "Saranap", "Pleasant Hill"],
84
84
  nearbyTowns: ["Martinez", "Concord", "Contra Costa"],
85
- sections: ["Civic life", "Community", "Local businesses", "Events", "Food & places"],
85
+ sections: ["Civic life", "Community", "Local businesses", "Real Estate", "Food & places", "Events", "Health"],
86
86
  description: "Local news, independent businesses and community voices from Walnut Creek, Rossmoor, Saranap and Pleasant Hill.",
87
87
  layout: "broadsheet",
88
88
  layouts: ["broadsheet"],
@@ -174,9 +174,30 @@ function defaultRevalidateTargets() {
174
174
 
175
175
  // src/editorial.ts
176
176
  var labels = {
177
- "Local businesses": "Local business",
177
+ "Local businesses": "Business",
178
+ "Events": "Things to do",
178
179
  "Food & places": "Food & drink"
179
180
  };
181
+ var EDITORIAL_SECTION_ORDER = [
182
+ "Civic life",
183
+ "Community",
184
+ "Local businesses",
185
+ "Real Estate",
186
+ "Food & places",
187
+ "Events",
188
+ "Health",
189
+ "Schools",
190
+ "Opinion"
191
+ ];
192
+ function orderedSections(sections, order = EDITORIAL_SECTION_ORDER) {
193
+ return sections.filter((section) => section.name !== "Local news").slice().sort((left, right) => {
194
+ const leftRank = order.indexOf(left.name);
195
+ const rightRank = order.indexOf(right.name);
196
+ const leftOrder = leftRank === -1 ? order.length : leftRank;
197
+ const rightOrder = rightRank === -1 ? order.length : rightRank;
198
+ return leftOrder - rightOrder || left.name.localeCompare(right.name);
199
+ });
200
+ }
180
201
  function sectionId(name) {
181
202
  return "section-" + name.normalize("NFKD").replace(/\p{Mark}/gu, "").toLowerCase().replace(/[^\p{Letter}\p{Number}]+/gu, "-").replace(/^-|-$/g, "");
182
203
  }
@@ -1907,6 +1928,7 @@ exports.CLASSIFIED_CATEGORIES = CLASSIFIED_CATEGORIES;
1907
1928
  exports.COOKIE_CATEGORIES = COOKIE_CATEGORIES;
1908
1929
  exports.CookieConsentBanner = CookieConsentBanner;
1909
1930
  exports.CookieSettingsView = CookieSettingsView;
1931
+ exports.EDITORIAL_SECTION_ORDER = EDITORIAL_SECTION_ORDER;
1910
1932
  exports.EVENTS = EVENTS;
1911
1933
  exports.FEATURE_NAMES = FEATURE_NAMES;
1912
1934
  exports.JOB_EMPLOYMENT_TYPES = JOB_EMPLOYMENT_TYPES;
@@ -1974,6 +1996,7 @@ exports.matchesStoryTag = matchesStoryTag;
1974
1996
  exports.nearbyUpdates = nearbyUpdates;
1975
1997
  exports.newsArticleJsonLd = newsArticleJsonLd;
1976
1998
  exports.normalizedText = normalizedText;
1999
+ exports.orderedSections = orderedSections;
1977
2000
  exports.parseSnapshot = parseSnapshot;
1978
2001
  exports.prepareClassified = prepareClassified;
1979
2002
  exports.prepareJobPost = prepareJobPost;
package/dist/index.d.cts CHANGED
@@ -102,6 +102,16 @@ declare function defaultRevalidateTargets(): {
102
102
  paths: string[];
103
103
  };
104
104
 
105
+ /**
106
+ * Canonical reader-facing order for editorial sections across the network.
107
+ * Names not listed here sort after these, alphabetically. "Schools" and
108
+ * "Opinion" are reserved so future sections slot in without a release.
109
+ */
110
+ declare const EDITORIAL_SECTION_ORDER: readonly ["Civic life", "Community", "Local businesses", "Real Estate", "Food & places", "Events", "Health", "Schools", "Opinion"];
111
+ /** Sorts sections into the canonical order, dropping the implicit "Local news" bucket. */
112
+ declare function orderedSections<T extends {
113
+ name: string;
114
+ }>(sections: T[], order?: readonly string[]): T[];
105
115
  declare function sectionId(name: string): string;
106
116
  declare function sectionPath(name: string): string;
107
117
  declare function sectionDefinition(name: string): EditorialSection;
@@ -301,4 +311,4 @@ declare function readerSources(input: unknown): {
301
311
  publisher?: string;
302
312
  }[];
303
313
 
304
- export { ANALYTICS_COOKIE, ANALYTICS_VERSION, ArticleProvenance, type Attribution, BROADSHEET_THEME, COOKIE_CATEGORIES, CouponOffer, EVENTS, EditorialSection, type EffectiveTheme, FeatureName, HomepageSelection, LAYOUT_COOKIE, NEWS_CACHE, NearbyUpdate, NewsArticle, NewsError, NewsItem, NewsPublication, PublicationInput, PublicationTheme, SESSION_IDLE_MS, THEME_COOKIE, THEME_EVENT, THEME_MAX_AGE_SECONDS, THEME_STORAGE_KEY, type ThemeMode, UTM_FIELDS, UUID, activeNearby, applyTheme, articleCacheKey, articleCacheOptions, articleMeta, articleUrl, attribution, briefSummary, clearTheme, composeEdition, defaultRevalidateTargets, definePublication, displayHeadline, edgeCacheControl, editorialSections, featureEnabled, feedCacheKey, feedCacheOptions, filterNews, getStoredTheme, getSystemTheme, inventoryCacheOptions, llmsText, matchesStoryTag, nearbyUpdates, newsArticleJsonLd, normalizedText, publicHttps, publicUrl, publicationJsonLd, publicationMeta, readerSources, recordConsentToCompliance, referralCode, resolveCoupon, resolveEffectiveTheme, resolveLayout, revalidateDecision, secretsMatch, sectionDefinition, sectionId, sectionPath, setTheme, shortDeck, shortText, shouldServeLastKnown, storyDate, storyTowns, subscribeTheme, themeInitScript, townSlug, validCalendarDate, walnutCreekTimes, withLastKnown };
314
+ export { ANALYTICS_COOKIE, ANALYTICS_VERSION, ArticleProvenance, type Attribution, BROADSHEET_THEME, COOKIE_CATEGORIES, CouponOffer, EDITORIAL_SECTION_ORDER, EVENTS, EditorialSection, type EffectiveTheme, FeatureName, HomepageSelection, LAYOUT_COOKIE, NEWS_CACHE, NearbyUpdate, NewsArticle, NewsError, NewsItem, NewsPublication, PublicationInput, PublicationTheme, SESSION_IDLE_MS, THEME_COOKIE, THEME_EVENT, THEME_MAX_AGE_SECONDS, THEME_STORAGE_KEY, type ThemeMode, UTM_FIELDS, UUID, activeNearby, applyTheme, articleCacheKey, articleCacheOptions, articleMeta, articleUrl, attribution, briefSummary, clearTheme, composeEdition, defaultRevalidateTargets, definePublication, displayHeadline, edgeCacheControl, editorialSections, featureEnabled, feedCacheKey, feedCacheOptions, filterNews, getStoredTheme, getSystemTheme, inventoryCacheOptions, llmsText, matchesStoryTag, nearbyUpdates, newsArticleJsonLd, normalizedText, orderedSections, publicHttps, publicUrl, publicationJsonLd, publicationMeta, readerSources, recordConsentToCompliance, referralCode, resolveCoupon, resolveEffectiveTheme, resolveLayout, revalidateDecision, secretsMatch, sectionDefinition, sectionId, sectionPath, setTheme, shortDeck, shortText, shouldServeLastKnown, storyDate, storyTowns, subscribeTheme, themeInitScript, townSlug, validCalendarDate, walnutCreekTimes, withLastKnown };
package/dist/index.d.ts CHANGED
@@ -102,6 +102,16 @@ declare function defaultRevalidateTargets(): {
102
102
  paths: string[];
103
103
  };
104
104
 
105
+ /**
106
+ * Canonical reader-facing order for editorial sections across the network.
107
+ * Names not listed here sort after these, alphabetically. "Schools" and
108
+ * "Opinion" are reserved so future sections slot in without a release.
109
+ */
110
+ declare const EDITORIAL_SECTION_ORDER: readonly ["Civic life", "Community", "Local businesses", "Real Estate", "Food & places", "Events", "Health", "Schools", "Opinion"];
111
+ /** Sorts sections into the canonical order, dropping the implicit "Local news" bucket. */
112
+ declare function orderedSections<T extends {
113
+ name: string;
114
+ }>(sections: T[], order?: readonly string[]): T[];
105
115
  declare function sectionId(name: string): string;
106
116
  declare function sectionPath(name: string): string;
107
117
  declare function sectionDefinition(name: string): EditorialSection;
@@ -301,4 +311,4 @@ declare function readerSources(input: unknown): {
301
311
  publisher?: string;
302
312
  }[];
303
313
 
304
- export { ANALYTICS_COOKIE, ANALYTICS_VERSION, ArticleProvenance, type Attribution, BROADSHEET_THEME, COOKIE_CATEGORIES, CouponOffer, EVENTS, EditorialSection, type EffectiveTheme, FeatureName, HomepageSelection, LAYOUT_COOKIE, NEWS_CACHE, NearbyUpdate, NewsArticle, NewsError, NewsItem, NewsPublication, PublicationInput, PublicationTheme, SESSION_IDLE_MS, THEME_COOKIE, THEME_EVENT, THEME_MAX_AGE_SECONDS, THEME_STORAGE_KEY, type ThemeMode, UTM_FIELDS, UUID, activeNearby, applyTheme, articleCacheKey, articleCacheOptions, articleMeta, articleUrl, attribution, briefSummary, clearTheme, composeEdition, defaultRevalidateTargets, definePublication, displayHeadline, edgeCacheControl, editorialSections, featureEnabled, feedCacheKey, feedCacheOptions, filterNews, getStoredTheme, getSystemTheme, inventoryCacheOptions, llmsText, matchesStoryTag, nearbyUpdates, newsArticleJsonLd, normalizedText, publicHttps, publicUrl, publicationJsonLd, publicationMeta, readerSources, recordConsentToCompliance, referralCode, resolveCoupon, resolveEffectiveTheme, resolveLayout, revalidateDecision, secretsMatch, sectionDefinition, sectionId, sectionPath, setTheme, shortDeck, shortText, shouldServeLastKnown, storyDate, storyTowns, subscribeTheme, themeInitScript, townSlug, validCalendarDate, walnutCreekTimes, withLastKnown };
314
+ export { ANALYTICS_COOKIE, ANALYTICS_VERSION, ArticleProvenance, type Attribution, BROADSHEET_THEME, COOKIE_CATEGORIES, CouponOffer, EDITORIAL_SECTION_ORDER, EVENTS, EditorialSection, type EffectiveTheme, FeatureName, HomepageSelection, LAYOUT_COOKIE, NEWS_CACHE, NearbyUpdate, NewsArticle, NewsError, NewsItem, NewsPublication, PublicationInput, PublicationTheme, SESSION_IDLE_MS, THEME_COOKIE, THEME_EVENT, THEME_MAX_AGE_SECONDS, THEME_STORAGE_KEY, type ThemeMode, UTM_FIELDS, UUID, activeNearby, applyTheme, articleCacheKey, articleCacheOptions, articleMeta, articleUrl, attribution, briefSummary, clearTheme, composeEdition, defaultRevalidateTargets, definePublication, displayHeadline, edgeCacheControl, editorialSections, featureEnabled, feedCacheKey, feedCacheOptions, filterNews, getStoredTheme, getSystemTheme, inventoryCacheOptions, llmsText, matchesStoryTag, nearbyUpdates, newsArticleJsonLd, normalizedText, orderedSections, publicHttps, publicUrl, publicationJsonLd, publicationMeta, readerSources, recordConsentToCompliance, referralCode, resolveCoupon, resolveEffectiveTheme, resolveLayout, revalidateDecision, secretsMatch, sectionDefinition, sectionId, sectionPath, setTheme, shortDeck, shortText, shouldServeLastKnown, storyDate, storyTowns, subscribeTheme, themeInitScript, townSlug, validCalendarDate, walnutCreekTimes, withLastKnown };
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ var walnutCreekTimes = definePublication({
18
18
  regionLabel: "Walnut Creek",
19
19
  towns: ["Walnut Creek", "Rossmoor", "Saranap", "Pleasant Hill"],
20
20
  nearbyTowns: ["Martinez", "Concord", "Contra Costa"],
21
- sections: ["Civic life", "Community", "Local businesses", "Events", "Food & places"],
21
+ sections: ["Civic life", "Community", "Local businesses", "Real Estate", "Food & places", "Events", "Health"],
22
22
  description: "Local news, independent businesses and community voices from Walnut Creek, Rossmoor, Saranap and Pleasant Hill.",
23
23
  layout: "broadsheet",
24
24
  layouts: ["broadsheet"],
@@ -110,9 +110,30 @@ function defaultRevalidateTargets() {
110
110
 
111
111
  // src/editorial.ts
112
112
  var labels = {
113
- "Local businesses": "Local business",
113
+ "Local businesses": "Business",
114
+ "Events": "Things to do",
114
115
  "Food & places": "Food & drink"
115
116
  };
117
+ var EDITORIAL_SECTION_ORDER = [
118
+ "Civic life",
119
+ "Community",
120
+ "Local businesses",
121
+ "Real Estate",
122
+ "Food & places",
123
+ "Events",
124
+ "Health",
125
+ "Schools",
126
+ "Opinion"
127
+ ];
128
+ function orderedSections(sections, order = EDITORIAL_SECTION_ORDER) {
129
+ return sections.filter((section) => section.name !== "Local news").slice().sort((left, right) => {
130
+ const leftRank = order.indexOf(left.name);
131
+ const rightRank = order.indexOf(right.name);
132
+ const leftOrder = leftRank === -1 ? order.length : leftRank;
133
+ const rightOrder = rightRank === -1 ? order.length : rightRank;
134
+ return leftOrder - rightOrder || left.name.localeCompare(right.name);
135
+ });
136
+ }
116
137
  function sectionId(name) {
117
138
  return "section-" + name.normalize("NFKD").replace(/\p{Mark}/gu, "").toLowerCase().replace(/[^\p{Letter}\p{Number}]+/gu, "-").replace(/^-|-$/g, "");
118
139
  }
@@ -496,4 +517,4 @@ function readerSources(input) {
496
517
  return output;
497
518
  }
498
519
 
499
- export { ANALYTICS_COOKIE, ANALYTICS_VERSION, ArticleProvenance, EVENTS, NEWS_CACHE, NewsError, SESSION_IDLE_MS, UTM_FIELDS, UUID, activeNearby, articleCacheKey, articleCacheOptions, articleMeta, articleUrl, attribution, briefSummary, composeEdition, defaultRevalidateTargets, displayHeadline, edgeCacheControl, editorialSections, feedCacheKey, feedCacheOptions, filterNews, inventoryCacheOptions, llmsText, matchesStoryTag, nearbyUpdates, newsArticleJsonLd, normalizedText, publicHttps, publicUrl, publicationJsonLd, publicationMeta, readerSources, referralCode, resolveCoupon, revalidateDecision, secretsMatch, sectionDefinition, sectionId, sectionPath, shortDeck, shortText, shouldServeLastKnown, storyDate, storyTowns, townSlug, validCalendarDate, walnutCreekTimes, withLastKnown };
520
+ export { ANALYTICS_COOKIE, ANALYTICS_VERSION, ArticleProvenance, EDITORIAL_SECTION_ORDER, EVENTS, NEWS_CACHE, NewsError, SESSION_IDLE_MS, UTM_FIELDS, UUID, activeNearby, articleCacheKey, articleCacheOptions, articleMeta, articleUrl, attribution, briefSummary, composeEdition, defaultRevalidateTargets, displayHeadline, edgeCacheControl, editorialSections, feedCacheKey, feedCacheOptions, filterNews, inventoryCacheOptions, llmsText, matchesStoryTag, nearbyUpdates, newsArticleJsonLd, normalizedText, orderedSections, publicHttps, publicUrl, publicationJsonLd, publicationMeta, readerSources, referralCode, resolveCoupon, revalidateDecision, secretsMatch, sectionDefinition, sectionId, sectionPath, shortDeck, shortText, shouldServeLastKnown, storyDate, storyTowns, townSlug, validCalendarDate, walnutCreekTimes, withLastKnown };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalemule/news-publication",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "description": "Shared server framework for ScaleMule local news publications. Walnut Creek Times is the broadsheet default; each paper supplies its own identity and feature flags.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",