Network Weekend (Marty 2026-11-17): 2 free post credits a day Fri 11-27 00:00 CT to Tue 12-01 00:00 CT, live VBBShop SKU values on every page and in the chatbot, the network ribbon

weekend.js: the date gate (WEEKEND_NOW test clock), FREE_CREDITS_PER_DAY stays 1. chainskus.js: skus() read every 60 s, so the
$10 pack shows what the contract credits (50 once the owner signs setSku, 40 before or after). netdeals.js + /assets/netweekend.js:
/api/network-deals and the ribbon; the VBB line is built from live values and drops itself if there is nothing true to say.
chatcore render hook, chatbot FACTS/CANNED from live values with a dated weekend fact. qa/weekend.test.mjs 33 pass, chatbot 182, smoke 268.
common.js?v=10, my.js?v=6, packages.js?v=2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-17 07:26:05 -06:00
parent 7b973edcf8
commit 3e0dee517d
23 changed files with 314 additions and 32 deletions
+26
View File
@@ -0,0 +1,26 @@
// Network Weekend (Marty 2026-11-17): Black Friday to Cyber Monday 2026, Fri 11-27 00:00 CT to Tue 12-01 00:00 CT, exact instants
// (late November is CST, UTC-6). Switches on and off by itself; nothing to flip on the server.
// On this site: 2 free post credits a day for network members (FREE_CREDITS_PER_DAY stays the normal value, 1).
// The $10 pack's 50 credits are NOT here: that is the VBBShop SKU the owner wallet sets (see chainskus.js, the pages read it live).
// WEEKEND_NOW (ISO time) is the test clock: tests only, never set it on the server.
'use strict';
const START = Date.parse('2026-11-27T06:00:00Z'); // Fri 11-27 00:00 CT
const END = Date.parse('2026-12-01T06:00:00Z'); // Tue 12-01 00:00 CT
const FREE_PER_DAY = 2;
function now() { const o = process.env.WEEKEND_NOW; const t = o ? Date.parse(o) : NaN; return Number.isNaN(t) ? Date.now() : t; }
function on(ms) { ms = ms == null ? now() : ms; return ms >= START && ms < END; }
// free post credits per Central day: the weekend number while it runs, else the normal setting
function freePerDay(base, ms) { return on(ms) ? Math.max(Number(base) || 0, FREE_PER_DAY) : Number(base) || 0; }
// the ribbon's VBB deal line from live values: the biggest pack's credits as the contract holds them (chainskus.js) against the
// normal CREDIT_PACKS number, and today's free credits. Nothing true to say (the owner has not switched the SKU yet and it is not
// the weekend) = null, so the ribbon shows no VBB line rather than a wrong one.
function dealLine(C, d) {
const live = require('./chainskus').packs(C);
const big = live.slice().sort((a, b) => b.usd - a.usd)[0]; const base = (C.packs.slice().sort((a, b) => b.usd - a.usd)[0] || {}).credits;
const free = freePerDay(C.freeCreditsPerDay); const parts = [];
if (big && base && big.credits > base) parts.push('The $' + big.usd + ' pack carries ' + big.credits + ' credits instead of ' + base);
if (free > C.freeCreditsPerDay) parts.push((parts.length ? 'and network' : 'Network') + ' members get ' + free + ' free post credits a day');
if (!parts.length) return null;
const x = Object.assign({}, d, { text: parts.join(', ') + '.' }); delete x.byDay; return x;
}
module.exports = { START, END, FREE_PER_DAY, now, on, freePerDay, dealLine };