diff --git a/promodays.js b/promodays.js index 27ea71c..96f0e1d 100644 --- a/promodays.js +++ b/promodays.js @@ -15,7 +15,7 @@ // - the chatbot fact and answer, the /api/promodays view for the strip, Overview card and /weekend page // // Settings (siteConfig): promoDaysOn '1'|'0' (kill switch), promoDays (JSON {"YYYY-MM-DD": {pct, minCents, name}}), weekendStart / -// weekendEnd / weekendPassEnd (ISO), weekendLinkspinCode, weekendBuilderCap (25), promoMailBase (link base for emails, default the share domain instantadpay.link). +// weekendEnd / weekendPassEnd (ISO), weekendLinkspinCode, weekendBuilderCap (24: DH keeperGrantsLeft 49 on 11-17, minus 5 PRO_PENDING, keeps a 20-grant reserve), promoMailBase (link base for emails, default the share domain instantadpay.link). // Test clock: env IAP_TEST_NOW (ISO), ignored when NODE_ENV=production. Copy rules: no em dashes, Central times, no income promises. 'use strict'; const fs = require('fs'); @@ -35,7 +35,7 @@ const DEFAULT_DAYS = { }; const DEFAULTS = { weekendStart: '2026-11-27T00:00:00-06:00', weekendEnd: '2026-12-01T00:00:00-06:00', weekendPassEnd: '2026-12-04T00:00:00-06:00', - weekendLinkspinCode: 'WEEKEND500', weekendStarterMinCents: 2000, weekendBuilderMinCents: 10000, weekendBuilderCap: 25, + weekendLinkspinCode: 'WEEKEND500', weekendStarterMinCents: 2000, weekendBuilderMinCents: 10000, weekendBuilderCap: 24, passBonus: { explorer: 15, champion: 15, legend: 60 } // days on top of the tier's own (30, 30, 365) }; @@ -61,7 +61,8 @@ function cfg() { builderMin: Number(c.weekendBuilderMinCents) || DEFAULTS.weekendBuilderMinCents, builderCap: Math.max(0, Number(c.weekendBuilderCap == null ? DEFAULTS.weekendBuilderCap : c.weekendBuilderCap) || 0), mailBase: String(c.promoMailBase || 'https://instantadpay.link').replace(/\/+$/, ''), // instantadpay.com is on the Spamhaus DBL (still listed 2026-11-17): email links use the share domain - passBonus: DEFAULTS.passBonus + passBonus: DEFAULTS.passBonus, + tiersOn: String(c.sovTiers) === '1' // the tier passes are only on sale with sovTiers; the pass bonus days are only said while they are }; } // the mapped day at ts, or null: { day, pct, minCents, name } @@ -143,7 +144,7 @@ function view(t) { st = { packs, usd, bonusCredits: Object.values(S.granted).filter(g => g.day === d.day).reduce((s, g) => s + g.bonus, 0) }; } return { on: c.on, live, today: d ? { day: d.day, name: d.name, pct: d.pct, minUsd: d.minCents / 100, stats: st } : null, days: list, startsAt: new Date(c.start).toISOString(), endsAt: new Date(c.end).toISOString(), passEndsAt: new Date(c.passEnd).toISOString(), - published: true, passBonusLive: c.on && t >= c.start && t < c.passEnd, passBonus: c.passBonus, lsCode: live ? c.lsCode : null, builderCap: c.builderCap, note: CREDITS_LINE }; + published: true, passBonusLive: c.on && c.tiersOn && t >= c.start && t < c.passEnd, passBonus: c.passBonus, lsCode: live ? c.lsCode : null, builderCap: c.builderCap, note: CREDITS_LINE }; } // Thanksgiving: friday.js sends this instead of the normal Thursday copy when tomorrow is a mapped Friday (one message) @@ -165,10 +166,10 @@ function thursdayCopy(nextFridayKey) { // the chatbot (chatbot.js): a fact for the system prompt and one answer, only while the weekend (or the Game Pass days) is on function chatFact(t) { const c = cfg(); t = t == null ? now() : t; - if (!c.on || t < c.start - 86400000 || t >= c.passEnd) return ''; + if (!c.on || t < c.start - 86400000 || t >= (c.tiersOn ? c.passEnd : c.end)) return ''; if (t < c.start) return '- NETWORK WEEKEND (starts Fri 2026-11-27 00:00 Central, tomorrow): Black Friday to Cyber Monday, midnight to midnight Central. Not live yet: say it starts at midnight; deals at https://instantadpay.com/weekend.\n'; - if (t >= c.end) return '- NETWORK WEEKEND is over (it ended Mon 11-30 at midnight Central). Still on until Thu 12-03 23:59 Central: tier Game Pass bonus days (Explorer and Champion 45 days, Legend 365 + 60). Five Dollar Friday is back to +20% on $5+ from Fri 12-04.\n'; - return '- NETWORK WEEKEND (LIVE now, Fri 11-27 00:00 to Mon 11-30 23:59 Central, midnight to midnight): Black Friday +40% bonus ad credits on any $5+ pack (instead of the usual Five Dollar Friday +20%, never both) plus the free 7-day Game Pass; Saturday and Sunday +20% on $5+; Cyber Monday +30% on $20+. Weekend Starter Bundle: any $20+ pack gets the LinkSpin code ' + c.lsCode + ' (500 LinkSpin credits, shown on the purchase notice). Builder Bundle: any $100+ pack gets DownlineHydra Pro free for the paying wallet, first ' + c.builderCap + ' comps, nobody is paid on a comp. Code NETWORKWEEKEND: 300 bonus ad credits, paid in 5 daily installments as the member finishes the daily ad set, one per account, new and existing accounts, valid until Mon 11-30 23:59 Central. Tier Game Pass bonus days through Thu 12-03 23:59 Central (Explorer and Champion 45 days, Legend 365 + 60) when the tier passes are on sale. Every pack pays its sponsor line in full. No price is cut on InstantAdPay. All deals: https://instantadpay.com/weekend. Ad credits buy advertising, not income; never promise income.\n'; + if (t >= c.end) return !c.tiersOn ? '' : '- NETWORK WEEKEND is over (it ended Mon 11-30 at midnight Central). Still on until Thu 12-03 23:59 Central: tier Game Pass bonus days (Explorer and Champion 45 days, Legend 365 + 60). Five Dollar Friday is back to +20% on $5+ from Fri 12-04.\n'; + return '- NETWORK WEEKEND (LIVE now, Fri 11-27 00:00 to Mon 11-30 23:59 Central, midnight to midnight): Black Friday +40% bonus ad credits on any $5+ pack (instead of the usual Five Dollar Friday +20%, never both) plus the free 7-day Game Pass; Saturday and Sunday +20% on $5+; Cyber Monday +30% on $20+. Weekend Starter Bundle: any $20+ pack gets the LinkSpin code ' + c.lsCode + ' (500 LinkSpin credits, shown on the purchase notice). Builder Bundle: any $100+ pack gets DownlineHydra Pro free for the paying wallet, first ' + c.builderCap + ' comps, nobody is paid on a comp. Code NETWORKWEEKEND: 300 bonus ad credits, paid in 5 daily installments as the member finishes the daily ad set, one per account, new and existing accounts, valid until Mon 11-30 23:59 Central.' + (c.tiersOn ? ' Tier Game Pass bonus days through Thu 12-03 23:59 Central (Explorer and Champion 45 days, Legend 365 + 60).' : '') + ' Every pack pays its sponsor line in full. No price is cut on InstantAdPay. All deals: https://instantadpay.com/weekend. Ad credits buy advertising, not income; never promise income.\n'; } const CHAT_RE = /(black friday|cyber monday|network weekend|weekend (deal|sale|bonus|promo|special)s?|thanksgiving|bundle|networkweekend|friday (bonus|promo|deal|special)|five dollar friday)/i; function chatAnswer(msg, t) { diff --git a/qa/promodays.test.cjs b/qa/promodays.test.cjs index b2556f7..91919b1 100644 --- a/qa/promodays.test.cjs +++ b/qa/promodays.test.cjs @@ -90,7 +90,7 @@ test('bundles: $20+ in the window shows the LinkSpin code; $100+ also says Downl const bn = r.notices.filter(x => x.subject === 'Network Weekend: your bundle extras'); assert.strictEqual(bn.length, 2); assert.ok(bn.every(x => /WEEKEND500/.test(x.text) && /linkspin\.app/.test(x.text) && /Ad credits buy advertising, not income\./.test(x.text))); - assert.ok(/DownlineHydra Pro/.test(bn[1].text) && /first 25 comps/.test(bn[1].text) && !/DownlineHydra/.test(bn[0].text)); + assert.ok(/DownlineHydra Pro/.test(bn[1].text) && /first 24 comps/.test(bn[1].text) && !/DownlineHydra/.test(bn[0].text)); }); test('builders list for DownlineHydra: $100+ packs from Fri 00:00 CT to Tue 00:00 CT, lowercase wallets', async () => { @@ -101,7 +101,7 @@ test('builders list for DownlineHydra: $100+ packs from Fri 00:00 CT to Tue 00:0 assert.deepStrictEqual(out.builders.map(b => b.usdCents), [10000, 25000]); assert.strictEqual(out.builders[0].wallet, '0xabcdef0000000000000000000000000000000002'); assert.match(out.builders[1].wallet, /^0x[a]+3$/); - assert.strictEqual(out.cap, 25); + assert.strictEqual(out.cap, 24); }); test('Thanksgiving Thu 11-26 18:00 CT: the Friday notice and email carry the Black Friday copy, once; a normal Thursday stays normal', async () => { @@ -147,7 +147,9 @@ test('chatbot: fact and answer only around the window; the Friday question on Bl assert.strictEqual(pd.chatFact(T('2026-11-25T12:00:00Z')), ''); assert.match(pd.chatFact(T('2026-11-26T12:00:00Z')), /starts Fri 2026-11-27 00:00 Central/); assert.match(pd.chatFact(T('2026-11-28T12:00:00Z')), /LIVE now/); - assert.match(pd.chatFact(T('2026-12-02T12:00:00Z')), /is over/); + assert.strictEqual(pd.chatFact(T('2026-12-02T12:00:00Z')), '', 'sovTiers off (live 11-17): no tier pass days to talk about after Mon'); + assert.ok(!/Game Pass bonus days/.test(pd.chatFact(T('2026-11-28T12:00:00Z'))), 'sovTiers off: the live fact leaves the tier days out'); + { const r2 = rig([], { sovTiers: '1' }); assert.match(r2.pd.chatFact(T('2026-12-02T12:00:00Z')), /is over.*Game Pass bonus days/); assert.match(r2.pd.chatFact(T('2026-11-28T12:00:00Z')), /Game Pass bonus days/); } assert.strictEqual(pd.chatFact(T('2026-12-04T06:00:00Z')), ''); assert.strictEqual(pd.chatAnswer('what is five dollar friday', T('2026-11-20T12:00:00Z')), null); assert.match(pd.chatAnswer('any black friday deal?', T('2026-11-27T15:00:00Z')), /Today is Black Friday: \+40% bonus ad credits on any \$5\+ pack/); diff --git a/qa/weekend.e2e.mjs b/qa/weekend.e2e.mjs index d08433b..ab9b3da 100644 --- a/qa/weekend.e2e.mjs +++ b/qa/weekend.e2e.mjs @@ -43,7 +43,7 @@ let fn; assert.strictEqual((await fetch(base + '/api/network/weekend-builders')).status, 401); assert.strictEqual((await fetch(base + '/api/network/weekend-builders', { headers: { 'X-Weekend-Key': 'x'.repeat(48) } })).status, 401); const b = await fetch(base + '/api/network/weekend-builders', { headers: { 'X-Weekend-Key': KEY } }); assert.strictEqual(b.status, 200); - const bj = await b.json(); assert.ok(Array.isArray(bj.builders) && bj.cap === 25 && bj.start === '2026-11-27T06:00:00.000Z'); ok('builders feed: key required, shape right'); + const bj = await b.json(); assert.ok(Array.isArray(bj.builders) && bj.cap === 24 && bj.start === '2026-11-27T06:00:00.000Z'); ok('builders feed: key required, shape right'); let { pg, ctx, errs } = await page(base, nowIso, '/weekend'); const state = await pg.textContent('#nwState'); assert.match(state, /It is Black Friday\. \+40% bonus ad credits on any \$5\+/); ok('/weekend live state'); assert.strictEqual(await pg.locator('.nw-day').count(), 4); assert.ok(await pg.locator('.nw-day.today').count() === 1); @@ -85,7 +85,7 @@ let fn; }; await run('2026-11-30T20:00:00Z', 8814); fn = async (base, nowIso) => { - const v = await (await fetch(base + '/api/promodays')).json(); assert.ok(!v.live && v.today === null && v.passBonusLive === true); ok('Tue 12-01: weekend off, pass days still on'); + const v = await (await fetch(base + '/api/promodays')).json(); assert.ok(!v.live && v.today === null && v.passBonusLive === false); ok('Tue 12-01: weekend off; no pass days shown while sovTiers is off'); const { pg, ctx } = await page(base, nowIso, '/'); assert.strictEqual(await pg.locator('.nw-ribbon').count(), 0); assert.strictEqual(await pg.locator('#nwStrip:not([hidden])').count(), 0); ok('Tue: no ribbon, no strip'); await ctx.close(); }; await run('2026-12-01T15:00:00Z', 8815);