Events 2.4.0 frontend, deploy and docs: Linked products, linked events, seo
- Site settings → Linked products (Connect, Show events from, Publish my events), help, command palette. - Events from linked products on /events, the home and campus pages, and /events/linked/<product>/<id> (markdown with HTML off, canonical to the origin, no JSON-LD, not in the sitemap). - Event page JSON-LD from @crosscode/seo; lib/eventSchema.ts removed. - Readiness check for linked products' sync; e2e spec with a fake Church Website (not run yet: needs the e2e Postgres). - crosscode: install and build the shared packages Events uses first (an older tag still builds as before); scripts/tests/events.bats. - Release notes, changelogs, handovers, hub-protocol.md, and the plan's "Changes while building". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
"zod": "^4.6.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@crosscode/seo": "*",
|
||||
"@types/express": "^5.0.6",
|
||||
"@types/jest": "^30.0.0",
|
||||
"@types/jsonwebtoken": "^9.0.10",
|
||||
|
||||
@@ -91,6 +91,13 @@ async function readiness(now = new Date(), db = prisma) {
|
||||
lastBackup ? `Last backup ${new Date(lastBackup).toLocaleString('en-ZA')}` : 'No backups found on this server.',
|
||||
'/dashboard/admin/settings?tab=backups');
|
||||
|
||||
// Linked products (2.4.0): a product whose events are shown here, but that hasn't answered for a day.
|
||||
const shown = await (db.productLink?.findMany({ where: { showEvents: true }, select: { url: true, lastGoodAt: true, lastSyncError: true, connectedAt: true } }) ?? Promise.resolve([])).catch(() => []);
|
||||
const stale = shown.filter(l => l.lastSyncError && now - new Date(l.lastGoodAt || l.connectedAt) > DAY);
|
||||
add('linked_sync', 'Events from linked products are up to date', stale.length === 0,
|
||||
stale.length ? `Not fetched for over a day: ${stale.map(l => l.url).join(', ')}. Their last events keep showing.` : `${shown.length} product${shown.length === 1 ? '' : 's'} fetched in the last day`,
|
||||
'/dashboard/admin/settings?tab=linked', shown.length > 0);
|
||||
|
||||
const applicable = checks.filter(c => c.applies);
|
||||
const passed = applicable.filter(c => c.ok).length;
|
||||
return { score: applicable.length ? Math.round((passed / applicable.length) * 100) : 0, passed, total: applicable.length, checks };
|
||||
|
||||
@@ -484,3 +484,37 @@ describe('protocol v2 heartbeat', () => {
|
||||
expect(await store.publicKeyStatus()).toBe('saved');
|
||||
});
|
||||
});
|
||||
|
||||
// ─── The event page's JSON-LD (@crosscode/seo, replacing frontend/src/lib/eventSchema.ts) ──
|
||||
|
||||
describe('event JSON-LD from crosscode.event/1', () => {
|
||||
test('matches what the event page sent before 2.4.0, with the price range from main tickets only', () => {
|
||||
const { eventJsonLd } = require('@crosscode/seo');
|
||||
const row = eventRow({ id: '00000000-0000-4000-8000-0000000000aa' });
|
||||
const built = buildCrosscodeEvent(row, new Map(), ctx());
|
||||
// As the page calls it (events/[id]/page.tsx).
|
||||
const ld = eventJsonLd({ ...built.event, description: row.description }, {
|
||||
pageUrl: `https://events.hope.test/events/${row.id}`,
|
||||
organizer: { name: 'Hope Family Church', url: 'https://events.hope.test' },
|
||||
priceRange: built.priceRangeCents,
|
||||
offerUrl: `https://events.hope.test/register/${row.id}`,
|
||||
validFrom: row.goLiveAt.toISOString(),
|
||||
});
|
||||
expect(ld).toEqual({
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'Event',
|
||||
name: 'Youth Camp',
|
||||
description: row.description,
|
||||
startDate: row.startDate.toISOString(),
|
||||
endDate: row.endDate.toISOString(),
|
||||
eventStatus: 'https://schema.org/EventScheduled',
|
||||
eventAttendanceMode: 'https://schema.org/OfflineEventAttendanceMode',
|
||||
location: { '@type': 'Place', name: 'Camp Wartburg', address: 'Camp Wartburg' },
|
||||
image: ['https://events.hope.test/api/uploads/camp.jpg'],
|
||||
url: `https://events.hope.test/events/${row.id}`,
|
||||
organizer: { '@type': 'Organization', name: 'Hope Family Church', url: 'https://events.hope.test' },
|
||||
// Before 2.4.0 the add-on T-shirt (R120) made this 120.00–450.00.
|
||||
offers: { '@type': 'AggregateOffer', lowPrice: '300.00', highPrice: '450.00', priceCurrency: 'ZAR', availability: 'https://schema.org/InStock', url: `https://events.hope.test/register/${row.id}`, validFrom: row.goLiveAt.toISOString() },
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user