Files
linkspin/public/credits.html
T
martbost 211eb5a0e8 Traffic sources: network macros, campaign URLs, per-source postbacks, Reports dimension
A Source is a first-class record of a network a member buys traffic on (PropellerAds,
Zeropark, Adsterra, ExoClick and 25 more from the shipped catalog, or defined by hand).
It remembers the network's macro tokens and conversion postback, attaches to spin links,
builds the exact campaign URL to paste into the network, fires that network's own
postback only for clicks that came through it, and shows up in Reports by source and
by the zone / placement / site the macro carried.

- data/traffic-sources.json: catalog of 29 networks (BeMob template harvest), un-ignored
  via data/* + !data/traffic-sources.json; loader tolerates missing fields, null costModel,
  {{slot}} labels with spaces and parentheses, optional slots, unknown single-brace macros
- sources.js: DATA_DIR/sources.json model, 30 per account, 20 params, key allow-list,
  postbacks.validateUrl on the filled postback; list/create/update/get/urlFor/test
- rotator.js: update() takes sourceId (owner-checked), pub() exposes it, hits and conversions
  are stamped with the source at click time (sr), wider query allow-list (cost, creative,
  site, banner, keyword, geo, os, browser, device, carrier, format, external_id, visitor_id),
  summary() adds sources[] and placements[], sourceCounts(), detachSource()
- postbacks.js: fire() delivers the matching source's postback after the manual ones through
  the same deliver() (guards, retry, rate cap, auto-disable); log rows carry source; convertFor,
  inbound and the page lead path pass sourceId; fill/deliver/logForSource exported
- routes (GET and POST): /api/sources/catalog, /api/my/sources, /api/my/sources/<id>,
  /api/my/sources/<id>/url; /sources screen
- /sources Control Room screen (list + Campaign URL / Postback / Settings tabs, two-step
  New source dialog); Links share kit gets a source select and a "Campaign URL for <network>"
  first row; Reports gets Traffic sources and Placements; rail entry; chatbot canned answer,
  FACTS line and KNOWLEDGE_DATE 2026-10-12
- cr.css: phone rail icons only at 34px so ten entries fit; cache tags bumped to 20261012a

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-12 11:16:24 -05:00

87 lines
5.4 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<meta name="robots" content="noindex, nofollow">
<title>Credits · LinkSpin</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rajdhani:wght@600;700&family=Manrope:wght@400;500;700&family=JetBrains+Mono:wght@500;700&display=swap">
<link rel="stylesheet" href="/assets/cr.css?v=20261012a">
<style>
.body{padding:16px 24px;display:grid;gap:16px}
.two{display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:16px;align-items:start}
.pkgs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.pk{border:1px solid var(--line);border-radius:8px;padding:12px 12px 10px;background:#FFF;display:flex;flex-direction:column;gap:4px;cursor:pointer;text-align:left;font:inherit;color:inherit;min-height:44px;box-shadow:var(--sh)}
.pk:hover{border-color:var(--accent)}
.pk.on{border-color:var(--sig);box-shadow:0 0 0 3px rgba(255,106,26,.18);background:linear-gradient(180deg,#FFFFFF,var(--hi-row))}
.pk .k{font:700 10px var(--mono);letter-spacing:.1em;text-transform:uppercase;color:var(--muted)}
.pk.on .k{color:var(--sig-2)}
.pk .price{font-family:var(--display);font-weight:700;font-size:28px;line-height:1;letter-spacing:.02em}
.pk.on .price{color:var(--accent-hi)}
.pk .cr{font-size:12px;color:var(--ink-2)}
.pk .tag{align-self:flex-start;margin-top:2px}
.row{display:flex;justify-content:space-between;gap:10px;padding:8px 0;border-bottom:1px solid var(--line);font-size:13px}
.row:last-child{border-bottom:0}
.buys .hd,.buys .rw{grid-template-columns:150px 110px 130px minmax(0,1fr)}
.acts{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
@media (max-width:900px){.two{grid-template-columns:1fr}.pkgs{grid-template-columns:repeat(2,minmax(0,1fr))}.buys .hd{display:none}.buys .rw{grid-template-columns:1fr 1fr}.body{padding:12px 16px}}
</style>
</head>
<body>
<div id="page">
<div class="body">
<div class="tiles" id="tiles"></div>
<div class="two">
<div style="display:grid;gap:16px;align-content:start">
<div class="panel" style="padding:0">
<div class="ph"><h3>Buy a package</h3><span class="meta" id="buyMeta">priced in dollars · settled in POL at the live rate · one transaction</span></div>
<div style="padding:14px 16px 16px;display:grid;gap:14px">
<div class="pkgs" id="pkgs"><div class="muted">loading packages…</div></div>
<div class="acts">
<span class="led"><span style="font-size:10px;letter-spacing:.1em;text-transform:uppercase">you pay</span><b id="payPol">·</b><span id="payUsd"></span></span>
<span class="mono muted" style="font-size:11px" id="rateLine"></span>
</div>
<div class="acts" id="buyActs">
<button class="btn pri" type="button" id="buyBtn" disabled>Connect a wallet to buy</button>
<button class="btn" type="button" id="cardBtn">Buy POL with a card</button>
<span class="muted" style="font-size:12px">SafePal recommended. MetaMask, Phantom and WalletConnect wallets also work.</span>
</div>
<div id="holdBox" class="warn" style="font-size:13px" hidden></div>
<p class="ink2" style="margin:0;font-size:12.5px;line-height:1.5" id="sponsorLine">Loading your sponsor…</p>
</div>
</div>
<div class="tbl buys">
<div class="ph"><h3>Your purchases</h3><span class="meta" id="buysMeta">every row links to the transaction</span></div>
<div class="hd"><span>When</span><span>Package</span><span>Paid</span><span>Transaction</span></div>
<div id="buyRows"></div>
<div class="ft">credits appear in Ads the moment the transaction settles · nothing is held by the site</div>
</div>
</div>
<div style="display:grid;gap:16px;align-content:start">
<div class="panel" style="padding:0">
<div class="ph"><h3 id="goesTitle">Where it goes</h3><span class="meta">same transaction</span></div>
<div style="padding:10px 16px 14px" id="goesRows"></div>
</div>
<div class="panel" style="padding:0">
<div class="ph"><h3>Your wallet</h3><span class="meta" id="walletMeta"></span></div>
<div style="padding:12px 16px 14px;display:grid;gap:10px" id="walletBox"></div>
</div>
<div class="panel" style="padding:0">
<div class="ph"><h3>Earn instead</h3><span class="meta">free credits</span></div>
<div style="padding:12px 16px 14px;display:grid;gap:8px;font-size:13px" class="ink2">
<div style="display:flex;justify-content:space-between;gap:10px"><span>View 5 ads, claim 5 credits</span><a href="/ads" style="font-weight:700;text-decoration:none">Ads →</a></div>
<div style="display:flex;justify-content:space-between;gap:10px"><span>Run a zone on your site</span><a href="/zones" style="font-weight:700;text-decoration:none">Zones →</a></div>
<div style="display:flex;justify-content:space-between;gap:10px"><span>Sign-in ad, once a day</span><span class="mono muted" style="font-size:11px">automatic</span></div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="/assets/common.js?v=20261009a"></script>
<script src="/assets/wallet.js?v=20261008a"></script>
<script src="/assets/cr-shell.js?v=20261012a"></script>
<script src="/assets/credits-screen.js?v=20261007a"></script>
</body>
</html>