@scalemule/news-publication 0.0.7
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/LICENSE +21 -0
- package/README.md +74 -0
- package/cookie-consent.css +419 -0
- package/dist/chunk-C7JTEHTH.js +158 -0
- package/dist/chunk-GB36YM56.js +72 -0
- package/dist/chunk-PYCU2T5O.js +93 -0
- package/dist/chunk-R33MJWND.js +261 -0
- package/dist/chunk-TJ7RL3PV.js +252 -0
- package/dist/chunk-YQXS2KQI.js +112 -0
- package/dist/cookie-consent-banner.cjs +210 -0
- package/dist/cookie-consent-banner.d.cts +19 -0
- package/dist/cookie-consent-banner.d.ts +19 -0
- package/dist/cookie-consent-banner.js +3 -0
- package/dist/cookie-settings-view.cjs +470 -0
- package/dist/cookie-settings-view.d.cts +15 -0
- package/dist/cookie-settings-view.d.ts +15 -0
- package/dist/cookie-settings-view.js +3 -0
- package/dist/index.cjs +1460 -0
- package/dist/index.d.cts +317 -0
- package/dist/index.d.ts +317 -0
- package/dist/index.js +441 -0
- package/dist/marketplace-Ch7mdJZv.d.cts +123 -0
- package/dist/marketplace-Ch7mdJZv.d.ts +123 -0
- package/dist/marketplace-forms.cjs +134 -0
- package/dist/marketplace-forms.d.cts +10 -0
- package/dist/marketplace-forms.d.ts +10 -0
- package/dist/marketplace-forms.js +115 -0
- package/dist/marketplace-view.cjs +110 -0
- package/dist/marketplace-view.d.cts +21 -0
- package/dist/marketplace-view.d.ts +21 -0
- package/dist/marketplace-view.js +85 -0
- package/dist/meet-5Ym5bxfh.d.cts +79 -0
- package/dist/meet-5Ym5bxfh.d.ts +79 -0
- package/dist/meet-forms.cjs +188 -0
- package/dist/meet-forms.d.cts +13 -0
- package/dist/meet-forms.d.ts +13 -0
- package/dist/meet-forms.js +166 -0
- package/dist/meet-view.cjs +82 -0
- package/dist/meet-view.d.cts +23 -0
- package/dist/meet-view.d.ts +23 -0
- package/dist/meet-view.js +59 -0
- package/dist/snapshot-BS4hn1dk.d.cts +234 -0
- package/dist/snapshot-BS4hn1dk.d.ts +234 -0
- package/dist/snapshot-file.cjs +192 -0
- package/dist/snapshot-file.d.cts +21 -0
- package/dist/snapshot-file.d.ts +21 -0
- package/dist/snapshot-file.js +38 -0
- package/marketplace.css +61 -0
- package/package.json +103 -0
- package/tokens/broadsheet.css +61 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { P as PublicationTheme, a as PublicationInput, N as NewsPublication, F as FeatureName, H as HomepageSelection, b as NearbyUpdate, c as NewsItem, E as EditorialSection, d as NewsArticle, C as CouponOffer } from './snapshot-BS4hn1dk.cjs';
|
|
2
|
+
export { A as ArticleCitation, e as CategoryRef, f as CouponSettings, g as CoverImageMetadata, h as FEATURE_NAMES, i as FeatureFlags, j as NewsFeed, k as NewsLayoutId, l as PublicationModules, m as PublicationRecord, n as PublicationSnapshot, R as ReferralSettings, S as SnapshotHooks, o as StoryDisplay, p as SyncSource, q as SyncedPublication, T as TagRef, r as acceptRemoteRecord, s as acceptSnapshot, t as parseSnapshot, u as publicationFromSnapshot, v as publicationRecord, w as snapshotFromRecord, x as syncPublication } from './snapshot-BS4hn1dk.cjs';
|
|
3
|
+
export { M as MEET_ACTIVITIES, a as MeetActivity, b as MeetupInput, P as PreparedMeetup, c as PublicPlace, d as activityLabel, e as canHostMeetup, i as isAdult, p as prepareMeetup, s as screenMessage } from './meet-5Ym5bxfh.cjs';
|
|
4
|
+
export { C as CLASSIFIED_CATEGORIES, a as ClassifiedCategory, b as ClassifiedListing, E as EmploymentType, J as JOB_EMPLOYMENT_TYPES, P as PreparedClassified, c as PreparedJob, d as PublicJob, e as categoryLabel, f as classifiedPath, g as classifiedSearchPath, h as clipChars, i as employmentLabel, j as isClassifiedCategory, k as isEmploymentType, l as jobEmployerBody, m as jobOpeningBody, n as jobPostingBody, p as prepareClassified, o as prepareJobPost, q as publicJobPath, r as publicJobsPath } from './marketplace-Ch7mdJZv.cjs';
|
|
5
|
+
export { CookieConsentBanner, CookieConsentBannerProps } from './cookie-consent-banner.cjs';
|
|
6
|
+
export { CookieSettingsView, CookieSettingsViewProps } from './cookie-settings-view.cjs';
|
|
7
|
+
import 'react';
|
|
8
|
+
|
|
9
|
+
/** Walnut Creek Times broadsheet colors. A paper overrides only what it changes. */
|
|
10
|
+
declare const BROADSHEET_THEME: PublicationTheme;
|
|
11
|
+
declare function featureEnabled(publication: NewsPublication, feature: FeatureName): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Build a paper from the Walnut Creek Times defaults.
|
|
14
|
+
* Identity, towns, and feature flags are the only required differences.
|
|
15
|
+
*/
|
|
16
|
+
declare function definePublication(input: PublicationInput): NewsPublication;
|
|
17
|
+
/** Cookie a reader layout preference is stored in. Absent cookie means the paper default. */
|
|
18
|
+
declare const LAYOUT_COOKIE = "news_publication_layout";
|
|
19
|
+
/**
|
|
20
|
+
* Crawlers and readers with no cookie get `publication.layout`.
|
|
21
|
+
* A cookie is honored only when that paper listed the layout.
|
|
22
|
+
*/
|
|
23
|
+
declare function resolveLayout(publication: NewsPublication, cookieValue?: string | null): string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Walnut Creek Times, the reference paper.
|
|
27
|
+
* Other papers call `definePublication` with their own name, towns, and flags.
|
|
28
|
+
* Daily Smile stays off unless a paper opts in: the joke catalog is site content.
|
|
29
|
+
*/
|
|
30
|
+
declare const walnutCreekTimes: NewsPublication;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Cache policy verified on walnutcreektimes.com.
|
|
34
|
+
* Feeds refresh every 30s, articles every 60s, and the edge holds a page for
|
|
35
|
+
* 60s with five minutes of stale-while-revalidate. Publishing calls
|
|
36
|
+
* POST /api/revalidate to drop that wait.
|
|
37
|
+
*/
|
|
38
|
+
declare const NEWS_CACHE: {
|
|
39
|
+
readonly feedRevalidateSeconds: 30;
|
|
40
|
+
readonly articleRevalidateSeconds: 60;
|
|
41
|
+
readonly edgeMaxAgeSeconds: 60;
|
|
42
|
+
readonly staleWhileRevalidateSeconds: 300;
|
|
43
|
+
readonly feedTag: "news-feed";
|
|
44
|
+
readonly articleTag: "news-article";
|
|
45
|
+
readonly inventoryTag: "public-news-discovery-v2";
|
|
46
|
+
readonly paths: readonly ["/", "/news"];
|
|
47
|
+
};
|
|
48
|
+
declare const feedCacheOptions: {
|
|
49
|
+
readonly revalidate: 30;
|
|
50
|
+
readonly tags: readonly ["news-feed"];
|
|
51
|
+
};
|
|
52
|
+
declare const articleCacheOptions: {
|
|
53
|
+
readonly revalidate: 60;
|
|
54
|
+
readonly tags: readonly ["news-article"];
|
|
55
|
+
};
|
|
56
|
+
declare const inventoryCacheOptions: {
|
|
57
|
+
readonly revalidate: 30;
|
|
58
|
+
readonly tags: readonly ["news-feed", "public-news-discovery-v2"];
|
|
59
|
+
};
|
|
60
|
+
declare function edgeCacheControl(): string;
|
|
61
|
+
declare function feedCacheKey(publicationId: string, before?: string, section?: string): string;
|
|
62
|
+
declare function articleCacheKey(publicationId: string, slug: string): string;
|
|
63
|
+
declare class NewsError extends Error {
|
|
64
|
+
status: number;
|
|
65
|
+
constructor(status: number, message: string);
|
|
66
|
+
}
|
|
67
|
+
/** A missing article must 404. Every other failure may serve the last good copy. */
|
|
68
|
+
declare function shouldServeLastKnown(error: unknown): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* In-memory stale fallback used when the gateway times out or returns 429/5xx.
|
|
71
|
+
* The Next.js data cache is separate and is configured with `feedCacheOptions`.
|
|
72
|
+
*/
|
|
73
|
+
declare function withLastKnown<T>(store: Map<string, T>, key: string, load: () => Promise<T>, accept?: (value: T) => boolean): Promise<T>;
|
|
74
|
+
declare function secretsMatch(provided: string | null | undefined, secret: string | null | undefined): boolean;
|
|
75
|
+
type RevalidateDecision = {
|
|
76
|
+
status: number;
|
|
77
|
+
body: {
|
|
78
|
+
error: string;
|
|
79
|
+
} | {
|
|
80
|
+
revalidated: true;
|
|
81
|
+
tag: string;
|
|
82
|
+
path: string;
|
|
83
|
+
now: number;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
/** Pure form of POST /api/revalidate. The site route performs the Next.js purge. */
|
|
87
|
+
declare function revalidateDecision(input: {
|
|
88
|
+
providedSecret: string | null;
|
|
89
|
+
configuredSecret: string | null;
|
|
90
|
+
tag?: string | null;
|
|
91
|
+
path?: string | null;
|
|
92
|
+
now?: number;
|
|
93
|
+
}): RevalidateDecision;
|
|
94
|
+
/** Tags and paths the default purge clears, including the discovery inventory tag. */
|
|
95
|
+
declare function defaultRevalidateTargets(): {
|
|
96
|
+
tags: string[];
|
|
97
|
+
paths: string[];
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
declare function sectionId(name: string): string;
|
|
101
|
+
declare function sectionPath(name: string): string;
|
|
102
|
+
declare function sectionDefinition(name: string): EditorialSection;
|
|
103
|
+
declare function editorialSections(items: NewsItem[]): EditorialSection[];
|
|
104
|
+
/** Published inventory only. Selection never duplicates or fabricates a story. */
|
|
105
|
+
declare function composeEdition(items: NewsItem[], selection?: HomepageSelection, now?: number): {
|
|
106
|
+
lead: NewsItem;
|
|
107
|
+
secondary: NewsItem[];
|
|
108
|
+
briefs: NewsItem[];
|
|
109
|
+
compact: NewsItem[];
|
|
110
|
+
sections: EditorialSection[];
|
|
111
|
+
navigation: EditorialSection[];
|
|
112
|
+
};
|
|
113
|
+
declare function displayHeadline(article: NewsItem, selection?: HomepageSelection): string;
|
|
114
|
+
/** A complete existing sentence, not a cut-off or generated summary. */
|
|
115
|
+
declare function briefSummary(article: NewsItem, selection?: HomepageSelection): string;
|
|
116
|
+
declare function normalizedText(value: string): string;
|
|
117
|
+
declare function townSlug(town: string): string;
|
|
118
|
+
declare function storyTowns(article: NewsItem, towns: string[], selection?: HomepageSelection): string[];
|
|
119
|
+
declare function matchesStoryTag(article: NewsItem, tag: string): boolean;
|
|
120
|
+
declare function filterNews(items: NewsItem[], filters: {
|
|
121
|
+
q?: string;
|
|
122
|
+
town?: string;
|
|
123
|
+
section?: string;
|
|
124
|
+
tag?: string;
|
|
125
|
+
}, publication: Pick<NewsPublication, "towns" | "matchTag">, selection?: HomepageSelection): NewsItem[];
|
|
126
|
+
declare function validCalendarDate(value: string): boolean;
|
|
127
|
+
declare function activeNearby(selection?: HomepageSelection, now?: number): NearbyUpdate[];
|
|
128
|
+
declare function nearbyUpdates(items: NewsItem[], selection?: HomepageSelection, now?: number): {
|
|
129
|
+
article: NewsItem;
|
|
130
|
+
slug: string;
|
|
131
|
+
title: string;
|
|
132
|
+
summary: string;
|
|
133
|
+
town: string;
|
|
134
|
+
starts: string;
|
|
135
|
+
ends?: string;
|
|
136
|
+
}[];
|
|
137
|
+
/** Display-only shortening. Cuts on character boundaries, never on bytes. */
|
|
138
|
+
declare function shortDeck(value: string | null | undefined, limit?: number): string;
|
|
139
|
+
declare function storyDate(value: string): string | null;
|
|
140
|
+
|
|
141
|
+
/** https URL with no userinfo. Anything else is dropped from public markup. */
|
|
142
|
+
declare function publicHttps(value?: string | null): string | undefined;
|
|
143
|
+
declare function articleUrl(canonical: string, slug: string): string;
|
|
144
|
+
/** Same NewsArticle graph Walnut Creek Times emits on an indexable story. */
|
|
145
|
+
declare function newsArticleJsonLd(publication: NewsPublication, article: NewsArticle, canonical: string, authorName?: string | null): {
|
|
146
|
+
"@context": string;
|
|
147
|
+
"@type": string;
|
|
148
|
+
headline: string;
|
|
149
|
+
description: string | undefined;
|
|
150
|
+
datePublished: string;
|
|
151
|
+
dateModified: string;
|
|
152
|
+
image: string[] | undefined;
|
|
153
|
+
mainEntityOfPage: string;
|
|
154
|
+
url: string;
|
|
155
|
+
author: {
|
|
156
|
+
"@type": string;
|
|
157
|
+
name: string;
|
|
158
|
+
};
|
|
159
|
+
publisher: {
|
|
160
|
+
"@type": string;
|
|
161
|
+
name: string;
|
|
162
|
+
url: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
declare function publicationJsonLd(publication: NewsPublication, canonical: string): {
|
|
166
|
+
"@context": string;
|
|
167
|
+
"@type": string;
|
|
168
|
+
name: string;
|
|
169
|
+
url: string;
|
|
170
|
+
description: string;
|
|
171
|
+
areaServed: string[];
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Fields a Next.js `generateMetadata` spreads in.
|
|
175
|
+
* Preview hosts pass `indexable: false` and stay out of Google.
|
|
176
|
+
*/
|
|
177
|
+
declare function publicationMeta(publication: NewsPublication, canonical: string, indexable: boolean): {
|
|
178
|
+
title: string;
|
|
179
|
+
description: string;
|
|
180
|
+
canonical: string;
|
|
181
|
+
indexable: boolean;
|
|
182
|
+
openGraph: {
|
|
183
|
+
title: string;
|
|
184
|
+
description: string;
|
|
185
|
+
url: string;
|
|
186
|
+
siteName: string;
|
|
187
|
+
type: "website";
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
declare function articleMeta(publication: NewsPublication, article: NewsArticle, canonical: string, indexable: boolean): {
|
|
191
|
+
title: string;
|
|
192
|
+
description: string;
|
|
193
|
+
canonical: string;
|
|
194
|
+
indexable: boolean;
|
|
195
|
+
openGraph: {
|
|
196
|
+
type: "article";
|
|
197
|
+
title: string;
|
|
198
|
+
description: string | undefined;
|
|
199
|
+
url: string;
|
|
200
|
+
publishedTime: string;
|
|
201
|
+
modifiedTime: string;
|
|
202
|
+
images: string[];
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
/** One line a paper can serve at /llms.txt. Towns and the article path stay explicit. */
|
|
206
|
+
declare function llmsText(publication: NewsPublication, canonical: string): string;
|
|
207
|
+
|
|
208
|
+
/** Bounded event contract from Walnut Creek Times. Never accept raw form or chat text. */
|
|
209
|
+
declare const ANALYTICS_VERSION = 1;
|
|
210
|
+
declare const ANALYTICS_COOKIE = "napsite_analytics_v1";
|
|
211
|
+
declare const SESSION_IDLE_MS: number;
|
|
212
|
+
declare const UUID: RegExp;
|
|
213
|
+
type Definition = {
|
|
214
|
+
category: "navigation" | "engagement" | "content" | "conversion" | "system";
|
|
215
|
+
source: "browser" | "server";
|
|
216
|
+
};
|
|
217
|
+
declare const EVENTS: Record<string, Definition>;
|
|
218
|
+
declare const UTM_FIELDS: readonly ["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term"];
|
|
219
|
+
type Attribution = Partial<Record<(typeof UTM_FIELDS)[number], string>> & {
|
|
220
|
+
referrer?: string;
|
|
221
|
+
landing_page?: string;
|
|
222
|
+
referral_code?: string;
|
|
223
|
+
};
|
|
224
|
+
declare function shortText(value: unknown, max?: number): string | undefined;
|
|
225
|
+
/** Query strings, fragments, credentials and private paths never reach analytics. */
|
|
226
|
+
declare function publicUrl(value: unknown, originOnly?: boolean): string | undefined;
|
|
227
|
+
declare function attribution(url: string, referrer?: string, publication?: Pick<NewsPublication, "referrals">): Attribution;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Coupon lookup for a paper. No Stripe call lives here.
|
|
231
|
+
* When `features.coupons` is off, every code resolves to null, including a
|
|
232
|
+
* configured offer. A paper may replace matching with `coupons.resolve`.
|
|
233
|
+
*/
|
|
234
|
+
declare function resolveCoupon(publication: NewsPublication, code: string | null | undefined): CouponOffer | null;
|
|
235
|
+
declare function referralCode(publication: NewsPublication, url: string): string | null;
|
|
236
|
+
|
|
237
|
+
type CookieCategory = "essential" | "performance" | "functional" | "advertising";
|
|
238
|
+
interface CookiePreferences {
|
|
239
|
+
/** Strictly necessary cookies required for core site operation and security. Always true. */
|
|
240
|
+
essential: true;
|
|
241
|
+
/** Analytics and performance measurement to improve community coverage and site speed. */
|
|
242
|
+
performance: boolean;
|
|
243
|
+
/** Personalization features such as narration audio speed, text sizing, and town filters. */
|
|
244
|
+
functional: boolean;
|
|
245
|
+
/** Local sponsorship delivery and partner campaign frequency capping. */
|
|
246
|
+
advertising: boolean;
|
|
247
|
+
}
|
|
248
|
+
interface CookieConsentRecord {
|
|
249
|
+
version: 1;
|
|
250
|
+
preferences: CookiePreferences;
|
|
251
|
+
timestamp: string;
|
|
252
|
+
anonymous_id?: string;
|
|
253
|
+
source: "banner_accept" | "banner_reject" | "settings_save";
|
|
254
|
+
}
|
|
255
|
+
interface CookieDisclosure {
|
|
256
|
+
name: string;
|
|
257
|
+
provider: string;
|
|
258
|
+
purpose: string;
|
|
259
|
+
duration: string;
|
|
260
|
+
type: "HTTP Cookie" | "Local Storage" | "Session Storage";
|
|
261
|
+
}
|
|
262
|
+
interface CookieCategoryDefinition {
|
|
263
|
+
id: CookieCategory;
|
|
264
|
+
title: string;
|
|
265
|
+
shortDescription: string;
|
|
266
|
+
fullDescription: string;
|
|
267
|
+
required: boolean;
|
|
268
|
+
cookies: CookieDisclosure[];
|
|
269
|
+
}
|
|
270
|
+
declare const COOKIE_CONSENT_KEY = "sm_cookie_consent_v1";
|
|
271
|
+
declare const COOKIE_CONSENT_BACKUP_KEY = "napsite_cookie_consent_v1";
|
|
272
|
+
declare const COOKIE_CONSENT_EVENT = "scalemule-cookie-consent-change";
|
|
273
|
+
declare const COOKIE_CONSENT_MAX_AGE_SECONDS: number;
|
|
274
|
+
declare const DEFAULT_PREFERENCES_REJECTED: CookiePreferences;
|
|
275
|
+
declare const DEFAULT_PREFERENCES_ACCEPTED: CookiePreferences;
|
|
276
|
+
declare const COOKIE_CATEGORIES: CookieCategoryDefinition[];
|
|
277
|
+
/**
|
|
278
|
+
* Retrieve the current cookie consent record.
|
|
279
|
+
* Checks HTTP cookie first, then localStorage fallback, then in-memory state.
|
|
280
|
+
*/
|
|
281
|
+
declare function getCookieConsent(): CookieConsentRecord | null;
|
|
282
|
+
/**
|
|
283
|
+
* Check if the user has already provided an explicit consent decision.
|
|
284
|
+
*/
|
|
285
|
+
declare function hasConsented(): boolean;
|
|
286
|
+
/**
|
|
287
|
+
* Check if a specific cookie category is currently permitted.
|
|
288
|
+
* Essential is always permitted.
|
|
289
|
+
*/
|
|
290
|
+
declare function isCategoryAllowed(category: CookieCategory): boolean;
|
|
291
|
+
/**
|
|
292
|
+
* Record cookie consent choices.
|
|
293
|
+
* Updates both HTTP cookies, localStorage, and fires a window event.
|
|
294
|
+
*/
|
|
295
|
+
declare function setCookieConsent(preferences: Partial<CookiePreferences>, source?: CookieConsentRecord["source"]): CookieConsentRecord;
|
|
296
|
+
/**
|
|
297
|
+
* Accepts all cookies (essential, performance, functional, advertising).
|
|
298
|
+
*/
|
|
299
|
+
declare function acceptAllCookies(): CookieConsentRecord;
|
|
300
|
+
/**
|
|
301
|
+
* Rejects all optional cookies (preserves essential cookies only).
|
|
302
|
+
*/
|
|
303
|
+
declare function rejectOptionalCookies(): CookieConsentRecord;
|
|
304
|
+
/**
|
|
305
|
+
* Clear consent record (used when resetting choices).
|
|
306
|
+
*/
|
|
307
|
+
declare function clearCookieConsent(): void;
|
|
308
|
+
/**
|
|
309
|
+
* Forward the user consent choice to ScaleMule compliance service.
|
|
310
|
+
* Respects customer security boundary: uses relative /api/compliance/consent proxy or client endpoint.
|
|
311
|
+
*/
|
|
312
|
+
declare function recordConsentToCompliance(record: CookieConsentRecord, options?: {
|
|
313
|
+
endpoint?: string;
|
|
314
|
+
publicationSlug?: string;
|
|
315
|
+
}): Promise<void>;
|
|
316
|
+
|
|
317
|
+
export { ANALYTICS_COOKIE, ANALYTICS_VERSION, type Attribution, BROADSHEET_THEME, COOKIE_CATEGORIES, COOKIE_CONSENT_BACKUP_KEY, COOKIE_CONSENT_EVENT, COOKIE_CONSENT_KEY, COOKIE_CONSENT_MAX_AGE_SECONDS, type CookieCategory, type CookieCategoryDefinition, type CookieConsentRecord, type CookieDisclosure, type CookiePreferences, CouponOffer, DEFAULT_PREFERENCES_ACCEPTED, DEFAULT_PREFERENCES_REJECTED, EVENTS, EditorialSection, FeatureName, HomepageSelection, LAYOUT_COOKIE, NEWS_CACHE, NearbyUpdate, NewsArticle, NewsError, NewsItem, NewsPublication, PublicationInput, PublicationTheme, SESSION_IDLE_MS, UTM_FIELDS, UUID, acceptAllCookies, activeNearby, articleCacheKey, articleCacheOptions, articleMeta, articleUrl, attribution, briefSummary, clearCookieConsent, composeEdition, defaultRevalidateTargets, definePublication, displayHeadline, edgeCacheControl, editorialSections, featureEnabled, feedCacheKey, feedCacheOptions, filterNews, getCookieConsent, hasConsented, inventoryCacheOptions, isCategoryAllowed, llmsText, matchesStoryTag, nearbyUpdates, newsArticleJsonLd, normalizedText, publicHttps, publicUrl, publicationJsonLd, publicationMeta, recordConsentToCompliance, referralCode, rejectOptionalCookies, resolveCoupon, resolveLayout, revalidateDecision, secretsMatch, sectionDefinition, sectionId, sectionPath, setCookieConsent, shortDeck, shortText, shouldServeLastKnown, storyDate, storyTowns, townSlug, validCalendarDate, walnutCreekTimes, withLastKnown };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { P as PublicationTheme, a as PublicationInput, N as NewsPublication, F as FeatureName, H as HomepageSelection, b as NearbyUpdate, c as NewsItem, E as EditorialSection, d as NewsArticle, C as CouponOffer } from './snapshot-BS4hn1dk.js';
|
|
2
|
+
export { A as ArticleCitation, e as CategoryRef, f as CouponSettings, g as CoverImageMetadata, h as FEATURE_NAMES, i as FeatureFlags, j as NewsFeed, k as NewsLayoutId, l as PublicationModules, m as PublicationRecord, n as PublicationSnapshot, R as ReferralSettings, S as SnapshotHooks, o as StoryDisplay, p as SyncSource, q as SyncedPublication, T as TagRef, r as acceptRemoteRecord, s as acceptSnapshot, t as parseSnapshot, u as publicationFromSnapshot, v as publicationRecord, w as snapshotFromRecord, x as syncPublication } from './snapshot-BS4hn1dk.js';
|
|
3
|
+
export { M as MEET_ACTIVITIES, a as MeetActivity, b as MeetupInput, P as PreparedMeetup, c as PublicPlace, d as activityLabel, e as canHostMeetup, i as isAdult, p as prepareMeetup, s as screenMessage } from './meet-5Ym5bxfh.js';
|
|
4
|
+
export { C as CLASSIFIED_CATEGORIES, a as ClassifiedCategory, b as ClassifiedListing, E as EmploymentType, J as JOB_EMPLOYMENT_TYPES, P as PreparedClassified, c as PreparedJob, d as PublicJob, e as categoryLabel, f as classifiedPath, g as classifiedSearchPath, h as clipChars, i as employmentLabel, j as isClassifiedCategory, k as isEmploymentType, l as jobEmployerBody, m as jobOpeningBody, n as jobPostingBody, p as prepareClassified, o as prepareJobPost, q as publicJobPath, r as publicJobsPath } from './marketplace-Ch7mdJZv.js';
|
|
5
|
+
export { CookieConsentBanner, CookieConsentBannerProps } from './cookie-consent-banner.js';
|
|
6
|
+
export { CookieSettingsView, CookieSettingsViewProps } from './cookie-settings-view.js';
|
|
7
|
+
import 'react';
|
|
8
|
+
|
|
9
|
+
/** Walnut Creek Times broadsheet colors. A paper overrides only what it changes. */
|
|
10
|
+
declare const BROADSHEET_THEME: PublicationTheme;
|
|
11
|
+
declare function featureEnabled(publication: NewsPublication, feature: FeatureName): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Build a paper from the Walnut Creek Times defaults.
|
|
14
|
+
* Identity, towns, and feature flags are the only required differences.
|
|
15
|
+
*/
|
|
16
|
+
declare function definePublication(input: PublicationInput): NewsPublication;
|
|
17
|
+
/** Cookie a reader layout preference is stored in. Absent cookie means the paper default. */
|
|
18
|
+
declare const LAYOUT_COOKIE = "news_publication_layout";
|
|
19
|
+
/**
|
|
20
|
+
* Crawlers and readers with no cookie get `publication.layout`.
|
|
21
|
+
* A cookie is honored only when that paper listed the layout.
|
|
22
|
+
*/
|
|
23
|
+
declare function resolveLayout(publication: NewsPublication, cookieValue?: string | null): string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Walnut Creek Times, the reference paper.
|
|
27
|
+
* Other papers call `definePublication` with their own name, towns, and flags.
|
|
28
|
+
* Daily Smile stays off unless a paper opts in: the joke catalog is site content.
|
|
29
|
+
*/
|
|
30
|
+
declare const walnutCreekTimes: NewsPublication;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Cache policy verified on walnutcreektimes.com.
|
|
34
|
+
* Feeds refresh every 30s, articles every 60s, and the edge holds a page for
|
|
35
|
+
* 60s with five minutes of stale-while-revalidate. Publishing calls
|
|
36
|
+
* POST /api/revalidate to drop that wait.
|
|
37
|
+
*/
|
|
38
|
+
declare const NEWS_CACHE: {
|
|
39
|
+
readonly feedRevalidateSeconds: 30;
|
|
40
|
+
readonly articleRevalidateSeconds: 60;
|
|
41
|
+
readonly edgeMaxAgeSeconds: 60;
|
|
42
|
+
readonly staleWhileRevalidateSeconds: 300;
|
|
43
|
+
readonly feedTag: "news-feed";
|
|
44
|
+
readonly articleTag: "news-article";
|
|
45
|
+
readonly inventoryTag: "public-news-discovery-v2";
|
|
46
|
+
readonly paths: readonly ["/", "/news"];
|
|
47
|
+
};
|
|
48
|
+
declare const feedCacheOptions: {
|
|
49
|
+
readonly revalidate: 30;
|
|
50
|
+
readonly tags: readonly ["news-feed"];
|
|
51
|
+
};
|
|
52
|
+
declare const articleCacheOptions: {
|
|
53
|
+
readonly revalidate: 60;
|
|
54
|
+
readonly tags: readonly ["news-article"];
|
|
55
|
+
};
|
|
56
|
+
declare const inventoryCacheOptions: {
|
|
57
|
+
readonly revalidate: 30;
|
|
58
|
+
readonly tags: readonly ["news-feed", "public-news-discovery-v2"];
|
|
59
|
+
};
|
|
60
|
+
declare function edgeCacheControl(): string;
|
|
61
|
+
declare function feedCacheKey(publicationId: string, before?: string, section?: string): string;
|
|
62
|
+
declare function articleCacheKey(publicationId: string, slug: string): string;
|
|
63
|
+
declare class NewsError extends Error {
|
|
64
|
+
status: number;
|
|
65
|
+
constructor(status: number, message: string);
|
|
66
|
+
}
|
|
67
|
+
/** A missing article must 404. Every other failure may serve the last good copy. */
|
|
68
|
+
declare function shouldServeLastKnown(error: unknown): boolean;
|
|
69
|
+
/**
|
|
70
|
+
* In-memory stale fallback used when the gateway times out or returns 429/5xx.
|
|
71
|
+
* The Next.js data cache is separate and is configured with `feedCacheOptions`.
|
|
72
|
+
*/
|
|
73
|
+
declare function withLastKnown<T>(store: Map<string, T>, key: string, load: () => Promise<T>, accept?: (value: T) => boolean): Promise<T>;
|
|
74
|
+
declare function secretsMatch(provided: string | null | undefined, secret: string | null | undefined): boolean;
|
|
75
|
+
type RevalidateDecision = {
|
|
76
|
+
status: number;
|
|
77
|
+
body: {
|
|
78
|
+
error: string;
|
|
79
|
+
} | {
|
|
80
|
+
revalidated: true;
|
|
81
|
+
tag: string;
|
|
82
|
+
path: string;
|
|
83
|
+
now: number;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
/** Pure form of POST /api/revalidate. The site route performs the Next.js purge. */
|
|
87
|
+
declare function revalidateDecision(input: {
|
|
88
|
+
providedSecret: string | null;
|
|
89
|
+
configuredSecret: string | null;
|
|
90
|
+
tag?: string | null;
|
|
91
|
+
path?: string | null;
|
|
92
|
+
now?: number;
|
|
93
|
+
}): RevalidateDecision;
|
|
94
|
+
/** Tags and paths the default purge clears, including the discovery inventory tag. */
|
|
95
|
+
declare function defaultRevalidateTargets(): {
|
|
96
|
+
tags: string[];
|
|
97
|
+
paths: string[];
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
declare function sectionId(name: string): string;
|
|
101
|
+
declare function sectionPath(name: string): string;
|
|
102
|
+
declare function sectionDefinition(name: string): EditorialSection;
|
|
103
|
+
declare function editorialSections(items: NewsItem[]): EditorialSection[];
|
|
104
|
+
/** Published inventory only. Selection never duplicates or fabricates a story. */
|
|
105
|
+
declare function composeEdition(items: NewsItem[], selection?: HomepageSelection, now?: number): {
|
|
106
|
+
lead: NewsItem;
|
|
107
|
+
secondary: NewsItem[];
|
|
108
|
+
briefs: NewsItem[];
|
|
109
|
+
compact: NewsItem[];
|
|
110
|
+
sections: EditorialSection[];
|
|
111
|
+
navigation: EditorialSection[];
|
|
112
|
+
};
|
|
113
|
+
declare function displayHeadline(article: NewsItem, selection?: HomepageSelection): string;
|
|
114
|
+
/** A complete existing sentence, not a cut-off or generated summary. */
|
|
115
|
+
declare function briefSummary(article: NewsItem, selection?: HomepageSelection): string;
|
|
116
|
+
declare function normalizedText(value: string): string;
|
|
117
|
+
declare function townSlug(town: string): string;
|
|
118
|
+
declare function storyTowns(article: NewsItem, towns: string[], selection?: HomepageSelection): string[];
|
|
119
|
+
declare function matchesStoryTag(article: NewsItem, tag: string): boolean;
|
|
120
|
+
declare function filterNews(items: NewsItem[], filters: {
|
|
121
|
+
q?: string;
|
|
122
|
+
town?: string;
|
|
123
|
+
section?: string;
|
|
124
|
+
tag?: string;
|
|
125
|
+
}, publication: Pick<NewsPublication, "towns" | "matchTag">, selection?: HomepageSelection): NewsItem[];
|
|
126
|
+
declare function validCalendarDate(value: string): boolean;
|
|
127
|
+
declare function activeNearby(selection?: HomepageSelection, now?: number): NearbyUpdate[];
|
|
128
|
+
declare function nearbyUpdates(items: NewsItem[], selection?: HomepageSelection, now?: number): {
|
|
129
|
+
article: NewsItem;
|
|
130
|
+
slug: string;
|
|
131
|
+
title: string;
|
|
132
|
+
summary: string;
|
|
133
|
+
town: string;
|
|
134
|
+
starts: string;
|
|
135
|
+
ends?: string;
|
|
136
|
+
}[];
|
|
137
|
+
/** Display-only shortening. Cuts on character boundaries, never on bytes. */
|
|
138
|
+
declare function shortDeck(value: string | null | undefined, limit?: number): string;
|
|
139
|
+
declare function storyDate(value: string): string | null;
|
|
140
|
+
|
|
141
|
+
/** https URL with no userinfo. Anything else is dropped from public markup. */
|
|
142
|
+
declare function publicHttps(value?: string | null): string | undefined;
|
|
143
|
+
declare function articleUrl(canonical: string, slug: string): string;
|
|
144
|
+
/** Same NewsArticle graph Walnut Creek Times emits on an indexable story. */
|
|
145
|
+
declare function newsArticleJsonLd(publication: NewsPublication, article: NewsArticle, canonical: string, authorName?: string | null): {
|
|
146
|
+
"@context": string;
|
|
147
|
+
"@type": string;
|
|
148
|
+
headline: string;
|
|
149
|
+
description: string | undefined;
|
|
150
|
+
datePublished: string;
|
|
151
|
+
dateModified: string;
|
|
152
|
+
image: string[] | undefined;
|
|
153
|
+
mainEntityOfPage: string;
|
|
154
|
+
url: string;
|
|
155
|
+
author: {
|
|
156
|
+
"@type": string;
|
|
157
|
+
name: string;
|
|
158
|
+
};
|
|
159
|
+
publisher: {
|
|
160
|
+
"@type": string;
|
|
161
|
+
name: string;
|
|
162
|
+
url: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
declare function publicationJsonLd(publication: NewsPublication, canonical: string): {
|
|
166
|
+
"@context": string;
|
|
167
|
+
"@type": string;
|
|
168
|
+
name: string;
|
|
169
|
+
url: string;
|
|
170
|
+
description: string;
|
|
171
|
+
areaServed: string[];
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Fields a Next.js `generateMetadata` spreads in.
|
|
175
|
+
* Preview hosts pass `indexable: false` and stay out of Google.
|
|
176
|
+
*/
|
|
177
|
+
declare function publicationMeta(publication: NewsPublication, canonical: string, indexable: boolean): {
|
|
178
|
+
title: string;
|
|
179
|
+
description: string;
|
|
180
|
+
canonical: string;
|
|
181
|
+
indexable: boolean;
|
|
182
|
+
openGraph: {
|
|
183
|
+
title: string;
|
|
184
|
+
description: string;
|
|
185
|
+
url: string;
|
|
186
|
+
siteName: string;
|
|
187
|
+
type: "website";
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
declare function articleMeta(publication: NewsPublication, article: NewsArticle, canonical: string, indexable: boolean): {
|
|
191
|
+
title: string;
|
|
192
|
+
description: string;
|
|
193
|
+
canonical: string;
|
|
194
|
+
indexable: boolean;
|
|
195
|
+
openGraph: {
|
|
196
|
+
type: "article";
|
|
197
|
+
title: string;
|
|
198
|
+
description: string | undefined;
|
|
199
|
+
url: string;
|
|
200
|
+
publishedTime: string;
|
|
201
|
+
modifiedTime: string;
|
|
202
|
+
images: string[];
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
/** One line a paper can serve at /llms.txt. Towns and the article path stay explicit. */
|
|
206
|
+
declare function llmsText(publication: NewsPublication, canonical: string): string;
|
|
207
|
+
|
|
208
|
+
/** Bounded event contract from Walnut Creek Times. Never accept raw form or chat text. */
|
|
209
|
+
declare const ANALYTICS_VERSION = 1;
|
|
210
|
+
declare const ANALYTICS_COOKIE = "napsite_analytics_v1";
|
|
211
|
+
declare const SESSION_IDLE_MS: number;
|
|
212
|
+
declare const UUID: RegExp;
|
|
213
|
+
type Definition = {
|
|
214
|
+
category: "navigation" | "engagement" | "content" | "conversion" | "system";
|
|
215
|
+
source: "browser" | "server";
|
|
216
|
+
};
|
|
217
|
+
declare const EVENTS: Record<string, Definition>;
|
|
218
|
+
declare const UTM_FIELDS: readonly ["utm_source", "utm_medium", "utm_campaign", "utm_content", "utm_term"];
|
|
219
|
+
type Attribution = Partial<Record<(typeof UTM_FIELDS)[number], string>> & {
|
|
220
|
+
referrer?: string;
|
|
221
|
+
landing_page?: string;
|
|
222
|
+
referral_code?: string;
|
|
223
|
+
};
|
|
224
|
+
declare function shortText(value: unknown, max?: number): string | undefined;
|
|
225
|
+
/** Query strings, fragments, credentials and private paths never reach analytics. */
|
|
226
|
+
declare function publicUrl(value: unknown, originOnly?: boolean): string | undefined;
|
|
227
|
+
declare function attribution(url: string, referrer?: string, publication?: Pick<NewsPublication, "referrals">): Attribution;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Coupon lookup for a paper. No Stripe call lives here.
|
|
231
|
+
* When `features.coupons` is off, every code resolves to null, including a
|
|
232
|
+
* configured offer. A paper may replace matching with `coupons.resolve`.
|
|
233
|
+
*/
|
|
234
|
+
declare function resolveCoupon(publication: NewsPublication, code: string | null | undefined): CouponOffer | null;
|
|
235
|
+
declare function referralCode(publication: NewsPublication, url: string): string | null;
|
|
236
|
+
|
|
237
|
+
type CookieCategory = "essential" | "performance" | "functional" | "advertising";
|
|
238
|
+
interface CookiePreferences {
|
|
239
|
+
/** Strictly necessary cookies required for core site operation and security. Always true. */
|
|
240
|
+
essential: true;
|
|
241
|
+
/** Analytics and performance measurement to improve community coverage and site speed. */
|
|
242
|
+
performance: boolean;
|
|
243
|
+
/** Personalization features such as narration audio speed, text sizing, and town filters. */
|
|
244
|
+
functional: boolean;
|
|
245
|
+
/** Local sponsorship delivery and partner campaign frequency capping. */
|
|
246
|
+
advertising: boolean;
|
|
247
|
+
}
|
|
248
|
+
interface CookieConsentRecord {
|
|
249
|
+
version: 1;
|
|
250
|
+
preferences: CookiePreferences;
|
|
251
|
+
timestamp: string;
|
|
252
|
+
anonymous_id?: string;
|
|
253
|
+
source: "banner_accept" | "banner_reject" | "settings_save";
|
|
254
|
+
}
|
|
255
|
+
interface CookieDisclosure {
|
|
256
|
+
name: string;
|
|
257
|
+
provider: string;
|
|
258
|
+
purpose: string;
|
|
259
|
+
duration: string;
|
|
260
|
+
type: "HTTP Cookie" | "Local Storage" | "Session Storage";
|
|
261
|
+
}
|
|
262
|
+
interface CookieCategoryDefinition {
|
|
263
|
+
id: CookieCategory;
|
|
264
|
+
title: string;
|
|
265
|
+
shortDescription: string;
|
|
266
|
+
fullDescription: string;
|
|
267
|
+
required: boolean;
|
|
268
|
+
cookies: CookieDisclosure[];
|
|
269
|
+
}
|
|
270
|
+
declare const COOKIE_CONSENT_KEY = "sm_cookie_consent_v1";
|
|
271
|
+
declare const COOKIE_CONSENT_BACKUP_KEY = "napsite_cookie_consent_v1";
|
|
272
|
+
declare const COOKIE_CONSENT_EVENT = "scalemule-cookie-consent-change";
|
|
273
|
+
declare const COOKIE_CONSENT_MAX_AGE_SECONDS: number;
|
|
274
|
+
declare const DEFAULT_PREFERENCES_REJECTED: CookiePreferences;
|
|
275
|
+
declare const DEFAULT_PREFERENCES_ACCEPTED: CookiePreferences;
|
|
276
|
+
declare const COOKIE_CATEGORIES: CookieCategoryDefinition[];
|
|
277
|
+
/**
|
|
278
|
+
* Retrieve the current cookie consent record.
|
|
279
|
+
* Checks HTTP cookie first, then localStorage fallback, then in-memory state.
|
|
280
|
+
*/
|
|
281
|
+
declare function getCookieConsent(): CookieConsentRecord | null;
|
|
282
|
+
/**
|
|
283
|
+
* Check if the user has already provided an explicit consent decision.
|
|
284
|
+
*/
|
|
285
|
+
declare function hasConsented(): boolean;
|
|
286
|
+
/**
|
|
287
|
+
* Check if a specific cookie category is currently permitted.
|
|
288
|
+
* Essential is always permitted.
|
|
289
|
+
*/
|
|
290
|
+
declare function isCategoryAllowed(category: CookieCategory): boolean;
|
|
291
|
+
/**
|
|
292
|
+
* Record cookie consent choices.
|
|
293
|
+
* Updates both HTTP cookies, localStorage, and fires a window event.
|
|
294
|
+
*/
|
|
295
|
+
declare function setCookieConsent(preferences: Partial<CookiePreferences>, source?: CookieConsentRecord["source"]): CookieConsentRecord;
|
|
296
|
+
/**
|
|
297
|
+
* Accepts all cookies (essential, performance, functional, advertising).
|
|
298
|
+
*/
|
|
299
|
+
declare function acceptAllCookies(): CookieConsentRecord;
|
|
300
|
+
/**
|
|
301
|
+
* Rejects all optional cookies (preserves essential cookies only).
|
|
302
|
+
*/
|
|
303
|
+
declare function rejectOptionalCookies(): CookieConsentRecord;
|
|
304
|
+
/**
|
|
305
|
+
* Clear consent record (used when resetting choices).
|
|
306
|
+
*/
|
|
307
|
+
declare function clearCookieConsent(): void;
|
|
308
|
+
/**
|
|
309
|
+
* Forward the user consent choice to ScaleMule compliance service.
|
|
310
|
+
* Respects customer security boundary: uses relative /api/compliance/consent proxy or client endpoint.
|
|
311
|
+
*/
|
|
312
|
+
declare function recordConsentToCompliance(record: CookieConsentRecord, options?: {
|
|
313
|
+
endpoint?: string;
|
|
314
|
+
publicationSlug?: string;
|
|
315
|
+
}): Promise<void>;
|
|
316
|
+
|
|
317
|
+
export { ANALYTICS_COOKIE, ANALYTICS_VERSION, type Attribution, BROADSHEET_THEME, COOKIE_CATEGORIES, COOKIE_CONSENT_BACKUP_KEY, COOKIE_CONSENT_EVENT, COOKIE_CONSENT_KEY, COOKIE_CONSENT_MAX_AGE_SECONDS, type CookieCategory, type CookieCategoryDefinition, type CookieConsentRecord, type CookieDisclosure, type CookiePreferences, CouponOffer, DEFAULT_PREFERENCES_ACCEPTED, DEFAULT_PREFERENCES_REJECTED, EVENTS, EditorialSection, FeatureName, HomepageSelection, LAYOUT_COOKIE, NEWS_CACHE, NearbyUpdate, NewsArticle, NewsError, NewsItem, NewsPublication, PublicationInput, PublicationTheme, SESSION_IDLE_MS, UTM_FIELDS, UUID, acceptAllCookies, activeNearby, articleCacheKey, articleCacheOptions, articleMeta, articleUrl, attribution, briefSummary, clearCookieConsent, composeEdition, defaultRevalidateTargets, definePublication, displayHeadline, edgeCacheControl, editorialSections, featureEnabled, feedCacheKey, feedCacheOptions, filterNews, getCookieConsent, hasConsented, inventoryCacheOptions, isCategoryAllowed, llmsText, matchesStoryTag, nearbyUpdates, newsArticleJsonLd, normalizedText, publicHttps, publicUrl, publicationJsonLd, publicationMeta, recordConsentToCompliance, referralCode, rejectOptionalCookies, resolveCoupon, resolveLayout, revalidateDecision, secretsMatch, sectionDefinition, sectionId, sectionPath, setCookieConsent, shortDeck, shortText, shouldServeLastKnown, storyDate, storyTowns, townSlug, validCalendarDate, walnutCreekTimes, withLastKnown };
|