Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/website/src/scripts/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ document.querySelectorAll<HTMLFormElement>('form[data-checkout]').forEach((form)
xEvent('checkout', { value: PRICING.plans[plan].price, currency: PRICING.currency, contents: [{ content_id: plan }] });
});
});
// Founding 100: seats left; on any failure the counters keep their static text.
// Founding 100: seats left, shown only once enough are taken to read as proof; otherwise the deadline stays.
const SHOW_SEATS_FROM = 10;
const foundingSlots = document.querySelectorAll<HTMLElement>('[data-founding-slot]');
if (foundingSlots.length) {
fetch('/api/offer', { cache: 'no-store' })
Expand All @@ -356,6 +357,7 @@ if (foundingSlots.length) {
const data = (res ?? {}) as { seats?: unknown; left?: unknown; open?: unknown };
if (typeof data.left !== 'number' || typeof data.seats !== 'number') return;
const { left, seats } = data;
if (data.open && seats - left < SHOW_SEATS_FROM) return;
foundingSlots.forEach((slot) => {
const out = slot.querySelector<HTMLElement>('[data-founding-left]');
if (out) out.textContent = data.open ? `${left} of ${seats} left` : 'Founding seats are gone';
Expand Down
Loading