@scalemule/news-publication 0.0.46 → 0.0.47
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/README.md +8 -0
- package/dist/{chunk-OIEO2YVG.js → chunk-2XSW7JZS.js} +1 -1
- package/dist/chunk-66GI2IX6.js +65 -0
- package/dist/{chunk-2IYKWGVM.js → chunk-GOWOYMSG.js} +13 -45
- package/dist/{chunk-UTBV6JJX.js → chunk-JV76ZEIA.js} +12 -27
- package/dist/{chunk-72PKW2HM.js → chunk-UL2Q3N26.js} +1 -1
- package/dist/{chunk-GVLJ3HAI.js → chunk-WAC6ATNP.js} +1 -1
- package/dist/cookie-consent-banner.cjs +13 -78
- package/dist/cookie-consent-banner.js +2 -2
- package/dist/cookie-settings-view.cjs +11 -26
- package/dist/cookie-settings-view.js +2 -2
- package/dist/index.cjs +137 -73
- package/dist/index.d.cts +34 -1
- package/dist/index.d.ts +34 -1
- package/dist/index.js +52 -10
- package/dist/network-bar.js +2 -2
- package/dist/network-copyright.js +2 -2
- package/dist/network.js +1 -1
- package/dist/sponsorship-view.cjs +75 -0
- package/dist/sponsorship-view.d.cts +11 -0
- package/dist/sponsorship-view.d.ts +11 -0
- package/dist/sponsorship-view.js +62 -0
- package/dist/sponsorships-CtnBe3S8.d.cts +137 -0
- package/dist/sponsorships-CtnBe3S8.d.ts +137 -0
- package/package.json +11 -4
- package/sponsorship.css +78 -0
package/dist/index.cjs
CHANGED
|
@@ -234,8 +234,8 @@ function shortDeck(value, limit = 160) {
|
|
|
234
234
|
return (space > opening.length / 2 ? opening.slice(0, space) : opening).trimEnd() + "\u2026";
|
|
235
235
|
}
|
|
236
236
|
function storyDate(value) {
|
|
237
|
-
const
|
|
238
|
-
return Number.isNaN(
|
|
237
|
+
const date2 = new Date(value);
|
|
238
|
+
return Number.isNaN(date2.getTime()) ? null : date2.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric", timeZone: "America/Los_Angeles" });
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
// src/seo.ts
|
|
@@ -1278,13 +1278,6 @@ var COOKIE_CATEGORIES = [
|
|
|
1278
1278
|
duration: "1 year",
|
|
1279
1279
|
type: "HTTP Cookie"
|
|
1280
1280
|
},
|
|
1281
|
-
{
|
|
1282
|
-
name: "napsite_session_v1",
|
|
1283
|
-
provider: "First-Party",
|
|
1284
|
-
purpose: "Maintains session continuity, security tokens, and server routing.",
|
|
1285
|
-
duration: "30 minutes (idle)",
|
|
1286
|
-
type: "Session Storage"
|
|
1287
|
-
},
|
|
1288
1281
|
{
|
|
1289
1282
|
name: "napsite_preview",
|
|
1290
1283
|
provider: "First-Party",
|
|
@@ -1298,9 +1291,16 @@ var COOKIE_CATEGORIES = [
|
|
|
1298
1291
|
id: "performance",
|
|
1299
1292
|
title: "Performance & Analytics Cookies",
|
|
1300
1293
|
shortDescription: "Help us measure reader engagement, story completion, and site reliability.",
|
|
1301
|
-
fullDescription: "
|
|
1294
|
+
fullDescription: "With your permission, first-party identifiers support page-visit and reading measurements. Aggregate reports help us improve the publication. Measurements are incomplete when readers decline consent and are not a count of unique people.",
|
|
1302
1295
|
required: false,
|
|
1303
1296
|
cookies: [
|
|
1297
|
+
{
|
|
1298
|
+
name: "napsite_session_v1",
|
|
1299
|
+
provider: "First-Party",
|
|
1300
|
+
purpose: "Groups consented reading measurements within a session.",
|
|
1301
|
+
duration: "30 minutes (idle)",
|
|
1302
|
+
type: "Session Storage"
|
|
1303
|
+
},
|
|
1304
1304
|
{
|
|
1305
1305
|
name: "napsite_visitor_v1",
|
|
1306
1306
|
provider: "First-Party",
|
|
@@ -1350,29 +1350,14 @@ var COOKIE_CATEGORIES = [
|
|
|
1350
1350
|
{
|
|
1351
1351
|
id: "advertising",
|
|
1352
1352
|
title: "Advertising & Local Sponsorship Cookies",
|
|
1353
|
-
shortDescription: "
|
|
1354
|
-
fullDescription: "
|
|
1353
|
+
shortDescription: "Measure clearly labeled community sponsorship views and link clicks.",
|
|
1354
|
+
fullDescription: "With your permission, we measure visible sponsor acknowledgments and link clicks. Repetition limits use temporary page-session memory. We do not use third-party advertising trackers or build behavioral advertising profiles.",
|
|
1355
1355
|
required: false,
|
|
1356
|
-
cookies: [
|
|
1357
|
-
{
|
|
1358
|
-
name: "napsite_sponsor_cap",
|
|
1359
|
-
provider: "First-Party",
|
|
1360
|
-
purpose: "Prevents repetitive display of identical local business announcements.",
|
|
1361
|
-
duration: "7 days",
|
|
1362
|
-
type: "Local Storage"
|
|
1363
|
-
},
|
|
1364
|
-
{
|
|
1365
|
-
name: "local_sponsor_ref",
|
|
1366
|
-
provider: "First-Party",
|
|
1367
|
-
purpose: "Attributes community inquiries directly to the sponsoring local merchant.",
|
|
1368
|
-
duration: "30 days",
|
|
1369
|
-
type: "Local Storage"
|
|
1370
|
-
}
|
|
1371
|
-
]
|
|
1356
|
+
cookies: []
|
|
1372
1357
|
}
|
|
1373
1358
|
];
|
|
1374
1359
|
function CookieConsentBanner({
|
|
1375
|
-
title = "
|
|
1360
|
+
title = "Your privacy choices",
|
|
1376
1361
|
text,
|
|
1377
1362
|
settingsUrl = "/cookies",
|
|
1378
1363
|
className = "",
|
|
@@ -1386,73 +1371,41 @@ function CookieConsentBanner({
|
|
|
1386
1371
|
const [visible, setVisible] = react.useState(false);
|
|
1387
1372
|
react.useEffect(() => {
|
|
1388
1373
|
setMounted(true);
|
|
1389
|
-
|
|
1390
|
-
if (
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
}
|
|
1398
|
-
if (!forceShow && !compliance.isGeoConsentRequired(countryCode)) {
|
|
1399
|
-
setVisible(false);
|
|
1400
|
-
void compliance.queryNetworkConsentHub(consentHubUrl, 1200).then((networkStatus) => {
|
|
1401
|
-
if (networkStatus === "accepted") {
|
|
1402
|
-
compliance.acceptAllCookies();
|
|
1403
|
-
} else if (networkStatus === "rejected") {
|
|
1404
|
-
compliance.rejectOptionalCookies();
|
|
1405
|
-
}
|
|
1406
|
-
});
|
|
1407
|
-
return;
|
|
1408
|
-
}
|
|
1409
|
-
let cancelled = false;
|
|
1410
|
-
void compliance.queryNetworkConsentHub(consentHubUrl, 1e3).then((networkStatus) => {
|
|
1411
|
-
if (cancelled) return;
|
|
1412
|
-
if (networkStatus === "accepted") {
|
|
1413
|
-
compliance.acceptAllCookies();
|
|
1414
|
-
setVisible(false);
|
|
1415
|
-
} else if (networkStatus === "rejected") {
|
|
1416
|
-
compliance.rejectOptionalCookies();
|
|
1417
|
-
setVisible(false);
|
|
1418
|
-
} else {
|
|
1419
|
-
setVisible(true);
|
|
1420
|
-
}
|
|
1421
|
-
});
|
|
1422
|
-
return () => {
|
|
1423
|
-
cancelled = true;
|
|
1424
|
-
};
|
|
1374
|
+
const url = new URL(window.location.href);
|
|
1375
|
+
if (url.searchParams.has("sm_consent")) {
|
|
1376
|
+
if (url.searchParams.get("sm_consent") === "0" && !compliance.hasConsented())
|
|
1377
|
+
compliance.rejectOptionalCookies({ hubUrl: consentHubUrl });
|
|
1378
|
+
url.searchParams.delete("sm_consent");
|
|
1379
|
+
window.history.replaceState(window.history.state, "", url);
|
|
1380
|
+
}
|
|
1381
|
+
setVisible(!compliance.hasConsented() && !compliance.isGpcActive());
|
|
1425
1382
|
}, [countryCode, forceShow, consentHubUrl]);
|
|
1426
1383
|
react.useEffect(() => {
|
|
1427
1384
|
const onConsentChange = () => {
|
|
1428
|
-
|
|
1429
|
-
setVisible(false);
|
|
1430
|
-
}
|
|
1385
|
+
setVisible(!compliance.hasConsented() && !compliance.isGpcActive());
|
|
1431
1386
|
};
|
|
1432
1387
|
window.addEventListener(compliance.COOKIE_CONSENT_EVENT, onConsentChange);
|
|
1433
1388
|
return () => window.removeEventListener(compliance.COOKIE_CONSENT_EVENT, onConsentChange);
|
|
1434
1389
|
}, []);
|
|
1435
1390
|
if (!mounted || !visible) return null;
|
|
1436
1391
|
const handleAccept = () => {
|
|
1437
|
-
const record = compliance.acceptAllCookies();
|
|
1392
|
+
const record = compliance.acceptAllCookies({ hubUrl: consentHubUrl });
|
|
1438
1393
|
setVisible(false);
|
|
1439
1394
|
void recordConsentToCompliance(record, {
|
|
1440
1395
|
endpoint: complianceEndpoint,
|
|
1441
1396
|
publicationSlug
|
|
1442
1397
|
});
|
|
1443
|
-
compliance.setNetworkConsentHub("accepted", consentHubUrl);
|
|
1444
1398
|
};
|
|
1445
1399
|
const handleReject = () => {
|
|
1446
|
-
const record = compliance.rejectOptionalCookies();
|
|
1400
|
+
const record = compliance.rejectOptionalCookies({ hubUrl: consentHubUrl });
|
|
1447
1401
|
setVisible(false);
|
|
1448
1402
|
void recordConsentToCompliance(record, {
|
|
1449
1403
|
endpoint: complianceEndpoint,
|
|
1450
1404
|
publicationSlug
|
|
1451
1405
|
});
|
|
1452
|
-
compliance.setNetworkConsentHub("rejected", consentHubUrl);
|
|
1453
1406
|
};
|
|
1454
1407
|
const defaultText = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1455
|
-
"
|
|
1408
|
+
"With your permission, we measure reading activity and sponsor acknowledgments. You can read the publication with optional cookies turned off. View",
|
|
1456
1409
|
" ",
|
|
1457
1410
|
/* @__PURE__ */ jsxRuntime.jsx("a", { href: settingsUrl, className: "sm-cookie-banner-link", children: "Cookie Settings" }),
|
|
1458
1411
|
" ",
|
|
@@ -3234,6 +3187,111 @@ function renderArticleBlocksToHtml(blocks, mediaMap, options) {
|
|
|
3234
3187
|
return parts.join("\n");
|
|
3235
3188
|
}
|
|
3236
3189
|
|
|
3190
|
+
// src/sponsorships.ts
|
|
3191
|
+
var SPONSORSHIP_POLICY = "Sponsors receive clearly identified recognition. Sponsorship does not influence reporting, event selection, factual information, rankings or editorial recommendations.";
|
|
3192
|
+
var SPONSORSHIP_OFFERINGS = [
|
|
3193
|
+
{
|
|
3194
|
+
type: "community_partner",
|
|
3195
|
+
name: "Publication Community Partner",
|
|
3196
|
+
price_cents: 35e3,
|
|
3197
|
+
duration: "One calendar month; exact start and end dates in the agreement.",
|
|
3198
|
+
deliverables: "One acknowledgment on the publication's community partners page and one compact acknowledgment below the community calendar. No article placements.",
|
|
3199
|
+
acknowledgments: "Two defined web locations; recurring display during the campaign, subject to reader repetition limits.",
|
|
3200
|
+
creative: "Name, approved logo, up to 140 characters of copy and one HTTPS link.",
|
|
3201
|
+
max_sponsors: 2,
|
|
3202
|
+
product_path: "/community-partners"
|
|
3203
|
+
},
|
|
3204
|
+
{
|
|
3205
|
+
type: "community_calendar",
|
|
3206
|
+
name: "Community Calendar Sponsor",
|
|
3207
|
+
price_cents: 25e3,
|
|
3208
|
+
duration: "One calendar month; exact start and end dates in the agreement.",
|
|
3209
|
+
deliverables: "One acknowledgment above the independently curated community events calendar.",
|
|
3210
|
+
acknowledgments: "One web location; recurring display during the campaign, subject to reader repetition limits.",
|
|
3211
|
+
creative: "Name, approved logo, up to 140 characters of copy and one HTTPS link.",
|
|
3212
|
+
max_sponsors: 1,
|
|
3213
|
+
product_path: "/this-week"
|
|
3214
|
+
},
|
|
3215
|
+
{
|
|
3216
|
+
type: "daily_briefing",
|
|
3217
|
+
name: "Daily Briefing Sponsor",
|
|
3218
|
+
price_cents: 3e4,
|
|
3219
|
+
duration: "One calendar month after verified newsletter delivery is operational.",
|
|
3220
|
+
deliverables: "One acknowledgment per agreed briefing edition. Edition dates and count must be specified in the agreement before booking.",
|
|
3221
|
+
acknowledgments: "One per contracted edition; no minimum send count is promised before launch.",
|
|
3222
|
+
creative: "Name, optional logo, up to 140 characters of approved copy and one HTTPS link.",
|
|
3223
|
+
max_sponsors: 1,
|
|
3224
|
+
product_path: "/newsletter"
|
|
3225
|
+
},
|
|
3226
|
+
{
|
|
3227
|
+
type: "community_guide",
|
|
3228
|
+
name: "Community Guide Sponsor",
|
|
3229
|
+
price_cents: null,
|
|
3230
|
+
duration: "Fixed dates agreed for a named guide.",
|
|
3231
|
+
deliverables: "One acknowledgment on one named, independently edited community guide; scope and updates agreed in writing.",
|
|
3232
|
+
acknowledgments: "One web location per contracted guide.",
|
|
3233
|
+
creative: "Name, approved logo, up to 140 characters of copy and one HTTPS link.",
|
|
3234
|
+
max_sponsors: 1,
|
|
3235
|
+
product_path: "/guides"
|
|
3236
|
+
}
|
|
3237
|
+
];
|
|
3238
|
+
function safeSponsorUrl(value) {
|
|
3239
|
+
if (typeof value !== "string" || value.length > 2048) return void 0;
|
|
3240
|
+
try {
|
|
3241
|
+
const url = new URL(value);
|
|
3242
|
+
if (url.protocol !== "https:" || url.username || url.password)
|
|
3243
|
+
return void 0;
|
|
3244
|
+
return url.toString();
|
|
3245
|
+
} catch {
|
|
3246
|
+
return void 0;
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3249
|
+
function placementAvailable(placement, now = Date.now()) {
|
|
3250
|
+
const verified = placement.verified_at && Date.parse(placement.verified_at);
|
|
3251
|
+
return placement.placement_type !== "daily_briefing" && placement.active && placement.availability === "available" && Boolean(safeSponsorUrl(placement.verification_url)) && typeof verified === "number" && Number.isFinite(verified) && verified <= now && now - verified <= 90 * 864e5;
|
|
3252
|
+
}
|
|
3253
|
+
|
|
3254
|
+
// src/measurement-consent.ts
|
|
3255
|
+
function measurementConsent(headers, sponsorship = false, now = Date.now()) {
|
|
3256
|
+
if (headers.get("dnt") === "1" || headers.get("sec-gpc") === "1")
|
|
3257
|
+
return false;
|
|
3258
|
+
const cookies = headers.get("cookie")?.split(";").map((value) => value.trim()) ?? [];
|
|
3259
|
+
const cookie = cookies.find((value) => value.startsWith("sm_cookie_consent_v1=")) ?? cookies.find((value) => value.startsWith("napsite_cookie_consent_v1="));
|
|
3260
|
+
if (!cookie) return false;
|
|
3261
|
+
try {
|
|
3262
|
+
const record = JSON.parse(
|
|
3263
|
+
decodeURIComponent(cookie.substring(cookie.indexOf("=") + 1))
|
|
3264
|
+
);
|
|
3265
|
+
const date2 = Date.parse(record.timestamp);
|
|
3266
|
+
return record.version === 1 && record.preferences?.essential === true && typeof record.preferences?.functional === "boolean" && typeof record.preferences?.advertising === "boolean" && record.preferences?.performance === true && (!sponsorship || record.preferences?.advertising === true) && Number.isFinite(date2) && date2 <= now + 3e5 && now - date2 < 365 * 864e5;
|
|
3267
|
+
} catch {
|
|
3268
|
+
return false;
|
|
3269
|
+
}
|
|
3270
|
+
}
|
|
3271
|
+
|
|
3272
|
+
// src/sponsorship-report.ts
|
|
3273
|
+
var escape = (text) => String(text ?? "").replace(
|
|
3274
|
+
/[&<>"']/g,
|
|
3275
|
+
(c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]
|
|
3276
|
+
);
|
|
3277
|
+
var date = (value) => new Date(value).toLocaleString("en-US", {
|
|
3278
|
+
timeZone: "UTC",
|
|
3279
|
+
dateStyle: "medium",
|
|
3280
|
+
timeStyle: "short"
|
|
3281
|
+
}) + " UTC";
|
|
3282
|
+
function metric(value) {
|
|
3283
|
+
if (value.status === "unavailable" || value.value === null)
|
|
3284
|
+
return "Unavailable";
|
|
3285
|
+
return `${escape(value.value.toLocaleString("en-US"))} <small>${escape(value.status)}</small>${value.from && value.to ? `<small>Observed period:<br>${escape(date(value.from))}<br>to ${escape(date(value.to))}</small>` : ""}`;
|
|
3286
|
+
}
|
|
3287
|
+
function campaignReportHtml(report) {
|
|
3288
|
+
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><title>${escape(report.campaign_name)} | Sponsorship report</title><style>
|
|
3289
|
+
@page{size:Letter;margin:18mm}*{box-sizing:border-box}body{font:11pt/1.5 Arial,sans-serif;color:#172d37;margin:0}h1,h2{font-family:Georgia,serif;font-weight:normal}h1{font-size:30pt;line-height:1.12;margin:16pt 0}h2{font-size:19pt;margin:0 0 8pt}header{border-bottom:2pt solid #173d32;padding-bottom:16pt}.brand{font-size:10pt;letter-spacing:1pt}p{margin:8pt 0}.meta{color:#4e5d64;font-size:10pt}section{break-inside:avoid;margin:24pt 0}table{width:100%;border-collapse:collapse;margin:12pt 0}td,th{text-align:left;border-bottom:1px solid #d8dedc;padding:8pt 5pt}th{font-size:9pt}small{display:block;color:#4e5d64;font-size:8pt}footer{border-top:1px solid #d8dedc;padding-top:12pt;font-size:9pt}.notes{font-size:9pt;color:#4e5d64}
|
|
3290
|
+
</style></head><body><header><div class="brand">BAY AREA NEWS NETWORK</div><p>Community sponsorship report</p><h1>${escape(report.campaign_name)}</h1><p>${escape(report.sponsor)}</p><p class="meta">Campaign period: ${escape(date(report.starts_at))} to ${escape(date(report.ends_at))}<br>Status: ${escape(report.status)}<br>Prepared: ${escape(date(report.generated_at))}</p></header>
|
|
3291
|
+
${report.placements.map((p) => `<section><h2>${escape(p.publication)}</h2><p>${escape(p.placement)} \xB7 ${escape(p.product_path)}</p><p class="meta">Community scope: ${escape(p.communities.length ? p.communities.join(", ") : "Publication-wide")}<br>Placement delivery: ${escape(p.delivery_status)}</p><table><thead><tr><th>Observed placement views</th><th>Observed sponsor link clicks</th><th>Newsletter deliveries</th></tr></thead><tbody><tr><td>${metric(p.views)}</td><td>${metric(p.clicks)}</td><td>${metric(p.newsletter_deliveries)}</td></tr></tbody></table><p class="notes">Views: ${escape(p.views.methodology)}<br>Clicks: ${escape(p.clicks.methodology)}<br>Newsletter: ${escape(p.newsletter_deliveries.methodology)}</p></section>`).join("")}
|
|
3292
|
+
<footer><p>${escape(report.reporting_note)}</p><p>${escape(report.editorial_independence)}</p><p>Campaign reference: ${escape(report.campaign_id)}</p></footer></body></html>`;
|
|
3293
|
+
}
|
|
3294
|
+
|
|
3237
3295
|
Object.defineProperty(exports, "COOKIE_CONSENT_BACKUP_KEY", {
|
|
3238
3296
|
enumerable: true,
|
|
3239
3297
|
get: function () { return compliance.COOKIE_CONSENT_BACKUP_KEY; }
|
|
@@ -3341,6 +3399,8 @@ exports.NEWS_CACHE = NEWS_CACHE;
|
|
|
3341
3399
|
exports.NetworkCopyrightNotice = NetworkCopyrightNotice;
|
|
3342
3400
|
exports.NewsError = NewsError;
|
|
3343
3401
|
exports.SESSION_IDLE_MS = SESSION_IDLE_MS;
|
|
3402
|
+
exports.SPONSORSHIP_OFFERINGS = SPONSORSHIP_OFFERINGS;
|
|
3403
|
+
exports.SPONSORSHIP_POLICY = SPONSORSHIP_POLICY;
|
|
3344
3404
|
exports.THEME_COOKIE = THEME_COOKIE;
|
|
3345
3405
|
exports.THEME_EVENT = THEME_EVENT;
|
|
3346
3406
|
exports.THEME_MAX_AGE_SECONDS = THEME_MAX_AGE_SECONDS;
|
|
@@ -3361,6 +3421,7 @@ exports.articleMeta = articleMeta;
|
|
|
3361
3421
|
exports.articleUrl = articleUrl;
|
|
3362
3422
|
exports.attribution = attribution;
|
|
3363
3423
|
exports.briefSummary = briefSummary;
|
|
3424
|
+
exports.campaignReportHtml = campaignReportHtml;
|
|
3364
3425
|
exports.canHostMeetup = canHostMeetup;
|
|
3365
3426
|
exports.categoryLabel = categoryLabel;
|
|
3366
3427
|
exports.classifiedPath = classifiedPath;
|
|
@@ -3403,12 +3464,14 @@ exports.listedPublications = listedPublications;
|
|
|
3403
3464
|
exports.llmsText = llmsText;
|
|
3404
3465
|
exports.localPublications = localPublications;
|
|
3405
3466
|
exports.matchesStoryTag = matchesStoryTag;
|
|
3467
|
+
exports.measurementConsent = measurementConsent;
|
|
3406
3468
|
exports.nearbyUpdates = nearbyUpdates;
|
|
3407
3469
|
exports.newsArticleJsonLd = newsArticleJsonLd;
|
|
3408
3470
|
exports.normalizedText = normalizedText;
|
|
3409
3471
|
exports.orderedSections = orderedSections;
|
|
3410
3472
|
exports.parseDocumentBlocks = parseDocumentBlocks;
|
|
3411
3473
|
exports.parseSnapshot = parseSnapshot;
|
|
3474
|
+
exports.placementAvailable = placementAvailable;
|
|
3412
3475
|
exports.prepareClassified = prepareClassified;
|
|
3413
3476
|
exports.prepareJobPost = prepareJobPost;
|
|
3414
3477
|
exports.prepareMeetup = prepareMeetup;
|
|
@@ -3430,6 +3493,7 @@ exports.resolveCoupon = resolveCoupon;
|
|
|
3430
3493
|
exports.resolveEffectiveTheme = resolveEffectiveTheme;
|
|
3431
3494
|
exports.resolveLayout = resolveLayout;
|
|
3432
3495
|
exports.revalidateDecision = revalidateDecision;
|
|
3496
|
+
exports.safeSponsorUrl = safeSponsorUrl;
|
|
3433
3497
|
exports.sanitizeInlineMarkdown = sanitizeInlineMarkdown;
|
|
3434
3498
|
exports.screenMessage = screenMessage;
|
|
3435
3499
|
exports.secretsMatch = secretsMatch;
|
package/dist/index.d.cts
CHANGED
|
@@ -15,6 +15,8 @@ import * as react from 'react';
|
|
|
15
15
|
export { VerifiedCardComponent, VerifiedCardSection, getArticleCards, isSafeActionUrl } from './verified-card.cjs';
|
|
16
16
|
export { C as CommunityMapArticleEmbed, c as communityMapEmbeds } from './community-maps-DKcYhQYN.cjs';
|
|
17
17
|
export { C as ContentBlock, S as StructuredDocument, a as StructuredMedia, f as formatArtworkCaption, p as parseDocumentBlocks, r as renderArticleBlocksToHtml, s as sanitizeInlineMarkdown } from './article-blocks-DsabIDmH.cjs';
|
|
18
|
+
import { M as Measurement } from './sponsorships-CtnBe3S8.cjs';
|
|
19
|
+
export { a as Campaign, b as CampaignStatus, c as CampaignTarget, C as Creative, d as Placement, e as PlacementType, P as PublicAcknowledgment, S as SPONSORSHIP_OFFERINGS, f as SPONSORSHIP_POLICY, g as SponsorParty, p as placementAvailable, s as safeSponsorUrl } from './sponsorships-CtnBe3S8.cjs';
|
|
18
20
|
|
|
19
21
|
/** Walnut Creek Times broadsheet colors. A paper overrides only what it changes. */
|
|
20
22
|
declare const BROADSHEET_THEME: PublicationTheme;
|
|
@@ -473,4 +475,35 @@ declare function publicationListeningCandidates<T extends ListeningArticle>(item
|
|
|
473
475
|
*/
|
|
474
476
|
declare const CURATED_COMMUNITY_CARDS: Record<string, Record<string, unknown>[]>;
|
|
475
477
|
|
|
476
|
-
|
|
478
|
+
/** The server enforces the same explicit consent gate as the browser. */
|
|
479
|
+
declare function measurementConsent(headers: Pick<Headers, "get">, sponsorship?: boolean, now?: number): boolean;
|
|
480
|
+
|
|
481
|
+
interface SponsorshipReport {
|
|
482
|
+
campaign_id: string;
|
|
483
|
+
campaign_name: string;
|
|
484
|
+
sponsor: string;
|
|
485
|
+
starts_at: string;
|
|
486
|
+
ends_at: string;
|
|
487
|
+
status: string;
|
|
488
|
+
generated_at: string;
|
|
489
|
+
editorial_independence: string;
|
|
490
|
+
reporting_note: string;
|
|
491
|
+
placements: Array<{
|
|
492
|
+
application_id: string;
|
|
493
|
+
publication_id: string;
|
|
494
|
+
publication: string;
|
|
495
|
+
publication_url: string;
|
|
496
|
+
placement_id: string;
|
|
497
|
+
placement: string;
|
|
498
|
+
product_path: string;
|
|
499
|
+
communities: string[];
|
|
500
|
+
delivery_status: string;
|
|
501
|
+
views: Measurement;
|
|
502
|
+
clicks: Measurement;
|
|
503
|
+
newsletter_deliveries: Measurement;
|
|
504
|
+
}>;
|
|
505
|
+
}
|
|
506
|
+
/** Shared by the newsroom print/export view and the repeatable PDF renderer. */
|
|
507
|
+
declare function campaignReportHtml(report: SponsorshipReport): string;
|
|
508
|
+
|
|
509
|
+
export { ANALYTICS_COOKIE, ANALYTICS_VERSION, ArticleProvenance, type Attribution, BROADSHEET_THEME, type BriefingCandidate, type BriefingPreferences, type BriefingReason, type BriefingSection, type BriefingSource, type BriefingVerification, COOKIE_CATEGORIES, CURATED_COMMUNITY_CARDS, CouponOffer, EDITORIAL_SECTION_ORDER, EVENTS, EditorialSection, type EffectiveTheme, FeatureName, HomepageSelection, LAYOUT_COOKIE, LOCAL_BRIEFING_POLICY_VERSION, type ListeningArticle, type LocalBriefing, type LocalBriefingItem, type LocalBriefingOptions, Measurement, NEWS_CACHE, NearbyUpdate, NewsArticle, NewsError, NewsItem, NewsPublication, PublicationInput, PublicationTheme, SESSION_IDLE_MS, type SponsorshipReport, THEME_COOKIE, THEME_EVENT, THEME_MAX_AGE_SECONDS, THEME_STORAGE_KEY, type ThemeMode, UTM_FIELDS, UUID, activeNearby, applyTheme, articleCacheKey, articleCacheOptions, articleMeta, articleUrl, attribution, briefSummary, campaignReportHtml, clearTheme, composeEdition, composeLocalBriefing, defaultRevalidateTargets, definePublication, displayHeadline, edgeCacheControl, editorialSections, featureEnabled, feedCacheKey, feedCacheOptions, filterNews, getStoredTheme, getSystemTheme, inventoryCacheOptions, llmsText, matchesStoryTag, measurementConsent, nearbyUpdates, newsArticleJsonLd, normalizedText, orderedSections, publicHttps, publicUrl, publicationJsonLd, publicationListeningCandidates, publicationListeningTrack, 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
|
@@ -15,6 +15,8 @@ import * as react from 'react';
|
|
|
15
15
|
export { VerifiedCardComponent, VerifiedCardSection, getArticleCards, isSafeActionUrl } from './verified-card.js';
|
|
16
16
|
export { C as CommunityMapArticleEmbed, c as communityMapEmbeds } from './community-maps-DKcYhQYN.js';
|
|
17
17
|
export { C as ContentBlock, S as StructuredDocument, a as StructuredMedia, f as formatArtworkCaption, p as parseDocumentBlocks, r as renderArticleBlocksToHtml, s as sanitizeInlineMarkdown } from './article-blocks-DsabIDmH.js';
|
|
18
|
+
import { M as Measurement } from './sponsorships-CtnBe3S8.js';
|
|
19
|
+
export { a as Campaign, b as CampaignStatus, c as CampaignTarget, C as Creative, d as Placement, e as PlacementType, P as PublicAcknowledgment, S as SPONSORSHIP_OFFERINGS, f as SPONSORSHIP_POLICY, g as SponsorParty, p as placementAvailable, s as safeSponsorUrl } from './sponsorships-CtnBe3S8.js';
|
|
18
20
|
|
|
19
21
|
/** Walnut Creek Times broadsheet colors. A paper overrides only what it changes. */
|
|
20
22
|
declare const BROADSHEET_THEME: PublicationTheme;
|
|
@@ -473,4 +475,35 @@ declare function publicationListeningCandidates<T extends ListeningArticle>(item
|
|
|
473
475
|
*/
|
|
474
476
|
declare const CURATED_COMMUNITY_CARDS: Record<string, Record<string, unknown>[]>;
|
|
475
477
|
|
|
476
|
-
|
|
478
|
+
/** The server enforces the same explicit consent gate as the browser. */
|
|
479
|
+
declare function measurementConsent(headers: Pick<Headers, "get">, sponsorship?: boolean, now?: number): boolean;
|
|
480
|
+
|
|
481
|
+
interface SponsorshipReport {
|
|
482
|
+
campaign_id: string;
|
|
483
|
+
campaign_name: string;
|
|
484
|
+
sponsor: string;
|
|
485
|
+
starts_at: string;
|
|
486
|
+
ends_at: string;
|
|
487
|
+
status: string;
|
|
488
|
+
generated_at: string;
|
|
489
|
+
editorial_independence: string;
|
|
490
|
+
reporting_note: string;
|
|
491
|
+
placements: Array<{
|
|
492
|
+
application_id: string;
|
|
493
|
+
publication_id: string;
|
|
494
|
+
publication: string;
|
|
495
|
+
publication_url: string;
|
|
496
|
+
placement_id: string;
|
|
497
|
+
placement: string;
|
|
498
|
+
product_path: string;
|
|
499
|
+
communities: string[];
|
|
500
|
+
delivery_status: string;
|
|
501
|
+
views: Measurement;
|
|
502
|
+
clicks: Measurement;
|
|
503
|
+
newsletter_deliveries: Measurement;
|
|
504
|
+
}>;
|
|
505
|
+
}
|
|
506
|
+
/** Shared by the newsroom print/export view and the repeatable PDF renderer. */
|
|
507
|
+
declare function campaignReportHtml(report: SponsorshipReport): string;
|
|
508
|
+
|
|
509
|
+
export { ANALYTICS_COOKIE, ANALYTICS_VERSION, ArticleProvenance, type Attribution, BROADSHEET_THEME, type BriefingCandidate, type BriefingPreferences, type BriefingReason, type BriefingSection, type BriefingSource, type BriefingVerification, COOKIE_CATEGORIES, CURATED_COMMUNITY_CARDS, CouponOffer, EDITORIAL_SECTION_ORDER, EVENTS, EditorialSection, type EffectiveTheme, FeatureName, HomepageSelection, LAYOUT_COOKIE, LOCAL_BRIEFING_POLICY_VERSION, type ListeningArticle, type LocalBriefing, type LocalBriefingItem, type LocalBriefingOptions, Measurement, NEWS_CACHE, NearbyUpdate, NewsArticle, NewsError, NewsItem, NewsPublication, PublicationInput, PublicationTheme, SESSION_IDLE_MS, type SponsorshipReport, THEME_COOKIE, THEME_EVENT, THEME_MAX_AGE_SECONDS, THEME_STORAGE_KEY, type ThemeMode, UTM_FIELDS, UUID, activeNearby, applyTheme, articleCacheKey, articleCacheOptions, articleMeta, articleUrl, attribution, briefSummary, campaignReportHtml, clearTheme, composeEdition, composeLocalBriefing, defaultRevalidateTargets, definePublication, displayHeadline, edgeCacheControl, editorialSections, featureEnabled, feedCacheKey, feedCacheOptions, filterNews, getStoredTheme, getSystemTheme, inventoryCacheOptions, llmsText, matchesStoryTag, measurementConsent, nearbyUpdates, newsArticleJsonLd, normalizedText, orderedSections, publicHttps, publicUrl, publicationJsonLd, publicationListeningCandidates, publicationListeningTrack, 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
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
export { NetworkCopyrightNotice } from './chunk-WAC6ATNP.js';
|
|
1
2
|
export { CURATED_COMMUNITY_CARDS, VerifiedCardComponent, VerifiedCardSection, getArticleCards, isSafeActionUrl } from './chunk-FMCHQI7K.js';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
3
|
+
export { MEET_ACTIVITIES, activityLabel, canHostMeetup, isAdult, prepareMeetup, screenMessage } from './chunk-GB36YM56.js';
|
|
4
|
+
export { CookieConsentBanner } from './chunk-GOWOYMSG.js';
|
|
5
|
+
export { CookieSettingsView } from './chunk-UL2Q3N26.js';
|
|
4
6
|
export { THEME_COOKIE, THEME_EVENT, THEME_MAX_AGE_SECONDS, THEME_STORAGE_KEY, ThemeToggle, applyTheme, clearTheme, getStoredTheme, getSystemTheme, resolveEffectiveTheme, setTheme, subscribeTheme, themeInitScript } from './chunk-NQD3M7ZY.js';
|
|
5
|
-
export { LocalNetworkBar } from './chunk-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export {
|
|
7
|
+
export { LocalNetworkBar } from './chunk-2XSW7JZS.js';
|
|
8
|
+
import { localPublications } from './chunk-JV76ZEIA.js';
|
|
9
|
+
export { COOKIE_CATEGORIES, COOKIE_CONSENT_BACKUP_KEY, COOKIE_CONSENT_EVENT, COOKIE_CONSENT_KEY, COOKIE_CONSENT_MAX_AGE_SECONDS, DEFAULT_CONSENT_HUB_URL, DEFAULT_PREFERENCES_ACCEPTED, DEFAULT_PREFERENCES_REJECTED, EDITORIAL_PRINCIPLES, EU_EEA_UK_COUNTRIES, NETWORK_CONSENT_STORAGE_KEY, NETWORK_PARENT, acceptAllCookies, checkUrlConsentBridge, clearCookieConsent, communityPublications, decorateNetworkUrl, findPublicationByHost, findPublicationBySlug, getCookieConsent, getNetworkPublicationUrl, hasConsented, isCategoryAllowed, isGeoConsentRequired, listedPublications, localPublications, queryNetworkConsentHub, recordConsentToCompliance, rejectOptionalCookies, setCookieConsent, setNetworkConsentHub } from './chunk-JV76ZEIA.js';
|
|
10
|
+
export { SPONSORSHIP_OFFERINGS, SPONSORSHIP_POLICY, placementAvailable, safeSponsorUrl } from './chunk-66GI2IX6.js';
|
|
9
11
|
export { communityMapEmbeds } from './chunk-IMYBSG7J.js';
|
|
10
12
|
export { formatArtworkCaption, parseDocumentBlocks, renderArticleBlocksToHtml, sanitizeInlineMarkdown } from './chunk-OISLCYER.js';
|
|
11
13
|
import { definePublication } from './chunk-57YVL6BD.js';
|
|
12
14
|
export { BROADSHEET_THEME, FEATURE_NAMES, LAYOUT_COOKIE, acceptRemoteRecord, acceptSnapshot, definePublication, featureEnabled, parseSnapshot, publicationFromSnapshot, publicationRecord, resolveLayout, snapshotFromRecord, syncPublication } from './chunk-57YVL6BD.js';
|
|
13
15
|
export { CLASSIFIED_CATEGORIES, JOB_EMPLOYMENT_TYPES, categoryLabel, classifiedPath, classifiedSearchPath, clipChars, dealDollars, dealGoPath, dealsFeedPath, employmentLabel, isClassifiedCategory, isEmploymentType, jobEmployerBody, jobOpeningBody, jobPostingBody, prepareClassified, prepareJobPost, publicJobPath, publicJobsPath } from './chunk-C7ZPLH2K.js';
|
|
14
|
-
export { MEET_ACTIVITIES, activityLabel, canHostMeetup, isAdult, prepareMeetup, screenMessage } from './chunk-GB36YM56.js';
|
|
15
16
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
16
17
|
|
|
17
18
|
// src/editorial.ts
|
|
@@ -175,8 +176,8 @@ function shortDeck(value, limit = 160) {
|
|
|
175
176
|
return (space > opening.length / 2 ? opening.slice(0, space) : opening).trimEnd() + "\u2026";
|
|
176
177
|
}
|
|
177
178
|
function storyDate(value) {
|
|
178
|
-
const
|
|
179
|
-
return Number.isNaN(
|
|
179
|
+
const date2 = new Date(value);
|
|
180
|
+
return Number.isNaN(date2.getTime()) ? null : date2.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric", timeZone: "America/Los_Angeles" });
|
|
180
181
|
}
|
|
181
182
|
|
|
182
183
|
// src/seo.ts
|
|
@@ -752,4 +753,45 @@ async function publicationListeningCandidates(items, read, publicationId, public
|
|
|
752
753
|
return output.sort((a, b) => (b.publishedAt ?? "").localeCompare(a.publishedAt ?? ""));
|
|
753
754
|
}
|
|
754
755
|
|
|
755
|
-
|
|
756
|
+
// src/measurement-consent.ts
|
|
757
|
+
function measurementConsent(headers, sponsorship = false, now = Date.now()) {
|
|
758
|
+
if (headers.get("dnt") === "1" || headers.get("sec-gpc") === "1")
|
|
759
|
+
return false;
|
|
760
|
+
const cookies = headers.get("cookie")?.split(";").map((value) => value.trim()) ?? [];
|
|
761
|
+
const cookie = cookies.find((value) => value.startsWith("sm_cookie_consent_v1=")) ?? cookies.find((value) => value.startsWith("napsite_cookie_consent_v1="));
|
|
762
|
+
if (!cookie) return false;
|
|
763
|
+
try {
|
|
764
|
+
const record = JSON.parse(
|
|
765
|
+
decodeURIComponent(cookie.substring(cookie.indexOf("=") + 1))
|
|
766
|
+
);
|
|
767
|
+
const date2 = Date.parse(record.timestamp);
|
|
768
|
+
return record.version === 1 && record.preferences?.essential === true && typeof record.preferences?.functional === "boolean" && typeof record.preferences?.advertising === "boolean" && record.preferences?.performance === true && (!sponsorship || record.preferences?.advertising === true) && Number.isFinite(date2) && date2 <= now + 3e5 && now - date2 < 365 * 864e5;
|
|
769
|
+
} catch {
|
|
770
|
+
return false;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
// src/sponsorship-report.ts
|
|
775
|
+
var escape = (text) => String(text ?? "").replace(
|
|
776
|
+
/[&<>"']/g,
|
|
777
|
+
(c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]
|
|
778
|
+
);
|
|
779
|
+
var date = (value) => new Date(value).toLocaleString("en-US", {
|
|
780
|
+
timeZone: "UTC",
|
|
781
|
+
dateStyle: "medium",
|
|
782
|
+
timeStyle: "short"
|
|
783
|
+
}) + " UTC";
|
|
784
|
+
function metric(value) {
|
|
785
|
+
if (value.status === "unavailable" || value.value === null)
|
|
786
|
+
return "Unavailable";
|
|
787
|
+
return `${escape(value.value.toLocaleString("en-US"))} <small>${escape(value.status)}</small>${value.from && value.to ? `<small>Observed period:<br>${escape(date(value.from))}<br>to ${escape(date(value.to))}</small>` : ""}`;
|
|
788
|
+
}
|
|
789
|
+
function campaignReportHtml(report) {
|
|
790
|
+
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><title>${escape(report.campaign_name)} | Sponsorship report</title><style>
|
|
791
|
+
@page{size:Letter;margin:18mm}*{box-sizing:border-box}body{font:11pt/1.5 Arial,sans-serif;color:#172d37;margin:0}h1,h2{font-family:Georgia,serif;font-weight:normal}h1{font-size:30pt;line-height:1.12;margin:16pt 0}h2{font-size:19pt;margin:0 0 8pt}header{border-bottom:2pt solid #173d32;padding-bottom:16pt}.brand{font-size:10pt;letter-spacing:1pt}p{margin:8pt 0}.meta{color:#4e5d64;font-size:10pt}section{break-inside:avoid;margin:24pt 0}table{width:100%;border-collapse:collapse;margin:12pt 0}td,th{text-align:left;border-bottom:1px solid #d8dedc;padding:8pt 5pt}th{font-size:9pt}small{display:block;color:#4e5d64;font-size:8pt}footer{border-top:1px solid #d8dedc;padding-top:12pt;font-size:9pt}.notes{font-size:9pt;color:#4e5d64}
|
|
792
|
+
</style></head><body><header><div class="brand">BAY AREA NEWS NETWORK</div><p>Community sponsorship report</p><h1>${escape(report.campaign_name)}</h1><p>${escape(report.sponsor)}</p><p class="meta">Campaign period: ${escape(date(report.starts_at))} to ${escape(date(report.ends_at))}<br>Status: ${escape(report.status)}<br>Prepared: ${escape(date(report.generated_at))}</p></header>
|
|
793
|
+
${report.placements.map((p) => `<section><h2>${escape(p.publication)}</h2><p>${escape(p.placement)} \xB7 ${escape(p.product_path)}</p><p class="meta">Community scope: ${escape(p.communities.length ? p.communities.join(", ") : "Publication-wide")}<br>Placement delivery: ${escape(p.delivery_status)}</p><table><thead><tr><th>Observed placement views</th><th>Observed sponsor link clicks</th><th>Newsletter deliveries</th></tr></thead><tbody><tr><td>${metric(p.views)}</td><td>${metric(p.clicks)}</td><td>${metric(p.newsletter_deliveries)}</td></tr></tbody></table><p class="notes">Views: ${escape(p.views.methodology)}<br>Clicks: ${escape(p.clicks.methodology)}<br>Newsletter: ${escape(p.newsletter_deliveries.methodology)}</p></section>`).join("")}
|
|
794
|
+
<footer><p>${escape(report.reporting_note)}</p><p>${escape(report.editorial_independence)}</p><p>Campaign reference: ${escape(report.campaign_id)}</p></footer></body></html>`;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
export { ANALYTICS_COOKIE, ANALYTICS_VERSION, ArticleProvenance, EDITORIAL_SECTION_ORDER, EVENTS, LOCAL_BRIEFING_POLICY_VERSION, NEWS_CACHE, NewsError, SESSION_IDLE_MS, UTM_FIELDS, UUID, activeNearby, articleCacheKey, articleCacheOptions, articleMeta, articleUrl, attribution, briefSummary, campaignReportHtml, composeEdition, composeLocalBriefing, defaultRevalidateTargets, displayHeadline, edgeCacheControl, editorialSections, feedCacheKey, feedCacheOptions, filterNews, inventoryCacheOptions, llmsText, matchesStoryTag, measurementConsent, nearbyUpdates, newsArticleJsonLd, normalizedText, orderedSections, publicHttps, publicUrl, publicationJsonLd, publicationListeningCandidates, publicationListeningTrack, publicationMeta, readerSources, referralCode, resolveCoupon, revalidateDecision, secretsMatch, sectionDefinition, sectionId, sectionPath, shortDeck, shortText, shouldServeLastKnown, storyDate, storyTowns, townSlug, validCalendarDate, walnutCreekTimes, withLastKnown };
|
package/dist/network-bar.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { LocalNetworkBar } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { LocalNetworkBar } from './chunk-2XSW7JZS.js';
|
|
2
|
+
import './chunk-JV76ZEIA.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { NetworkCopyrightNotice } from './chunk-
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { NetworkCopyrightNotice } from './chunk-WAC6ATNP.js';
|
|
2
|
+
import './chunk-JV76ZEIA.js';
|
package/dist/network.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { EDITORIAL_PRINCIPLES, NETWORK_PARENT, communityPublications, findPublicationByHost, findPublicationBySlug, getNetworkPublicationUrl, isNetworkHostname, listedPublications, localPublications } from './chunk-
|
|
1
|
+
export { EDITORIAL_PRINCIPLES, NETWORK_PARENT, communityPublications, findPublicationByHost, findPublicationBySlug, getNetworkPublicationUrl, isNetworkHostname, listedPublications, localPublications } from './chunk-JV76ZEIA.js';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
|
|
5
|
+
// src/sponsorships.ts
|
|
6
|
+
function safeSponsorUrl(value) {
|
|
7
|
+
if (typeof value !== "string" || value.length > 2048) return void 0;
|
|
8
|
+
try {
|
|
9
|
+
const url = new URL(value);
|
|
10
|
+
if (url.protocol !== "https:" || url.username || url.password)
|
|
11
|
+
return void 0;
|
|
12
|
+
return url.toString();
|
|
13
|
+
} catch {
|
|
14
|
+
return void 0;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function SponsorAcknowledgment({
|
|
18
|
+
creative,
|
|
19
|
+
label = "Community Partner",
|
|
20
|
+
preview = false,
|
|
21
|
+
acknowledgment
|
|
22
|
+
}) {
|
|
23
|
+
const logo = safeSponsorUrl(creative.logo_url);
|
|
24
|
+
const destination = safeSponsorUrl(creative.destination_url);
|
|
25
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
26
|
+
"aside",
|
|
27
|
+
{
|
|
28
|
+
className: "sm-sponsorship",
|
|
29
|
+
"aria-label": `${label}: ${creative.name}`,
|
|
30
|
+
"data-sponsorship": preview ? void 0 : acknowledgment?.campaign_id,
|
|
31
|
+
"data-placement-id": preview ? void 0 : acknowledgment?.placement_id,
|
|
32
|
+
"data-publication-id": preview ? void 0 : acknowledgment?.publication_id,
|
|
33
|
+
"data-sponsor-id": preview ? void 0 : acknowledgment?.sponsor_id,
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sm-sponsorship-copy", children: [
|
|
36
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "sm-sponsorship-label", children: [
|
|
37
|
+
label,
|
|
38
|
+
preview ? " \xB7 Illustrative preview" : ""
|
|
39
|
+
] }),
|
|
40
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "sm-sponsorship-name", children: creative.name }),
|
|
41
|
+
creative.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sm-sponsorship-description", children: creative.description }),
|
|
42
|
+
destination && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
43
|
+
"a",
|
|
44
|
+
{
|
|
45
|
+
href: destination,
|
|
46
|
+
rel: "sponsored noopener noreferrer",
|
|
47
|
+
referrerPolicy: "no-referrer",
|
|
48
|
+
"data-analytics-skip": "true",
|
|
49
|
+
children: [
|
|
50
|
+
creative.link_label || "Learn more",
|
|
51
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "sm-sponsorship-sr", children: [
|
|
52
|
+
" about ",
|
|
53
|
+
creative.name
|
|
54
|
+
] })
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
] }),
|
|
59
|
+
logo && /* @__PURE__ */ jsxRuntime.jsx(
|
|
60
|
+
"img",
|
|
61
|
+
{
|
|
62
|
+
src: logo,
|
|
63
|
+
alt: `${creative.name} logo`,
|
|
64
|
+
loading: "lazy",
|
|
65
|
+
decoding: "async",
|
|
66
|
+
referrerPolicy: "no-referrer",
|
|
67
|
+
className: "sm-sponsorship-logo"
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
exports.SponsorAcknowledgment = SponsorAcknowledgment;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import react__default from 'react';
|
|
2
|
+
import { C as Creative, P as PublicAcknowledgment } from './sponsorships-CtnBe3S8.cjs';
|
|
3
|
+
|
|
4
|
+
declare function SponsorAcknowledgment({ creative, label, preview, acknowledgment, }: {
|
|
5
|
+
creative: Creative;
|
|
6
|
+
label?: "Community Partner" | "Sponsored";
|
|
7
|
+
preview?: boolean;
|
|
8
|
+
acknowledgment?: PublicAcknowledgment;
|
|
9
|
+
}): react__default.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { SponsorAcknowledgment };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import react__default from 'react';
|
|
2
|
+
import { C as Creative, P as PublicAcknowledgment } from './sponsorships-CtnBe3S8.js';
|
|
3
|
+
|
|
4
|
+
declare function SponsorAcknowledgment({ creative, label, preview, acknowledgment, }: {
|
|
5
|
+
creative: Creative;
|
|
6
|
+
label?: "Community Partner" | "Sponsored";
|
|
7
|
+
preview?: boolean;
|
|
8
|
+
acknowledgment?: PublicAcknowledgment;
|
|
9
|
+
}): react__default.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { SponsorAcknowledgment };
|