Files
linkspin/weekendfact.js
T
martbost 5613d10224 Network Weekend (Marty 2026-11-17): ribbon, WEEKEND500 start gate, date-gated chatbot fact
- netdeals.js + /api/network-deals (hub /v1/network-deals) and /assets/netweekend.js loaded from common.js and netline.js:
  the ribbon shows only Fri 11-27 00:00 CT to Tue 12-01 00:00 CT by the page's own clock (common/netline ?v=20261117nw)
- promos: optional starts (MySQL promo_codes.starts) so a code can be created dormant and open by itself; setClock for tests
- weekendfact.js: chatbot FACTS for the event (live deal lines from the hub) Fri to Mon, the WEEKEND500 line to Tue 12-08 00:00 CT
- qa/networkweekend.test.cjs: 8 pass (test clocks only)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 07:22:52 -06:00

27 lines
2.4 KiB
JavaScript

// NETWORK WEEKEND chatbot fact (Marty 2026-11-17): date-gated, present only while it applies.
// Fri 11-27 00:00 CT to Tue 12-01 00:00 CT: the event is live; deal lines come from the hub feed (netdeals.js) by the Central day.
// Tue 12-01 00:00 CT to Tue 12-08 00:00 CT: only the WEEKEND500 code fact (Monday buyers get a week to redeem).
// CHATBOT_NOW (ISO) = test clock, tests only.
const NW = { start: Date.parse('2026-11-27T00:00:00-06:00'), end: Date.parse('2026-12-01T00:00:00-06:00'), codeEnd: Date.parse('2026-12-08T00:00:00-06:00') };
const NL = String.fromCharCode(10);
function nwNow() { const t = Date.parse(process.env.CHATBOT_NOW || ''); return Number.isNaN(t) ? Date.now() : t; }
function lines(now) {
const t = now === undefined ? nwNow() : now;
if (t < NW.start || t >= NW.codeEnd) return [];
const code = '- PROMO CODE WEEKEND500 (Network Weekend 2026): 500 LinkSpin ad credits (earned-grade), one per account, new and existing accounts. It is handed out on the InstantAdPay purchase notice for any InstantAdPay pack of $20 or more bought Fri 11-27 to Mon 11-30 (midnight to midnight Central). Redeem it in the promo code box on the LinkSpin dashboard until Tue 12-08 midnight Central. It is not a referral reward and pays nobody. Ad credits buy advertising, not income.';
if (t >= NW.end) return [code];
const out = ['- NETWORK WEEKEND (Black Friday to Cyber Monday 2026, LIVE NOW): Fri 11-27 to Mon 11-30, midnight to midnight Central; every deal ends Tue 12-01 00:00 Central (the InstantAdPay Game Pass bonus days run to Thu 12-03 midnight Central). All deals: https://instantadpay.com/weekend. LinkSpin prices and payouts are unchanged this weekend; the LinkSpin part is the WEEKEND500 code. Never quote earnings or income. Today\'s network deals:'];
try {
const ev = (require('./netdeals').current().events || []).find(e => t >= Date.parse(e.startsAt) && t < Date.parse(e.endsAt));
if (ev) {
const day = new Date(t - 6 * 3600 * 1000).toISOString().slice(0, 10);
for (const d of ev.deals) if (t < Date.parse(d.endsAt || ev.endsAt)) out.push(' * ' + d.name + ': ' + ((d.byDay && d.byDay[day]) || d.text) + (d.note ? ' ' + d.note : ''));
}
} catch (e) {}
out.push(code);
return out;
}
// '' outside the dates, else a newline then the fact lines (it follows ${launchFact()} on the same template line)
function weekendFact(now) { const l = lines(now); return l.length ? NL + l.join(NL) : ''; }
module.exports = { weekendFact, NW };