Files

90 lines
12 KiB
JavaScript

// Stack POL's site assistant (Marty 2026-11-15): what it knows. The engine is chatcore.js (the same on every rebuilt site);
// retrieval also covers the other network sites through the hub (netkb.js), this site's entries first.
// Storage (2026-11-16): kb.json and netkb-cache.json are MySQL documents through docstore.js (DOCSTORE_URL, stackpol-mysql), so
// the entries and the cached network set survive a deploy. The OpenRouter key comes from the OPENROUTER_API_KEY env (a Coolify
// secret). No admin knowledge-base editing here.
//
// Every fact below was checked against this repo on KNOWLEDGE_DATE: server.js (the on-page FAQ, the pages, /api/totals, member
// stacks only when switched on), programs.js (the programs and their kinds), README.md (the indexer refreshes every 5 minutes;
// members are named only when opted in). Stack POL sells nothing and holds nothing.
// HOUSE RULE: when a feature changes, update CANNED and FACTS in the same commit and bump KNOWLEDGE_DATE.
// Plain words, no em dashes, never a promise of income, never quote totals as what someone will earn, never RM Circle.
'use strict';
const core = require('./chatcore');
const { PROGRAMS } = require('./programs');
const KNOWLEDGE_DATE = '2026-11-20';
// Network Weekend (Black Friday to Cyber Monday 2026): live Fri 11-27 00:00 CT to Tue 12-01 00:00 CT (CST = UTC-6); WEEKEND_NOW = test clock
const NW_START = Date.parse('2026-11-27T06:00:00Z'), NW_END = Date.parse('2026-12-01T06:00:00Z');
const nwNow = () => { const t = process.env.WEEKEND_NOW ? Date.parse(process.env.WEEKEND_NOW) : NaN; return Number.isNaN(t) ? Date.now() : t; };
const nwLive = () => { const t = nwNow(); return t >= NW_START && t < NW_END; };
const URL_ = String(process.env.SITE_URL || 'https://stackpol.com').replace(/\/+$/, '');
const SUPPORT = 'https://instantadpay.com/support';
const NAMES = PROGRAMS.map(p => p.n).join(', ');
const NOT_INCOME = 'No promise of income is made: the totals are what the whole network has paid so far, and many members earn little or nothing.';
const CANNED = [
{ id: 'support', title: 'Talk to a person, or a problem with my account', q: ['How do I contact support?', 'My payout is not on the ledger', 'I need a real person'], tags: ['support', 'help', 'ticket', 'problem'],
re: core.SUPPORT_RE, handoff: true,
a: 'Network support handles every network site: open ' + SUPPORT + ', say which program it is about, and include your username, your wallet address and the transaction link if you have one. Marty answers there and by email. Tap "Open network support" below and your question goes with you.' },
{ id: 'pro', title: 'Stack POL Pro: what it gives and how it unlocks', q: ['What is Stack POL Pro?', 'What does Pro give me?', 'Why does my Pro say Not yet?'], tags: ['pro', 'stack pol pro', 'banners', 'qr code', 'unlock'],
re: /(pro|pro member|premium|upgrade|not yet)/i,
a: 'Stack POL Pro puts your own LinkSpin Banner Spins in the ad spots on your Stack POL page, adds your spin links, and shows your QR code; any Stack POL page opened with ?ref=your-username carries your referral. It unlocks once, for good, with an InstantAdPay ad package of $10 or more bought on or after November 9, 2026, when Pro launched (packages bought before then do not unlock it). Your Pro status shows at ' + URL_ + '/my. If you think yours should be on, ask network support with your username.' },
{ id: 'my-stack', title: 'My Stack POL: signing in', q: ['How do I sign in to Stack POL?', 'What is My Stack POL?', 'Where are my join links?'], tags: ['sign in', 'my stack pol', 'login', 'join links', 'share kit'],
re: /(sign ?in|log ?in|my stack pol|\/my|join links|share kit)/i,
a: 'Go to ' + URL_ + '/my and tap "Sign in with your network account": it uses the account you already have on InstantAdPay, with no new password (not signed in there yet, it takes you through the InstantAdPay sign-in and straight back). Inside: your page switch, Pro, your join links for every network site, a share kit with a ready post, banner code, images and your QR code, and your own payouts.' },
{ id: 'about', title: 'What is Stack POL?', q: ['What is Stack POL?', 'How does Stack POL work?', 'What is this site?'], tags: ['stack pol', 'overview', 'ledger', 'payouts'],
re: /(what('s| is) (stack ?pol|this (site|place))|how does (stack ?pol|this site|it) work)/i,
a: 'Stack POL adds up every POL payout from the programs in the network: InstantAdPay, LinkSpin, the other network sites and the games that pay POL. The front page shows everyone combined, every row links to its Polygon transaction, and a member who switches it on gets their own page with their own stack. Stack POL only shows payouts; it sells nothing and holds nothing. ' + NOT_INCOME },
{ id: 'numbers', title: 'Where the numbers come from', q: ['Where do the numbers come from?', 'How often does it update?', 'Can I check a payment?'], tags: ['numbers', 'ledger', 'polygonscan', 'update'],
re: /(where do the numbers|numbers come from|how often|update[sd]?\b|refresh|check (a |the )?payment|polygonscan|verify)/i,
a: 'From each program\'s own payout records and from the network contracts on Polygon, refreshed every 5 minutes. Every row in the ledger (' + URL_ + '/ledger) links to its Polygon transaction, so anyone can check it on Polygonscan.' },
{ id: 'income', title: 'Is this income? Will I earn this much?', q: ['Will I earn this much?', 'Is this income?', 'How much can I make?'], tags: ['income', 'earnings', 'promise'],
re: /(will i (earn|make|get)|how much (can|will|do) (i|you|people) (earn|make)|is (this|it) income|earn this much|guarantee)/i,
a: NOT_INCOME + ' What one member stacks depends on what they do in each program.' },
{ id: 'my-page', title: 'Your own Stack POL page', q: ['How do I get my own Stack POL page?', 'Why is my name not on Stack POL?', 'How do I hide my page?'], tags: ['my page', 'opt in', 'username', 'promo tools'],
re: /(my (own )?(stack|page)|own (stack )?page|switch on|opt.?in|my name (is )?not|hide my|show my stack)/i,
a: 'Join InstantAdPay free, link a wallet, and switch on "Show my Stack POL page" in Promo tools. Your page lives at ' + URL_ + '/your-username and updates every 5 minutes. Members are named on Stack POL only when they switch it on.' },
{ id: 'programs', title: 'Which programs are on Stack POL', q: ['Which programs are on Stack POL?', 'Where does the POL come from?', 'Are the games included?'], tags: ['programs', 'games', 'sites', 'earn pages'],
re: /(which programs|what programs|programs (are|on)|where does the pol come from|games? (included|on)|\/earn)/i,
a: 'The programs on Stack POL: ' + NAMES + '. Each has its own page (for example ' + URL_ + '/earn/viraladblitz) and its own ledger filter, and each pays straight to members\' own wallets on Polygon. See them all at ' + URL_ + '/programs' },
{ id: 'start', title: 'How to start', q: ['How do I start?', 'How do I join?', 'Is it free?'], tags: ['join', 'start', 'free', 'instantadpay'],
re: /(how (do|can) i (start|join|sign ?up)|\bjoin\b|sign ?up|get started|is (it|this) free|free to join)/i,
a: 'Start free on InstantAdPay (https://instantadpay.com/join): one network account works across every network site. What you stack depends on what you do in each program. ' + NOT_INCOME },
{ id: 'custody', title: 'Does Stack POL hold my money?', q: ['Does Stack POL hold my money?', 'How do I withdraw from Stack POL?'], tags: ['custody', 'withdraw', 'wallet', 'safe'],
re: /(hold (my|the) (money|funds|pol)|withdraw|cash ?out|balance|safe|scam|legit)/i,
a: 'No. Stack POL only shows payouts. Every payment goes straight from the program to your own wallet on Polygon, so there is nothing here to withdraw.' },
{ id: 'pol', title: 'What is POL?', q: ['What is POL?', 'Is POL the same as MATIC?', 'Which wallet do I need?'], tags: ['pol', 'polygon', 'matic', 'wallet'],
re: /(what is pol|\bpol\b|matic|polygon|wallet|safepal|metamask)/i,
a: 'POL is the native token of the Polygon network, formerly MATIC. Fees are a fraction of a cent and transfers confirm in seconds, which is why small payouts work on it. To receive payouts, use SafePal or any other crypto wallet on Polygon, and never share your recovery phrase.' },
{ id: 'blog', title: 'The blog', q: ['Is there a blog?', 'Where are the guides?'], tags: ['blog', 'guides', 'articles'],
re: /\bblog\b|articles?|guides?|rss/i,
a: 'The blog at ' + URL_ + '/blog has guides on building in POL across the network, with an RSS feed at ' + URL_ + '/blog/feed.xml.' }
];
const FAQ = [
{ id: 'f-network', title: 'Stack POL and the network', source: 'faq', tags: ['network', 'one account'],
questions: ['Is Stack POL part of InstantAdPay?', 'Which network sites are there?'],
answer: 'Stack POL is the network\'s payout tracker. One network account works across InstantAdPay, LinkSpin, Downline Banners, Viral Banner Blitz, ViralAdBlitz, DownlineHydra, 5xYourTeam, Stack POL and Earners Corner, and each site\'s member payouts show here.' }
];
const FACTS = () => [
'- WHAT IT IS: Stack POL (' + URL_ + ') adds up every POL payout across the network: ' + NAMES + '. Front page = everyone combined (network totals, last 7 days, latest payouts), /programs, /earn/<program> pages, /ledger (filter ?p=), opt-in member pages ' + URL_ + '/<username>, /blog. It sells nothing and holds nothing: every payment goes from the program straight to the member\'s wallet on Polygon.',
'- DATA: each program\'s payout records and the network contracts on Polygon, refreshed every 5 minutes; every ledger row links to its Polygon transaction. Members are named only when they switch on "Show my Stack POL page" in InstantAdPay Promo tools (join InstantAdPay free and link a wallet first).',
(nwLive() ? '- NETWORK WEEKEND (live now, Black Friday to Cyber Monday, Fri 11-27 to Mon 11-30, midnight to midnight Central): Stack POL sells nothing itself. Its Pro view unlocks with any InstantAdPay package of $10 or more (an existing perk, not a weekend price), so a $10+ InstantAdPay pack this weekend also unlocks Stack POL Pro. Every network deal: https://instantadpay.com/weekend. Ad credits buy advertising, not income.' : null),
'- MY STACK POL (' + URL_ + '/my, live 2026-11-19): sign in with the network account (the InstantAdPay account; no new password). Shows the page switch, Pro status, join links for every network site, a share kit (ready post, banner code, images, QR code) and the payouts of that member.',
'- STACK POL PRO (it EXISTS; never say there is no Pro or paid tier): own LinkSpin Banner Spins in the page ad spots, own spin links and a QR code on the member page; ?ref=username on any Stack POL page carries their referral. Unlocks once, for good, with ONE InstantAdPay ad package of $10 or more bought on or after 2026-11-09 (Pro launch); packages bought before that date do not count, and several smaller packages do not add up. Status shows on /my as Pro or Not yet. Questions about a missing unlock go to network support.',
'- NEVER quote a total as what someone will earn; never state a maximum. ' + NOT_INCOME,
'- For how a program pays (prices, splits, rules), use that program\'s own knowledge-base entries and send people to that site. SUPPORT: network support at ' + SUPPORT + '.'
].filter(Boolean).join('\n');
const SITE = {
id: 'stackpol', hubSite: 'stackpol', netId: 'stackpol', name: 'Stack POL', url: URL_, supportUrl: SUPPORT, knowledgeDate: KNOWLEDGE_DATE,
dataDir: process.env.DATA_DIR || require('path').join(__dirname, 'data'), canned: CANNED, faq: FAQ, facts: FACTS,
intro: 'You are the assistant on Stack POL (' + URL_ + '), the network\'s payout tracker: it adds up every POL payout across the network\'s sites and games, each one checkable on Polygon. Most questions about how to earn belong to a specific program: answer from that program\'s entries and link to it.',
quickTopics: ['What is Stack POL?', 'How do I get my own page?', 'What is ViralAdBlitz?', 'How does Downline Banners pay?']
};
function init() { return core.init(SITE); }
module.exports = { init, handle: core.handle, answer: core.answer, KNOWLEDGE_DATE, CANNED, FAQ, SITE };