Daily login bonus (streak) + solo-ad budget default

- Daily login bonus: once/day, base 5 credits + gentle streak (+1/day, cap +5)
  for consecutive days; granted after sign-in, toast + cha-ching. New
  login_day/login_streak on earned_credits; /api/my/login-bonus.
- Solo ad: selecting Solo now defaults Budget to 50 credits (5cr x 10 min
  deliveries) so entering 10 isn't rejected after submit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-07 08:19:40 -05:00
parent a8968041dc
commit 4a9e4c789e
5 changed files with 20 additions and 1 deletions
+11
View File
@@ -285,6 +285,15 @@
chatSync(d);
MYID = d.memberId || MYID;
startLiveFeed();
if (!window.__lbChecked) { // daily login bonus, once per session (server guards once/day)
window.__lbChecked = true;
api('/api/my/login-bonus').then(r => {
if (r && r.granted > 0) {
IAP.status('🎁 Daily login bonus: +' + r.granted + ' credits' + (r.streak > 1 ? ' · ' + r.streak + '-day streak' : '') + '!', 'ok');
playSound('chaching'); setTimeout(loadDashboard, 900);
}
}).catch(() => {});
}
const wc = d.welcomeCredits || 0;
$('dbCredits').textContent = ((d.credits || 0) + wc).toLocaleString();
$('dbCreditsSub').textContent = wc ? (d.credits || 0).toLocaleString() + ' purchased · ' + wc + ' welcome' : '';
@@ -592,6 +601,8 @@
// fixed-cost types derive their spend (featured = day slots, visits = flat pack),
// so hide the free-form Budget field for them to avoid confusion
$('cBudgetRow').hidden = (t === 'featured' || t === 'visits');
// 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();
$('cTitle').placeholder = t === 'solo' ? 'Subject line (max 80)' : 'Headline (max 60)';
soloHint();