Member welcome offer + member perk: after a chapter clear, a signed-in non-member (IAP memberId 0) sees a dismissible "Become an InstantAdPay member" card once per Central day (bonus from IAP /api/starter/public, cached 10 min, skipped when off); a member's first hand-off grants one free hangar upgrade (token on the player, next purchase costs nothing, no POL moved), with a one-time lobby message

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-05 06:24:20 -05:00
parent 4fa68b2745
commit 09692de8c6
8 changed files with 218 additions and 13 deletions
+2 -1
View File
@@ -31,7 +31,7 @@ const sleep = ms => new Promise(r => setTimeout(r, ms));
const spawnLib = require('../lib/spawn');
(async () => {
await sleep(1200);
for (let i = 0; i < 60; i++) { try { await fetch(B + '/health'); break; } catch (e) { await sleep(250); } }
process.env.DR_SSO_SECRET = SECRET; const sso = require('../lib/sso');
const h = await call('/health'); eq([h.body.sso, h.body.faucet, h.body.signups], [true, false, 'testers'], 'posture: sso on, faucet off, testers mode');
@@ -81,6 +81,7 @@ const spawnLib = require('../lib/spawn');
// a replay of chapter 1 pays nothing; the hangar sink works; the sweep makes a payout row
const r2 = (await post('/api/run/start', { W, H })).body; eq(r2.chapter, 3, 'a new run starts on chapter 3 (progress kept)');
await post('/api/run/end', { runId: r2.runId });
const perkBuy = await post('/api/hangar/buy', { item: 'ship' }); eq([perkBuy.status, perkBuy.body.free], [200, true], 'the member perk (one free upgrade, 2026-10-05) pays for the first purchase'); // test/starter.js covers it in full
const buyNo = await post('/api/hangar/buy', { item: 'shield' }); eq(buyNo.status, 400, 'shield (0.05 POL) refused on a 0.01 balance');
await admin('/api/admin/settings', { itemPol: { slow: 0.005 } });
const buy = await post('/api/hangar/buy', { item: 'slow' }); eq([buy.status, buy.body.paid, buy.body.balance.unpaid], [200, '0.005 POL', 0.005], 'slow field bought from the POL balance');