Login ads: flat 30-day slot, same as InstantAdPay

- Engine (JSON + MySQL twin): login ads are a slot buy (loginSlotCredits 1000,
  loginSlotDays 30, loginSlotsMax 3, dwell 10 s). createCampaign pins the budget
  to the slot price, sets the 30-day expiry and charges it once, purchased credits
  only (credited purchased grade first, the rest burns on-chain; viewing credits
  never pay). countLoginSlots counts live member slots (house never counts); a 4th
  is refused while 3 are live. Sign-in pick prefers member slots over the house.
  The per-day charge loop only runs for legacy login ads with no expiry.
- Day keys on Central time (ctDay / dayKeyNow / today) instead of UTC toISOString,
  incl. login lastShownDay, the daily sweep, claim streak and sign-in bonus.
- Beyond IAP: resuming a paused slot obeys the same cap, top-up is refused on a
  slot, the audit's days-charged check skips slots, JSON grantWelcome keeps the
  purchased grade.
- Ads screen: slot wording, loginSlots { max, used, free } from the API, chip and
  cost line show open slots, Launch disabled with an explanation when full; no Top
  up on slots; classic dashboard, earning page, admin rate labels and chatbot
  (canned answer + FACTS, KNOWLEDGE_DATE 2026-10-18) updated. Cache tags bumped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-18 05:45:30 -05:00
parent 44d40863db
commit 57b8eb4208
11 changed files with 51 additions and 28 deletions
+10 -6
View File
@@ -785,7 +785,7 @@
try {
const r = await (await fetch('/api/my/campaigns')).json();
if (r.error) return;
lastRates = r.rates;
lastRates = r.rates; lastSlots = r.loginSlots || null;
if ($('cGeoHint') && r.tiers) $('cGeoHint').textContent = 'All three ticked = everyone. Tier 1: ' + r.tiers.t1.join(', ') + '. Tier 2: ' + r.tiers.t2.join(', ') + '. Tier 3: every other country. Geo applies to delivery on this site; a narrowed banner or text ad is kept off the worldwide partner network. ' + (r.geoReady ? '' : 'Country data is still loading, so narrowed campaigns pause until it is ready. ') + 'IP geolocation by DB-IP.';
// populate the banner-size dropdown once (ids map to NAS width/height)
if (r.bannerSizes && $('cSize') && !$('cSize').options.length)
@@ -799,14 +799,14 @@
if ($('spendNote')) $('spendNote').textContent = r.inCampaigns
? 'Not counting ' + r.inCampaigns.toLocaleString() + ' credits already set aside for your live campaigns. That budget spends down inside each campaign below. This number only moves when you start, top up or pause a campaign.'
: 'This is what is not committed to a campaign. When you start one, its budget moves out of here and spends down inside the campaign.';
$('spendRates').innerHTML = [['Banner', r.rates.bannerCreditsPerBatch + ' cr / ' + r.rates.bannerBatch + ' views'], ['Text', r.rates.textCreditsPerBatch + ' cr / ' + r.rates.textBatch + ' views'], ['Login', r.rates.loginCreditsPerDay + ' cr / day'], ['Solo', r.rates.soloCostPerRecipient + ' cr / delivery'], ['Featured', (r.rates.featuredPerDay || 40) + ' cr / day'], ['Visit', (r.rates.visitCostPerVisit || 3) + ' cr / visit']].map(x => '<span><b>' + x[0] + '</b> ' + x[1] + '</span>').join('');
$('spendRates').innerHTML = [['Banner', r.rates.bannerCreditsPerBatch + ' cr / ' + r.rates.bannerBatch + ' views'], ['Text', r.rates.textCreditsPerBatch + ' cr / ' + r.rates.textBatch + ' views'], ['Login', (r.rates.loginSlotCredits || 1000).toLocaleString() + ' cr / ' + (r.rates.loginSlotDays || 30) + '-day slot'], ['Solo', r.rates.soloCostPerRecipient + ' cr / delivery'], ['Featured', (r.rates.featuredPerDay || 40) + ' cr / day'], ['Visit', (r.rates.visitCostPerVisit || 3) + ' cr / visit']].map(x => '<span><b>' + x[0] + '</b> ' + x[1] + '</span>').join('');
}
$('rateLine').textContent = 'Available to spend: ' + r.availableCredits.toLocaleString()
+ (r.earnedCredits ? ' (' + r.purchasedCredits.toLocaleString() + ' purchased + ' + r.earnedCredits + ' earned)' : '')
+ (r.inCampaigns ? ' · ' + r.inCampaigns.toLocaleString() + ' set aside in live campaigns' : '')
+ ' credits · rates: banner ' + r.rates.bannerCreditsPerBatch + 'cr/' + r.rates.bannerBatch
+ ' views, text ' + r.rates.textCreditsPerBatch + 'cr/' + r.rates.textBatch
+ ' views, login ' + r.rates.loginCreditsPerDay + 'cr/day, solo '
+ ' views, login ' + (r.rates.loginSlotCredits || 1000) + 'cr per ' + (r.rates.loginSlotDays || 30) + '-day slot, solo '
+ (r.rates.soloCostPerRecipient || 5) + 'cr/delivery';
const el = $('campList');
el.innerHTML = '';
@@ -841,7 +841,7 @@
}));
} catch (e) {}
}
let lastRates = null;
let lastRates = null, lastSlots = null;
function soloHint() {
if (!lastRates || $('cType').value !== 'solo') return;
const cost = lastRates.soloCostPerRecipient || 5;
@@ -895,12 +895,15 @@
});
const WHERE = { banner: 'Runs in the ad viewer, on the home page, the live ledger, every Overview, the sidebar tile, and out in the Network Ad Space rotation across the wider network.',
text: 'Runs in the ad viewer, the live ledger text slot, and out in the Network Ad Space rotation.',
login: 'Full screen for every member who signs in, ten seconds, once a day per member. Opens in a fresh tab, so any working page qualifies. Login ads spend purchased credits only.',
login: 'Full screen for every member who signs in, ten seconds, once a day per member. Opens in a fresh tab, so any working page qualifies. A slot is 1,000 purchased credits for 30 days of unlimited sign-in impressions, never charged per day. 3 slots at a time, first come first served. Login ads spend purchased credits only.',
solo: 'Delivered into member inboxes under Earn credits. Each read is timed and rewarded, so it gets opened.',
video: 'Plays in Watch videos and the Shorts feed under Earn credits. You pay only for completed watches.',
featured: 'Your headline and link in the Featured strip on every member Overview for the days you book.',
visits: 'A distinct member opens your site in a new tab, stays eight seconds and passes a check. Nobody counts twice.' };
const whereHint = () => { const el = $('cWhere'); if (el) el.textContent = WHERE[$('cType').value] || ''; };
const whereHint = () => { const el = $('cWhere'); if (!el) return; const t = $('cType').value; let s = WHERE[t] || '';
if (t === 'login' && lastRates) s = s.replace('1,000', (lastRates.loginSlotCredits || 1000).toLocaleString()).replace('30 days', (lastRates.loginSlotDays || 30) + ' days').replace('3 slots', (lastRates.loginSlotsMax || 3) + ' slots');
if (t === 'login' && lastSlots) s += lastSlots.free ? ' ' + lastSlots.free + ' of ' + lastSlots.max + ' slots open right now.' : ' All ' + lastSlots.max + ' slots are taken right now; a place opens when a running slot ends its ' + lastSlots.days + ' days.';
el.textContent = s; };
whereHint();
// runs on every type change AND once at load, so the default type (banner) shows its size + image rows immediately
function applyType() { // hoisted: loadCampaigns may run before this line is reached
@@ -924,6 +927,7 @@
// solo ads have a real floor (5cr x 10 deliveries): default to 50 so 10 isn't rejected
if (t === 'solo' && (!$('cBudget').value || Number($('cBudget').value) < 50)) $('cBudget').value = (lastRates && lastRates.soloCostPerRecipient ? lastRates.soloCostPerRecipient : 5) * 10;
if (t === 'visits') visitHint();
if (t === 'login') $('cBudget').value = (lastRates && lastRates.loginSlotCredits) || 1000; // a slot is one flat price
$('cTitle').placeholder = t === 'solo' ? 'Subject line (max 80)' : 'Headline (max 60)';
soloHint();
if (t === 'video') videoHint();