Paywell / website · paywell.company / commits / 7e0f71a3
Website: current files new
written by Branchwell · 7e0f71a365c394e3d705901a3d571633d0a233ae
56 files changed
404.html added
| 1 | + <!doctype html> | |
| 2 | + <html lang="en"> | |
| 3 | + <head> | |
| 4 | + <meta charset="utf-8"> | |
| 5 | + <meta name="viewport" content="width=device-width,initial-scale=1"> | |
| 6 | + <title>Page not found | Paywell</title> | |
| 7 | + <meta name="description" content="This page doesn’t exist."> | |
| 8 | + <link rel="canonical" href="https://paywell.company/404"> | |
| 9 | + <meta property="og:type" content="website"><meta property="og:site_name" content="Paywell"> | |
| 10 | + <meta property="og:title" content="Page not found | Paywell"><meta property="og:description" content="This page doesn’t exist."> | |
| 11 | + <meta property="og:url" content="https://paywell.company/404"><meta property="og:image" content="https://paywell.company/img/og.jpg"> | |
| 12 | + <meta name="twitter:card" content="summary_large_image"> | |
| 13 | + <meta name="theme-color" content="#0f3d2e"> | |
| 14 | + <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='9' fill='%230f3d2e'/%3E%3Ccircle cx='16' cy='14.5' r='8.5' fill='%23e0a526'/%3E%3Ccircle cx='16' cy='14.5' r='6.6' fill='none' stroke='%230f3d2e' stroke-opacity='.35' stroke-width='1'/%3E%3Cpath d='M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z' fill='%230f3d2e'/%3E%3Cpath d='M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4' fill='none' stroke='%237fd1a3' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E"> | |
| 15 | + <link rel="manifest" href="/app/manifest.webmanifest"> | |
| 16 | + <link rel="stylesheet" href="/assets/site.css"> | |
| 17 | + </head> | |
| 18 | + <body> | |
| 19 | + <a class="skip" href="#main">Skip to content</a> | |
| 20 | + <div class="wrap"> | |
| 21 | + <header class="top"><a class="brand" href="/"><svg viewBox="0 0 32 32" aria-hidden="true"><rect width="32" height="32" rx="9" fill="#0f3d2e"/><circle cx="16" cy="14.5" r="8.5" fill="#e0a526"/><circle cx="16" cy="14.5" r="6.6" fill="none" stroke="#0f3d2e" stroke-opacity=".35" stroke-width="1"/><path d="M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z" fill="#0f3d2e"/><path d="M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4" fill="none" stroke="#7fd1a3" stroke-width="2.2" stroke-linecap="round"/></svg>Paywell</a><nav class="main" aria-label="Main"><a href="/how-it-works/">How it works</a><a href="/fair-pay/">Fair pay</a><a href="/learn/">Bitcoin basics</a><a href="/rate/">Rate a visit</a><a href="/app/">Team app</a><a href="/open/">Open code</a></nav></header> | |
| 22 | + </div> | |
| 23 | + <main id="main"> | |
| 24 | + <div class="wrap"><section style="padding:60px 0 90px"><h1 class="sm">We couldn’t find that page.</h1><p class="lede">If you were trying to rate a visit, check the link on your receipt, text or email, or enter your code.</p><div class="btns"><a class="btn" href="/rate/">Rate a visit</a><a class="btn o" href="/">Home</a></div></section></div> | |
| 25 | + </main> | |
| 26 | + <div class="wrap"><footer class="site">Paywell <span aria-hidden="true">·</span> <a href="/careers/">Careers</a></footer></div> | |
| 27 | + </body> | |
| 28 | + </html> |
app/app.css added
| 1 | + .app-intro{padding:8px 0 18px} | |
| 2 | + .app{background:var(--card);border:1px solid var(--line);border-radius:28px;overflow:hidden} | |
| 3 | + .tabs{display:flex;gap:4px;overflow-x:auto;padding:10px;border-bottom:1px solid var(--line);background:var(--tint);scrollbar-width:none} | |
| 4 | + .tabs button{flex:0 0 auto;min-height:44px;padding:10px 16px;border-radius:999px;border:0;background:transparent;color:var(--mut);font:inherit;font-size:15px;font-weight:600;cursor:pointer} | |
| 5 | + .tabs button[aria-current=page]{background:var(--card);color:var(--fg);box-shadow:0 1px 3px rgba(0,0,0,.08)} | |
| 6 | + .panel{padding:24px;outline:0} | |
| 7 | + .pg{display:grid;gap:16px} | |
| 8 | + .g2{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:16px} | |
| 9 | + .tile{border:1px solid var(--line);border-radius:20px;padding:20px;background:var(--bg)} | |
| 10 | + .tile h3{font-size:15px;color:var(--mut);font-weight:600;margin:0 0 6px} | |
| 11 | + .usd{font-size:34px;font-weight:750;letter-spacing:-.02em;line-height:1.1} | |
| 12 | + .usd.big{font-size:46px} | |
| 13 | + .btc{font-size:14px;color:var(--mut);margin-top:4px} | |
| 14 | + .tile p{margin:8px 0 0;color:var(--mut);font-size:15px} | |
| 15 | + .pill{display:inline-block;font-size:13px;font-weight:650;padding:4px 10px;border-radius:999px;background:var(--tint);color:var(--ac)} | |
| 16 | + .pill.hold{background:var(--warn);color:var(--warn-fg)} | |
| 17 | + .pill.no{background:rgba(128,128,128,.15);color:var(--mut)} | |
| 18 | + .row{display:flex;justify-content:space-between;gap:12px;align-items:center;padding:14px 0;border-bottom:1px solid var(--line)} | |
| 19 | + .row:last-child{border-bottom:0} | |
| 20 | + .row .l{min-width:0}.row .l b{display:block}.row .l span{color:var(--mut);font-size:14px} | |
| 21 | + .row .r{text-align:right;white-space:nowrap} | |
| 22 | + .stars{color:var(--gold);letter-spacing:1px} | |
| 23 | + .acts{display:flex;gap:10px;flex-wrap:wrap} | |
| 24 | + .acts .btn{flex:1;min-width:140px} | |
| 25 | + .toggle{display:flex;align-items:center;gap:10px;font-size:15px;color:var(--mut);cursor:pointer;min-height:44px} | |
| 26 | + .toggle input{width:22px;height:22px;accent-color:var(--ac)} | |
| 27 | + .fm{display:grid;gap:10px;max-width:520px} | |
| 28 | + .fm label{font-weight:650} | |
| 29 | + .fm input,.fm textarea,.fm select{min-height:50px;padding:12px 14px;border-radius:14px;border:1.5px solid var(--line);background:var(--card);color:var(--fg);font:inherit} | |
| 30 | + .note{background:var(--warn);color:var(--warn-fg);border-radius:16px;padding:14px 16px;font-size:15px} | |
| 31 | + .scroll{overflow-x:auto} | |
| 32 | + .check{display:flex;gap:14px;align-items:flex-start;padding:14px 0;border-bottom:1px solid var(--line)} | |
| 33 | + .check i{flex:0 0 28px;height:28px;border-radius:999px;display:grid;place-items:center;font-style:normal;font-weight:800;background:var(--tint);color:var(--ac)} | |
| 34 | + .check i.x{background:var(--warn);color:var(--warn-fg)} | |
| 35 | + .panel h2{font-size:24px;margin:0 0 4px} | |
| 36 | + @media (max-width:560px){.panel{padding:16px}.usd.big{font-size:38px}.app{border-radius:20px}} | |
| 37 | + /* Team chat */ | |
| 38 | + .chat{display:grid;grid-template-columns:210px 1fr;gap:16px;min-height:540px} | |
| 39 | + .chs{display:flex;flex-direction:column;gap:4px} | |
| 40 | + .ch{display:flex;align-items:center;gap:6px;min-height:44px;padding:8px 14px;border-radius:999px;border:0;background:transparent;color:var(--mut);font:inherit;font-size:15px;font-weight:600;cursor:pointer;text-align:left} | |
| 41 | + .ch span{opacity:.6}.ch i{margin-left:auto;font-style:normal;font-size:12px;background:var(--gold);color:#1b1300;border-radius:999px;padding:1px 8px} | |
| 42 | + .ch[aria-current=true]{background:var(--tint);color:var(--fg)} | |
| 43 | + .room{display:flex;flex-direction:column;border:1px solid var(--line);border-radius:22px;background:var(--bg);overflow:hidden;min-width:0} | |
| 44 | + .roomh{padding:14px 18px;border-bottom:1px solid var(--line);display:flex;gap:10px;align-items:baseline;flex-wrap:wrap}.roomh span{color:var(--mut);font-size:14px} | |
| 45 | + .msgs{flex:1;overflow-y:auto;max-height:520px;padding:10px 14px} | |
| 46 | + .msg{display:flex;gap:12px;padding:10px 4px} | |
| 47 | + .av{flex:0 0 38px;height:38px;border-radius:14px;color:#fff;display:grid;place-items:center;font-weight:800} | |
| 48 | + .mb{min-width:0}.mh b{margin-right:8px}.mh span{color:var(--mut);font-size:13px} | |
| 49 | + .mb p{margin:2px 0 4px;overflow-wrap:anywhere} | |
| 50 | + .res{display:flex;gap:6px;flex-wrap:wrap;margin-top:4px} | |
| 51 | + .re{min-height:32px;padding:2px 10px;border-radius:999px;border:1px solid var(--line);background:var(--card);color:var(--fg);font:inherit;font-size:14px;cursor:pointer} | |
| 52 | + .re.add{opacity:.55}.re:hover{border-color:var(--ac)} | |
| 53 | + .gif{display:inline-flex;flex-direction:column;align-items:center;justify-content:center;width:170px;height:118px;border-radius:18px;margin:6px 0 2px;color:#1b1b1b;overflow:hidden} | |
| 54 | + .ge{font-size:48px;line-height:1;display:block}.gw{font-weight:800;font-size:15px;margin-top:6px;letter-spacing:.01em} | |
| 55 | + .a-pop .ge{animation:pop 1s infinite}.a-wag .ge{animation:wag .6s infinite alternate}.a-pulse .ge{animation:pulse .9s infinite}.a-shake .ge{animation:shake .5s infinite}.a-float .ge{animation:float 1.6s infinite ease-in-out}.a-spin .ge{animation:spin 2s infinite linear}.a-launch .ge{animation:launch 1.4s infinite} | |
| 56 | + @keyframes pop{0%,100%{transform:scale(1)}50%{transform:scale(1.25) rotate(-8deg)}} | |
| 57 | + @keyframes wag{from{transform:rotate(-14deg)}to{transform:rotate(14deg)}} | |
| 58 | + @keyframes pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.18)}} | |
| 59 | + @keyframes shake{0%,100%{transform:translateX(0)}25%{transform:translateX(-5px)}75%{transform:translateX(5px)}} | |
| 60 | + @keyframes float{0%,100%{transform:translateY(0)}50%{transform:translateY(-8px)}} | |
| 61 | + @keyframes spin{to{transform:rotate(360deg)}} | |
| 62 | + @keyframes launch{0%{transform:translateY(10px)}60%{transform:translateY(-12px)}100%{transform:translateY(10px)}} | |
| 63 | + @media (prefers-reduced-motion:reduce){.gif .ge{animation:none!important}} | |
| 64 | + .gifs{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:8px;padding:12px 14px;border-top:1px solid var(--line);max-height:240px;overflow-y:auto} | |
| 65 | + .gifs button{border:0;padding:0;background:none;cursor:pointer;border-radius:18px} | |
| 66 | + .gifs .gif{width:100%;height:96px;margin:0}.gifs .ge{font-size:38px} | |
| 67 | + .compose{display:flex;gap:8px;padding:12px;border-top:1px solid var(--line);background:var(--card)} | |
| 68 | + .compose input{flex:1;min-width:0;min-height:48px;padding:10px 16px;border-radius:999px;border:1.5px solid var(--line);background:var(--bg);color:var(--fg);font:inherit} | |
| 69 | + .gifbtn{min-width:56px;min-height:48px;border-radius:999px;border:1.5px solid var(--line);background:linear-gradient(135deg,#ffd166,#ef476f);color:#1b1b1b;font:inherit;font-weight:800;cursor:pointer} | |
| 70 | + .send{min-height:48px;padding:10px 20px} | |
| 71 | + .chatnote{margin:0;padding:0 14px 10px;background:var(--card)} | |
| 72 | + .app.out .tabs{display:none} | |
| 73 | + .signin{margin:30px auto;max-width:420px;text-align:center;justify-items:center} | |
| 74 | + .signin .btn{width:100%;min-height:56px;font-size:18px} | |
| 75 | + @media (max-width:700px){.chat{grid-template-columns:1fr;min-height:0}.chs{flex-direction:row;overflow-x:auto;scrollbar-width:none}.ch{flex:0 0 auto}.msgs{max-height:60vh}} | |
| 76 | + /* Take payment */ | |
| 77 | + .tap{text-align:center;display:grid;justify-items:center;gap:6px} | |
| 78 | + .nfc{position:relative;width:110px;height:110px;margin:6px auto 8px} | |
| 79 | + .nfc span{position:absolute;inset:0;border:3px solid var(--ac);border-radius:999px;opacity:0;animation:ring 2.2s infinite} | |
| 80 | + .nfc span:nth-child(2){animation-delay:.7s}.nfc span:nth-child(3){animation-delay:1.4s} | |
| 81 | + @keyframes ring{0%{transform:scale(.3);opacity:.9}100%{transform:scale(1);opacity:0}} | |
| 82 | + @media (prefers-reduced-motion:reduce){.nfc span{animation:none;opacity:.5}} | |
| 83 | + .big-ok{width:72px;height:72px;border-radius:999px;background:var(--a);color:var(--on-a);display:grid;place-items:center;font-size:38px;font-weight:800} | |
| 84 | + .cust{display:grid;gap:4px;max-width:320px;margin:8px auto;padding:18px;border-radius:24px;border:1px solid var(--line);background:var(--card)} | |
| 85 | + .custstars{color:var(--gold);font-size:34px;letter-spacing:4px} | |
| 86 | + .qr{display:grid;grid-template-columns:repeat(21,1fr);width:210px;height:210px;padding:12px;background:#fff;border-radius:16px;margin:10px auto} | |
| 87 | + .qr i{display:block}.qr i.on{background:#0f3d2e} | |
| 88 | + | |
| 89 | + .bar{height:10px;border-radius:999px;background:var(--tint);overflow:hidden;margin:8px 0}.bar i{display:block;height:100%;background:var(--ac);border-radius:999px} | |
| 90 | + .choice{display:flex;gap:12px;align-items:flex-start;border:1px solid var(--line);border-radius:18px;padding:14px 16px;margin:8px 0;cursor:pointer;background:var(--card)}.choice input{width:22px;height:22px;margin-top:2px;accent-color:var(--ac);flex:none}.choice>span{display:grid;gap:2px}.choice:has(input:checked){border-color:var(--ac);background:var(--tint)} | |
| 91 | + #ownbox label{display:block;margin:10px 0 6px;font-weight:650}#ownbox input{display:block;width:100%;font-family:ui-monospace,monospace} | |
| 92 | + /* Real app */ | |
| 93 | + .err{color:#b3261e;font-weight:600;margin:6px 0 0;min-height:1em} | |
| 94 | + @media (prefers-color-scheme:dark){.err{color:#ff8a80}} | |
| 95 | + .or{display:flex;align-items:center;gap:12px;color:var(--mut);font-size:14px;margin:14px 0;width:100%}.or::before,.or::after{content:"";flex:1;height:1px;background:var(--line)} | |
| 96 | + .signin.wide{max-width:520px;text-align:left;justify-items:stretch} | |
| 97 | + .calc{font-size:15px;color:var(--mut);background:var(--tint);border-radius:14px;padding:10px 14px;margin-top:10px;overflow-wrap:anywhere} | |
| 98 | + .mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;overflow-wrap:anywhere;word-break:break-all} | |
| 99 | + .center{text-align:center;justify-items:center} | |
| 100 | + .qrbox{display:grid;place-items:center;margin:10px auto}.qrbox svg{width:220px;height:220px;background:#fff;padding:10px;border-radius:16px} | |
| 101 | + .starpick{display:flex;gap:6px;flex-wrap:wrap}.starpick label{cursor:pointer}.starpick input{position:absolute;opacity:0;width:1px;height:1px} | |
| 102 | + .starpick span{display:inline-grid;place-items:center;min-width:52px;min-height:44px;padding:4px 10px;border-radius:999px;border:1.5px solid var(--line);background:var(--card);font-weight:700} | |
| 103 | + .starpick input:checked+span{background:var(--gold);border-color:var(--gold);color:#1b1300}.starpick input:focus-visible+span{outline:2px solid var(--ac);outline-offset:2px} | |
| 104 | + .btn.sm{min-height:40px;padding:8px 16px;font-size:15px} | |
| 105 | + .peer form{display:grid;gap:10px}.peer input[name=note]{min-height:48px;padding:10px 14px;border-radius:14px;border:1.5px solid var(--line);background:var(--card);color:var(--fg);font:inherit} |
app/app.js added
| 1 | + // Paywell team app. Open source, public domain. TEST MODE: real accounts, ratings, reviews, scores and a real | |
| 2 | + // Bitcoin wallet on the signet test network (test coins have no value). Daily bonuses are worked out and shown; | |
| 3 | + // no real money moves until licensed payroll and custody partners are in place. | |
| 4 | + (function () { | |
| 5 | + 'use strict'; | |
| 6 | + const $ = (s, r) => (r || document).querySelector(s); | |
| 7 | + const esc = (t) => String(t == null ? '' : t).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c])); | |
| 8 | + const usd = (cents) => (cents < 0 ? '−' : '') + '$' + (Math.abs(cents) / 100).toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 }); | |
| 9 | + const usdSats = (sats) => price ? usd(Math.round(sats / 1e8 * price * 100)) : (sats.toLocaleString() + ' sats'); | |
| 10 | + const stars = (n) => '<span class="stars" aria-label="' + n + ' of 5 stars">' + '★'.repeat(n) + '<span style="opacity:.25">' + '★'.repeat(5 - n) + '</span></span>'; | |
| 11 | + const b64u = (buf) => { const b = new Uint8Array(buf); let s = ''; for (let i = 0; i < b.length; i++) s += String.fromCharCode(b[i]); return btoa(s).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, ''); }; | |
| 12 | + const unb64u = (s) => Uint8Array.from(atob(s.replace(/-/g, '+').replace(/_/g, '/') + '==='.slice((s.length + 3) % 4)), (c) => c.charCodeAt(0)); | |
| 13 | + const enc = new TextEncoder(); | |
| 14 | + const dayName = (d) => new Date(d + 'T12:00:00Z').toLocaleDateString('en-US', { weekday: 'short', month: 'short', day: 'numeric' }); | |
| 15 | + const when = (t) => new Date(t).toLocaleString('en-US', { month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' }); | |
| 16 | + | |
| 17 | + const GIFS = [{ id: 'party', e: '🎉', word: 'Woohoo!', a: 'pop', bg: '#ffd166,#ef476f' }, { id: 'dog', e: '🐶', word: 'Good boy!', a: 'wag', bg: '#a0e7e5,#4cc9f0' }, { id: 'fire', e: '🔥', word: 'On fire', a: 'pulse', bg: '#ffb347,#ff5e62' }, { id: 'clap', e: '👏', word: 'Bravo', a: 'shake', bg: '#b8f2a5,#2ec4b6' }, { id: 'coffee', e: '☕', word: 'Coffee time', a: 'float', bg: '#f6d6ad,#c08552' }, { id: 'taco', e: '🌮', word: 'Taco Tuesday', a: 'spin', bg: '#ffe66d,#ff9f1c' }, { id: 'cat', e: '🐱', word: 'Mood', a: 'wag', bg: '#e0c3fc,#8ec5fc' }, { id: 'rocket', e: '🚀', word: 'Let’s go', a: 'launch', bg: '#a1c4fd,#5e60ce' }, { id: 'heart', e: '💚', word: 'Thank you', a: 'pulse', bg: '#c1f7d5,#2d6a4f' }]; | |
| 18 | + const gifHtml = (g) => { const c = g.bg.split(','); return '<span class="gif a-' + g.a + '" style="background:linear-gradient(135deg,' + c[0] + ',' + c[1] + ')"><span class="ge">' + g.e + '</span><span class="gw">' + g.word + '</span></span>'; }; | |
| 19 | + const COLORS = ['#2d6a4f', '#c2185b', '#e76f51', '#5e60ce', '#0077b6', '#b5838d', '#6a994e', '#bc6c25']; | |
| 20 | + const colorFor = (id) => COLORS[[...String(id)].reduce((a, c) => a + c.charCodeAt(0), 0) % COLORS.length]; | |
| 21 | + | |
| 22 | + let S = null; // summary from the server | |
| 23 | + let price = 0; // USD per BTC | |
| 24 | + let wallet = null; // { w, words } in memory only, after passkey unlock | |
| 25 | + let chainState = null; // last wallet sync | |
| 26 | + let cur = 'home', curCh = 'general', chatTimer = null, lastMsg = 0, chatMsgs = []; | |
| 27 | + let lastCred = null; // credential id used this session (for the vault) | |
| 28 | + | |
| 29 | + // ---------- API ---------- | |
| 30 | + async function api(path, body) { | |
| 31 | + const r = await fetch(path, body === undefined ? { credentials: 'same-origin' } : { method: 'POST', credentials: 'same-origin', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) }); | |
| 32 | + const j = await r.json().catch(() => ({})); | |
| 33 | + if (!r.ok) { const e = new Error(j.error || 'Something went wrong. Try again.'); e.status = r.status; throw e; } | |
| 34 | + return j; | |
| 35 | + } | |
| 36 | + async function loadPrice() { try { const j = await api('/api/chain/price'); price = j.usd || 0; } catch (e) {} } | |
| 37 | + | |
| 38 | + // ---------- Passkeys (WebAuthn) with the PRF extension for the wallet lock ---------- | |
| 39 | + let PRF_IN = null; | |
| 40 | + async function prfIn() { if (!PRF_IN) PRF_IN = new Uint8Array(await crypto.subtle.digest('SHA-256', enc.encode('paywell-wallet-vault-v1'))); return PRF_IN; } | |
| 41 | + const passkeysOk = () => !!(window.PublicKeyCredential && navigator.credentials && navigator.credentials.create); | |
| 42 | + | |
| 43 | + async function createPasskey(name) { | |
| 44 | + const { challenge, rpId } = await api('/api/app/challenge', {}); | |
| 45 | + const cred = await navigator.credentials.create({ publicKey: { | |
| 46 | + challenge: unb64u(challenge), rp: { id: rpId, name: 'Paywell' }, | |
| 47 | + user: { id: crypto.getRandomValues(new Uint8Array(16)), name: name + ' (Paywell)', displayName: name }, | |
| 48 | + pubKeyCredParams: [{ type: 'public-key', alg: -7 }, { type: 'public-key', alg: -257 }], | |
| 49 | + authenticatorSelection: { residentKey: 'required', requireResidentKey: true, userVerification: 'required' }, | |
| 50 | + attestation: 'none', timeout: 120000, | |
| 51 | + extensions: { prf: { eval: { first: await prfIn() } } }, | |
| 52 | + } }); | |
| 53 | + const ext = cred.getClientExtensionResults ? cred.getClientExtensionResults() : {}; | |
| 54 | + return { | |
| 55 | + payload: { id: cred.id, clientDataJSON: b64u(cred.response.clientDataJSON), attestationObject: b64u(cred.response.attestationObject) }, | |
| 56 | + prf: ext.prf && ext.prf.results && ext.prf.results.first ? new Uint8Array(ext.prf.results.first) : null, | |
| 57 | + prfOn: !!(ext.prf && ext.prf.enabled), | |
| 58 | + }; | |
| 59 | + } | |
| 60 | + async function getPasskey(allowId) { | |
| 61 | + const { challenge, rpId } = await api('/api/app/challenge', {}); | |
| 62 | + const pk = { challenge: unb64u(challenge), rpId, userVerification: 'required', timeout: 120000, extensions: { prf: { eval: { first: await prfIn() } } } }; | |
| 63 | + if (allowId) pk.allowCredentials = [{ type: 'public-key', id: unb64u(allowId) }]; | |
| 64 | + const cred = await navigator.credentials.get({ publicKey: pk }); | |
| 65 | + const ext = cred.getClientExtensionResults ? cred.getClientExtensionResults() : {}; | |
| 66 | + lastCred = cred.id; | |
| 67 | + return { | |
| 68 | + payload: { id: cred.id, clientDataJSON: b64u(cred.response.clientDataJSON), authenticatorData: b64u(cred.response.authenticatorData), signature: b64u(cred.response.signature) }, | |
| 69 | + prf: ext.prf && ext.prf.results && ext.prf.results.first ? new Uint8Array(ext.prf.results.first) : null, | |
| 70 | + }; | |
| 71 | + } | |
| 72 | + function passkeyError(e) { | |
| 73 | + if (e && e.name === 'NotAllowedError') return 'The passkey step was cancelled or timed out. Try again.'; | |
| 74 | + if (e && e.name === 'InvalidStateError') return 'This device already has a Paywell passkey. Use “Sign in” instead.'; | |
| 75 | + return (e && e.message) || 'Something went wrong. Try again.'; | |
| 76 | + } | |
| 77 | + | |
| 78 | + // ---------- Wallet lock: AES-GCM key from the passkey's PRF secret (HKDF), same as everywhere else in Paywell ---------- | |
| 79 | + async function hkdf(prf, salt, info) { | |
| 80 | + const k = await crypto.subtle.importKey('raw', prf, 'HKDF', false, ['deriveBits']); | |
| 81 | + return new Uint8Array(await crypto.subtle.deriveBits({ name: 'HKDF', hash: 'SHA-256', salt: salt.length ? salt : new Uint8Array(32), info: enc.encode(info) }, k, 256)); | |
| 82 | + } | |
| 83 | + async function vaultSave(credId, prf, words) { | |
| 84 | + const salt = crypto.getRandomValues(new Uint8Array(16)), iv = crypto.getRandomValues(new Uint8Array(12)); | |
| 85 | + const key = await crypto.subtle.importKey('raw', await hkdf(prf, salt, 'paywell-vault-key'), 'AES-GCM', false, ['encrypt']); | |
| 86 | + const ct = new Uint8Array(await crypto.subtle.encrypt({ name: 'AES-GCM', iv, additionalData: enc.encode(credId) }, key, enc.encode(words))); | |
| 87 | + const box = new Uint8Array(12 + ct.length); box.set(iv); box.set(ct, 12); | |
| 88 | + await api('/api/vault/save', { cred: credId, auth: b64u(await hkdf(prf, new Uint8Array(0), 'paywell-vault-auth')), blob: b64u(box), salt: b64u(salt) }); | |
| 89 | + } | |
| 90 | + async function vaultOpen(credId, prf) { | |
| 91 | + const j = await api('/api/vault/get', { cred: credId, auth: b64u(await hkdf(prf, new Uint8Array(0), 'paywell-vault-auth')) }); | |
| 92 | + const box = unb64u(j.blob); | |
| 93 | + const key = await crypto.subtle.importKey('raw', await hkdf(prf, unb64u(j.salt), 'paywell-vault-key'), 'AES-GCM', false, ['decrypt']); | |
| 94 | + return new TextDecoder().decode(await crypto.subtle.decrypt({ name: 'AES-GCM', iv: box.slice(0, 12), additionalData: enc.encode(credId) }, key, box.slice(12))); | |
| 95 | + } | |
| 96 | + async function unlockWallet(cred) { | |
| 97 | + if (!cred.prf) throw new Error('This browser’s passkeys can’t open a locked wallet yet. Try Chrome or Safari, or use your own wallet.'); | |
| 98 | + const words = await vaultOpen(cred.payload.id, cred.prf); | |
| 99 | + wallet = { w: PWW.open(words) }; | |
| 100 | + return wallet; | |
| 101 | + } | |
| 102 | + | |
| 103 | + // ---------- Screens ---------- | |
| 104 | + const panel = () => $('#panel'); | |
| 105 | + function setTab(t) { | |
| 106 | + cur = t; | |
| 107 | + document.querySelectorAll('.tabs button').forEach((b) => b.setAttribute('aria-current', b.dataset.tab === t ? 'page' : 'false')); | |
| 108 | + if (chatTimer) { clearInterval(chatTimer); chatTimer = null; } | |
| 109 | + render(); | |
| 110 | + } | |
| 111 | + function shell(signedIn) { | |
| 112 | + $('#app').classList.toggle('out', !signedIn); | |
| 113 | + } | |
| 114 | + | |
| 115 | + function gate(msg) { | |
| 116 | + shell(false); | |
| 117 | + const setup = (location.hash.match(/setup=([A-Za-z0-9_-]+)/) || [])[1]; | |
| 118 | + if (setup) return setupScreen(setup); | |
| 119 | + panel().innerHTML = '<div class="signin"><h2>Paywell team app</h2><p class="small">Sign in with your face, fingerprint or screen lock. No username or password.</p>' + | |
| 120 | + (msg ? '<p class="err" role="alert">' + esc(msg) + '</p>' : '') + | |
| 121 | + (passkeysOk() ? '<button class="btn" type="button" data-act="signin">Sign in with passkey</button>' : '<p class="note">This browser doesn’t support passkeys. Try a recent Chrome, Safari, Edge or Firefox.</p>') + | |
| 122 | + '<div class="or"><span>or</span></div>' + | |
| 123 | + '<form class="fm" id="startteam"><h3>Start a test team</h3><p class="small">Try everything for real: passkey sign-in, ratings, peer reviews, scores, tiers, team chat and a Bitcoin wallet on the test network. Test coins have no value and no real money moves.</p>' + | |
| 124 | + '<label for="sname">Your first name</label><input id="sname" required maxlength="40" autocomplete="given-name">' + | |
| 125 | + '<label for="steam">Team name</label><input id="steam" required maxlength="60" placeholder="e.g. Maple Street Bakery">' + | |
| 126 | + '<button class="btn o" type="submit">Create my passkey and team</button></form>' + | |
| 127 | + '<p class="small">Joining a team? Open the setup link your team sent you.</p></div>'; | |
| 128 | + } | |
| 129 | + async function setupScreen(token) { | |
| 130 | + panel().innerHTML = '<div class="signin"><p class="small">Checking your setup link…</p></div>'; | |
| 131 | + try { | |
| 132 | + const s = await api('/api/app/setup', { token }); | |
| 133 | + panel().innerHTML = '<div class="signin"><h2>Welcome, ' + esc(s.name) + '</h2><p class="small">You’ve been added to <b>' + esc(s.team) + '</b>. Save a passkey on this device and your face, fingerprint or screen lock becomes your sign-in.</p>' + | |
| 134 | + '<p class="err" id="serr" role="alert"></p><button class="btn" type="button" data-act="join" data-token="' + esc(token) + '" data-name="' + esc(s.name) + '">Create my passkey</button></div>'; | |
| 135 | + } catch (e) { | |
| 136 | + history.replaceState(null, '', '/app/'); | |
| 137 | + gate(e.message); | |
| 138 | + } | |
| 139 | + } | |
| 140 | + | |
| 141 | + function payoutScreen(note) { | |
| 142 | + panel().innerHTML = '<form class="fm signin wide" id="payoutf"><h2>Where should your Bitcoin go?</h2><p class="small">Your daily Bitcoin bonus needs a wallet. You can change this any time.</p>' + | |
| 143 | + (note ? '<p class="err" role="alert">' + esc(note) + '</p>' : '') + | |
| 144 | + '<label class="choice"><input type="radio" name="pm" value="paywell" checked><span><b>Create a wallet for me</b><span class="small">Easiest. Made right here with your account, and your passkey locks its backup. Nothing to write down.</span></span></label>' + | |
| 145 | + '<label class="choice"><input type="radio" name="pm" value="own"><span><b>Use my own wallet</b><span class="small">Paste the address of a wallet you already have. Bonuses go straight there.</span></span></label>' + | |
| 146 | + '<div id="ownbox" hidden><label for="oaddr">Your Bitcoin wallet address</label><input id="oaddr" autocomplete="off" spellcheck="false" placeholder="tb1… while in test mode"></div>' + | |
| 147 | + '<button class="btn" type="submit">Continue</button></form>'; | |
| 148 | + } | |
| 149 | + | |
| 150 | + function tierChip(t) { return '<span class="pill">' + esc(S.tiers[t].name) + '</span>'; } | |
| 151 | + function scoreBar(n) { return '<div class="bar" role="img" aria-label="Score ' + n + ' of 100"><i style="width:' + n + '%"></i></div>'; } | |
| 152 | + | |
| 153 | + const views = { | |
| 154 | + home() { | |
| 155 | + const s = S.score; | |
| 156 | + const paidTo = S.me.payout === 'own' ? 'your own wallet' : 'your Paywell wallet'; | |
| 157 | + return '<div class="pg"><div><h2>Hi, ' + esc(S.me.name) + '</h2><p class="small">' + esc(S.org.name) + ' · ' + esc(S.me.tierName) + ' (' + S.me.shares + ' bonus share' + (S.me.shares === 1 ? '' : 's') + ')</p></div>' + | |
| 158 | + '<div class="g2"><div class="tile"><h3>Today’s Bitcoin bonus</h3><div class="usd big">' + usd(S.todayCents) + '</div><p>Paid automatically every day to ' + paidTo + '. Test mode: worked out for real, no money moves.</p></div>' + | |
| 159 | + '<div class="tile"><h3>Your score: ' + s.score + '</h3>' + scoreBar(s.score) + '<p>Customers ' + (s.customerN ? s.customerAvg + ' ★ (' + s.customerN + ')' : 'no ratings yet') + ' · 60%<br>Teammates ' + (s.peerN ? s.peerAvg + ' ★ (' + s.peerN + ')' : 'no reviews yet') + ' · 40%' + (!s.customerN && !s.peerN ? '<br>Everyone starts at 70 until reviews come in.' : '') + '</p></div></div>' + | |
| 160 | + '<div class="tile"><h3>How today’s bonus is worked out</h3><p class="calc">Score ' + s.score + ' × ' + S.me.shares + ' share' + (S.me.shares === 1 ? '' : 's') + ' (' + esc(S.me.tierName) + ') × ' + usd(S.org.shareCents) + ' per share = <b>' + usd(S.todayCents) + '</b></p><p>Your wage is separate: at least the minimum wage where you work, and reviews never lower it.</p></div>' + | |
| 161 | + '<div class="tile"><h3>Daily bonuses</h3>' + (S.days.length ? S.days.map((d) => '<div class="row"><div class="l"><b>' + dayName(d.day) + '</b><span>Score ' + d.score + ' · ' + esc(S.tiers[d.tier].name) + '</span></div><div class="r"><b>' + usd(d.cents) + '</b><div class="small">test</div></div></div>').join('') : '<p>Your first daily bonus shows here tomorrow.</p>') + '</div>' + | |
| 162 | + '<div class="acts"><button class="btn" data-go="take">Get paid</button><button class="btn o" data-go="checkin">Daily check-in</button><button class="btn o" data-go="wallet">Wallet</button></div></div>'; | |
| 163 | + }, | |
| 164 | + checkin() { | |
| 165 | + const mates = S.team.filter((m) => m.id !== S.me.id); | |
| 166 | + return '<div class="pg"><div><h2>Daily check-in</h2><p class="small">Rate each teammate you worked with today, 1 to 5 stars, on teamwork, care and reliability. One review per teammate per day. They see the stars and your note, never who wrote it. Only your own team can see reviews.</p></div>' + | |
| 167 | + (mates.length ? mates.map((m) => { | |
| 168 | + const done = S.reviewedToday.includes(m.id); | |
| 169 | + return '<form class="tile peer" data-person="' + esc(m.id) + '"><div class="row"><div class="l"><b>' + esc(m.name) + '</b><span>' + esc(S.tiers[m.tier].name) + '</span></div><div class="r">' + (done ? '<span class="pill">Reviewed today ✓</span>' : '') + '</div></div>' + | |
| 170 | + (done ? '' : '<div class="starpick" role="radiogroup" aria-label="Stars for ' + esc(m.name) + '">' + [1, 2, 3, 4, 5].map((n) => '<label><input type="radio" name="st" value="' + n + '" required><span>' + n + '★</span></label>').join('') + '</div><input name="note" maxlength="500" placeholder="A kind, honest note (optional)"><button class="btn" type="submit">Send review</button><p class="small res" role="status"></p>') + '</form>'; | |
| 171 | + }).join('') : '<div class="tile"><p>No teammates yet. ' + (S.me.admin ? 'Add people in the Team tab.' : 'Your team will add people soon.') + '</p></div>') + '</div>'; | |
| 172 | + }, | |
| 173 | + ratings() { | |
| 174 | + const r = S.ratings, p = S.peers; | |
| 175 | + return '<div class="pg"><div><h2>Your ratings and reviews</h2><p class="small">Customer ratings (60% of your score) and teammate reviews (40%), from the last four weeks. Customers’ contact details stay private.</p></div>' + | |
| 176 | + '<form class="tile fm" id="visitf"><h3>Ask a customer to rate a visit</h3><p>Makes a one-time rating link for a visit you just did. In a real shop this comes on the receipt by itself.</p><label for="vsvc">What was the visit?</label><input id="vsvc" maxlength="60" placeholder="e.g. Haircut"><button class="btn" type="submit">Make rating link</button><div id="vout"></div></form>' + | |
| 177 | + '<div class="tile"><h3>From customers</h3>' + (r.length ? r.map((x) => '<div class="row"><div class="l">' + stars(x.stars) + '<b>' + esc(x.brand) + '</b><span>' + when(x.created) + (x.note ? ' · “' + esc(x.note) + '”' : '') + '</span></div><div class="r"><span class="pill ' + (x.status === 'counted' ? '' : 'hold') + '">' + (x.status === 'counted' ? 'Counted' : 'Being checked') + '</span></div></div>').join('') : '<p>No customer ratings yet. Make a rating link above to try it.</p>') + '</div>' + | |
| 178 | + '<div class="tile"><h3>From teammates</h3>' + (p.length ? p.map((x) => '<div class="row"><div class="l">' + stars(x.stars) + '<span>' + dayName(x.day) + (x.note ? ' · “' + esc(x.note) + '”' : '') + '</span></div></div>').join('') : '<p>No teammate reviews yet.</p>') + '</div>' + | |
| 179 | + '<div class="tile"><h3>Fair rules</h3><p>1 and 2 star customer ratings are checked before they count. Ratings about prices, scheduling or company rules don’t count. You can dispute any rating within 14 days, and it has no effect while it’s reviewed. Reviews never lower your wage. <a href="/how-it-works/#disputes">How disputes work</a></p></div></div>'; | |
| 180 | + }, | |
| 181 | + take() { | |
| 182 | + const need = S.me.payout === 'paywell' && !wallet; | |
| 183 | + return '<div class="pg"><div><h2>Get paid</h2><p class="small">Show this to the customer. They scan it, or tap it on Android, and pay from any Bitcoin wallet. Shown in dollars. No tip screen, ever.</p></div>' + | |
| 184 | + (need ? '<div class="tile"><p>Unlock your wallet first so we know where the payment goes.</p><button class="btn" data-act="unlock">Unlock wallet with passkey</button></div>' : | |
| 185 | + '<form class="tile fm" id="takef"><label for="tamt">Amount (dollars)</label><input id="tamt" inputmode="decimal" placeholder="25.00"><label for="tfor">For</label><input id="tfor" maxlength="60" placeholder="e.g. Dog grooming"><button class="btn" type="submit">Show payment code</button></form>') + | |
| 186 | + '<div id="tbox"></div></div>'; | |
| 187 | + }, | |
| 188 | + wallet() { | |
| 189 | + const own = S.me.payout === 'own'; | |
| 190 | + let h = '<div class="pg"><div class="tile"><h3>Where your daily bonus goes</h3><div class="row"><div class="l">' + (own ? '<b>Your own wallet</b><span class="mono">' + esc(S.me.payoutAddr) + '</span>' : '<b>Your Paywell wallet</b><span>Made with your account. Your passkey locks its backup; we can’t open it.</span>') + '</div><div class="r"><button class="btn o sm" data-act="payout">Change</button></div></div></div>'; | |
| 191 | + if (!own || wallet) { | |
| 192 | + if (!wallet) h += '<div class="tile"><h3>Wallet</h3><p>Locked. Your passkey opens it.</p><button class="btn" data-act="unlock">Unlock wallet with passkey</button><p class="err" id="werr" role="alert"></p></div>'; | |
| 193 | + else { | |
| 194 | + const st = chainState; | |
| 195 | + h += '<div class="tile"><h3>Wallet balance</h3><div class="usd big">' + (st ? usdSats(st.balance) : '…') + '</div><p>' + (st ? st.balance.toLocaleString() + ' sats on the test network' + (price ? ' · ' + usd(Math.round(price * 100)) + ' per BTC' : '') : 'Checking the network…') + '</p></div>' + | |
| 196 | + '<div class="acts"><button class="btn" data-act="receive">Receive</button><button class="btn o" data-act="send">Send</button><button class="btn o" data-act="refresh">Refresh</button></div><div id="wbox"></div>' + | |
| 197 | + '<div class="tile"><h3>Activity</h3>' + (st && st.history.length ? st.history.slice(0, 30).map((t) => '<div class="row"><div class="l"><b>' + (t.delta >= 0 ? 'Received' : 'Sent') + '</b><span>' + (t.time ? when(t.time) : 'Just now') + (t.confirmed ? '' : ' · pending') + '</span></div><div class="r"><b>' + (t.delta >= 0 ? '+' : '−') + usdSats(Math.abs(t.delta)) + '</b></div></div>').join('') : '<p>Nothing yet. Get free test coins from a signet faucet, then send them to your Receive address.</p><p><a class="btn o sm" href="https://signetfaucet.com/" rel="noopener" target="_blank">Get free test coins</a></p>') + '</div>'; | |
| 198 | + } | |
| 199 | + } | |
| 200 | + h += '<div class="note">Test network only: test coins have no value. Trading between Bitcoin and dollars goes through a licensed exchange partner and opens with live mode.</div></div>'; | |
| 201 | + return h; | |
| 202 | + }, | |
| 203 | + chat() { | |
| 204 | + const ch = [['general', 'Hellos, news and everyday stuff'], ['shout-outs', 'Great days and high fives'], ['random', 'Anything goes (keep it kind)']]; | |
| 205 | + return '<div class="chat"><aside class="chs" aria-label="Channels">' + ch.map((c) => '<button class="ch" data-ch="' + c[0] + '"' + (c[0] === curCh ? ' aria-current="true"' : '') + '><span>#</span>' + c[0] + '</button>').join('') + '</aside>' + | |
| 206 | + '<section class="room"><header class="roomh"><b>#' + curCh + '</b><span>' + ch.find((c) => c[0] === curCh)[1] + '</span></header><div class="msgs" id="msgs" role="log" aria-live="polite"><p class="small">Loading…</p></div>' + | |
| 207 | + '<div class="gifs" id="gifs" hidden>' + GIFS.map((g) => '<button type="button" data-gif="' + g.id + '" aria-label="' + esc(g.word) + '">' + gifHtml(g) + '</button>').join('') + '</div>' + | |
| 208 | + '<form class="compose" id="say"><button type="button" class="gifbtn" data-act="gifs" aria-label="Stickers">GIF</button><input id="sayin" maxlength="1000" placeholder="Message #' + curCh + '" autocomplete="off"><button class="btn send" type="submit">Send</button></form></section></div>'; | |
| 209 | + }, | |
| 210 | + team() { | |
| 211 | + let h = '<div class="pg"><div><h2>' + esc(S.org.name) + '</h2><p class="small">Three tiers: Explorer (1 share), Builder (1½), Guide (2). Tiers are reviewed every three months.</p></div><div class="tile">' + | |
| 212 | + S.team.map((m) => '<div class="row"><div class="l"><b>' + esc(m.name) + (m.id === S.me.id ? ' (you)' : '') + '</b><span>' + esc(S.tiers[m.tier].name) + '</span></div><div class="r">' + | |
| 213 | + (S.me.admin && m.id !== S.me.id ? '<select data-tier="' + esc(m.id) + '" aria-label="Tier for ' + esc(m.name) + '">' + [1, 2, 3].map((t) => '<option value="' + t + '"' + (t === m.tier ? ' selected' : '') + '>' + S.tiers[t].name + '</option>').join('') + '</select>' : tierChip(m.tier)) + '</div></div>').join('') + '</div>'; | |
| 214 | + if (S.me.admin) h += '<form class="tile fm" id="invitef"><h3>Add a teammate</h3><p>Makes a one-time setup link (good for 24 hours). Send it only to them, by text or email. Opening it lets them save a passkey and join.</p><label for="iname">Their first name</label><input id="iname" required maxlength="40"><label for="itier">Tier</label><select id="itier"><option value="1">Explorer</option><option value="2">Builder</option><option value="3">Guide</option></select><button class="btn" type="submit">Make setup link</button><div id="iout"></div></form>'; | |
| 215 | + return h + '</div>'; | |
| 216 | + }, | |
| 217 | + security() { | |
| 218 | + return '<div class="pg"><div><h2>Security</h2></div><div class="tile">' + | |
| 219 | + '<div class="check"><i>✓</i><div><b>Passkey sign-in</b><div class="small">Your face, fingerprint or screen lock is your sign-in. No username, no password, nothing to steal or forget.</div></div></div>' + | |
| 220 | + '<div class="check"><i>✓</i><div><b>Wallet locked by your passkey</b><div class="small">Your wallet’s backup is locked on your device before it reaches us. We store it but can’t open it. Nothing to write down.</div></div></div>' + | |
| 221 | + '<div class="check"><i>✓</i><div><b>Confirm before money moves</b><div class="small">Sending, and changing where your bonus goes, always asks for your passkey again.</div></div></div>' + | |
| 222 | + '<div class="check"><i>✓</i><div><b>Reviews stay in your team</b><div class="small">Only signed-in members of your own team can see your team’s ratings and reviews.</div></div></div>' + | |
| 223 | + '</div><p><button class="btn o" data-act="signout">Sign out</button></p><div class="note">We will never ask for a setup link or recovery words, by phone, text, email or in person. Anyone who asks is trying to steal from you.</div></div>'; | |
| 224 | + }, | |
| 225 | + }; | |
| 226 | + | |
| 227 | + function render() { | |
| 228 | + if (!S) return; | |
| 229 | + shell(true); | |
| 230 | + panel().innerHTML = views[cur] ? views[cur]() : views.home(); | |
| 231 | + if (cur === 'chat') { lastMsg = 0; chatMsgs = []; pollChat(); chatTimer = setInterval(pollChat, 4000); } | |
| 232 | + if (cur === 'wallet' && wallet && !chainState) refreshWallet(); | |
| 233 | + } | |
| 234 | + | |
| 235 | + async function refresh() { S = await api('/api/app/me'); render(); } | |
| 236 | + | |
| 237 | + // ---------- Chat ---------- | |
| 238 | + function msgHtml(m) { | |
| 239 | + const g = (m.body.match(/^:gif:([a-z]+):$/) || [])[1]; | |
| 240 | + const gif = g && GIFS.find((x) => x.id === g); | |
| 241 | + return '<div class="msg"><span class="av" style="background:' + colorFor(m.person) + '">' + esc(m.name[0] || '?') + '</span><div class="mb"><div class="mh"><b>' + esc(m.name) + '</b><span>' + when(m.created) + '</span></div>' + (gif ? gifHtml(gif) : '<p>' + esc(m.body) + '</p>') + '</div></div>'; | |
| 242 | + } | |
| 243 | + async function pollChat(body) { | |
| 244 | + try { | |
| 245 | + const j = body ? await api('/api/app/chat?c=' + curCh + '&since=' + lastMsg, { channel: curCh, body }) : await api('/api/app/chat?c=' + curCh + '&since=' + lastMsg); | |
| 246 | + if (j.messages.length) { chatMsgs = chatMsgs.concat(j.messages); lastMsg = j.messages[j.messages.length - 1].id; } | |
| 247 | + const box = $('#msgs'); if (!box) return; | |
| 248 | + const atEnd = box.scrollHeight - box.scrollTop - box.clientHeight < 60; | |
| 249 | + box.innerHTML = chatMsgs.length ? chatMsgs.map(msgHtml).join('') : '<p class="small">No messages yet. Say hello! 👋</p>'; | |
| 250 | + if (atEnd || body || j.messages.length) box.scrollTop = box.scrollHeight; | |
| 251 | + } catch (e) { if (e.status === 401) { S = null; gate(); } } | |
| 252 | + } | |
| 253 | + | |
| 254 | + // ---------- Wallet actions ---------- | |
| 255 | + async function refreshWallet() { | |
| 256 | + if (!wallet) return; | |
| 257 | + try { chainState = await PWW.sync(wallet.w); } | |
| 258 | + catch (e) { chainState = chainState || { balance: 0, history: [], utxos: [], nextReceive: 0, nextChange: 0 }; } | |
| 259 | + if (cur === 'wallet') render(); | |
| 260 | + } | |
| 261 | + function receiveBox() { | |
| 262 | + const a = wallet.w.address(chainState ? chainState.nextReceive : 0); | |
| 263 | + $('#wbox').innerHTML = '<div class="tile center"><h3>Your receive address</h3><div class="qrbox">' + PWW.qrSvg('bitcoin:' + a) + '</div><p class="mono">' + esc(a) + '</p><button class="btn o sm" data-copy="' + esc(a) + '">Copy address</button></div>'; | |
| 264 | + } | |
| 265 | + function sendBox() { | |
| 266 | + $('#wbox').innerHTML = '<form class="tile fm" id="sendf"><h3>Send Bitcoin</h3><label for="sto">To address</label><input id="sto" autocomplete="off" spellcheck="false" placeholder="tb1…"><label for="samt">Amount (dollars)</label><input id="samt" inputmode="decimal" placeholder="5.00"><p class="small" id="sout"></p><button class="btn" type="submit">Review and confirm with passkey</button><p class="err" role="alert" id="serr"></p><p class="small">Bitcoin payments can’t be undone. Check the address and amount.</p></form>'; | |
| 267 | + } | |
| 268 | + | |
| 269 | + // ---------- Events ---------- | |
| 270 | + document.addEventListener('click', async (e) => { | |
| 271 | + const t = e.target.closest('button, a'); | |
| 272 | + if (!t) return; | |
| 273 | + if (t.dataset.tab) { setTab(t.dataset.tab); return; } | |
| 274 | + if (t.dataset.go) { setTab(t.dataset.go); return; } | |
| 275 | + if (t.dataset.ch) { curCh = t.dataset.ch; render(); return; } | |
| 276 | + if (t.dataset.copy) { try { await navigator.clipboard.writeText(t.dataset.copy); t.textContent = 'Copied ✓'; } catch (x) {} return; } | |
| 277 | + if (t.dataset.gif) { $('#gifs').hidden = true; pollChat(':gif:' + t.dataset.gif + ':'); return; } | |
| 278 | + const act = t.dataset.act; | |
| 279 | + if (!act) return; | |
| 280 | + try { | |
| 281 | + if (act === 'gifs') { const g = $('#gifs'); g.hidden = !g.hidden; return; } | |
| 282 | + if (act === 'signin') { | |
| 283 | + t.disabled = true; t.textContent = 'Waiting for your passkey…'; | |
| 284 | + const c = await getPasskey(); | |
| 285 | + await api('/api/app/login', { credential: c.payload }); | |
| 286 | + S = await api('/api/app/me'); | |
| 287 | + if (S.me.payout === 'paywell' && c.prf) { try { await unlockWallet(c); } catch (x) {} } | |
| 288 | + cur = 'home'; render(); loadPrice(); return; | |
| 289 | + } | |
| 290 | + if (act === 'join') { | |
| 291 | + t.disabled = true; t.textContent = 'Waiting for your passkey…'; | |
| 292 | + const c = await createPasskey(t.dataset.name); | |
| 293 | + await api('/api/app/register', { credential: c.payload, setup: t.dataset.token }); | |
| 294 | + history.replaceState(null, '', '/app/'); | |
| 295 | + await afterSignup(c); | |
| 296 | + return; | |
| 297 | + } | |
| 298 | + if (act === 'unlock') { | |
| 299 | + const c = await getPasskey(); | |
| 300 | + await unlockWallet(c); | |
| 301 | + chainState = null; render(); refreshWallet(); return; | |
| 302 | + } | |
| 303 | + if (act === 'refresh') { chainState = null; render(); refreshWallet(); return; } | |
| 304 | + if (act === 'receive') { if (chainState) receiveBox(); return; } | |
| 305 | + if (act === 'send') { sendBox(); return; } | |
| 306 | + if (act === 'payout') { payoutScreen(); return; } | |
| 307 | + if (act === 'signout') { await api('/api/app/logout', {}); S = null; wallet = null; chainState = null; gate(); return; } | |
| 308 | + } catch (x) { | |
| 309 | + const msg = passkeyError(x); | |
| 310 | + const where = $('#werr') || $('#serr'); | |
| 311 | + if (S && !where) { alertBox(msg); } else if (where) where.textContent = msg; else gate(msg); | |
| 312 | + } | |
| 313 | + }); | |
| 314 | + function alertBox(msg) { const p = document.createElement('p'); p.className = 'err'; p.setAttribute('role', 'alert'); p.textContent = msg; panel().prepend(p); } | |
| 315 | + | |
| 316 | + async function afterSignup(c) { | |
| 317 | + S = await api('/api/app/me'); | |
| 318 | + lastCred = c.payload.id; | |
| 319 | + window._signupCred = c; | |
| 320 | + payoutScreen(); | |
| 321 | + } | |
| 322 | + | |
| 323 | + document.addEventListener('change', async (e) => { | |
| 324 | + if (e.target.name === 'pm') { const b = $('#ownbox'); if (b) b.hidden = e.target.value !== 'own'; } | |
| 325 | + if (e.target.dataset && e.target.dataset.tier) { | |
| 326 | + try { await api('/api/app/tier', { person: e.target.dataset.tier, tier: Number(e.target.value) }); await refresh(); } catch (x) { alertBox(x.message); } | |
| 327 | + } | |
| 328 | + }); | |
| 329 | + document.addEventListener('input', (e) => { | |
| 330 | + if (e.target.id === 'samt') { const v = parseFloat(e.target.value) || 0; $('#sout').textContent = v && price ? Math.round(v / price * 1e8).toLocaleString() + ' sats' : ''; } | |
| 331 | + }); | |
| 332 | + | |
| 333 | + document.addEventListener('submit', async (e) => { | |
| 334 | + const f = e.target; e.preventDefault(); | |
| 335 | + const btn = f.querySelector('button[type=submit]'); | |
| 336 | + const fail = (msg) => { let p = f.querySelector('.err'); if (!p) { p = document.createElement('p'); p.className = 'err'; p.setAttribute('role', 'alert'); f.appendChild(p); } p.textContent = msg; if (btn) btn.disabled = false; }; | |
| 337 | + try { | |
| 338 | + if (btn) btn.disabled = true; | |
| 339 | + if (f.id === 'startteam') { | |
| 340 | + const name = $('#sname').value.trim(), team = $('#steam').value.trim(); | |
| 341 | + if (!name || !team) return fail('Add your first name and a team name.'); | |
| 342 | + const c = await createPasskey(name); | |
| 343 | + await api('/api/app/register', { credential: c.payload, name, team }); | |
| 344 | + await afterSignup(c); | |
| 345 | + return; | |
| 346 | + } | |
| 347 | + if (f.id === 'payoutf') { | |
| 348 | + const mode = f.querySelector('input[name=pm]:checked').value; | |
| 349 | + if (mode === 'own') { | |
| 350 | + const addr = $('#oaddr').value.trim(); | |
| 351 | + if (!PWW.validAddress(addr)) return fail('That doesn’t look like a test-network Bitcoin address (they start with tb1).'); | |
| 352 | + const c = await getPasskey(); | |
| 353 | + await api('/api/app/payout', { mode: 'own', addr, credential: c.payload }); | |
| 354 | + } else { | |
| 355 | + // Make the wallet here, lock its backup with the passkey and store the locked copy with us. | |
| 356 | + let c = window._signupCred && window._signupCred.prf ? window._signupCred : null; | |
| 357 | + if (!c) c = await getPasskey(); | |
| 358 | + if (!c.prf) return fail('This browser’s passkeys can’t lock a wallet backup yet. Choose “Use my own wallet”, or try Chrome or Safari.'); | |
| 359 | + let words = null; | |
| 360 | + try { words = await vaultOpen(c.payload.id, c.prf); } catch (x) { words = PWW.newWords(); await vaultSave(c.payload.id, c.prf, words); } | |
| 361 | + wallet = { w: PWW.open(words) }; | |
| 362 | + const body = { mode: 'paywell', walletAddr: wallet.w.address(0) }; | |
| 363 | + if (S.me.payout === 'own') { const c2 = await getPasskey(c.payload.id); body.credential = c2.payload; } | |
| 364 | + await api('/api/app/payout', body); | |
| 365 | + } | |
| 366 | + window._signupCred = null; | |
| 367 | + S = await api('/api/app/me'); cur = mode === 'own' ? 'home' : 'wallet'; chainState = null; render(); loadPrice(); | |
| 368 | + return; | |
| 369 | + } | |
| 370 | + if (f.classList.contains('peer')) { | |
| 371 | + const st = f.querySelector('input[name=st]:checked'); | |
| 372 | + if (!st) return fail('Pick 1 to 5 stars.'); | |
| 373 | + await api('/api/app/peer', { person: f.dataset.person, stars: Number(st.value), note: f.note.value }); | |
| 374 | + S = await api('/api/app/me'); render(); return; | |
| 375 | + } | |
| 376 | + if (f.id === 'visitf') { | |
| 377 | + const j = await api('/api/app/visit', { service: $('#vsvc').value }); | |
| 378 | + $('#vout').innerHTML = '<div class="center"><div class="qrbox">' + PWW.qrSvg(j.url) + '</div><p class="mono small">' + esc(j.url) + '</p><p><button class="btn o sm" type="button" data-copy="' + esc(j.url) + '">Copy link</button> <a class="btn o sm" href="' + esc(j.url) + '" target="_blank" rel="noopener">Open it as the customer</a></p><p class="small">Works once, for 14 days. Refresh this tab after rating to see it count.</p></div>'; | |
| 379 | + btn.disabled = false; return; | |
| 380 | + } | |
| 381 | + if (f.id === 'takef') { | |
| 382 | + const dollars = parseFloat($('#tamt').value) || 0; | |
| 383 | + if (!price) await loadPrice(); | |
| 384 | + const addr = S.me.payout === 'own' ? S.me.payoutAddr : wallet.w.address(chainState ? chainState.nextReceive : 0); | |
| 385 | + const visit = await api('/api/app/visit', { service: $('#tfor').value || 'Payment' }); | |
| 386 | + const btcAmt = dollars && price ? (dollars / price).toFixed(8).replace(/0+$/, '').replace(/\.$/, '') : ''; | |
| 387 | + const bip21 = 'bitcoin:' + addr + (btcAmt ? '?amount=' + btcAmt : '') + ($('#tfor').value ? (btcAmt ? '&' : '?') + 'label=' + encodeURIComponent($('#tfor').value) : ''); | |
| 388 | + const link = 'https://paywell.company/pay/?u=' + encodeURIComponent(bip21) + '&r=' + encodeURIComponent(visit.url); | |
| 389 | + $('#tbox').innerHTML = '<div class="tile center"><h3>' + (dollars ? usd(Math.round(dollars * 100)) : 'Any amount') + '</h3><div class="qrbox">' + PWW.qrSvg(link) + '</div><p>Ask them to scan this with their phone camera. It opens the payment, then asks them to rate the visit. No tip.</p>' + | |
| 390 | + ('NDEFReader' in window ? '<button class="btn o sm" type="button" id="nfcw" data-link="' + esc(link) + '">Write to an NFC tag</button> ' : '') + '<button class="btn o sm" type="button" data-copy="' + esc(link) + '">Copy link</button><p class="small" id="nfcmsg"></p></div>'; | |
| 391 | + btn.disabled = false; return; | |
| 392 | + } | |
| 393 | + if (f.id === 'sendf') { | |
| 394 | + const to = $('#sto').value.trim(), dollars = parseFloat($('#samt').value) || 0; | |
| 395 | + if (!price) await loadPrice(); | |
| 396 | + if (!dollars || !price) return fail('Enter an amount in dollars.'); | |
| 397 | + const sats = Math.round(dollars / price * 1e8); | |
| 398 | + const fees = await api('/api/chain/fees').catch(() => ({})); | |
| 399 | + const rate = Math.max(1, Math.ceil(fees['3'] || 2)); | |
| 400 | + if (!chainState) chainState = await PWW.sync(wallet.w); | |
| 401 | + const tx = PWW.buildPayment(wallet.w, chainState, to, sats, rate); | |
| 402 | + if (!confirm('Send ' + usd(Math.round(dollars * 100)) + ' (' + sats.toLocaleString() + ' test sats) plus a network fee of about ' + usdSats(tx.fee) + '? You’ll confirm with your passkey next.')) { btn.disabled = false; return; } | |
| 403 | + await getPasskey(lastCred || undefined); // a fresh face, fingerprint or screen-lock check before money moves | |
| 404 | + const r = await fetch('/api/chain/tx', { method: 'POST', body: tx.hex }).then((x) => x.json()); | |
| 405 | + if (r.error) return fail('The network didn’t take it: ' + r.error); | |
| 406 | + $('#wbox').innerHTML = '<div class="tile center"><div class="big-ok">✓</div><h3>Sent</h3><p class="mono small">' + esc(r.txid) + '</p></div>'; | |
| 407 | + setTimeout(refreshWallet, 3000); return; | |
| 408 | + } | |
| 409 | + if (f.id === 'invitef') { | |
| 410 | + const j = await api('/api/app/invite', { name: $('#iname').value, tier: Number($('#itier').value) }); | |
| 411 | + $('#iout').innerHTML = '<p class="mono small">' + esc(j.url) + '</p><p><button class="btn o sm" type="button" data-copy="' + esc(j.url) + '">Copy setup link</button></p><p class="small">Good for 24 hours, works once.</p>'; | |
| 412 | + btn.disabled = false; await refresh(); return; | |
| 413 | + } | |
| 414 | + if (f.id === 'say') { | |
| 415 | + const v = $('#sayin').value.trim(); if (!v) { btn.disabled = false; return; } | |
| 416 | + $('#sayin').value = ''; await pollChat(v); btn.disabled = false; $('#sayin').focus(); return; | |
| 417 | + } | |
| 418 | + } catch (x) { fail(passkeyError(x)); } | |
| 419 | + }); | |
| 420 | + document.addEventListener('click', async (e) => { | |
| 421 | + const b = e.target.closest('#nfcw'); if (!b) return; | |
| 422 | + try { const w = new NDEFReader(); await w.write({ records: [{ recordType: 'url', data: b.dataset.link }] }); $('#nfcmsg').textContent = 'Written. Customers can tap that tag with their phone to pay.'; } | |
| 423 | + catch (x) { $('#nfcmsg').textContent = 'Couldn’t write the tag: ' + (x.message || x); } | |
| 424 | + }); | |
| 425 | + | |
| 426 | + // ---------- Start ---------- | |
| 427 | + (async () => { | |
| 428 | + loadPrice(); | |
| 429 | + if (/setup=/.test(location.hash)) { gate(); return; } | |
| 430 | + try { S = await api('/api/app/me'); render(); } | |
| 431 | + catch (e) { gate(e.status === 401 ? '' : e.message); } | |
| 432 | + })(); | |
| 433 | + window.addEventListener('hashchange', () => { if (/setup=/.test(location.hash)) gate(); }); | |
| 434 | + })(); |
app/icon-512.png added
Not a text file.
app/icon.svg added
| 1 | + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><rect width="32" height="32" rx="9" fill="#0f3d2e"/><circle cx="16" cy="14.5" r="8.5" fill="#e0a526"/><circle cx="16" cy="14.5" r="6.6" fill="none" stroke="#0f3d2e" stroke-opacity=".35" stroke-width="1"/><path d="M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z" fill="#0f3d2e"/><path d="M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4" fill="none" stroke="#7fd1a3" stroke-width="2.2" stroke-linecap="round"/></svg> |
app/index.html added
| 1 | + <!doctype html> | |
| 2 | + <html lang="en"> | |
| 3 | + <head> | |
| 4 | + <meta charset="utf-8"> | |
| 5 | + <meta name="viewport" content="width=device-width,initial-scale=1"> | |
| 6 | + <title>Team app | Paywell</title> | |
| 7 | + <meta name="description" content="The Paywell team app: start a team, sign in with a passkey, check in on teammates, send rating links, take payment, hold a Bitcoin wallet and chat. Test mode: test coins only."> | |
| 8 | + <link rel="canonical" href="https://paywell.company/app/"> | |
| 9 | + <meta property="og:type" content="website"><meta property="og:site_name" content="Paywell"> | |
| 10 | + <meta property="og:title" content="Team app | Paywell"><meta property="og:description" content="The Paywell team app: start a team, sign in with a passkey, check in on teammates, send rating links, take payment, hold a Bitcoin wallet and chat. Test mode: test coins only."> | |
| 11 | + <meta property="og:url" content="https://paywell.company/app/"><meta property="og:image" content="https://paywell.company/img/og.jpg"> | |
| 12 | + <meta name="twitter:card" content="summary_large_image"> | |
| 13 | + <meta name="theme-color" content="#0f3d2e"> | |
| 14 | + <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='9' fill='%230f3d2e'/%3E%3Ccircle cx='16' cy='14.5' r='8.5' fill='%23e0a526'/%3E%3Ccircle cx='16' cy='14.5' r='6.6' fill='none' stroke='%230f3d2e' stroke-opacity='.35' stroke-width='1'/%3E%3Cpath d='M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z' fill='%230f3d2e'/%3E%3Cpath d='M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4' fill='none' stroke='%237fd1a3' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E"> | |
| 15 | + <link rel="manifest" href="/app/manifest.webmanifest"> | |
| 16 | + <link rel="stylesheet" href="/assets/site.css"> | |
| 17 | + <link rel="stylesheet" href="/app/app.css"> | |
| 18 | + <meta name="apple-mobile-web-app-capable" content="yes"> | |
| 19 | + </head> | |
| 20 | + <body> | |
| 21 | + <a class="skip" href="#main">Skip to content</a> | |
| 22 | + <div class="wrap"> | |
| 23 | + <header class="top"><a class="brand" href="/"><svg viewBox="0 0 32 32" aria-hidden="true"><rect width="32" height="32" rx="9" fill="#0f3d2e"/><circle cx="16" cy="14.5" r="8.5" fill="#e0a526"/><circle cx="16" cy="14.5" r="6.6" fill="none" stroke="#0f3d2e" stroke-opacity=".35" stroke-width="1"/><path d="M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z" fill="#0f3d2e"/><path d="M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4" fill="none" stroke="#7fd1a3" stroke-width="2.2" stroke-linecap="round"/></svg>Paywell</a><nav class="main" aria-label="Main"><a href="/how-it-works/">How it works</a><a href="/fair-pay/">Fair pay</a><a href="/learn/">Bitcoin basics</a><a href="/rate/">Rate a visit</a><a href="/app/" aria-current=page>Team app</a><a href="/open/">Open code</a></nav></header> | |
| 24 | + </div> | |
| 25 | + <main id="main"> | |
| 26 | + <div class="wrap"> | |
| 27 | + <div class="app-intro"> | |
| 28 | + <div><p class="eyebrow">Team app · test mode</p><h1 class="sm">Your pay, in plain dollars.</h1> | |
| 29 | + <p class="lede">Start a test team, add your teammates, and use every part of Paywell: daily check-ins, customer rating links, taking payment, your own Bitcoin wallet and team chat. It all runs here on the web, on any phone or computer. Test mode uses test coins, and no real money moves.</p></div> | |
| 30 | + </div> | |
| 31 | + <div class="app out" id="app"> | |
| 32 | + <nav class="tabs" aria-label="Team app"> | |
| 33 | + <button data-tab="home" aria-current="page">Home</button><button data-tab="checkin">Check-in</button><button data-tab="ratings">Ratings</button><button data-tab="take">Take payment</button><button data-tab="wallet">Wallet</button><button data-tab="chat">Team chat</button><button data-tab="team">Team</button><button data-tab="security">Security</button> | |
| 34 | + </nav> | |
| 35 | + <div class="panel" id="panel" tabindex="-1" aria-live="polite"><p class="small center">Loading…</p></div> | |
| 36 | + </div> | |
| 37 | + <p class="small" style="margin:18px 0 40px">Sign-in is a passkey only: your face, fingerprint or screen lock. No passwords. The wallet runs on Bitcoin’s test network (signet), and its backup is locked by your passkey so we can never open it. All of this code is open: see <a href="/open/">Open code</a>.</p> | |
| 38 | + </div> | |
| 39 | + <script src="/app/wallet.js" defer></script> | |
| 40 | + <script src="/app/app.js" defer></script> | |
| 41 | + </main> | |
| 42 | + <div class="wrap"><footer class="site">Paywell <span aria-hidden="true">·</span> <a href="/careers/">Careers</a></footer></div> | |
| 43 | + </body> | |
| 44 | + </html> |
app/manifest.webmanifest added
| 1 | + {"name":"Paywell","short_name":"Paywell","start_url":"/app/","scope":"/","display":"standalone","background_color":"#0f3d2e","theme_color":"#0f3d2e","icons":[{"src":"/app/icon.svg","sizes":"any","type":"image/svg+xml","purpose":"any"},{"src":"/app/icon-512.png","sizes":"512x512","type":"image/png"}]} |
app/wallet.js added
Not a text file.
assets/pay.js added
| 1 | + (function(){ | |
| 2 | + var $=function(id){return document.getElementById(id)}; | |
| 3 | + var q=new URLSearchParams(location.search);var u=q.get('u');var r=q.get('r'); | |
| 4 | + if(!u||!/^bitcoin:/i.test(u))return; | |
| 5 | + var body=u.slice(8);var addr=body.split('?')[0];var params=new URLSearchParams(body.split('?')[1]||''); | |
| 6 | + var btc=parseFloat(params.get('amount')||'');var label=params.get('label'); | |
| 7 | + $('p-none').hidden=true;$('p-req').hidden=false; | |
| 8 | + $('p-for').textContent=(label?label+' · ':'')+'To '+addr.slice(0,10)+'…'+addr.slice(-6); | |
| 9 | + $('p-open').href=u; | |
| 10 | + $('p-usd').textContent=btc?'Loading amount…':'Any amount'; | |
| 11 | + if(btc){$('p-btc').textContent=btc.toFixed(8)+' BTC'; | |
| 12 | + fetch('/api/rate/price').then(function(x){return x.json()}).then(function(j){if(j.usd)$('p-usd').textContent='$'+(btc*j.usd).toLocaleString('en-US',{minimumFractionDigits:2,maximumFractionDigits:2});else $('p-usd').textContent=btc.toFixed(8)+' BTC';}).catch(function(){$('p-usd').textContent=btc.toFixed(8)+' BTC';});} | |
| 13 | + $('p-copy').addEventListener('click',function(){try{navigator.clipboard.writeText(addr);this.textContent='Copied';}catch(e){}}); | |
| 14 | + if(r&&/^https:\/\/paywell\.ai\//.test(r)){$('p-rate').hidden=false;$('p-rate-a').href=r;} | |
| 15 | + })(); |
assets/rate.css added
| 1 | + .rate{max-width:760px} | |
| 2 | + .rate section{padding-top:10px} | |
| 3 | + .r-codeform{display:grid;gap:10px;margin:8px 0 18px} | |
| 4 | + .r-codeform label{font-weight:650} | |
| 5 | + .r-row{display:flex;gap:10px;flex-wrap:wrap} | |
| 6 | + .r-row input{flex:1;min-width:200px;min-height:52px;padding:12px 16px;border-radius:14px;border:1.5px solid var(--line);background:var(--card);color:var(--fg);font:inherit;font-size:20px;letter-spacing:.08em;text-transform:uppercase} | |
| 7 | + fieldset.stars{border:0;padding:0;margin:0 0 18px} | |
| 8 | + .r-stars{display:grid;gap:10px} | |
| 9 | + .r-stars label{display:block;cursor:pointer} | |
| 10 | + .r-stars input{position:absolute;opacity:0;width:1px;height:1px} | |
| 11 | + .r-stars span{display:flex;align-items:center;gap:16px;min-height:64px;padding:12px 20px;border-radius:18px;border:2px solid var(--line);background:var(--card);font-size:19px;font-weight:600} | |
| 12 | + .r-stars b{color:var(--gold);font-size:24px;min-width:140px;letter-spacing:2px} | |
| 13 | + .r-stars input:checked+span{border-color:var(--ac);background:var(--tint)} | |
| 14 | + .r-stars input:focus-visible+span{outline:3px solid var(--gold);outline-offset:2px} | |
| 15 | + .r-notelabel{display:block;font-weight:650;margin:6px 0 8px} | |
| 16 | + #r-note{width:100%;padding:14px 16px;border-radius:14px;border:1.5px solid var(--line);background:var(--card);color:var(--fg);font:inherit;resize:vertical} | |
| 17 | + .r-send{margin-top:16px;width:100%;min-height:56px;font-size:18px} | |
| 18 | + .r-ferr{color:var(--bad);min-height:1.5em;margin:10px 0 0} | |
| 19 | + .r-hp{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden} | |
| 20 | + .r-sample-badge{display:inline-block;background:var(--warn);color:var(--warn-fg);border-radius:999px;padding:6px 14px;font-size:14px;font-weight:600} | |
| 21 | + .r-how{margin-top:40px} | |
| 22 | + @media (max-width:560px){.r-stars b{min-width:118px;font-size:21px}} |
assets/rate.js added
| 1 | + (function(){ | |
| 2 | + var $=function(id){return document.getElementById(id)}; | |
| 3 | + var token=null; | |
| 4 | + function show(id){['r-start','r-form-wrap','r-done'].forEach(function(s){$(s).hidden=(s!==id)});window.scrollTo(0,0);} | |
| 5 | + function err(msg){var e=$('r-err');e.textContent=msg;e.hidden=!msg;$('r-loading').hidden=true;} | |
| 6 | + function post(path,body){return fetch('/api/rate/'+path,{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify(body)}).then(function(r){return r.json().then(function(j){j._ok=r.ok;return j})});} | |
| 7 | + function tokenFromUrl(){ | |
| 8 | + var m=location.pathname.match(/^\/r\/([A-Za-z0-9_.-]+)/); if(m) return m[1]; | |
| 9 | + var q=new URLSearchParams(location.search); if(q.get('t')) return q.get('t'); | |
| 10 | + return null; | |
| 11 | + } | |
| 12 | + function load(t){ | |
| 13 | + err('');$('r-loading').hidden=false; | |
| 14 | + post('check',{token:t}).then(function(j){ | |
| 15 | + $('r-loading').hidden=true; | |
| 16 | + if(!j._ok){err(j.error||'Something went wrong. Please try again.');show('r-start');return;} | |
| 17 | + token=t;var v=j.visit; | |
| 18 | + $('r-test').hidden=!j.test; | |
| 19 | + $('r-where').textContent=[v.brand,v.service,v.date?new Date(v.date+'T12:00:00').toLocaleDateString(undefined,{month:'long',day:'numeric'}):''].filter(Boolean).join(' · '); | |
| 20 | + $('r-q').textContent='How was your visit with '+v.person+'?'; | |
| 21 | + show('r-form-wrap'); | |
| 22 | + }).catch(function(){err('We couldn’t reach Paywell. Check your connection and try again.');}); | |
| 23 | + } | |
| 24 | + $('r-code').addEventListener('submit',function(e){ | |
| 25 | + e.preventDefault();var c=$('r-code-in').value.trim(); | |
| 26 | + if(!c){err('Please enter the code from your receipt.');return;} | |
| 27 | + var m=c.match(/\/r\/([A-Za-z0-9_.-]+)/); if(m){load(m[1]);return;} | |
| 28 | + if(c.indexOf('.')>0&&c.length>40){load(c);return;} | |
| 29 | + err('');post('code',{code:c}).then(function(j){if(j._ok&&j.token)load(j.token);else err(j.error||'We couldn’t find that code.');}).catch(function(){err('We couldn’t reach Paywell. Try again in a minute.');}); | |
| 30 | + }); | |
| 31 | + $('r-sample').addEventListener('click',function(){ | |
| 32 | + fetch('/api/rate/sample').then(function(r){return r.json()}).then(function(j){if(j.token)load(j.token);else err('The sample isn’t available right now.');}).catch(function(){err('We couldn’t reach Paywell. Try again in a minute.');}); | |
| 33 | + }); | |
| 34 | + $('r-form').addEventListener('submit',function(e){ | |
| 35 | + e.preventDefault();var f=e.target;var s=f.querySelector('input[name=stars]:checked'); | |
| 36 | + if(!s){$('r-ferr').textContent='Please tap a rating first.';return;} | |
| 37 | + var b=f.querySelector('.r-send');b.disabled=true;$('r-ferr').textContent=''; | |
| 38 | + post('submit',{token:token,stars:+s.value,note:f.note.value,website:f.website.value}).then(function(j){ | |
| 39 | + b.disabled=false; | |
| 40 | + if(!j._ok){$('r-ferr').textContent=j.error||'That didn’t go through. Please try again.';return;} | |
| 41 | + var p=j.person||'them'; | |
| 42 | + var msg={bonus:'Your rating raises '+p+'’s bonus today. The company pays it, not you.',none:'Thanks for letting us know. An okay rating doesn’t change anyone’s pay.',review:'Thanks for telling us. A low rating is checked before it counts, and '+p+' gets a chance to respond. It never touches their wage or earned pay.'}[j.effect]; | |
| 43 | + $('r-done-h').textContent=j.effect==='review'?'Thanks for your honesty.':'Thank you!'; | |
| 44 | + $('r-done-p').textContent=msg;$('r-done-test').hidden=!j.test;show('r-done'); | |
| 45 | + }).catch(function(){b.disabled=false;$('r-ferr').textContent='We couldn’t reach Paywell. Please try again.';}); | |
| 46 | + }); | |
| 47 | + var t=tokenFromUrl(); if(t) load(t); | |
| 48 | + })(); |
assets/site.css added
| 1 | + *{box-sizing:border-box} | |
| 2 | + :root{--bg:#f6f8f5;--fg:#13241c;--mut:#566a60;--card:#fff;--line:#dbe5de;--a:#0f3d2e;--on-a:#f6f8f5;--ac:#1e7a52;--gold:#c98a12;--tint:#e8f3ec;--warn:#fff4dc;--warn-fg:#6b4a00;--bad:#b3261e} | |
| 3 | + @media (prefers-color-scheme:dark){:root{--bg:#0b1310;--fg:#eaf3ee;--mut:#9db3a7;--card:#121e19;--line:#1f3129;--a:#7fd1a3;--on-a:#0b1310;--ac:#7fd1a3;--gold:#f0bd4f;--tint:#12261d;--warn:#2b2312;--warn-fg:#f3d48c;--bad:#ff8a80}} | |
| 4 | + html{scroll-behavior:smooth} | |
| 5 | + body{margin:0;background:var(--bg);color:var(--fg);font:17px/1.6 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;-webkit-font-smoothing:antialiased} | |
| 6 | + img,svg{max-width:100%;height:auto;display:block} | |
| 7 | + a{color:inherit} | |
| 8 | + .wrap{max-width:1100px;margin:0 auto;padding:0 20px} | |
| 9 | + .skip{position:absolute;left:-9999px}.skip:focus{left:16px;top:12px;background:var(--card);padding:10px 16px;border-radius:999px;z-index:9} | |
| 10 | + header.top{display:flex;align-items:center;justify-content:space-between;padding:20px 0;gap:16px;flex-wrap:wrap} | |
| 11 | + .brand{display:flex;align-items:center;gap:10px;font-weight:800;font-size:22px;letter-spacing:-.02em;text-decoration:none} | |
| 12 | + .brand svg{width:32px;height:32px} | |
| 13 | + nav.main{display:flex;gap:6px;flex-wrap:wrap} | |
| 14 | + nav.main a{color:var(--mut);text-decoration:none;font-size:15px;padding:10px 14px;border-radius:999px;min-height:44px;display:inline-flex;align-items:center} | |
| 15 | + nav.main a:hover,nav.main a[aria-current=page]{color:var(--fg);background:var(--tint)} | |
| 16 | + .hero{display:grid;grid-template-columns:1.05fr 1fr;gap:40px;align-items:center;padding:36px 0 64px} | |
| 17 | + h1{font-size:clamp(38px,6.2vw,68px);line-height:1.04;margin:0 0 18px;letter-spacing:-.035em} | |
| 18 | + h1.sm{font-size:clamp(34px,5vw,54px)} | |
| 19 | + .lede{font-size:20px;color:var(--mut);max-width:560px;margin:0 0 28px} | |
| 20 | + .eyebrow{font-size:13px;letter-spacing:.12em;text-transform:uppercase;font-weight:700;color:var(--ac);margin:0 0 10px} | |
| 21 | + .btns{display:flex;gap:12px;flex-wrap:wrap} | |
| 22 | + .btn{display:inline-flex;align-items:center;justify-content:center;min-height:48px;padding:12px 26px;border-radius:999px;background:var(--a);color:var(--on-a);text-decoration:none;font-weight:650;border:0;font:inherit;font-weight:650;cursor:pointer} | |
| 23 | + .btn.o{background:transparent;color:var(--fg);border:1.5px solid var(--line)} | |
| 24 | + .btn:focus-visible,a:focus-visible,button:focus-visible,input:focus-visible,textarea:focus-visible{outline:3px solid var(--gold);outline-offset:2px} | |
| 25 | + .art{border-radius:28px;overflow:hidden;background:var(--tint)} | |
| 26 | + .art img{width:100%;aspect-ratio:3/2;object-fit:cover} | |
| 27 | + h2{font-size:clamp(28px,4vw,40px);letter-spacing:-.025em;line-height:1.12;margin:0 0 12px} | |
| 28 | + h3{font-size:20px;margin:0 0 6px;letter-spacing:-.01em} | |
| 29 | + .sec{padding:60px 0;border-top:1px solid var(--line)} | |
| 30 | + .sub{color:var(--mut);max-width:680px;margin:0 0 32px;font-size:18px} | |
| 31 | + .cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:16px} | |
| 32 | + .card{background:var(--card);border:1px solid var(--line);border-radius:20px;padding:24px} | |
| 33 | + .card p{margin:0;color:var(--mut)} | |
| 34 | + .card .ic{width:44px;height:44px;border-radius:14px;background:var(--tint);display:grid;place-items:center;margin-bottom:14px;color:var(--ac)} | |
| 35 | + .card .ic svg{width:24px;height:24px} | |
| 36 | + .split{display:grid;grid-template-columns:1fr 1fr;gap:40px;align-items:center} | |
| 37 | + .split.top{align-items:start} | |
| 38 | + .photo{border-radius:24px;overflow:hidden;background:var(--tint)} | |
| 39 | + .photo img{width:100%;aspect-ratio:3/2;object-fit:cover} | |
| 40 | + ol.steps{list-style:none;counter-reset:s;margin:0;padding:0;display:grid;gap:14px} | |
| 41 | + ol.steps li{counter-increment:s;background:var(--card);border:1px solid var(--line);border-radius:18px;padding:18px 20px 18px 68px;position:relative} | |
| 42 | + ol.steps li:before{content:counter(s);position:absolute;left:20px;top:18px;width:32px;height:32px;border-radius:999px;background:var(--a);color:var(--on-a);display:grid;place-items:center;font-weight:700;font-size:15px} | |
| 43 | + ol.steps b{display:block;margin-bottom:2px}ol.steps span{color:var(--mut)} | |
| 44 | + .callout{background:var(--tint);border-radius:20px;padding:22px 24px;font-size:17px} | |
| 45 | + .callout.warn{background:var(--warn);color:var(--warn-fg)} | |
| 46 | + .status{display:inline-flex;gap:8px;align-items:center;font-size:14px;font-weight:600;padding:8px 14px;border-radius:999px;background:var(--warn);color:var(--warn-fg);margin:0 0 18px} | |
| 47 | + .status:before{content:"";width:8px;height:8px;border-radius:999px;background:currentColor} | |
| 48 | + .prose{max-width:760px} | |
| 49 | + .prose h2{font-size:28px;margin-top:44px} | |
| 50 | + .prose h3{margin-top:28px} | |
| 51 | + .prose p,.prose li{color:var(--fg)} | |
| 52 | + .prose ul{padding-left:22px} | |
| 53 | + .prose li{margin:6px 0} | |
| 54 | + table.t{width:100%;border-collapse:collapse;background:var(--card);border:1px solid var(--line);border-radius:16px;overflow:hidden;font-size:16px} | |
| 55 | + table.t th,table.t td{padding:12px 14px;text-align:left;border-bottom:1px solid var(--line);vertical-align:top} | |
| 56 | + table.t th{background:var(--tint);font-size:14px;letter-spacing:.02em} | |
| 57 | + table.t tr:last-child td{border-bottom:0} | |
| 58 | + .never{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px;margin:18px 0} | |
| 59 | + .never div{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:16px 18px;font-weight:600} | |
| 60 | + .never div:before{content:"✕ ";color:var(--bad)} | |
| 61 | + .yes div:before{content:"✓ ";color:var(--ac)} | |
| 62 | + details{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:4px 20px;margin:10px 0} | |
| 63 | + details summary{cursor:pointer;font-weight:650;padding:14px 0;min-height:44px} | |
| 64 | + details[open] summary{border-bottom:1px solid var(--line);margin-bottom:10px} | |
| 65 | + footer.site{border-top:1px solid var(--line);padding:26px 0 44px;color:var(--mut);font-size:15px} | |
| 66 | + footer.site a{text-decoration:none}footer.site a:hover{text-decoration:underline} | |
| 67 | + .small{font-size:14px;color:var(--mut)} | |
| 68 | + @media (max-width:860px){.hero,.split{grid-template-columns:1fr}.hero{padding:16px 0 48px}.split .photo{order:-1}} | |
| 69 | + @media (max-width:560px){nav.main a{padding:8px 11px;font-size:14px}body{font-size:16.5px}} | |
| 70 | + | |
| 71 | + /* How-it-works diagram */ | |
| 72 | + .flow{margin:8px 0 28px;display:grid;grid-template-columns:1.25fr auto 1fr auto 1fr auto 1.1fr;gap:12px;align-items:center} | |
| 73 | + .fcol{display:grid;gap:12px} | |
| 74 | + .fbox{background:var(--card);border:1px solid var(--line);border-radius:20px;padding:16px 18px;display:grid;gap:4px} | |
| 75 | + .fbox b{font-size:17px}.fbox span{color:var(--mut);font-size:15px;line-height:1.4}.fbox em{font-style:normal;font-weight:700;color:var(--ac);font-size:14px} | |
| 76 | + .fbox.mid{background:var(--tint);border-color:transparent} | |
| 77 | + .fbox.gold{background:var(--a);color:var(--on-a);border-color:transparent}.fbox.gold span{color:var(--on-a);opacity:.85} | |
| 78 | + .fop{font-size:28px;font-weight:800;color:var(--ac);text-align:center} | |
| 79 | + .fbase{grid-column:1/-1;border:2px dashed var(--line);border-radius:20px;padding:14px 18px;display:grid;gap:2px}.fbase span{color:var(--mut);font-size:15px} | |
| 80 | + .ranks{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin:0 0 20px} | |
| 81 | + .rank{background:var(--card);border:1px solid var(--line);border-radius:20px;padding:18px;display:grid;gap:4px} | |
| 82 | + .rank i{font-style:normal;width:36px;height:36px;border-radius:999px;background:var(--a);color:var(--on-a);display:grid;place-items:center;font-weight:800} | |
| 83 | + .rank b{font-size:18px}.rank span{color:var(--mut);font-size:15px} | |
| 84 | + @media (max-width:860px){.flow{grid-template-columns:1fr}.fop{font-size:24px;line-height:1}.fa{display:inline-block;transform:rotate(90deg)}.ranks{grid-template-columns:1fr}} |
assets/visitor-odometer.v1.css added
| 1 | + /* Self-host with visitor-odometer.v1.js. No fonts, images, or other requests. */ | |
| 2 | + .visitor-odometer { | |
| 3 | + --visitor-accent: #ffad64; | |
| 4 | + display: flex; flex-wrap: wrap; align-items: center; gap: 8px 13px; | |
| 5 | + margin-block: 1rem; font: inherit; | |
| 6 | + } | |
| 7 | + .visitor-odometer-label { | |
| 8 | + font: 600 .72rem/1.25 ui-monospace, monospace; | |
| 9 | + letter-spacing: .16em; text-transform: uppercase; | |
| 10 | + } | |
| 11 | + .visitor-odometer-tiles { | |
| 12 | + display: inline-flex; gap: clamp(2px, 1vw, 4px); max-width: 100%; padding: 5px; | |
| 13 | + border: 1px solid #ffffff20; border-radius: 9px; background: linear-gradient(#18191c, #070708); | |
| 14 | + box-shadow: 0 8px 25px -12px #0009; | |
| 15 | + } | |
| 16 | + .visitor-odometer-tile { | |
| 17 | + position: relative; display: grid; overflow: hidden; place-items: center; | |
| 18 | + min-width: 0; width: clamp(13px, 7vw, 29px); height: clamp(26px, 9vw, 39px); | |
| 19 | + border-radius: 4px; background: linear-gradient(#24252a 0%, #17181b 49%, #0b0c0d 51%, #18191c); | |
| 20 | + box-shadow: inset 0 0 0 1px #ffffff12, inset 0 -6px 10px #0007; | |
| 21 | + } | |
| 22 | + .visitor-odometer-tile::after { | |
| 23 | + position: absolute; inset-inline: 0; top: 50%; height: 1px; content: ""; background: #0009; | |
| 24 | + } | |
| 25 | + .visitor-odometer-face { | |
| 26 | + color: var(--visitor-accent); font: 600 clamp(14px, 5vw, 24px)/1 ui-monospace, monospace; | |
| 27 | + font-variant-numeric: tabular-nums; text-shadow: 0 0 7px #f580256e; | |
| 28 | + animation: visitor-odometer-roll .6s cubic-bezier(.2, .8, .2, 1) both; | |
| 29 | + } | |
| 30 | + .visitor-odometer-note { font-size: .875rem; } | |
| 31 | + .visitor-odometer-number { font-weight: 650; } | |
| 32 | + .visitor-odometer-sr { | |
| 33 | + position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; | |
| 34 | + clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); | |
| 35 | + } | |
| 36 | + @keyframes visitor-odometer-roll { | |
| 37 | + from { transform: translateY(-90%); opacity: 0; } | |
| 38 | + to { transform: none; opacity: 1; } | |
| 39 | + } | |
| 40 | + @media (prefers-reduced-motion: reduce) { .visitor-odometer-face { animation: none; } } |
assets/visitor-odometer.v1.js added
| 1 | + // Aggregate-only visitor odometer: no cookies, referrer, identifiers or beacons. | |
| 2 | + (() => { | |
| 3 | + 'use strict'; | |
| 4 | + const endpoint = 'https://projectatom.ai/api/visits'; | |
| 5 | + const selector = '[data-visitor-odometer][data-visitor-site]'; | |
| 6 | + const siteIDs = new Set(['projectatom', 'protomota', 'airesourcepro', 'skillfarm', 'portfolio', 'opentalon', 'inkspring', 'jotley', | |
| 7 | + 'glimmer', 'pulsecanvas', 'graphley', 'bucksley', 'jobley', 'voxley', 'textley', 'moontrace', 'sunlaid', 'cypress', 'lightwell', 'lumengesso', 'clearwake', 'krahn', 'chewandrinse', 'sidestreetmakers', 'carryspan', 'commonwakemarine', 'rootwardgardens', 'evenharbor', 'clearmeadow', 'fieldofwhy', | |
| 8 | + 'watchencyclopedia', 'paywell', 'makeaclip', 'groundroom', 'brightpatchstories', 'calendarley', 'champagnedamage', | |
| 9 | + 'neverwastv', 'noctvrne', 'otherworldvision', 'quillflow', 'tradenook', 'trendii', 'vexley', 'laceless', 'kindpaw', 'petgrove', | |
| 10 | + 'homegrove', 'cyclical', 'commongrocer', 'brightiris', 'homeandroad', 'clothworks', 'jotkey', 'stridewell', 'branchwell', 'platewell', 'everbuilt']); | |
| 11 | + const pending = new Map(); | |
| 12 | + const minimumDigits = 7; | |
| 13 | + const ordinal = n => Number.isSafeInteger(n) && n > 0; | |
| 14 | + const keyFor = site => site === 'projectatom' ? 'atom-visitor-no' : `visitor-odometer-v1:${site}`; | |
| 15 | + function element(tag, name, text = '') { | |
| 16 | + const node = document.createElement(tag); | |
| 17 | + node.className = name; | |
| 18 | + node.textContent = text; | |
| 19 | + return node; | |
| 20 | + } | |
| 21 | + function paint(node, count, mine, unavailable = false) { | |
| 22 | + const numeral = count == null ? (unavailable ? '–' : '·').repeat(minimumDigits) : String(count).padStart(minimumDigits, '0'); | |
| 23 | + const description = count == null ? (unavailable ? 'Visitor count unavailable' : 'Loading visitor count') : `${count.toLocaleString()} visitors`; | |
| 24 | + const accessibleTotal = element('span', 'visitor-odometer-sr', description); | |
| 25 | + accessibleTotal.setAttribute('role', 'status'); | |
| 26 | + const label = element('span', 'visitor-odometer-label', 'Visitors'); | |
| 27 | + label.setAttribute('aria-hidden', 'true'); | |
| 28 | + const digits = element('span', 'visitor-odometer-tiles'); | |
| 29 | + digits.setAttribute('aria-hidden', 'true'); | |
| 30 | + for (const character of numeral) { | |
| 31 | + const digit = element('span', 'visitor-odometer-tile'); | |
| 32 | + digit.append(element('span', 'visitor-odometer-face', character)); | |
| 33 | + digits.append(digit); | |
| 34 | + } | |
| 35 | + const note = element('span', 'visitor-odometer-note', ordinal(mine) ? 'You’re visitor ' : 'Thank you for being here.'); | |
| 36 | + if (ordinal(mine)) { | |
| 37 | + note.append(element('strong', 'visitor-odometer-number', `No. ${mine.toLocaleString()}`), '. Thank you for being here.'); | |
| 38 | + } | |
| 39 | + node.classList.add('visitor-odometer'); | |
| 40 | + node.setAttribute('role', 'group'); | |
| 41 | + node.setAttribute('aria-label', 'Visitor counter'); | |
| 42 | + node.replaceChildren(label, digits, accessibleTotal, note); | |
| 43 | + } | |
| 44 | + function browserNumber(site) { | |
| 45 | + try { | |
| 46 | + const n = Number(window.localStorage.getItem(keyFor(site))); | |
| 47 | + return ordinal(n) ? n : null; | |
| 48 | + } catch { return null; } | |
| 49 | + } | |
| 50 | + async function request(site, method) { | |
| 51 | + const response = await fetch(site === 'projectatom' ? '/api/visits' : `${endpoint}?site=${encodeURIComponent(site)}`, { | |
| 52 | + method, | |
| 53 | + signal: typeof AbortSignal.timeout === 'function' ? AbortSignal.timeout(4500) : undefined, | |
| 54 | + mode: 'cors', | |
| 55 | + credentials: 'omit', | |
| 56 | + referrerPolicy: 'no-referrer', | |
| 57 | + cache: 'no-store', | |
| 58 | + redirect: 'error', | |
| 59 | + }); | |
| 60 | + if (!response.ok) throw new Error('Counter unavailable'); | |
| 61 | + const result = await response.json(); | |
| 62 | + if (!Number.isSafeInteger(result?.count) || result.count < 0) throw new Error('Counter unavailable'); | |
| 63 | + return result; | |
| 64 | + } | |
| 65 | + async function load(site, mine) { | |
| 66 | + const read = () => request(site, 'GET').catch(async () => { | |
| 67 | + await new Promise(resolve => setTimeout(resolve, 400)); | |
| 68 | + return request(site, 'GET'); | |
| 69 | + }); | |
| 70 | + const run = async () => { | |
| 71 | + mine = browserNumber(site) ?? mine; | |
| 72 | + const data = await (mine ? read() : request(site, 'POST').catch(read)); | |
| 73 | + if (ordinal(data.you) && data.you <= data.count) { | |
| 74 | + try { window.localStorage.setItem(keyFor(site), String(data.you)); } catch { /* storage disabled */ } | |
| 75 | + } | |
| 76 | + return data; | |
| 77 | + }; | |
| 78 | + const locks = site === 'projectatom' ? window.navigator?.locks : null; | |
| 79 | + const result = await (locks ? locks.request(keyFor(site), run) : run()); | |
| 80 | + if (ordinal(result.you) && result.you <= result.count) { | |
| 81 | + mine = result.you; | |
| 82 | + // Keep the number only on this browser, for the current site. It is | |
| 83 | + // never placed in the URL or otherwise sent back to the counter. | |
| 84 | + try { window.localStorage.setItem(keyFor(site), String(mine)); } catch { /* storage disabled */ } | |
| 85 | + } | |
| 86 | + return { count: result.count, mine }; | |
| 87 | + } | |
| 88 | + function mount(widget) { | |
| 89 | + if (!widget.isConnected || widget.firstElementChild) return; | |
| 90 | + const site = widget.getAttribute('data-visitor-site'); | |
| 91 | + if (!siteIDs.has(site)) return; | |
| 92 | + const mine = browserNumber(site); | |
| 93 | + paint(widget, null, mine); | |
| 94 | + if (!pending.has(site)) pending.set(site, load(site, mine)); | |
| 95 | + pending.get(site).then(result => { if (widget.isConnected) paint(widget, result.count, result.mine); }) | |
| 96 | + .catch(() => { if (widget.isConnected) paint(widget, null, mine, true); }); | |
| 97 | + } | |
| 98 | + | |
| 99 | + // Hydrating or navigating an SPA can replace server-rendered placeholders. | |
| 100 | + // Reuse the previous request: remounting must not count a second visit. | |
| 101 | + document.querySelectorAll(selector).forEach(mount); | |
| 102 | + new MutationObserver(records => { | |
| 103 | + for (const record of records) { | |
| 104 | + if (record.target.matches?.(selector)) mount(record.target); | |
| 105 | + for (const node of record.addedNodes) { | |
| 106 | + if (node.matches?.(selector)) mount(node); | |
| 107 | + node.querySelectorAll?.(selector).forEach(mount); | |
| 108 | + } | |
| 109 | + } | |
| 110 | + }).observe(document.body, { childList: true, subtree: true }); | |
| 111 | + })(); |
careers/careers.js added
| 1 | + (function(){var f=document.getElementById('cr-form');if(!f)return;var m=document.getElementById('cr-msg'); | |
| 2 | + f.addEventListener('submit',function(e){e.preventDefault(); | |
| 3 | + var E=f.elements,n=(E['name'].value||'').trim(),em=(E['email'].value||'').trim(),t=E['request'].value.trim(); | |
| 4 | + if(!n){m.textContent='Please add your name.';return;} | |
| 5 | + if(!/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(em)){m.textContent='Please add a valid email.';return;} | |
| 6 | + if(!t){m.textContent='Please write a short message.';return;} | |
| 7 | + var b=f.querySelector('button');b.disabled=true;m.textContent='Sending…'; | |
| 8 | + fetch('/api/request',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({request:'Name: '+n+'\nEmail: '+em+'\n\n'+t,name:n,email:em,message:t,site:location.hostname,website:E['website'].value})}) | |
| 9 | + .then(function(r){if(!r.ok)throw 0;f.reset();m.textContent='Thanks. We got your note and will be in touch about joining our team.';}) | |
| 10 | + .catch(function(){m.textContent='That didn’t go through. Please try again in a minute.';}) | |
| 11 | + .then(function(){b.disabled=false;});});})(); |
careers/index.html added
| 1 | + <!doctype html> | |
| 2 | + <html lang="en"> | |
| 3 | + <head> | |
| 4 | + <meta charset="utf-8"> | |
| 5 | + <meta name="viewport" content="width=device-width,initial-scale=1"> | |
| 6 | + <title>Careers | Paywell</title> | |
| 7 | + <meta name="description" content="Join our team at Paywell. Part-time roles paid by the hour, work as much or as little as you want, take days off whenever you want, a Bitcoin bonus paid out automatically every day, and holistic health care."> | |
| 8 | + <link rel="canonical" href="https://paywell.company/careers/"> | |
| 9 | + <meta property="og:type" content="website"><meta property="og:site_name" content="Paywell"> | |
| 10 | + <meta property="og:title" content="Careers | Paywell"><meta property="og:description" content="Careers at Paywell. Send us a short request to work with us."> | |
| 11 | + <meta property="og:url" content="https://paywell.company/careers/"><meta property="og:image" content="https://paywell.company/img/og.jpg"> | |
| 12 | + <meta name="twitter:card" content="summary_large_image"> | |
| 13 | + <meta name="theme-color" content="#0f3d2e"> | |
| 14 | + <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='9' fill='%230f3d2e'/%3E%3Ccircle cx='16' cy='14.5' r='8.5' fill='%23e0a526'/%3E%3Ccircle cx='16' cy='14.5' r='6.6' fill='none' stroke='%230f3d2e' stroke-opacity='.35' stroke-width='1'/%3E%3Cpath d='M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z' fill='%230f3d2e'/%3E%3Cpath d='M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4' fill='none' stroke='%237fd1a3' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E"> | |
| 15 | + <link rel="manifest" href="/app/manifest.webmanifest"> | |
| 16 | + <link rel="stylesheet" href="/assets/site.css"> | |
| 17 | + <link rel="stylesheet" href="/careers/careers.css"> | |
| 18 | + </head> | |
| 19 | + <body> | |
| 20 | + <a class="skip" href="#main">Skip to content</a> | |
| 21 | + <div class="wrap"> | |
| 22 | + <header class="top"><a class="brand" href="/"><svg viewBox="0 0 32 32" aria-hidden="true"><rect width="32" height="32" rx="9" fill="#0f3d2e"/><circle cx="16" cy="14.5" r="8.5" fill="#e0a526"/><circle cx="16" cy="14.5" r="6.6" fill="none" stroke="#0f3d2e" stroke-opacity=".35" stroke-width="1"/><path d="M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z" fill="#0f3d2e"/><path d="M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4" fill="none" stroke="#7fd1a3" stroke-width="2.2" stroke-linecap="round"/></svg>Paywell</a><nav class="main" aria-label="Main"><a href="/how-it-works/">How it works</a><a href="/fair-pay/">Fair pay</a><a href="/learn/">Bitcoin basics</a><a href="/rate/">Rate a visit</a><a href="/app/">Team app</a><a href="/open/">Open code</a><a href="/careers/">Careers</a></nav></header> | |
| 23 | + </div> | |
| 24 | + <main id="main" class="ct-main"><style id="ct-style"> | |
| 25 | + main.ct-main{max-width:1180px!important;width:100%;margin:0 auto!important;padding:56px 20px 80px!important;box-sizing:border-box;display:block!important} | |
| 26 | + .ct-main .ct-eyebrow{display:inline-block;font-size:13px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;opacity:.75;margin:0 0 10px} | |
| 27 | + .ct-main h1{font-size:clamp(36px,6vw,60px);line-height:1.05;margin:0 0 16px} | |
| 28 | + .ct-main h2{font-size:clamp(24px,3.4vw,34px);line-height:1.15;margin:0 0 10px} | |
| 29 | + .ct-main p{font-size:18px;line-height:1.6;margin:0 0 14px} | |
| 30 | + .ct-main .ct-lede{font-size:21px;max-width:820px} | |
| 31 | + .ct-main section{margin:0 0 56px} | |
| 32 | + .ct-facts{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin:28px 0 0} | |
| 33 | + .ct-facts div{border:1px solid rgba(127,127,127,.35);border-radius:18px;padding:16px 18px;font-size:16px;line-height:1.4} | |
| 34 | + .ct-facts b{display:block;font-size:17px;margin-bottom:2px} | |
| 35 | + .ct-cards{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-top:18px} | |
| 36 | + .ct-cards div{border:1px solid rgba(127,127,127,.35);border-radius:20px;padding:20px 22px} | |
| 37 | + .ct-cards h3{font-size:19px;margin:0 0 6px}.ct-cards p{font-size:16px;margin:0;opacity:.88} | |
| 38 | + .ct-join{border:2px solid currentColor;border-radius:24px;padding:28px;max-width:760px} | |
| 39 | + .ct-join label{display:block;font-weight:700;font-size:19px;margin:0 0 10px} | |
| 40 | + .ct-row{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-bottom:14px}.ct-join input{width:100%;box-sizing:border-box;font:inherit;font-size:17px;padding:12px 16px;border-radius:14px;border:1.5px solid rgba(127,127,127,.5);background:transparent;color:inherit} | |
| 41 | + .ct-join textarea{width:100%;min-height:150px;box-sizing:border-box;font:inherit;font-size:17px;padding:14px 16px;border-radius:16px;border:1.5px solid rgba(127,127,127,.5);background:transparent;color:inherit} | |
| 42 | + .ct-join button{margin-top:14px;border:0;cursor:pointer;font:inherit;font-weight:700;font-size:17px;padding:14px 28px;border-radius:999px;background:currentColor} | |
| 43 | + .ct-join button span{color:#fff;mix-blend-mode:difference} | |
| 44 | + .ct-hp{position:absolute;left:-9999px} | |
| 45 | + .ct-main .ct-small{font-size:15px;opacity:.75} | |
| 46 | + @media (max-width:900px){.ct-facts{grid-template-columns:1fr 1fr}.ct-cards{grid-template-columns:1fr}} | |
| 47 | + @media (max-width:520px){.ct-facts,.ct-row{grid-template-columns:1fr}.ct-join{padding:20px}} | |
| 48 | + </style> | |
| 49 | + <section><span class="ct-eyebrow">Careers</span><h1>Join our team</h1> | |
| 50 | + <p class="ct-lede">We're looking for people to join our team at Paywell. No résumé needed. Tell us your name, your email and what you'd like to do, and we'll get back to you.</p> | |
| 51 | + | |
| 52 | + <div class="ct-facts"><div><b>Your hours, your days off</b>Work as much or as little as you want, up to 39 hours a week, and take days off whenever you want</div><div><b>Paid hourly</b>A guaranteed hourly wage in U.S. dollars, on time, every time</div><div><b>Daily Bitcoin bonus</b>Paid out automatically, every day</div><div><b>Holistic health care</b>Through the holistic clinics we work with</div></div></section> | |
| 53 | + <section><form id="cr-form" class="ct-join" novalidate> | |
| 54 | + <div class="ct-row"><div><label for="cr-name">Name</label><input id="cr-name" name="name" required maxlength="120" autocomplete="name"></div> | |
| 55 | + <div><label for="cr-email">Email</label><input id="cr-email" name="email" type="email" required maxlength="200" autocomplete="email"></div></div> | |
| 56 | + <label for="cr-request">Message</label> | |
| 57 | + <textarea id="cr-request" name="request" required maxlength="4000" rows="6" placeholder="What work would you like to do with us?"></textarea> | |
| 58 | + <div class="ct-hp" aria-hidden="true"><label>Leave this empty <input name="website" tabindex="-1" autocomplete="off"></label></div> | |
| 59 | + <button type="submit"><span>Join our team</span></button> | |
| 60 | + <p id="cr-msg" class="cr-msg" role="status" aria-live="polite"></p> | |
| 61 | + </form></section> | |
| 62 | + <section><h2>Our pay promise</h2><div class="ct-cards"> | |
| 63 | + <div><h3>Flexible hours, days off anytime</h3><p>All our roles are part-time and paid by the hour. Work as much or as little as you want, up to 39 hours a week, and take days off whenever you want.</p></div> | |
| 64 | + <div><h3>A guaranteed hourly wage</h3><p>Every team member is paid by the hour, at a guaranteed wage that meets or beats every wage law where they work, paid in U.S. dollars.</p></div> | |
| 65 | + <div><h3>Daily Bitcoin bonuses</h3><p>On top of that wage, every team member gets a Bitcoin bonus every day, paid out automatically. It grows with how well they perform, and we fund it ourselves.</p></div> | |
| 66 | + <div><h3>No tips, ever</h3><p>Our team does not ask for or accept tips. Customers thank great work with a free rating instead.</p></div> | |
| 67 | + <div><h3>Fair ratings</h3><p>Every team member can see each rating that affects them and can dispute it. A real person reviews every dispute.</p></div> | |
| 68 | + <div><h3>Holistic health care</h3><p>Team members get their health care through the holistic clinics we work with. Care outside those clinics is not covered.</p></div> | |
| 69 | + </div></section> | |
| 70 | + <section><h2>How bonuses are worked out</h2><p>Everyone gets a bonus every day, paid out automatically. Its size comes from what customers and teammates say about someone's work, and from their tier. There are three tiers.</p> | |
| 71 | + <div class="pgflow" aria-label="How daily Bitcoin bonuses are worked out"> | |
| 72 | + <style> | |
| 73 | + .pgflow{margin:18px 0 8px;display:grid;grid-template-columns:1.2fr auto 1fr auto 1fr auto 1.1fr;gap:10px;align-items:center;text-align:left} | |
| 74 | + .pgflow .pc{display:grid;gap:10px} | |
| 75 | + .pgflow .pb{border:1px solid rgba(127,127,127,.35);border-radius:18px;padding:14px 16px;display:grid;gap:3px;line-height:1.35} | |
| 76 | + .pgflow .pb b{font-size:16px}.pgflow .pb span{font-size:14px;opacity:.8}.pgflow .pb em{font-style:normal;font-weight:700;font-size:13px;opacity:.9} | |
| 77 | + .pgflow .pm{background:rgba(127,127,127,.12);border-color:transparent} | |
| 78 | + .pgflow .pg{border:2px solid currentColor} | |
| 79 | + .pgflow .po{font-size:26px;font-weight:800;text-align:center;opacity:.75} | |
| 80 | + .pgflow .pw{grid-column:1/-1;border:2px dashed rgba(127,127,127,.4);border-radius:18px;padding:12px 16px;font-size:15px} | |
| 81 | + .pgflow .pt{grid-column:1/-1;display:grid;grid-template-columns:repeat(3,1fr);gap:10px} | |
| 82 | + .pgflow .pt div{border:1px solid rgba(127,127,127,.35);border-radius:16px;padding:12px 14px;font-size:14px;line-height:1.35} | |
| 83 | + @media (max-width:820px){.pgflow,.pgflow .pt{grid-template-columns:1fr}.pgflow .pa{display:inline-block;transform:rotate(90deg)}} | |
| 84 | + </style> | |
| 85 | + <div class="pc"><div class="pb"><b>Customer reviews</b><span>Free stars after each visit</span><em>60% of the score</em></div><div class="pb"><b>Peer reviews</b><span>Teammates rate teamwork each week</span><em>40% of the score</em></div></div> | |
| 86 | + <div class="po" aria-hidden="true"><span class="pa">→</span></div> | |
| 87 | + <div class="pb pm"><b>Score</b><span>0 to 100, from recent ratings, updated daily</span></div> | |
| 88 | + <div class="po" aria-hidden="true">×</div> | |
| 89 | + <div class="pb pm"><b>Tier</b><span>Explorer, Builder or Guide. Higher tier, bigger bonus</span></div> | |
| 90 | + <div class="po" aria-hidden="true">=</div> | |
| 91 | + <div class="pb pg"><b>Daily Bitcoin bonus</b><span>Paid by us, automatically, every day. Shown in dollars</span></div> | |
| 92 | + <div class="pt"><div><b>Explorer</b><br>Everyone starts here, learning the work.</div><div><b>Builder</b><br>Growing, with steady high scores and teammates’ backing.</div><div><b>Guide</b><br>On the way to mastery, helping others grow.</div></div> | |
| 93 | + <div class="pw"><b>Plus a guaranteed wage</b>, at least the minimum wage where they work, through normal payroll. Reviews and tier never lower it.</div> | |
| 94 | + </div> | |
| 95 | + <p><a href="/fair-pay/">Read our full fair pay policy</a></p><p class="ct-small">Bitcoin bonuses are pay and are taxed like pay. Bonuses are always shown in U.S. dollars first.</p></section></main> | |
| 96 | + <div class="wrap"><footer class="site">Paywell <span aria-hidden="true">·</span> <a href="/research/">Research</a> <span aria-hidden="true">·</span> <a href="/careers/">Careers</a></footer></div> | |
| 97 | + </body> | |
| 98 | + </html> |
fair-pay/index.html added
| 1 | + <!doctype html> | |
| 2 | + <html lang="en"> | |
| 3 | + <head> | |
| 4 | + <meta charset="utf-8"> | |
| 5 | + <meta name="viewport" content="width=device-width,initial-scale=1"> | |
| 6 | + <title>Fair pay. No tipping. | Paywell</title> | |
| 7 | + <meta name="description" content="The fair pay policy every Paywell company follows: part-time roles, a guaranteed wage, daily company-funded Bitcoin bonuses, paid out automatically, and no tips."> | |
| 8 | + <link rel="canonical" href="https://paywell.company/fair-pay/"> | |
| 9 | + <meta property="og:type" content="website"><meta property="og:site_name" content="Paywell"> | |
| 10 | + <meta property="og:title" content="Fair pay. No tipping. | Paywell"><meta property="og:description" content="The fair pay policy every Paywell company follows: part-time roles, a guaranteed wage, daily company-funded Bitcoin bonuses, paid out automatically, and no tips."> | |
| 11 | + <meta property="og:url" content="https://paywell.company/fair-pay/"><meta property="og:image" content="https://paywell.company/img/og.jpg"> | |
| 12 | + <meta name="twitter:card" content="summary_large_image"> | |
| 13 | + <meta name="theme-color" content="#0f3d2e"> | |
| 14 | + <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='9' fill='%230f3d2e'/%3E%3Ccircle cx='16' cy='14.5' r='8.5' fill='%23e0a526'/%3E%3Ccircle cx='16' cy='14.5' r='6.6' fill='none' stroke='%230f3d2e' stroke-opacity='.35' stroke-width='1'/%3E%3Cpath d='M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z' fill='%230f3d2e'/%3E%3Cpath d='M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4' fill='none' stroke='%237fd1a3' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E"> | |
| 15 | + <link rel="manifest" href="/app/manifest.webmanifest"> | |
| 16 | + <link rel="stylesheet" href="/assets/site.css"> | |
| 17 | + </head> | |
| 18 | + <body> | |
| 19 | + <a class="skip" href="#main">Skip to content</a> | |
| 20 | + <div class="wrap"> | |
| 21 | + <header class="top"><a class="brand" href="/"><svg viewBox="0 0 32 32" aria-hidden="true"><rect width="32" height="32" rx="9" fill="#0f3d2e"/><circle cx="16" cy="14.5" r="8.5" fill="#e0a526"/><circle cx="16" cy="14.5" r="6.6" fill="none" stroke="#0f3d2e" stroke-opacity=".35" stroke-width="1"/><path d="M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z" fill="#0f3d2e"/><path d="M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4" fill="none" stroke="#7fd1a3" stroke-width="2.2" stroke-linecap="round"/></svg>Paywell</a><nav class="main" aria-label="Main"><a href="/how-it-works/">How it works</a><a href="/fair-pay/" aria-current=page>Fair pay</a><a href="/learn/">Bitcoin basics</a><a href="/rate/">Rate a visit</a><a href="/app/">Team app</a><a href="/open/">Open code</a><a href="/careers/">Careers</a></nav></header> | |
| 22 | + </div> | |
| 23 | + <main id="main"> | |
| 24 | + <div class="wrap"> | |
| 25 | + <section class="hero" style="padding-bottom:40px"> | |
| 26 | + <div> | |
| 27 | + <p class="eyebrow">Our employment policy</p> | |
| 28 | + <h1 class="sm">Fair pay. No tipping.</h1> | |
| 29 | + <p class="lede">The same promise at every company that pays through Paywell. Good work is rewarded by the company, never by asking customers for more.</p> | |
| 30 | + </div> | |
| 31 | + <div class="art"><img src="/img/payday.webp" width="1536" height="1024" alt="A plumber smiling at his phone on the tailgate of his truck"></div> | |
| 32 | + </section> | |
| 33 | + </div> | |
| 34 | + <section class="sec"><div class="wrap prose"> | |
| 35 | + <h2>The policy</h2> | |
| 36 | + <div class="never yes"> | |
| 37 | + <div>Part-time, paid hourly</div><div>Work as much or as little as you want</div><div>Days off whenever you want</div><div>A guaranteed wage</div><div>Daily Bitcoin bonuses</div><div>Rewards paid by the company</div><div>Thanks through ratings</div> | |
| 38 | + </div> | |
| 39 | + <ol class="steps"> | |
| 40 | + <li><b>Part-time roles.</b><span>Every role is part-time and paid by the hour. Team members work as much or as little as they want, up to 39 hours a week, and take days off whenever they want.</span></li> | |
| 41 | + <li><b>A guaranteed wage.</b><span>Every team member gets a steady hourly wage that meets or beats every wage law where they work, paid through normal payroll.</span></li> | |
| 42 | + <li><b>Daily Bitcoin bonuses.</b><span>On top of that wage, team members get a bonus every day, paid out automatically, shown in dollars and paid in Bitcoin. It grows with customer reviews, peer reviews and tier (there are three).</span></li> | |
| 43 | + <li><b>No tips.</b><span>Team members don’t ask for or accept tips. Customers never see a tip jar, tip line or tip screen.</span></li> | |
| 44 | + <li><b>Thanks without spending.</b><span>Customers who loved the service can leave a rating. Great ratings raise that person’s bonus.</span></li> | |
| 45 | + <li><b>The company pays the reward.</b><span>Every bonus comes from the company. Customers never pay extra for good service.</span></li> | |
| 46 | + <li><b>Holistic health care.</b><span>Team members get their health care through the holistic clinics we work with. Care outside those clinics is not covered.</span></li> | |
| 47 | + </ol> | |
| 48 | + <h2>What it means for customers</h2> | |
| 49 | + <p>The price you see is the whole price. Nobody will hand you a screen asking for 20%. If someone did a great job, a quick rating is the best way to thank them, and it costs you nothing.</p> | |
| 50 | + <h2>What it means for team members</h2> | |
| 51 | + <p>You know what you’ll earn before the week starts. Great days earn more. Hard days never take away what you’re owed. You can always dispute a rating, and you can always see how your bonus was worked out. <a href="/how-it-works/">See the full rules</a>.</p> | |
| 52 | + <h2>Bonuses and taxes</h2> | |
| 53 | + <p>Bonuses are part of your pay. They are reported at their dollar value when paid, and taxes are withheld the same way as your wage, so there are no surprises at tax time.</p> | |
| 54 | + <h2>New to Bitcoin?</h2> | |
| 55 | + <p>Read <a href="/learn/">Bitcoin basics</a>: what it is, how to keep it safe, how to turn it into dollars, and what fees, price swings and taxes mean for you.</p> | |
| 56 | + </div></section> | |
| 57 | + </main> | |
| 58 | + <div class="wrap"><footer class="site">Paywell <span aria-hidden="true">·</span> <a href="/careers/">Careers</a></footer></div> | |
| 59 | + </body> | |
| 60 | + </html> |
how-it-works/index.html added
| 1 | + <!doctype html> | |
| 2 | + <html lang="en"> | |
| 3 | + <head> | |
| 4 | + <meta charset="utf-8"> | |
| 5 | + <meta name="viewport" content="width=device-width,initial-scale=1"> | |
| 6 | + <title>How Paywell works | Wages, bonuses and ratings</title> | |
| 7 | + <meta name="description" content="How Paywell pays a guaranteed wage plus a daily Bitcoin bonus based on customer reviews, peer reviews and one of three tiers, and how reviews are checked, disputed and protected from fraud."> | |
| 8 | + <link rel="canonical" href="https://paywell.company/how-it-works/"> | |
| 9 | + <meta property="og:type" content="website"><meta property="og:site_name" content="Paywell"> | |
| 10 | + <meta property="og:title" content="How Paywell works | Wages, bonuses and ratings"><meta property="og:description" content="How Paywell pays a guaranteed wage plus a daily Bitcoin bonus based on customer reviews, peer reviews and one of three tiers, and how reviews are checked, disputed and protected from fraud."> | |
| 11 | + <meta property="og:url" content="https://paywell.company/how-it-works/"><meta property="og:image" content="https://paywell.company/img/og.jpg"> | |
| 12 | + <meta name="twitter:card" content="summary_large_image"> | |
| 13 | + <meta name="theme-color" content="#0f3d2e"> | |
| 14 | + <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='9' fill='%230f3d2e'/%3E%3Ccircle cx='16' cy='14.5' r='8.5' fill='%23e0a526'/%3E%3Ccircle cx='16' cy='14.5' r='6.6' fill='none' stroke='%230f3d2e' stroke-opacity='.35' stroke-width='1'/%3E%3Cpath d='M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z' fill='%230f3d2e'/%3E%3Cpath d='M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4' fill='none' stroke='%237fd1a3' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E"> | |
| 15 | + <link rel="manifest" href="/app/manifest.webmanifest"> | |
| 16 | + <link rel="stylesheet" href="/assets/site.css"> | |
| 17 | + </head> | |
| 18 | + <body> | |
| 19 | + <a class="skip" href="#main">Skip to content</a> | |
| 20 | + <div class="wrap"> | |
| 21 | + <header class="top"><a class="brand" href="/"><svg viewBox="0 0 32 32" aria-hidden="true"><rect width="32" height="32" rx="9" fill="#0f3d2e"/><circle cx="16" cy="14.5" r="8.5" fill="#e0a526"/><circle cx="16" cy="14.5" r="6.6" fill="none" stroke="#0f3d2e" stroke-opacity=".35" stroke-width="1"/><path d="M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z" fill="#0f3d2e"/><path d="M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4" fill="none" stroke="#7fd1a3" stroke-width="2.2" stroke-linecap="round"/></svg>Paywell</a><nav class="main" aria-label="Main"><a href="/how-it-works/" aria-current=page>How it works</a><a href="/fair-pay/">Fair pay</a><a href="/learn/">Bitcoin basics</a><a href="/rate/">Rate a visit</a><a href="/app/">Team app</a><a href="/open/">Open code</a><a href="/careers/">Careers</a></nav></header> | |
| 22 | + </div> | |
| 23 | + <main id="main"> | |
| 24 | + <div class="wrap"> | |
| 25 | + <section class="hero" style="padding-bottom:40px"> | |
| 26 | + <div> | |
| 27 | + <p class="eyebrow">How it works</p> | |
| 28 | + <h1 class="sm">Simple rules, written down.</h1> | |
| 29 | + <p class="lede">Here is exactly how pay, bonuses and ratings fit together, and how we keep the system fair for team members and customers.</p> | |
| 30 | + </div> | |
| 31 | + <div class="art"><img src="/img/crew.webp" width="1536" height="1024" alt="A home-repair crew having a morning huddle beside a service van"></div> | |
| 32 | + </section> | |
| 33 | + </div> | |
| 34 | + | |
| 35 | + <section class="sec"><div class="wrap prose"> | |
| 36 | + <h2 id="pay">1. Your pay</h2> | |
| 37 | + <p>Your pay has two parts. The wage is fixed. The Bitcoin bonus grows with your reviews and your tier.</p> | |
| 38 | + <div class="pgflow" aria-label="How daily Bitcoin bonuses are worked out"> | |
| 39 | + <style> | |
| 40 | + .pgflow{margin:18px 0 8px;display:grid;grid-template-columns:1.2fr auto 1fr auto 1fr auto 1.1fr;gap:10px;align-items:center;text-align:left} | |
| 41 | + .pgflow .pc{display:grid;gap:10px} | |
| 42 | + .pgflow .pb{border:1px solid rgba(127,127,127,.35);border-radius:18px;padding:14px 16px;display:grid;gap:3px;line-height:1.35} | |
| 43 | + .pgflow .pb b{font-size:16px}.pgflow .pb span{font-size:14px;opacity:.8}.pgflow .pb em{font-style:normal;font-weight:700;font-size:13px;opacity:.9} | |
| 44 | + .pgflow .pm{background:rgba(127,127,127,.12);border-color:transparent} | |
| 45 | + .pgflow .pg{border:2px solid currentColor} | |
| 46 | + .pgflow .po{font-size:26px;font-weight:800;text-align:center;opacity:.75} | |
| 47 | + .pgflow .pw{grid-column:1/-1;border:2px dashed rgba(127,127,127,.4);border-radius:18px;padding:12px 16px;font-size:15px} | |
| 48 | + .pgflow .pt{grid-column:1/-1;display:grid;grid-template-columns:repeat(3,1fr);gap:10px} | |
| 49 | + .pgflow .pt div{border:1px solid rgba(127,127,127,.35);border-radius:16px;padding:12px 14px;font-size:14px;line-height:1.35} | |
| 50 | + @media (max-width:820px){.pgflow,.pgflow .pt{grid-template-columns:1fr}.pgflow .pa{display:inline-block;transform:rotate(90deg)}} | |
| 51 | + </style> | |
| 52 | + <div class="pc"><div class="pb"><b>Customer reviews</b><span>Free stars after each visit</span><em>60% of the score</em></div><div class="pb"><b>Peer reviews</b><span>Teammates rate teamwork each week</span><em>40% of the score</em></div></div> | |
| 53 | + <div class="po" aria-hidden="true"><span class="pa">→</span></div> | |
| 54 | + <div class="pb pm"><b>Score</b><span>0 to 100, from recent ratings, updated daily</span></div> | |
| 55 | + <div class="po" aria-hidden="true">×</div> | |
| 56 | + <div class="pb pm"><b>Tier</b><span>Explorer, Builder or Guide. Higher tier, bigger bonus</span></div> | |
| 57 | + <div class="po" aria-hidden="true">=</div> | |
| 58 | + <div class="pb pg"><b>Daily Bitcoin bonus</b><span>Paid by us, automatically, every day. Shown in dollars</span></div> | |
| 59 | + <div class="pt"><div><b>Explorer</b><br>Everyone starts here, learning the work.</div><div><b>Builder</b><br>Growing, with steady high scores and teammates’ backing.</div><div><b>Guide</b><br>On the way to mastery, helping others grow.</div></div> | |
| 60 | + <div class="pw"><b>Plus a guaranteed wage</b>, at least the minimum wage where they work, through normal payroll. Reviews and tier never lower it.</div> | |
| 61 | + </div> | |
| 62 | + <table class="t"> | |
| 63 | + <tr><th>Part</th><th>How it’s paid</th><th>Can reviews change it?</th></tr> | |
| 64 | + <tr><td><b>Guaranteed wage</b></td><td>Hourly, in U.S. dollars, through regular payroll with normal tax withholding. At or above the legal minimum wage where you work, plus overtime as the law requires. Paid on the same payday every time.</td><td>Never. Base pay and payday never depend on ratings.</td></tr> | |
| 65 | + <tr><td><b>Daily Bitcoin bonus</b></td><td>Your score × your tier’s bonus shares × the value of one share, set by your company and shown to the team. Paid automatically every day in Bitcoin to your wallet, shown in dollars.</td><td>Only today’s bonus, before it’s paid. It never goes below zero.</td></tr> | |
| 66 | + </table> | |
| 67 | + <p>Bonuses are wages too. They show on your pay stub at their dollar value on the day they’re paid, and taxes are withheld and reported the same way as the rest of your pay. If you work overtime, these bonuses are counted in your regular rate, so your overtime pay goes up with them, as federal law requires.</p> | |
| 68 | + | |
| 69 | + <h2 id="score">2. Your score: customers and teammates</h2> | |
| 70 | + <p>Your score runs from 0 to 100 and uses recent reviews and updates every day, so one bad day can’t sink it.</p> | |
| 71 | + <table class="t"> | |
| 72 | + <tr><th>Part of your score</th><th>Where it comes from</th><th>Weight</th></tr> | |
| 73 | + <tr><td><b>Customer reviews</b></td><td>After each visit, the customer can give 1 to 5 stars through a one-time link. No app, no account, no tip.</td><td>60%</td></tr> | |
| 74 | + <tr><td><b>Peer reviews</b></td><td>The daily check-in: at the end of each shift, teammates who worked with you give 1 to 5 stars on teamwork, care and reliability, with an optional note.</td><td>40%</td></tr> | |
| 75 | + </table> | |
| 76 | + <p>Five stars counts as 100 and one star counts as 0. Customer reviews of 1 or 2 stars count only after they’re checked. No new reviews? Your score stays where it was. A missing check-in is never counted as a yes or a no.</p> | |
| 77 | + <ul> | |
| 78 | + <li><b>Peer reviews are private.</b> You see the stars and notes, not who wrote them. Managers can’t see who wrote what either, and nobody outside your company ever sees them.</li> | |
| 79 | + <li><b>One check-in per teammate per day.</b> You can’t review yourself, and trading five-star reviews or ganging up on someone is flagged and removed.</li> | |
| 80 | + </ul> | |
| 81 | + <div class="callout"><b>Example.</b> Maya’s customers gave her 4.8 stars on average (that’s 95) and her teammates 4.6 stars (that’s 90). Her score is 95 × 60% + 90 × 40% = 93. She’s a Builder (tier 2), so her bonus today is 93% of 1½ shares.</div> | |
| 82 | + | |
| 83 | + <h2 id="tiers">3. Three tiers</h2> | |
| 84 | + <p>There are only three tiers. Your tier sets how many bonus shares you get each day.</p> | |
| 85 | + <div class="ranks"> | |
| 86 | + <div class="rank"><i>1</i><b>Explorer</b><span>Everyone starts here, learning the work. 1 bonus share.</span></div> | |
| 87 | + <div class="rank"><i>2</i><b>Builder</b><span>Growing: steady high scores and teammates’ backing. 1½ bonus shares.</span></div> | |
| 88 | + <div class="rank"><i>3</i><b>Guide</b><span>On the way to mastery, helping others grow. 2 bonus shares.</span></div> | |
| 89 | + </div> | |
| 90 | + <ul> | |
| 91 | + <li><b>Moving up</b> is reviewed every three months. It looks at your score over that time and at what your teammates say.</li> | |
| 92 | + <li><b>Moving down</b> only happens after a full three months of low scores, with written notice first and the right to dispute it.</li> | |
| 93 | + <li>Your tier never lowers your wage.</li> | |
| 94 | + </ul> | |
| 95 | + | |
| 96 | + <h2 id="safeguards">4. Safeguards for team members</h2> | |
| 97 | + <div class="never"> | |
| 98 | + <div>No cut to hourly wages</div><div>No cut to earned pay</div><div>No cut to wallet balances</div><div>No clawback of paid bonuses</div> | |
| 99 | + </div> | |
| 100 | + <ul> | |
| 101 | + <li><b>Low ratings are checked first.</b> A 1 or 2 star rating is held for review before it counts. The reviewer looks at the visit record and any note from the customer.</li> | |
| 102 | + <li><b>You see every rating.</b> Each one shows in your app with the date, the visit and any comment. Customer contact details stay private.</li> | |
| 103 | + <li><b>Things outside your control don’t count against you.</b> Prices, wait times caused by scheduling, weather and company policies are filtered out.</li> | |
| 104 | + <li><b>Ratings only follow the law.</b> Where local law limits how bonuses can change, the stricter rule wins, and a low rating simply won’t lower anything.</li> | |
| 105 | + </ul> | |
| 106 | + | |
| 107 | + <h2 id="disputes">5. Disputing a review</h2> | |
| 108 | + <div class="split top" style="gap:28px"> | |
| 109 | + <ol class="steps"> | |
| 110 | + <li><b>Tap “Dispute”</b><span>Any rating in your app, within 14 days. Say what happened in your own words.</span></li> | |
| 111 | + <li><b>The rating is paused</b><span>A disputed rating has no effect on your bonus while it’s reviewed.</span></li> | |
| 112 | + <li><b>Someone fair reviews it</b><span>A trained reviewer outside your own team, never your direct manager.</span></li> | |
| 113 | + <li><b>Decision in 5 business days</b><span>You get the reason in writing. If it’s unclear, you win.</span></li> | |
| 114 | + </ol> | |
| 115 | + <div class="photo"><img src="/img/dispute.webp" width="1536" height="1024" alt="Two coworkers talking calmly at a break room table" loading="lazy"></div> | |
| 116 | + </div> | |
| 117 | + <p>Disputes never count against you, and nobody can be punished for raising one. You can also ask for a second review by a different person.</p> | |
| 118 | + | |
| 119 | + <h2 id="fraud">6. Keeping reviews honest</h2> | |
| 120 | + <div class="photo" style="margin:14px 0 18px"><img src="/img/takepay.webp" width="1536" height="1024" alt="A florist showing a code on her phone to a customer who scans it with his own phone" loading="lazy"></div> | |
| 121 | + <ul> | |
| 122 | + <li><b>One visit, one link.</b> Each rating link is signed, tied to one real completed visit, works once, and expires after 14 days.</li> | |
| 123 | + <li><b>Links go to the customer.</b> Links are printed on the receipt, sent to the contact the customer gave, or shown to them once as a code at the end of the visit. A team member can’t rate their own visit, and a link can’t be used twice.</li> | |
| 124 | + <li><b>Unusual patterns are flagged.</b> Bursts of ratings, many ratings from one device, or ratings from people connected to the team member are set aside for review.</li> | |
| 125 | + <li><b>Nobody can edit a rating.</b> Not managers, not team members. Every change, review and decision is logged.</li> | |
| 126 | + <li><b>No personal tracking.</b> We don’t use ad trackers. Rating pages keep only what’s needed to check the rating.</li> | |
| 127 | + </ul> | |
| 128 | + | |
| 129 | + <h2 id="wallet">7. Your wallet, your choice</h2> | |
| 130 | + <div class="photo" style="margin:14px 0 18px"><img src="/img/keys.webp" width="1536" height="1024" alt="A person unlocking a phone with their face at a bus stop in the morning" loading="lazy"></div> | |
| 131 | + <p>When you sign up, you choose where your Bitcoin goes: <b>we create a wallet for you</b> with your account (your passkey locks its backup, nothing to write down), or <b>you paste the address of a wallet you already have</b> and bonuses go straight there. You can switch any time.</p> | |
| 132 | + <p>Bonuses paid to your Paywell wallet land in the app. You can keep them there, send them to another wallet you control, spend them where Bitcoin is accepted, or turn them into dollars through a licensed provider. It works the other way too: if you’d like, you can choose to turn some of your own dollars into Bitcoin after payday, through a licensed provider, always your choice and never required. <a href="/learn/">Learn the basics</a> before you move anything.</p> | |
| 133 | + <p><b>Your keys, not ours.</b> A wallet we make for you is opened only by your passkey. We keep a locked backup we cannot open, so we can never move your coins, and neither can anyone who breaks into our servers.</p> | |
| 134 | + </div></section> | |
| 135 | + </main> | |
| 136 | + <div class="wrap"><footer class="site">Paywell <span aria-hidden="true">·</span> <a href="/careers/">Careers</a></footer></div> | |
| 137 | + </body> | |
| 138 | + </html> |
img/checkin.webp added
Not a text file.
img/crew.webp added
Not a text file.
img/dispute.webp added
Not a text file.
img/hero.webp added
Not a text file.
img/keys.webp added
Not a text file.
img/learn.webp added
Not a text file.
img/logo.svg added
| 1 | + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><rect width="32" height="32" rx="9" fill="#0f3d2e"/><circle cx="16" cy="14.5" r="8.5" fill="#e0a526"/><circle cx="16" cy="14.5" r="6.6" fill="none" stroke="#0f3d2e" stroke-opacity=".35" stroke-width="1"/><path d="M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z" fill="#0f3d2e"/><path d="M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4" fill="none" stroke="#7fd1a3" stroke-width="2.2" stroke-linecap="round"/></svg> |
img/og.jpg added
Not a text file.
img/open.webp added
Not a text file.
img/payday.webp added
Not a text file.
img/rate.webp added
Not a text file.
img/secure.webp added
Not a text file.
img/spend.webp added
Not a text file.
img/takepay.webp added
Not a text file.
index.html added
| 1 | + <!doctype html> | |
| 2 | + <html lang="en"> | |
| 3 | + <head> | |
| 4 | + <meta charset="utf-8"> | |
| 5 | + <meta name="viewport" content="width=device-width,initial-scale=1"> | |
| 6 | + <title>Paywell | Fair pay you can see</title> | |
| 7 | + <meta name="description" content="Paywell pays team members a guaranteed wage plus daily Bitcoin bonuses shown in dollars, and lets customers thank great service with a rating instead of a tip."> | |
| 8 | + <link rel="canonical" href="https://paywell.company/"> | |
| 9 | + <meta property="og:type" content="website"><meta property="og:site_name" content="Paywell"> | |
| 10 | + <meta property="og:title" content="Paywell | Fair pay you can see"><meta property="og:description" content="Paywell pays team members a guaranteed wage plus daily Bitcoin bonuses shown in dollars, and lets customers thank great service with a rating instead of a tip."> | |
| 11 | + <meta property="og:url" content="https://paywell.company/"><meta property="og:image" content="https://paywell.company/img/og.jpg"> | |
| 12 | + <meta name="twitter:card" content="summary_large_image"> | |
| 13 | + <meta name="theme-color" content="#0f3d2e"> | |
| 14 | + <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='9' fill='%230f3d2e'/%3E%3Ccircle cx='16' cy='14.5' r='8.5' fill='%23e0a526'/%3E%3Ccircle cx='16' cy='14.5' r='6.6' fill='none' stroke='%230f3d2e' stroke-opacity='.35' stroke-width='1'/%3E%3Cpath d='M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z' fill='%230f3d2e'/%3E%3Cpath d='M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4' fill='none' stroke='%237fd1a3' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E"> | |
| 15 | + <link rel="manifest" href="/app/manifest.webmanifest"> | |
| 16 | + <link rel="stylesheet" href="/assets/site.css"> | |
| 17 | + <script type="application/ld+json">{"@context":"https://schema.org","@type":"Organization","name":"Paywell","url":"https://paywell.company","logo":"https://paywell.company/img/og.jpg","description":"Fair pay, daily Bitcoin bonuses shown in dollars, and no-tip customer ratings."}</script> | |
| 18 | + <link rel="stylesheet" href="/assets/visitor-odometer.v1.css"><script defer src="/assets/visitor-odometer.v1.js"></script></head> | |
| 19 | + <body> | |
| 20 | + <a class="skip" href="#main">Skip to content</a> | |
| 21 | + <div class="wrap"> | |
| 22 | + <header class="top"><a class="brand" href="/"><svg viewBox="0 0 32 32" aria-hidden="true"><rect width="32" height="32" rx="9" fill="#0f3d2e"/><circle cx="16" cy="14.5" r="8.5" fill="#e0a526"/><circle cx="16" cy="14.5" r="6.6" fill="none" stroke="#0f3d2e" stroke-opacity=".35" stroke-width="1"/><path d="M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z" fill="#0f3d2e"/><path d="M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4" fill="none" stroke="#7fd1a3" stroke-width="2.2" stroke-linecap="round"/></svg>Paywell</a><nav class="main" aria-label="Main"><a href="/how-it-works/">How it works</a><a href="/fair-pay/">Fair pay</a><a href="/learn/">Bitcoin basics</a><a href="/rate/">Rate a visit</a><a href="/app/">Team app</a><a href="/open/">Open code</a><a href="/careers/">Careers</a></nav></header> | |
| 23 | + </div> | |
| 24 | + <main id="main"> | |
| 25 | + <div class="wrap"> | |
| 26 | + <section class="hero"> | |
| 27 | + <div> | |
| 28 | + <p class="status">Open now in test mode. Test coins only, no real money moves.</p> | |
| 29 | + <div class="visitor-welcome" data-visitor-odometer data-visitor-site="paywell"></div><h1>Fair pay you can see.</h1> | |
| 30 | + <p class="lede">A guaranteed wage, a daily Bitcoin bonus shown in plain dollars, and a simple way for customers to say thank you without spending a cent. No tip jars. No tip screens.</p> | |
| 31 | + <div class="btns"><a class="btn" href="/app/">Start a test team</a><a class="btn o" href="/how-it-works/">How it works</a></div> | |
| 32 | + </div> | |
| 33 | + <div class="art"><img src="/img/hero.webp" width="1536" height="1024" alt="A dog groomer in a bright salon smiling at her phone during a short break"></div> | |
| 34 | + </section> | |
| 35 | + </div> | |
| 36 | + | |
| 37 | + <section class="sec"><div class="wrap"> | |
| 38 | + <p class="eyebrow">How Paywell works</p> | |
| 39 | + <h2>Do great work, earn more Bitcoin.</h2> | |
| 40 | + <p class="sub">Your wage is always guaranteed. On top of it, a daily Bitcoin bonus grows with what customers and teammates say about your work, and with your tier. There are only three tiers.</p> | |
| 41 | + <div class="pgflow" aria-label="How daily Bitcoin bonuses are worked out"> | |
| 42 | + <style> | |
| 43 | + .pgflow{margin:18px 0 8px;display:grid;grid-template-columns:1.2fr auto 1fr auto 1fr auto 1.1fr;gap:10px;align-items:center;text-align:left} | |
| 44 | + .pgflow .pc{display:grid;gap:10px} | |
| 45 | + .pgflow .pb{border:1px solid rgba(127,127,127,.35);border-radius:18px;padding:14px 16px;display:grid;gap:3px;line-height:1.35} | |
| 46 | + .pgflow .pb b{font-size:16px}.pgflow .pb span{font-size:14px;opacity:.8}.pgflow .pb em{font-style:normal;font-weight:700;font-size:13px;opacity:.9} | |
| 47 | + .pgflow .pm{background:rgba(127,127,127,.12);border-color:transparent} | |
| 48 | + .pgflow .pg{border:2px solid currentColor} | |
| 49 | + .pgflow .po{font-size:26px;font-weight:800;text-align:center;opacity:.75} | |
| 50 | + .pgflow .pw{grid-column:1/-1;border:2px dashed rgba(127,127,127,.4);border-radius:18px;padding:12px 16px;font-size:15px} | |
| 51 | + .pgflow .pt{grid-column:1/-1;display:grid;grid-template-columns:repeat(3,1fr);gap:10px} | |
| 52 | + .pgflow .pt div{border:1px solid rgba(127,127,127,.35);border-radius:16px;padding:12px 14px;font-size:14px;line-height:1.35} | |
| 53 | + @media (max-width:820px){.pgflow,.pgflow .pt{grid-template-columns:1fr}.pgflow .pa{display:inline-block;transform:rotate(90deg)}} | |
| 54 | + </style> | |
| 55 | + <div class="pc"><div class="pb"><b>Customer reviews</b><span>Free stars after each visit</span><em>60% of the score</em></div><div class="pb"><b>Peer reviews</b><span>Teammates rate teamwork each week</span><em>40% of the score</em></div></div> | |
| 56 | + <div class="po" aria-hidden="true"><span class="pa">→</span></div> | |
| 57 | + <div class="pb pm"><b>Score</b><span>0 to 100, from recent ratings, updated daily</span></div> | |
| 58 | + <div class="po" aria-hidden="true">×</div> | |
| 59 | + <div class="pb pm"><b>Tier</b><span>Explorer, Builder or Guide. Higher tier, bigger bonus</span></div> | |
| 60 | + <div class="po" aria-hidden="true">=</div> | |
| 61 | + <div class="pb pg"><b>Daily Bitcoin bonus</b><span>Paid by us, automatically, every day. Shown in dollars</span></div> | |
| 62 | + <div class="pt"><div><b>Explorer</b><br>Everyone starts here, learning the work.</div><div><b>Builder</b><br>Growing, with steady high scores and teammates’ backing.</div><div><b>Guide</b><br>On the way to mastery, helping others grow.</div></div> | |
| 63 | + <div class="pw"><b>Plus a guaranteed wage</b>, at least the minimum wage where they work, through normal payroll. Reviews and tier never lower it.</div> | |
| 64 | + </div> | |
| 65 | + <div class="ranks"> | |
| 66 | + <div class="rank"><i>1</i><b>Explorer</b><span>Everyone starts here, learning the work. 1 bonus share.</span></div> | |
| 67 | + <div class="rank"><i>2</i><b>Builder</b><span>Growing: steady high scores and teammates’ backing. 1½ bonus shares.</span></div> | |
| 68 | + <div class="rank"><i>3</i><b>Guide</b><span>On the way to mastery, helping others grow. 2 bonus shares.</span></div> | |
| 69 | + </div> | |
| 70 | + <p style="margin-top:22px"><a class="btn o" href="/how-it-works/">See the full rules</a></p> | |
| 71 | + </div></section> | |
| 72 | + | |
| 73 | + <section class="sec"><div class="wrap split"> | |
| 74 | + <div class="photo"><img src="/img/rate.webp" width="1536" height="1024" alt="A customer holding a phone above a receipt with a small printed code on a shop counter" loading="lazy"></div> | |
| 75 | + <div> | |
| 76 | + <p class="eyebrow">For customers</p> | |
| 77 | + <h2>Say thanks in ten seconds.</h2> | |
| 78 | + <p class="sub">Scan the code on your receipt or tap the link in your text or email. Pick a rating. That’s it. No app, no account, no tip.</p> | |
| 79 | + <ol class="steps"> | |
| 80 | + <li><b>Open your link</b><span>Each visit gets its own one-time link.</span></li> | |
| 81 | + <li><b>Tap a rating</b><span>Big, simple buttons. Add a note if you like.</span></li> | |
| 82 | + <li><b>Done</b><span>Great ratings raise that person’s daily bonus. The company pays it, not you.</span></li> | |
| 83 | + </ol> | |
| 84 | + <p style="margin-top:22px"><a class="btn o" href="/rate/">Rate a visit</a></p> | |
| 85 | + </div> | |
| 86 | + </div></section> | |
| 87 | + | |
| 88 | + <section class="sec"><div class="wrap split"> | |
| 89 | + <div> | |
| 90 | + <p class="eyebrow">Daily check-in</p> | |
| 91 | + <h2>Thirty seconds at the end of each shift.</h2> | |
| 92 | + <p class="sub">Before you head home, rate each teammate you worked with today: one to five stars and a kind, honest note if you like. It takes less than a minute, and it is how good teamwork gets noticed.</p> | |
| 93 | + <ol class="steps"> | |
| 94 | + <li><b>Only people you worked with</b><span>One check-in per teammate per day. You can’t rate yourself.</span></li> | |
| 95 | + <li><b>Private to your company</b><span>Check-ins stay inside your own team. Nobody outside it ever sees them, and teammates see the stars and notes, not who wrote them.</span></li> | |
| 96 | + <li><b>Skipping is fine</b><span>A missing check-in is never counted as a yes or a no. It simply doesn’t count.</span></li> | |
| 97 | + </ol> | |
| 98 | + </div> | |
| 99 | + <div class="photo"><img src="/img/checkin.webp" width="1536" height="1024" alt="Two coworkers at a café counter after closing, one tapping stars on a phone while the other smiles" loading="lazy"></div> | |
| 100 | + </div></section> | |
| 101 | + | |
| 102 | + <section class="sec"><div class="wrap"> | |
| 103 | + <p class="eyebrow">Our promises</p> | |
| 104 | + <h2>What a rating can never do.</h2> | |
| 105 | + <p class="sub">Ratings are a way to reward great work. They are not a way to take pay away.</p> | |
| 106 | + <div class="never"> | |
| 107 | + <div>Lower your hourly wage</div><div>Move your payday</div><div>Take back pay you’ve earned</div><div>Touch your wallet balance</div><div>Claw back a bonus already paid</div> | |
| 108 | + </div> | |
| 109 | + <p class="sub">A low rating only counts after it is checked, and you can always dispute it. If the facts are unclear, the team member gets the benefit of the doubt. <a href="/how-it-works/#safeguards">Read the safeguards</a>.</p> | |
| 110 | + </div></section> | |
| 111 | + | |
| 112 | + <section class="sec"><div class="wrap split"> | |
| 113 | + <div> | |
| 114 | + <p class="eyebrow">The team app</p> | |
| 115 | + <h2>Dollars first. Always.</h2> | |
| 116 | + <p class="sub">Your bonus is held in Bitcoin, but the app shows what it’s worth in U.S. dollars, right now. Bitcoin amounts and rates are one tap away when you want them. The point is to show what your money can buy, not to get you trading.</p> | |
| 117 | + <div class="cards" style="grid-template-columns:1fr 1fr"> | |
| 118 | + <div class="card"><h3>See every paycheck</h3><p>Wage, score, tier and Bitcoin bonus, day by day.</p></div> | |
| 119 | + <div class="card"><h3>Your wallet, your keys</h3><p>We make a wallet that only you can open, or you use your own. Hold it, send it, or turn it into dollars through a licensed provider.</p></div> | |
| 120 | + <div class="card"><h3>Your ratings</h3><p>See each rating and dispute any you think is wrong.</p></div> | |
| 121 | + <div class="card"><h3>Learn as you go</h3><p>Short lessons on fees, price swings, taxes and keeping it safe.</p></div> | |
| 122 | + <div class="card"><h3>Team chat</h3><p>Channels for your crew, shout-outs, GIFs and shift swaps. Friendly, not corporate.</p></div> | |
| 123 | + <div class="card"><h3>Take payment</h3><p>Show a code or tap phones. The customer pays, then rates the visit. No kiosks, no tip screens.</p></div> | |
| 124 | + <div class="card"><h3>Daily check-in</h3><p>Rate the teammates you worked with today, in under a minute.</p></div> | |
| 125 | + <div class="card"><h3>Passkey sign-in</h3><p>Your face or fingerprint is your login. No usernames, no passwords.</p></div> | |
| 126 | + </div> | |
| 127 | + <p style="margin-top:22px"><a class="btn" href="/app/">Open the team app</a></p> | |
| 128 | + </div> | |
| 129 | + <div class="photo"><img src="/img/payday.webp" width="1536" height="1024" alt="A plumber sitting on the tailgate of a work truck at sunset, smiling at his phone" loading="lazy"></div> | |
| 130 | + </div></section> | |
| 131 | + | |
| 132 | + <section class="sec"><div class="wrap split"> | |
| 133 | + <div class="photo"><img src="/img/crew.webp" width="1536" height="1024" alt="A home-repair crew of four having a cheerful morning huddle beside a service van" loading="lazy"></div> | |
| 134 | + <div> | |
| 135 | + <p class="eyebrow">Fair pay. No tipping.</p> | |
| 136 | + <h2>One policy, every company.</h2> | |
| 137 | + <p class="sub">Every company that pays through Paywell follows the same promise: part-time roles paid by the hour, as much or as little as each person wants up to 39 hours a week, days off whenever they want, a guaranteed wage, daily performance bonuses, paid out automatically funded by the company, and no tips asked for or accepted. Customers never see a tip prompt.</p> | |
| 138 | + <p><a class="btn o" href="/fair-pay/">Read the fair pay policy</a></p> | |
| 139 | + </div> | |
| 140 | + </div></section> | |
| 141 | + | |
| 142 | + <section class="sec"><div class="wrap"> | |
| 143 | + <div class="callout"><b>Where things stand.</b> The team app works today in test mode: start a team, invite teammates, check in, send rating links, take test payments and chat. It uses Bitcoin’s test network, so the coins have no value. Real wages and bonuses will go through a licensed payroll provider, and no real money moves through Paywell until every legal and tax check is done. Everything we build is open for anyone to copy: <a href="/open/">see the code</a>.</div> | |
| 144 | + </div></section> | |
| 145 | + </main> | |
| 146 | + <div class="wrap"><!-- branch-note --><style>.branch-note{box-sizing:border-box;max-width:1180px;margin:48px auto;padding:0 20px;color:inherit;text-align:left}.branch-note .bn-box{border:2px solid currentColor;border-radius:24px;padding:32px 28px;background:color-mix(in srgb,currentColor 6%,transparent)}.branch-note .bn-eye{margin:0 0 6px;font-size:13px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;opacity:.8}.branch-note h2{margin:0 0 12px;font-size:clamp(26px,3.8vw,40px);line-height:1.12}.branch-note p{margin:0 0 10px;max-width:760px;font-size:18px;line-height:1.55}.branch-note p:last-child{margin-bottom:0}.branch-note .bn-lic{opacity:.8;font-size:16px}</style><section class="branch-note" id="branch" aria-labelledby="branch-h"><div class="bn-box"><p class="bn-eye">We're open source</p><h2 id="branch-h">Start your own branch</h2><p>Anyone can start their own branch of Paywell without asking us, and can give it a different name. We're fully open source: our designs, research and specs are public domain, free for anyone to use, copy and change.</p></div></section><!-- /branch-note --> | |
| 147 | + <!--ct-home--><section class="ct-home" style="max-width:1180px;margin:48px auto;padding:0 20px;box-sizing:border-box"><div style="border:2px solid currentColor;border-radius:24px;padding:28px 28px 24px;display:flex;flex-wrap:wrap;gap:18px;align-items:center;justify-content:space-between"><div style="max-width:720px"><h2 style="margin:0 0 8px;font-size:clamp(24px,3.4vw,34px);line-height:1.15">Join our team</h2><p style="margin:0;font-size:18px;line-height:1.55">We're looking for people to join our team. Part-time roles paid by the hour, work as much or as little as you want, take days off whenever you want, a bonus paid out automatically every day, and holistic health care.</p></div><a href="/careers/" style="display:inline-block;padding:14px 28px;border-radius:999px;border:2px solid currentColor;font-weight:700;text-decoration:none;color:inherit;font-size:17px">See careers</a></div></section><!--/ct-home--><footer class="site">Paywell <span aria-hidden="true">·</span> <a href="/research/">Research</a> <span aria-hidden="true">·</span> <a href="/careers/">Careers</a></footer></div> | |
| 148 | + </body> | |
| 149 | + </html> |
learn/index.html added
| 1 | + <!doctype html> | |
| 2 | + <html lang="en"> | |
| 3 | + <head> | |
| 4 | + <meta charset="utf-8"> | |
| 5 | + <meta name="viewport" content="width=device-width,initial-scale=1"> | |
| 6 | + <title>Bitcoin basics | Paywell</title> | |
| 7 | + <meta name="description" content="Plain-English Bitcoin basics for team members: holding, sending, spending and converting Bitcoin, plus fees, price swings, taxes, wallet security and passkey-locked backups."> | |
| 8 | + <link rel="canonical" href="https://paywell.company/learn/"> | |
| 9 | + <meta property="og:type" content="website"><meta property="og:site_name" content="Paywell"> | |
| 10 | + <meta property="og:title" content="Bitcoin basics | Paywell"><meta property="og:description" content="Plain-English Bitcoin basics for team members: holding, sending, spending and converting Bitcoin, plus fees, price swings, taxes, wallet security and passkey-locked backups."> | |
| 11 | + <meta property="og:url" content="https://paywell.company/learn/"><meta property="og:image" content="https://paywell.company/img/og.jpg"> | |
| 12 | + <meta name="twitter:card" content="summary_large_image"> | |
| 13 | + <meta name="theme-color" content="#0f3d2e"> | |
| 14 | + <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='9' fill='%230f3d2e'/%3E%3Ccircle cx='16' cy='14.5' r='8.5' fill='%23e0a526'/%3E%3Ccircle cx='16' cy='14.5' r='6.6' fill='none' stroke='%230f3d2e' stroke-opacity='.35' stroke-width='1'/%3E%3Cpath d='M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z' fill='%230f3d2e'/%3E%3Cpath d='M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4' fill='none' stroke='%237fd1a3' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E"> | |
| 15 | + <link rel="manifest" href="/app/manifest.webmanifest"> | |
| 16 | + <link rel="stylesheet" href="/assets/site.css"> | |
| 17 | + </head> | |
| 18 | + <body> | |
| 19 | + <a class="skip" href="#main">Skip to content</a> | |
| 20 | + <div class="wrap"> | |
| 21 | + <header class="top"><a class="brand" href="/"><svg viewBox="0 0 32 32" aria-hidden="true"><rect width="32" height="32" rx="9" fill="#0f3d2e"/><circle cx="16" cy="14.5" r="8.5" fill="#e0a526"/><circle cx="16" cy="14.5" r="6.6" fill="none" stroke="#0f3d2e" stroke-opacity=".35" stroke-width="1"/><path d="M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z" fill="#0f3d2e"/><path d="M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4" fill="none" stroke="#7fd1a3" stroke-width="2.2" stroke-linecap="round"/></svg>Paywell</a><nav class="main" aria-label="Main"><a href="/how-it-works/">How it works</a><a href="/fair-pay/">Fair pay</a><a href="/learn/" aria-current=page>Bitcoin basics</a><a href="/rate/">Rate a visit</a><a href="/app/">Team app</a><a href="/open/">Open code</a><a href="/careers/">Careers</a></nav></header> | |
| 22 | + </div> | |
| 23 | + <main id="main"> | |
| 24 | + <div class="wrap"> | |
| 25 | + <section class="hero" style="padding-bottom:40px"> | |
| 26 | + <div> | |
| 27 | + <p class="eyebrow">Bitcoin basics</p> | |
| 28 | + <h1 class="sm">What your bonus is, and what you can do with it.</h1> | |
| 29 | + <p class="lede">Plain English, no hype. Your bonus is paid in Bitcoin and always shown in dollars. Here’s what that means for you.</p> | |
| 30 | + </div> | |
| 31 | + <div class="art"><img src="/img/learn.webp" width="1536" height="1024" alt="A young woman at a kitchen table carefully writing on a small paper card"></div> | |
| 32 | + </section> | |
| 33 | + </div> | |
| 34 | + <section class="sec"><div class="wrap"> | |
| 35 | + <h2>Four things you can do</h2> | |
| 36 | + <p class="sub">It’s your money. You choose what happens to it.</p> | |
| 37 | + <div class="cards"><div class="card" id="hold"><h3>Hold Bitcoin without a bank</h3><p>Bitcoin lives in a wallet, not a bank account. Your Paywell wallet works on your phone. You don’t need a bank account to receive your bonus or to keep it.</p></div><div class="card" id="send"><h3>Send it to another wallet</h3><p>You can move your Bitcoin to any other wallet you control, like a hardware wallet or another app.</p></div><div class="card" id="spend"><h3>Spend it where it’s accepted</h3><p>Some shops, websites and services take Bitcoin directly. You scan their code and confirm the amount in dollars.</p></div><div class="card" id="convert"><h3>Turn it into dollars</h3><p>Supported providers can convert your Bitcoin into U.S. dollars and send them to a bank account or debit card.</p></div></div> | |
| 38 | + </div></section> | |
| 39 | + <section class="sec"><div class="wrap prose"> | |
| 40 | + <h3>Hold Bitcoin without a bank</h3><p>A wallet holds the keys that prove the Bitcoin is yours. Think of it like the key to a safe: whoever has the key can open it. That’s why your Paywell wallet keeps a locked backup, opened only by your passkey.</p><h3>Send it to another wallet</h3><p>Every wallet has an address, a long string of letters and numbers or a QR code. Always copy and paste or scan it, never type it by hand, and send a small test amount first. Bitcoin sent to the wrong address can’t be pulled back.</p><p>Sending uses a network fee. The app shows the fee in dollars before you confirm.</p><h3>Spend it where it’s accepted</h3><p>Most places still want dollars, so spending usually means converting first. Spending Bitcoin can count as selling it for tax purposes, so the app keeps a record for you.</p><h3>Turn it into dollars</h3><p>The app will show the provider’s rate and fee in dollars before you agree, so you know exactly how many dollars you’ll get. Providers are licensed and may ask you to verify your identity the first time.</p> | |
| 41 | + <h2 id="fees">Fees</h2> | |
| 42 | + <p>Moving Bitcoin isn’t free. Sending it pays a network fee that changes with how busy the network is. Converting it to dollars usually has a provider fee or a spread. Paywell always shows the full cost in dollars before you confirm. Paying your bonus into your wallet costs you nothing.</p> | |
| 43 | + <h2 id="volatility">Price swings</h2> | |
| 44 | + <p>Bitcoin’s price in dollars moves up and down, sometimes a lot in a single day. A bonus worth $100 today could be worth more or less next week. That’s why the app shows today’s dollar value first. If you need that money for rent or bills, you can turn it into dollars soon after it arrives. Holding Bitcoin is your choice, not a requirement, and we’ll never push you to trade.</p> | |
| 45 | + <div class="callout warn"><b>Good rule of thumb:</b> don’t hold more in Bitcoin than you could handle seeing drop by half. Keep money for bills in dollars.</div> | |
| 46 | + <h2 id="taxes">Taxes</h2> | |
| 47 | + <ul> | |
| 48 | + <li><b>When you get it:</b> your bonus is taxable pay at its dollar value on the day it’s paid. It shows on your pay stub and your year-end tax form, and taxes are withheld for you.</li> | |
| 49 | + <li><b>When you sell, spend or convert it:</b> if the price went up since you got it, the gain may be taxable. If it went down, you may have a loss.</li> | |
| 50 | + <li><b>Records:</b> the app keeps the date and dollar value of everything that comes in and goes out, so you or your tax preparer have what you need.</li> | |
| 51 | + </ul> | |
| 52 | + <p class="small">This is general information, not tax advice. Rules differ by state and change over time.</p> | |
| 53 | + <h2 id="security">Keeping your wallet safe</h2> | |
| 54 | + <div class="split top" style="gap:28px"> | |
| 55 | + <ul> | |
| 56 | + <li>Lock the app with your phone’s face, fingerprint or passcode.</li> | |
| 57 | + <li>Sign in with your passkey (your face or fingerprint). There’s no password to steal.</li> | |
| 58 | + <li>Never share a passkey setup link or any recovery words with anyone, including anyone who says they work for us. We will never ask.</li> | |
| 59 | + <li>Watch out for messages that rush you or promise to double your money. Those are scams.</li> | |
| 60 | + <li>Check addresses carefully, and send a small test first.</li> | |
| 61 | + </ul> | |
| 62 | + <div class="photo"><img src="/img/secure.webp" width="1536" height="1024" alt="A small fireproof box on a shelf holding a folded paper card and a steel plate" loading="lazy"></div> | |
| 63 | + </div> | |
| 64 | + <h2 id="recovery">Your backup, locked by your passkey</h2> | |
| 65 | + <p>Every wallet has secret keys. Most apps make you write down 12 or 24 recovery words and keep them safe forever. With Paywell you don’t have to.</p> | |
| 66 | + <ul> | |
| 67 | + <li>When you create your wallet, your phone locks a backup of its keys with your passkey (your face or fingerprint) and stores the locked backup with us.</li> | |
| 68 | + <li>Only your passkey can open it. We keep a locked box we can’t open, so nobody here can see or move your Bitcoin.</li> | |
| 69 | + <li>Your passkey syncs through your phone’s password manager. On a new phone, sign in with it and your wallet comes back.</li> | |
| 70 | + <li>Keep your phone’s password manager account safe, and add a second device you trust, so you never lose your passkey.</li> | |
| 71 | + </ul> | |
| 72 | + <p>Moving from another wallet app? Enter its recovery words once, and from then on your passkey keeps the backup.</p> | |
| 73 | + <h2>Questions?</h2> | |
| 74 | + <p>The team app has short lessons on each of these, and you can ask your own AI assistant to explain anything here in more detail.</p> | |
| 75 | + </div></section> | |
| 76 | + </main> | |
| 77 | + <div class="wrap"><footer class="site">Paywell <span aria-hidden="true">·</span> <a href="/careers/">Careers</a></footer></div> | |
| 78 | + </body> | |
| 79 | + </html> |
llms.txt added
| 1 | + # Paywell | |
| 2 | + > Paywell is an open pay and customer-ratings platform, working today in test mode. Team members get a guaranteed wage through normal payroll, a daily company-funded Bitcoin bonus, paid out automatically always shown in U.S. dollars, that grows with customer reviews (60%), peer reviews (40%) and tier (three tiers). Customers rate visits through a one-time link (receipt QR code, text or email) with no app, no account and no tip. | |
| 3 | + | |
| 4 | + - [How it works](https://paywell.company/how-it-works/): pay parts, score, three tiers, safeguards, disputes, fraud checks | |
| 5 | + - [Fair pay. No tipping.](https://paywell.company/fair-pay/): the employment policy every Paywell company follows | |
| 6 | + - [Bitcoin basics](https://paywell.company/learn/): holding, sending, spending, converting, fees, price swings, taxes, security, passkey-locked wallet backup | |
| 7 | + - [Rate a visit](https://paywell.company/rate/): customer rating page | |
| 8 | + - [Team app](https://paywell.company/app/): working test-mode app: passkeys, teams, daily check-ins, rating links, take payment, test-network wallet, chat | |
| 9 | + - [Open code](https://paywell.company/open/): all source code, database, logo and pay model, public domain | |
| 10 | + - [Research](https://paywell.company/research/): sources and the full operating model | |
| 11 | + | |
| 12 | + Ratings never lower wages, earned pay, wallet balances or paid bonuses. Status: test mode; no real money moves yet. |
open/index.html added
| 1 | + <!doctype html> | |
| 2 | + <html lang="en"> | |
| 3 | + <head> | |
| 4 | + <meta charset="utf-8"> | |
| 5 | + <meta name="viewport" content="width=device-width,initial-scale=1"> | |
| 6 | + <title>Open code | Paywell</title> | |
| 7 | + <meta name="description" content="All of Paywell is open: the team app, the server, the database, the wallet, the rating links, the logo and the pay model. Copy any of it, free, no permission needed."> | |
| 8 | + <link rel="canonical" href="https://paywell.company/open/"> | |
| 9 | + <meta property="og:type" content="website"><meta property="og:site_name" content="Paywell"> | |
| 10 | + <meta property="og:title" content="Open code | Paywell"><meta property="og:description" content="All of Paywell is open: the team app, the server, the database, the wallet, the rating links, the logo and the pay model. Copy any of it, free, no permission needed."> | |
| 11 | + <meta property="og:url" content="https://paywell.company/open/"><meta property="og:image" content="https://paywell.company/img/og.jpg"> | |
| 12 | + <meta name="twitter:card" content="summary_large_image"> | |
| 13 | + <meta name="theme-color" content="#0f3d2e"> | |
| 14 | + <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='9' fill='%230f3d2e'/%3E%3Ccircle cx='16' cy='14.5' r='8.5' fill='%23e0a526'/%3E%3Ccircle cx='16' cy='14.5' r='6.6' fill='none' stroke='%230f3d2e' stroke-opacity='.35' stroke-width='1'/%3E%3Cpath d='M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z' fill='%230f3d2e'/%3E%3Cpath d='M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4' fill='none' stroke='%237fd1a3' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E"> | |
| 15 | + <link rel="manifest" href="/app/manifest.webmanifest"> | |
| 16 | + <link rel="stylesheet" href="/assets/site.css"> | |
| 17 | + </head> | |
| 18 | + <body> | |
| 19 | + <a class="skip" href="#main">Skip to content</a> | |
| 20 | + <div class="wrap"> | |
| 21 | + <header class="top"><a class="brand" href="/"><svg viewBox="0 0 32 32" aria-hidden="true"><rect width="32" height="32" rx="9" fill="#0f3d2e"/><circle cx="16" cy="14.5" r="8.5" fill="#e0a526"/><circle cx="16" cy="14.5" r="6.6" fill="none" stroke="#0f3d2e" stroke-opacity=".35" stroke-width="1"/><path d="M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z" fill="#0f3d2e"/><path d="M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4" fill="none" stroke="#7fd1a3" stroke-width="2.2" stroke-linecap="round"/></svg>Paywell</a><nav class="main" aria-label="Main"><a href="/how-it-works/">How it works</a><a href="/fair-pay/">Fair pay</a><a href="/learn/">Bitcoin basics</a><a href="/rate/">Rate a visit</a><a href="/app/">Team app</a><a href="/open/" aria-current=page>Open code</a><a href="/careers/">Careers</a></nav></header> | |
| 22 | + </div> | |
| 23 | + <main id="main"> | |
| 24 | + <div class="wrap"> | |
| 25 | + <section class="hero"> | |
| 26 | + <div> | |
| 27 | + <p class="eyebrow">Open code</p> | |
| 28 | + <h1>Take it. It’s yours too.</h1> | |
| 29 | + <p class="lede">Every line of Paywell is public and free to copy, change and use, for any reason, with no permission needed. The code, the database, the designs, the logo and the full pay model are all here. We give it away on purpose: fair pay should be easy for every company to start.</p> | |
| 30 | + <div class="btns"><a class="btn" href="https://github.com/projectatomai/hosting-research">See it all on GitHub</a><a class="btn o" href="/research/">Read the research</a></div> | |
| 31 | + </div> | |
| 32 | + <div class="art"><img src="/img/open.webp" width="1536" height="1024" alt="A laptop on a workbench showing code beside a notebook with a hand-drawn diagram of the bonus formula" loading="lazy"></div> | |
| 33 | + </section> | |
| 34 | + </div> | |
| 35 | + | |
| 36 | + <section class="sec"><div class="wrap prose"> | |
| 37 | + <h2>What’s open</h2> | |
| 38 | + <div class="scroll"><table class="t"> | |
| 39 | + <tr><th>File</th><th>What it does</th><th>Get it</th></tr> | |
| 40 | + <tr><td><b>paywell-app.js</b></td><td>Team app server: passkey sign-up and sign-in (WebAuthn checked on our server), teams, setup links, daily check-ins, scores, daily bonus math, chat, rating links, and the test-network Bitcoin proxy.</td><td><a href="/open/src/paywell-app.js.txt">Read it here</a> · <a href="https://github.com/projectatomai/hosting-research/blob/main/domain-sites/functions/paywell-app.js">Source</a></td></tr><tr><td><b>paywell-api.js</b></td><td>Customer rating links (signed, one use, 14 days) and the wallet vault that stores a passkey-locked backup we cannot open.</td><td><a href="/open/src/paywell-api.js.txt">Read it here</a> · <a href="https://github.com/projectatomai/hosting-research/blob/main/domain-sites/functions/paywell-api.js">Source</a></td></tr><tr><td><b>schema.sql</b></td><td>The whole database: teams, people, passkeys, sessions, check-ins, ratings, chat, vault.</td><td><a href="/open/src/schema.sql.txt">Read it here</a> · <a href="https://github.com/projectatomai/hosting-research/blob/main/tools/paywell-gen/schema.sql">Source</a></td></tr><tr><td><b>app.js</b></td><td>The team app in the browser: screens, passkeys, wallet lock (PRF + HKDF + AES-GCM), check-ins, payments, chat.</td><td><a href="/open/src/app.js.txt">Read it here</a> · <a href="https://github.com/projectatomai/hosting-research/blob/main/domain-sites/paywell.company/app/app.js">Source</a></td></tr><tr><td><b>wallet-src.js</b></td><td>The wallet: BIP39 words, BIP84 addresses, building and signing payments, QR codes. Built with audited open libraries (@scure).</td><td><a href="/open/src/wallet-src.js.txt">Read it here</a> · <a href="https://github.com/projectatomai/hosting-research/blob/main/tools/paywell-gen/app-src/wallet-src.js">Source</a></td></tr><tr><td><b>rate.js</b></td><td>The customer rating page.</td><td><a href="/open/src/rate.js.txt">Read it here</a> · <a href="https://github.com/projectatomai/hosting-research/blob/main/domain-sites/paywell.company/assets/rate.js">Source</a></td></tr><tr><td><b>bonus_diagram.html</b></td><td>The daily bonus diagram used on this site and on every brand’s fair pay page.</td><td><a href="/open/src/bonus_diagram.html.txt">Read it here</a> · <a href="https://github.com/projectatomai/hosting-research/blob/main/tools/paywell-gen/bonus_diagram.html">Source</a></td></tr><tr><td><b>logo.svg</b></td><td>Our logo: a gold coin with a rating star, over a smile.</td><td><a href="/open/src/logo.svg.txt">Read it here</a> · <a href="https://github.com/projectatomai/hosting-research/blob/main/tools/paywell-gen/logo.svg">Source</a></td></tr><tr><td><b>build.py</b></td><td>Builds every page of this website.</td><td><a href="/open/src/build.py.txt">Read it here</a> · <a href="https://github.com/projectatomai/hosting-research/blob/main/tools/paywell-gen/build.py">Source</a></td></tr> | |
| 41 | + </table></div> | |
| 42 | + <p>Everything is dedicated to the public domain (CC0 for words and pictures, the Unlicense for code). You don’t need to credit us.</p> | |
| 43 | + | |
| 44 | + <h2>How it fits together</h2> | |
| 45 | + <ol class="steps"> | |
| 46 | + <li><b>A website, nothing to install</b><span>The site, the team app and the rating pages are plain web pages served from the edge. They work on any phone or computer, and you can add the app to your home screen.</span></li> | |
| 47 | + <li><b>Passkeys only</b><span>Sign-in uses WebAuthn passkeys: your face, fingerprint or screen lock. There are no passwords to steal. Our server checks every passkey signature itself.</span></li> | |
| 48 | + <li><b>A small database</b><span>One SQLite database (Cloudflare D1) holds teams, people, check-ins, ratings and chat. Sessions are stored only as a fingerprint (hash) of the token.</span></li> | |
| 49 | + <li><b>A wallet we can’t open</b><span>The wallet is made in your browser. Its backup words are locked with a key that only your passkey can produce (the WebAuthn PRF extension), then stored with us as a sealed box.</span></li> | |
| 50 | + <li><b>Signed rating links</b><span>Each visit gets a link signed by the server (HMAC-SHA256). It works once, for 14 days, and can’t be faked or reused.</span></li> | |
| 51 | + <li><b>The math is public</b><span>Score = customer reviews 60% + peer check-ins 40%, from 0 to 100. Daily bonus = score × tier shares × the value of one share. Tiers: Explorer 1, Builder 1½, Guide 2.</span></li> | |
| 52 | + </ol> | |
| 53 | + | |
| 54 | + <h2>Run your own copy</h2> | |
| 55 | + <ol> | |
| 56 | + <li>Copy the <code>domain-sites</code> folder and the <code>tools/paywell-gen</code> folder from the repository.</li> | |
| 57 | + <li>Create a D1 database and load <code>schema.sql</code> into it.</li> | |
| 58 | + <li>Deploy to Cloudflare Pages with that database bound as <code>PAYWELL_DB</code>.</li> | |
| 59 | + <li>Change the domain name in <code>paywell-app.js</code> (it’s the passkey website ID), and you have your own Paywell.</li> | |
| 60 | + </ol> | |
| 61 | + <div class="callout"><b>Before real money moves.</b> Test mode uses Bitcoin’s test network. Paying real wages needs a licensed payroll provider, normal tax withholding and reporting, and the money transmitter rules in each state. Our <a href="/research/">research page</a> lists the sources.</div> | |
| 62 | + </div></section> | |
| 63 | + </main> | |
| 64 | + <div class="wrap"><footer class="site">Paywell <span aria-hidden="true">·</span> <a href="/careers/">Careers</a></footer></div> | |
| 65 | + </body> | |
| 66 | + </html> |
open/src/app.js.txt added
| 1 | + // Paywell team app. Open source, public domain. TEST MODE: real accounts, ratings, reviews, scores and a real | |
| 2 | + // Bitcoin wallet on the signet test network (test coins have no value). Daily bonuses are worked out and shown; | |
| 3 | + // no real money moves until licensed payroll and custody partners are in place. | |
| 4 | + (function () { | |
| 5 | + 'use strict'; | |
| 6 | + const $ = (s, r) => (r || document).querySelector(s); | |
| 7 | + const esc = (t) => String(t == null ? '' : t).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c])); | |
| 8 | + const usd = (cents) => (cents < 0 ? '−' : '') + '$' + (Math.abs(cents) / 100).toLocaleString('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 }); | |
| 9 | + const usdSats = (sats) => price ? usd(Math.round(sats / 1e8 * price * 100)) : (sats.toLocaleString() + ' sats'); | |
| 10 | + const stars = (n) => '<span class="stars" aria-label="' + n + ' of 5 stars">' + '★'.repeat(n) + '<span style="opacity:.25">' + '★'.repeat(5 - n) + '</span></span>'; | |
| 11 | + const b64u = (buf) => { const b = new Uint8Array(buf); let s = ''; for (let i = 0; i < b.length; i++) s += String.fromCharCode(b[i]); return btoa(s).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, ''); }; | |
| 12 | + const unb64u = (s) => Uint8Array.from(atob(s.replace(/-/g, '+').replace(/_/g, '/') + '==='.slice((s.length + 3) % 4)), (c) => c.charCodeAt(0)); | |
| 13 | + const enc = new TextEncoder(); | |
| 14 | + const dayName = (d) => new Date(d + 'T12:00:00Z').toLocaleDateString('en-US', { weekday: 'short', month: 'short', day: 'numeric' }); | |
| 15 | + const when = (t) => new Date(t).toLocaleString('en-US', { month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' }); | |
| 16 | + | |
| 17 | + const GIFS = [{ id: 'party', e: '🎉', word: 'Woohoo!', a: 'pop', bg: '#ffd166,#ef476f' }, { id: 'dog', e: '🐶', word: 'Good boy!', a: 'wag', bg: '#a0e7e5,#4cc9f0' }, { id: 'fire', e: '🔥', word: 'On fire', a: 'pulse', bg: '#ffb347,#ff5e62' }, { id: 'clap', e: '👏', word: 'Bravo', a: 'shake', bg: '#b8f2a5,#2ec4b6' }, { id: 'coffee', e: '☕', word: 'Coffee time', a: 'float', bg: '#f6d6ad,#c08552' }, { id: 'taco', e: '🌮', word: 'Taco Tuesday', a: 'spin', bg: '#ffe66d,#ff9f1c' }, { id: 'cat', e: '🐱', word: 'Mood', a: 'wag', bg: '#e0c3fc,#8ec5fc' }, { id: 'rocket', e: '🚀', word: 'Let’s go', a: 'launch', bg: '#a1c4fd,#5e60ce' }, { id: 'heart', e: '💚', word: 'Thank you', a: 'pulse', bg: '#c1f7d5,#2d6a4f' }]; | |
| 18 | + const gifHtml = (g) => { const c = g.bg.split(','); return '<span class="gif a-' + g.a + '" style="background:linear-gradient(135deg,' + c[0] + ',' + c[1] + ')"><span class="ge">' + g.e + '</span><span class="gw">' + g.word + '</span></span>'; }; | |
| 19 | + const COLORS = ['#2d6a4f', '#c2185b', '#e76f51', '#5e60ce', '#0077b6', '#b5838d', '#6a994e', '#bc6c25']; | |
| 20 | + const colorFor = (id) => COLORS[[...String(id)].reduce((a, c) => a + c.charCodeAt(0), 0) % COLORS.length]; | |
| 21 | + | |
| 22 | + let S = null; // summary from the server | |
| 23 | + let price = 0; // USD per BTC | |
| 24 | + let wallet = null; // { w, words } in memory only, after passkey unlock | |
| 25 | + let chainState = null; // last wallet sync | |
| 26 | + let cur = 'home', curCh = 'general', chatTimer = null, lastMsg = 0, chatMsgs = []; | |
| 27 | + let lastCred = null; // credential id used this session (for the vault) | |
| 28 | + | |
| 29 | + // ---------- API ---------- | |
| 30 | + async function api(path, body) { | |
| 31 | + const r = await fetch(path, body === undefined ? { credentials: 'same-origin' } : { method: 'POST', credentials: 'same-origin', headers: { 'content-type': 'application/json' }, body: JSON.stringify(body) }); | |
| 32 | + const j = await r.json().catch(() => ({})); | |
| 33 | + if (!r.ok) { const e = new Error(j.error || 'Something went wrong. Try again.'); e.status = r.status; throw e; } | |
| 34 | + return j; | |
| 35 | + } | |
| 36 | + async function loadPrice() { try { const j = await api('/api/chain/price'); price = j.usd || 0; } catch (e) {} } | |
| 37 | + | |
| 38 | + // ---------- Passkeys (WebAuthn) with the PRF extension for the wallet lock ---------- | |
| 39 | + let PRF_IN = null; | |
| 40 | + async function prfIn() { if (!PRF_IN) PRF_IN = new Uint8Array(await crypto.subtle.digest('SHA-256', enc.encode('paywell-wallet-vault-v1'))); return PRF_IN; } | |
| 41 | + const passkeysOk = () => !!(window.PublicKeyCredential && navigator.credentials && navigator.credentials.create); | |
| 42 | + | |
| 43 | + async function createPasskey(name) { | |
| 44 | + const { challenge, rpId } = await api('/api/app/challenge', {}); | |
| 45 | + const cred = await navigator.credentials.create({ publicKey: { | |
| 46 | + challenge: unb64u(challenge), rp: { id: rpId, name: 'Paywell' }, | |
| 47 | + user: { id: crypto.getRandomValues(new Uint8Array(16)), name: name + ' (Paywell)', displayName: name }, | |
| 48 | + pubKeyCredParams: [{ type: 'public-key', alg: -7 }, { type: 'public-key', alg: -257 }], | |
| 49 | + authenticatorSelection: { residentKey: 'required', requireResidentKey: true, userVerification: 'required' }, | |
| 50 | + attestation: 'none', timeout: 120000, | |
| 51 | + extensions: { prf: { eval: { first: await prfIn() } } }, | |
| 52 | + } }); | |
| 53 | + const ext = cred.getClientExtensionResults ? cred.getClientExtensionResults() : {}; | |
| 54 | + return { | |
| 55 | + payload: { id: cred.id, clientDataJSON: b64u(cred.response.clientDataJSON), attestationObject: b64u(cred.response.attestationObject) }, | |
| 56 | + prf: ext.prf && ext.prf.results && ext.prf.results.first ? new Uint8Array(ext.prf.results.first) : null, | |
| 57 | + prfOn: !!(ext.prf && ext.prf.enabled), | |
| 58 | + }; | |
| 59 | + } | |
| 60 | + async function getPasskey(allowId) { | |
| 61 | + const { challenge, rpId } = await api('/api/app/challenge', {}); | |
| 62 | + const pk = { challenge: unb64u(challenge), rpId, userVerification: 'required', timeout: 120000, extensions: { prf: { eval: { first: await prfIn() } } } }; | |
| 63 | + if (allowId) pk.allowCredentials = [{ type: 'public-key', id: unb64u(allowId) }]; | |
| 64 | + const cred = await navigator.credentials.get({ publicKey: pk }); | |
| 65 | + const ext = cred.getClientExtensionResults ? cred.getClientExtensionResults() : {}; | |
| 66 | + lastCred = cred.id; | |
| 67 | + return { | |
| 68 | + payload: { id: cred.id, clientDataJSON: b64u(cred.response.clientDataJSON), authenticatorData: b64u(cred.response.authenticatorData), signature: b64u(cred.response.signature) }, | |
| 69 | + prf: ext.prf && ext.prf.results && ext.prf.results.first ? new Uint8Array(ext.prf.results.first) : null, | |
| 70 | + }; | |
| 71 | + } | |
| 72 | + function passkeyError(e) { | |
| 73 | + if (e && e.name === 'NotAllowedError') return 'The passkey step was cancelled or timed out. Try again.'; | |
| 74 | + if (e && e.name === 'InvalidStateError') return 'This device already has a Paywell passkey. Use “Sign in” instead.'; | |
| 75 | + return (e && e.message) || 'Something went wrong. Try again.'; | |
| 76 | + } | |
| 77 | + | |
| 78 | + // ---------- Wallet lock: AES-GCM key from the passkey's PRF secret (HKDF), same as everywhere else in Paywell ---------- | |
| 79 | + async function hkdf(prf, salt, info) { | |
| 80 | + const k = await crypto.subtle.importKey('raw', prf, 'HKDF', false, ['deriveBits']); | |
| 81 | + return new Uint8Array(await crypto.subtle.deriveBits({ name: 'HKDF', hash: 'SHA-256', salt: salt.length ? salt : new Uint8Array(32), info: enc.encode(info) }, k, 256)); | |
| 82 | + } | |
| 83 | + async function vaultSave(credId, prf, words) { | |
| 84 | + const salt = crypto.getRandomValues(new Uint8Array(16)), iv = crypto.getRandomValues(new Uint8Array(12)); | |
| 85 | + const key = await crypto.subtle.importKey('raw', await hkdf(prf, salt, 'paywell-vault-key'), 'AES-GCM', false, ['encrypt']); | |
| 86 | + const ct = new Uint8Array(await crypto.subtle.encrypt({ name: 'AES-GCM', iv, additionalData: enc.encode(credId) }, key, enc.encode(words))); | |
| 87 | + const box = new Uint8Array(12 + ct.length); box.set(iv); box.set(ct, 12); | |
| 88 | + await api('/api/vault/save', { cred: credId, auth: b64u(await hkdf(prf, new Uint8Array(0), 'paywell-vault-auth')), blob: b64u(box), salt: b64u(salt) }); | |
| 89 | + } | |
| 90 | + async function vaultOpen(credId, prf) { | |
| 91 | + const j = await api('/api/vault/get', { cred: credId, auth: b64u(await hkdf(prf, new Uint8Array(0), 'paywell-vault-auth')) }); | |
| 92 | + const box = unb64u(j.blob); | |
| 93 | + const key = await crypto.subtle.importKey('raw', await hkdf(prf, unb64u(j.salt), 'paywell-vault-key'), 'AES-GCM', false, ['decrypt']); | |
| 94 | + return new TextDecoder().decode(await crypto.subtle.decrypt({ name: 'AES-GCM', iv: box.slice(0, 12), additionalData: enc.encode(credId) }, key, box.slice(12))); | |
| 95 | + } | |
| 96 | + async function unlockWallet(cred) { | |
| 97 | + if (!cred.prf) throw new Error('This browser’s passkeys can’t open a locked wallet yet. Try Chrome or Safari, or use your own wallet.'); | |
| 98 | + const words = await vaultOpen(cred.payload.id, cred.prf); | |
| 99 | + wallet = { w: PWW.open(words) }; | |
| 100 | + return wallet; | |
| 101 | + } | |
| 102 | + | |
| 103 | + // ---------- Screens ---------- | |
| 104 | + const panel = () => $('#panel'); | |
| 105 | + function setTab(t) { | |
| 106 | + cur = t; | |
| 107 | + document.querySelectorAll('.tabs button').forEach((b) => b.setAttribute('aria-current', b.dataset.tab === t ? 'page' : 'false')); | |
| 108 | + if (chatTimer) { clearInterval(chatTimer); chatTimer = null; } | |
| 109 | + render(); | |
| 110 | + } | |
| 111 | + function shell(signedIn) { | |
| 112 | + $('#app').classList.toggle('out', !signedIn); | |
| 113 | + } | |
| 114 | + | |
| 115 | + function gate(msg) { | |
| 116 | + shell(false); | |
| 117 | + const setup = (location.hash.match(/setup=([A-Za-z0-9_-]+)/) || [])[1]; | |
| 118 | + if (setup) return setupScreen(setup); | |
| 119 | + panel().innerHTML = '<div class="signin"><h2>Paywell team app</h2><p class="small">Sign in with your face, fingerprint or screen lock. No username or password.</p>' + | |
| 120 | + (msg ? '<p class="err" role="alert">' + esc(msg) + '</p>' : '') + | |
| 121 | + (passkeysOk() ? '<button class="btn" type="button" data-act="signin">Sign in with passkey</button>' : '<p class="note">This browser doesn’t support passkeys. Try a recent Chrome, Safari, Edge or Firefox.</p>') + | |
| 122 | + '<div class="or"><span>or</span></div>' + | |
| 123 | + '<form class="fm" id="startteam"><h3>Start a test team</h3><p class="small">Try everything for real: passkey sign-in, ratings, peer reviews, scores, tiers, team chat and a Bitcoin wallet on the test network. Test coins have no value and no real money moves.</p>' + | |
| 124 | + '<label for="sname">Your first name</label><input id="sname" required maxlength="40" autocomplete="given-name">' + | |
| 125 | + '<label for="steam">Team name</label><input id="steam" required maxlength="60" placeholder="e.g. Maple Street Bakery">' + | |
| 126 | + '<button class="btn o" type="submit">Create my passkey and team</button></form>' + | |
| 127 | + '<p class="small">Joining a team? Open the setup link your team sent you.</p></div>'; | |
| 128 | + } | |
| 129 | + async function setupScreen(token) { | |
| 130 | + panel().innerHTML = '<div class="signin"><p class="small">Checking your setup link…</p></div>'; | |
| 131 | + try { | |
| 132 | + const s = await api('/api/app/setup', { token }); | |
| 133 | + panel().innerHTML = '<div class="signin"><h2>Welcome, ' + esc(s.name) + '</h2><p class="small">You’ve been added to <b>' + esc(s.team) + '</b>. Save a passkey on this device and your face, fingerprint or screen lock becomes your sign-in.</p>' + | |
| 134 | + '<p class="err" id="serr" role="alert"></p><button class="btn" type="button" data-act="join" data-token="' + esc(token) + '" data-name="' + esc(s.name) + '">Create my passkey</button></div>'; | |
| 135 | + } catch (e) { | |
| 136 | + history.replaceState(null, '', '/app/'); | |
| 137 | + gate(e.message); | |
| 138 | + } | |
| 139 | + } | |
| 140 | + | |
| 141 | + function payoutScreen(note) { | |
| 142 | + panel().innerHTML = '<form class="fm signin wide" id="payoutf"><h2>Where should your Bitcoin go?</h2><p class="small">Your daily Bitcoin bonus needs a wallet. You can change this any time.</p>' + | |
| 143 | + (note ? '<p class="err" role="alert">' + esc(note) + '</p>' : '') + | |
| 144 | + '<label class="choice"><input type="radio" name="pm" value="paywell" checked><span><b>Create a wallet for me</b><span class="small">Easiest. Made right here with your account, and your passkey locks its backup. Nothing to write down.</span></span></label>' + | |
| 145 | + '<label class="choice"><input type="radio" name="pm" value="own"><span><b>Use my own wallet</b><span class="small">Paste the address of a wallet you already have. Bonuses go straight there.</span></span></label>' + | |
| 146 | + '<div id="ownbox" hidden><label for="oaddr">Your Bitcoin wallet address</label><input id="oaddr" autocomplete="off" spellcheck="false" placeholder="tb1… while in test mode"></div>' + | |
| 147 | + '<button class="btn" type="submit">Continue</button></form>'; | |
| 148 | + } | |
| 149 | + | |
| 150 | + function tierChip(t) { return '<span class="pill">' + esc(S.tiers[t].name) + '</span>'; } | |
| 151 | + function scoreBar(n) { return '<div class="bar" role="img" aria-label="Score ' + n + ' of 100"><i style="width:' + n + '%"></i></div>'; } | |
| 152 | + | |
| 153 | + const views = { | |
| 154 | + home() { | |
| 155 | + const s = S.score; | |
| 156 | + const paidTo = S.me.payout === 'own' ? 'your own wallet' : 'your Paywell wallet'; | |
| 157 | + return '<div class="pg"><div><h2>Hi, ' + esc(S.me.name) + '</h2><p class="small">' + esc(S.org.name) + ' · ' + esc(S.me.tierName) + ' (' + S.me.shares + ' bonus share' + (S.me.shares === 1 ? '' : 's') + ')</p></div>' + | |
| 158 | + '<div class="g2"><div class="tile"><h3>Today’s Bitcoin bonus</h3><div class="usd big">' + usd(S.todayCents) + '</div><p>Paid automatically every day to ' + paidTo + '. Test mode: worked out for real, no money moves.</p></div>' + | |
| 159 | + '<div class="tile"><h3>Your score: ' + s.score + '</h3>' + scoreBar(s.score) + '<p>Customers ' + (s.customerN ? s.customerAvg + ' ★ (' + s.customerN + ')' : 'no ratings yet') + ' · 60%<br>Teammates ' + (s.peerN ? s.peerAvg + ' ★ (' + s.peerN + ')' : 'no reviews yet') + ' · 40%' + (!s.customerN && !s.peerN ? '<br>Everyone starts at 70 until reviews come in.' : '') + '</p></div></div>' + | |
| 160 | + '<div class="tile"><h3>How today’s bonus is worked out</h3><p class="calc">Score ' + s.score + ' × ' + S.me.shares + ' share' + (S.me.shares === 1 ? '' : 's') + ' (' + esc(S.me.tierName) + ') × ' + usd(S.org.shareCents) + ' per share = <b>' + usd(S.todayCents) + '</b></p><p>Your wage is separate: at least the minimum wage where you work, and reviews never lower it.</p></div>' + | |
| 161 | + '<div class="tile"><h3>Daily bonuses</h3>' + (S.days.length ? S.days.map((d) => '<div class="row"><div class="l"><b>' + dayName(d.day) + '</b><span>Score ' + d.score + ' · ' + esc(S.tiers[d.tier].name) + '</span></div><div class="r"><b>' + usd(d.cents) + '</b><div class="small">test</div></div></div>').join('') : '<p>Your first daily bonus shows here tomorrow.</p>') + '</div>' + | |
| 162 | + '<div class="acts"><button class="btn" data-go="take">Get paid</button><button class="btn o" data-go="checkin">Daily check-in</button><button class="btn o" data-go="wallet">Wallet</button></div></div>'; | |
| 163 | + }, | |
| 164 | + checkin() { | |
| 165 | + const mates = S.team.filter((m) => m.id !== S.me.id); | |
| 166 | + return '<div class="pg"><div><h2>Daily check-in</h2><p class="small">Rate each teammate you worked with today, 1 to 5 stars, on teamwork, care and reliability. One review per teammate per day. They see the stars and your note, never who wrote it. Only your own team can see reviews.</p></div>' + | |
| 167 | + (mates.length ? mates.map((m) => { | |
| 168 | + const done = S.reviewedToday.includes(m.id); | |
| 169 | + return '<form class="tile peer" data-person="' + esc(m.id) + '"><div class="row"><div class="l"><b>' + esc(m.name) + '</b><span>' + esc(S.tiers[m.tier].name) + '</span></div><div class="r">' + (done ? '<span class="pill">Reviewed today ✓</span>' : '') + '</div></div>' + | |
| 170 | + (done ? '' : '<div class="starpick" role="radiogroup" aria-label="Stars for ' + esc(m.name) + '">' + [1, 2, 3, 4, 5].map((n) => '<label><input type="radio" name="st" value="' + n + '" required><span>' + n + '★</span></label>').join('') + '</div><input name="note" maxlength="500" placeholder="A kind, honest note (optional)"><button class="btn" type="submit">Send review</button><p class="small res" role="status"></p>') + '</form>'; | |
| 171 | + }).join('') : '<div class="tile"><p>No teammates yet. ' + (S.me.admin ? 'Add people in the Team tab.' : 'Your team will add people soon.') + '</p></div>') + '</div>'; | |
| 172 | + }, | |
| 173 | + ratings() { | |
| 174 | + const r = S.ratings, p = S.peers; | |
| 175 | + return '<div class="pg"><div><h2>Your ratings and reviews</h2><p class="small">Customer ratings (60% of your score) and teammate reviews (40%), from the last four weeks. Customers’ contact details stay private.</p></div>' + | |
| 176 | + '<form class="tile fm" id="visitf"><h3>Ask a customer to rate a visit</h3><p>Makes a one-time rating link for a visit you just did. In a real shop this comes on the receipt by itself.</p><label for="vsvc">What was the visit?</label><input id="vsvc" maxlength="60" placeholder="e.g. Haircut"><button class="btn" type="submit">Make rating link</button><div id="vout"></div></form>' + | |
| 177 | + '<div class="tile"><h3>From customers</h3>' + (r.length ? r.map((x) => '<div class="row"><div class="l">' + stars(x.stars) + '<b>' + esc(x.brand) + '</b><span>' + when(x.created) + (x.note ? ' · “' + esc(x.note) + '”' : '') + '</span></div><div class="r"><span class="pill ' + (x.status === 'counted' ? '' : 'hold') + '">' + (x.status === 'counted' ? 'Counted' : 'Being checked') + '</span></div></div>').join('') : '<p>No customer ratings yet. Make a rating link above to try it.</p>') + '</div>' + | |
| 178 | + '<div class="tile"><h3>From teammates</h3>' + (p.length ? p.map((x) => '<div class="row"><div class="l">' + stars(x.stars) + '<span>' + dayName(x.day) + (x.note ? ' · “' + esc(x.note) + '”' : '') + '</span></div></div>').join('') : '<p>No teammate reviews yet.</p>') + '</div>' + | |
| 179 | + '<div class="tile"><h3>Fair rules</h3><p>1 and 2 star customer ratings are checked before they count. Ratings about prices, scheduling or company rules don’t count. You can dispute any rating within 14 days, and it has no effect while it’s reviewed. Reviews never lower your wage. <a href="/how-it-works/#disputes">How disputes work</a></p></div></div>'; | |
| 180 | + }, | |
| 181 | + take() { | |
| 182 | + const need = S.me.payout === 'paywell' && !wallet; | |
| 183 | + return '<div class="pg"><div><h2>Get paid</h2><p class="small">Show this to the customer. They scan it, or tap it on Android, and pay from any Bitcoin wallet. Shown in dollars. No tip screen, ever.</p></div>' + | |
| 184 | + (need ? '<div class="tile"><p>Unlock your wallet first so we know where the payment goes.</p><button class="btn" data-act="unlock">Unlock wallet with passkey</button></div>' : | |
| 185 | + '<form class="tile fm" id="takef"><label for="tamt">Amount (dollars)</label><input id="tamt" inputmode="decimal" placeholder="25.00"><label for="tfor">For</label><input id="tfor" maxlength="60" placeholder="e.g. Dog grooming"><button class="btn" type="submit">Show payment code</button></form>') + | |
| 186 | + '<div id="tbox"></div></div>'; | |
| 187 | + }, | |
| 188 | + wallet() { | |
| 189 | + const own = S.me.payout === 'own'; | |
| 190 | + let h = '<div class="pg"><div class="tile"><h3>Where your daily bonus goes</h3><div class="row"><div class="l">' + (own ? '<b>Your own wallet</b><span class="mono">' + esc(S.me.payoutAddr) + '</span>' : '<b>Your Paywell wallet</b><span>Made with your account. Your passkey locks its backup; we can’t open it.</span>') + '</div><div class="r"><button class="btn o sm" data-act="payout">Change</button></div></div></div>'; | |
| 191 | + if (!own || wallet) { | |
| 192 | + if (!wallet) h += '<div class="tile"><h3>Wallet</h3><p>Locked. Your passkey opens it.</p><button class="btn" data-act="unlock">Unlock wallet with passkey</button><p class="err" id="werr" role="alert"></p></div>'; | |
| 193 | + else { | |
| 194 | + const st = chainState; | |
| 195 | + h += '<div class="tile"><h3>Wallet balance</h3><div class="usd big">' + (st ? usdSats(st.balance) : '…') + '</div><p>' + (st ? st.balance.toLocaleString() + ' sats on the test network' + (price ? ' · ' + usd(Math.round(price * 100)) + ' per BTC' : '') : 'Checking the network…') + '</p></div>' + | |
| 196 | + '<div class="acts"><button class="btn" data-act="receive">Receive</button><button class="btn o" data-act="send">Send</button><button class="btn o" data-act="refresh">Refresh</button></div><div id="wbox"></div>' + | |
| 197 | + '<div class="tile"><h3>Activity</h3>' + (st && st.history.length ? st.history.slice(0, 30).map((t) => '<div class="row"><div class="l"><b>' + (t.delta >= 0 ? 'Received' : 'Sent') + '</b><span>' + (t.time ? when(t.time) : 'Just now') + (t.confirmed ? '' : ' · pending') + '</span></div><div class="r"><b>' + (t.delta >= 0 ? '+' : '−') + usdSats(Math.abs(t.delta)) + '</b></div></div>').join('') : '<p>Nothing yet. Get free test coins from a signet faucet, then send them to your Receive address.</p><p><a class="btn o sm" href="https://signetfaucet.com/" rel="noopener" target="_blank">Get free test coins</a></p>') + '</div>'; | |
| 198 | + } | |
| 199 | + } | |
| 200 | + h += '<div class="note">Test network only: test coins have no value. Trading between Bitcoin and dollars goes through a licensed exchange partner and opens with live mode.</div></div>'; | |
| 201 | + return h; | |
| 202 | + }, | |
| 203 | + chat() { | |
| 204 | + const ch = [['general', 'Hellos, news and everyday stuff'], ['shout-outs', 'Great days and high fives'], ['random', 'Anything goes (keep it kind)']]; | |
| 205 | + return '<div class="chat"><aside class="chs" aria-label="Channels">' + ch.map((c) => '<button class="ch" data-ch="' + c[0] + '"' + (c[0] === curCh ? ' aria-current="true"' : '') + '><span>#</span>' + c[0] + '</button>').join('') + '</aside>' + | |
| 206 | + '<section class="room"><header class="roomh"><b>#' + curCh + '</b><span>' + ch.find((c) => c[0] === curCh)[1] + '</span></header><div class="msgs" id="msgs" role="log" aria-live="polite"><p class="small">Loading…</p></div>' + | |
| 207 | + '<div class="gifs" id="gifs" hidden>' + GIFS.map((g) => '<button type="button" data-gif="' + g.id + '" aria-label="' + esc(g.word) + '">' + gifHtml(g) + '</button>').join('') + '</div>' + | |
| 208 | + '<form class="compose" id="say"><button type="button" class="gifbtn" data-act="gifs" aria-label="Stickers">GIF</button><input id="sayin" maxlength="1000" placeholder="Message #' + curCh + '" autocomplete="off"><button class="btn send" type="submit">Send</button></form></section></div>'; | |
| 209 | + }, | |
| 210 | + team() { | |
| 211 | + let h = '<div class="pg"><div><h2>' + esc(S.org.name) + '</h2><p class="small">Three tiers: Explorer (1 share), Builder (1½), Guide (2). Tiers are reviewed every three months.</p></div><div class="tile">' + | |
| 212 | + S.team.map((m) => '<div class="row"><div class="l"><b>' + esc(m.name) + (m.id === S.me.id ? ' (you)' : '') + '</b><span>' + esc(S.tiers[m.tier].name) + '</span></div><div class="r">' + | |
| 213 | + (S.me.admin && m.id !== S.me.id ? '<select data-tier="' + esc(m.id) + '" aria-label="Tier for ' + esc(m.name) + '">' + [1, 2, 3].map((t) => '<option value="' + t + '"' + (t === m.tier ? ' selected' : '') + '>' + S.tiers[t].name + '</option>').join('') + '</select>' : tierChip(m.tier)) + '</div></div>').join('') + '</div>'; | |
| 214 | + if (S.me.admin) h += '<form class="tile fm" id="invitef"><h3>Add a teammate</h3><p>Makes a one-time setup link (good for 24 hours). Send it only to them, by text or email. Opening it lets them save a passkey and join.</p><label for="iname">Their first name</label><input id="iname" required maxlength="40"><label for="itier">Tier</label><select id="itier"><option value="1">Explorer</option><option value="2">Builder</option><option value="3">Guide</option></select><button class="btn" type="submit">Make setup link</button><div id="iout"></div></form>'; | |
| 215 | + return h + '</div>'; | |
| 216 | + }, | |
| 217 | + security() { | |
| 218 | + return '<div class="pg"><div><h2>Security</h2></div><div class="tile">' + | |
| 219 | + '<div class="check"><i>✓</i><div><b>Passkey sign-in</b><div class="small">Your face, fingerprint or screen lock is your sign-in. No username, no password, nothing to steal or forget.</div></div></div>' + | |
| 220 | + '<div class="check"><i>✓</i><div><b>Wallet locked by your passkey</b><div class="small">Your wallet’s backup is locked on your device before it reaches us. We store it but can’t open it. Nothing to write down.</div></div></div>' + | |
| 221 | + '<div class="check"><i>✓</i><div><b>Confirm before money moves</b><div class="small">Sending, and changing where your bonus goes, always asks for your passkey again.</div></div></div>' + | |
| 222 | + '<div class="check"><i>✓</i><div><b>Reviews stay in your team</b><div class="small">Only signed-in members of your own team can see your team’s ratings and reviews.</div></div></div>' + | |
| 223 | + '</div><p><button class="btn o" data-act="signout">Sign out</button></p><div class="note">We will never ask for a setup link or recovery words, by phone, text, email or in person. Anyone who asks is trying to steal from you.</div></div>'; | |
| 224 | + }, | |
| 225 | + }; | |
| 226 | + | |
| 227 | + function render() { | |
| 228 | + if (!S) return; | |
| 229 | + shell(true); | |
| 230 | + panel().innerHTML = views[cur] ? views[cur]() : views.home(); | |
| 231 | + if (cur === 'chat') { lastMsg = 0; chatMsgs = []; pollChat(); chatTimer = setInterval(pollChat, 4000); } | |
| 232 | + if (cur === 'wallet' && wallet && !chainState) refreshWallet(); | |
| 233 | + } | |
| 234 | + | |
| 235 | + async function refresh() { S = await api('/api/app/me'); render(); } | |
| 236 | + | |
| 237 | + // ---------- Chat ---------- | |
| 238 | + function msgHtml(m) { | |
| 239 | + const g = (m.body.match(/^:gif:([a-z]+):$/) || [])[1]; | |
| 240 | + const gif = g && GIFS.find((x) => x.id === g); | |
| 241 | + return '<div class="msg"><span class="av" style="background:' + colorFor(m.person) + '">' + esc(m.name[0] || '?') + '</span><div class="mb"><div class="mh"><b>' + esc(m.name) + '</b><span>' + when(m.created) + '</span></div>' + (gif ? gifHtml(gif) : '<p>' + esc(m.body) + '</p>') + '</div></div>'; | |
| 242 | + } | |
| 243 | + async function pollChat(body) { | |
| 244 | + try { | |
| 245 | + const j = body ? await api('/api/app/chat?c=' + curCh + '&since=' + lastMsg, { channel: curCh, body }) : await api('/api/app/chat?c=' + curCh + '&since=' + lastMsg); | |
| 246 | + if (j.messages.length) { chatMsgs = chatMsgs.concat(j.messages); lastMsg = j.messages[j.messages.length - 1].id; } | |
| 247 | + const box = $('#msgs'); if (!box) return; | |
| 248 | + const atEnd = box.scrollHeight - box.scrollTop - box.clientHeight < 60; | |
| 249 | + box.innerHTML = chatMsgs.length ? chatMsgs.map(msgHtml).join('') : '<p class="small">No messages yet. Say hello! 👋</p>'; | |
| 250 | + if (atEnd || body || j.messages.length) box.scrollTop = box.scrollHeight; | |
| 251 | + } catch (e) { if (e.status === 401) { S = null; gate(); } } | |
| 252 | + } | |
| 253 | + | |
| 254 | + // ---------- Wallet actions ---------- | |
| 255 | + async function refreshWallet() { | |
| 256 | + if (!wallet) return; | |
| 257 | + try { chainState = await PWW.sync(wallet.w); } | |
| 258 | + catch (e) { chainState = chainState || { balance: 0, history: [], utxos: [], nextReceive: 0, nextChange: 0 }; } | |
| 259 | + if (cur === 'wallet') render(); | |
| 260 | + } | |
| 261 | + function receiveBox() { | |
| 262 | + const a = wallet.w.address(chainState ? chainState.nextReceive : 0); | |
| 263 | + $('#wbox').innerHTML = '<div class="tile center"><h3>Your receive address</h3><div class="qrbox">' + PWW.qrSvg('bitcoin:' + a) + '</div><p class="mono">' + esc(a) + '</p><button class="btn o sm" data-copy="' + esc(a) + '">Copy address</button></div>'; | |
| 264 | + } | |
| 265 | + function sendBox() { | |
| 266 | + $('#wbox').innerHTML = '<form class="tile fm" id="sendf"><h3>Send Bitcoin</h3><label for="sto">To address</label><input id="sto" autocomplete="off" spellcheck="false" placeholder="tb1…"><label for="samt">Amount (dollars)</label><input id="samt" inputmode="decimal" placeholder="5.00"><p class="small" id="sout"></p><button class="btn" type="submit">Review and confirm with passkey</button><p class="err" role="alert" id="serr"></p><p class="small">Bitcoin payments can’t be undone. Check the address and amount.</p></form>'; | |
| 267 | + } | |
| 268 | + | |
| 269 | + // ---------- Events ---------- | |
| 270 | + document.addEventListener('click', async (e) => { | |
| 271 | + const t = e.target.closest('button, a'); | |
| 272 | + if (!t) return; | |
| 273 | + if (t.dataset.tab) { setTab(t.dataset.tab); return; } | |
| 274 | + if (t.dataset.go) { setTab(t.dataset.go); return; } | |
| 275 | + if (t.dataset.ch) { curCh = t.dataset.ch; render(); return; } | |
| 276 | + if (t.dataset.copy) { try { await navigator.clipboard.writeText(t.dataset.copy); t.textContent = 'Copied ✓'; } catch (x) {} return; } | |
| 277 | + if (t.dataset.gif) { $('#gifs').hidden = true; pollChat(':gif:' + t.dataset.gif + ':'); return; } | |
| 278 | + const act = t.dataset.act; | |
| 279 | + if (!act) return; | |
| 280 | + try { | |
| 281 | + if (act === 'gifs') { const g = $('#gifs'); g.hidden = !g.hidden; return; } | |
| 282 | + if (act === 'signin') { | |
| 283 | + t.disabled = true; t.textContent = 'Waiting for your passkey…'; | |
| 284 | + const c = await getPasskey(); | |
| 285 | + await api('/api/app/login', { credential: c.payload }); | |
| 286 | + S = await api('/api/app/me'); | |
| 287 | + if (S.me.payout === 'paywell' && c.prf) { try { await unlockWallet(c); } catch (x) {} } | |
| 288 | + cur = 'home'; render(); loadPrice(); return; | |
| 289 | + } | |
| 290 | + if (act === 'join') { | |
| 291 | + t.disabled = true; t.textContent = 'Waiting for your passkey…'; | |
| 292 | + const c = await createPasskey(t.dataset.name); | |
| 293 | + await api('/api/app/register', { credential: c.payload, setup: t.dataset.token }); | |
| 294 | + history.replaceState(null, '', '/app/'); | |
| 295 | + await afterSignup(c); | |
| 296 | + return; | |
| 297 | + } | |
| 298 | + if (act === 'unlock') { | |
| 299 | + const c = await getPasskey(); | |
| 300 | + await unlockWallet(c); | |
| 301 | + chainState = null; render(); refreshWallet(); return; | |
| 302 | + } | |
| 303 | + if (act === 'refresh') { chainState = null; render(); refreshWallet(); return; } | |
| 304 | + if (act === 'receive') { if (chainState) receiveBox(); return; } | |
| 305 | + if (act === 'send') { sendBox(); return; } | |
| 306 | + if (act === 'payout') { payoutScreen(); return; } | |
| 307 | + if (act === 'signout') { await api('/api/app/logout', {}); S = null; wallet = null; chainState = null; gate(); return; } | |
| 308 | + } catch (x) { | |
| 309 | + const msg = passkeyError(x); | |
| 310 | + const where = $('#werr') || $('#serr'); | |
| 311 | + if (S && !where) { alertBox(msg); } else if (where) where.textContent = msg; else gate(msg); | |
| 312 | + } | |
| 313 | + }); | |
| 314 | + function alertBox(msg) { const p = document.createElement('p'); p.className = 'err'; p.setAttribute('role', 'alert'); p.textContent = msg; panel().prepend(p); } | |
| 315 | + | |
| 316 | + async function afterSignup(c) { | |
| 317 | + S = await api('/api/app/me'); | |
| 318 | + lastCred = c.payload.id; | |
| 319 | + window._signupCred = c; | |
| 320 | + payoutScreen(); | |
| 321 | + } | |
| 322 | + | |
| 323 | + document.addEventListener('change', async (e) => { | |
| 324 | + if (e.target.name === 'pm') { const b = $('#ownbox'); if (b) b.hidden = e.target.value !== 'own'; } | |
| 325 | + if (e.target.dataset && e.target.dataset.tier) { | |
| 326 | + try { await api('/api/app/tier', { person: e.target.dataset.tier, tier: Number(e.target.value) }); await refresh(); } catch (x) { alertBox(x.message); } | |
| 327 | + } | |
| 328 | + }); | |
| 329 | + document.addEventListener('input', (e) => { | |
| 330 | + if (e.target.id === 'samt') { const v = parseFloat(e.target.value) || 0; $('#sout').textContent = v && price ? Math.round(v / price * 1e8).toLocaleString() + ' sats' : ''; } | |
| 331 | + }); | |
| 332 | + | |
| 333 | + document.addEventListener('submit', async (e) => { | |
| 334 | + const f = e.target; e.preventDefault(); | |
| 335 | + const btn = f.querySelector('button[type=submit]'); | |
| 336 | + const fail = (msg) => { let p = f.querySelector('.err'); if (!p) { p = document.createElement('p'); p.className = 'err'; p.setAttribute('role', 'alert'); f.appendChild(p); } p.textContent = msg; if (btn) btn.disabled = false; }; | |
| 337 | + try { | |
| 338 | + if (btn) btn.disabled = true; | |
| 339 | + if (f.id === 'startteam') { | |
| 340 | + const name = $('#sname').value.trim(), team = $('#steam').value.trim(); | |
| 341 | + if (!name || !team) return fail('Add your first name and a team name.'); | |
| 342 | + const c = await createPasskey(name); | |
| 343 | + await api('/api/app/register', { credential: c.payload, name, team }); | |
| 344 | + await afterSignup(c); | |
| 345 | + return; | |
| 346 | + } | |
| 347 | + if (f.id === 'payoutf') { | |
| 348 | + const mode = f.querySelector('input[name=pm]:checked').value; | |
| 349 | + if (mode === 'own') { | |
| 350 | + const addr = $('#oaddr').value.trim(); | |
| 351 | + if (!PWW.validAddress(addr)) return fail('That doesn’t look like a test-network Bitcoin address (they start with tb1).'); | |
| 352 | + const c = await getPasskey(); | |
| 353 | + await api('/api/app/payout', { mode: 'own', addr, credential: c.payload }); | |
| 354 | + } else { | |
| 355 | + // Make the wallet here, lock its backup with the passkey and store the locked copy with us. | |
| 356 | + let c = window._signupCred && window._signupCred.prf ? window._signupCred : null; | |
| 357 | + if (!c) c = await getPasskey(); | |
| 358 | + if (!c.prf) return fail('This browser’s passkeys can’t lock a wallet backup yet. Choose “Use my own wallet”, or try Chrome or Safari.'); | |
| 359 | + let words = null; | |
| 360 | + try { words = await vaultOpen(c.payload.id, c.prf); } catch (x) { words = PWW.newWords(); await vaultSave(c.payload.id, c.prf, words); } | |
| 361 | + wallet = { w: PWW.open(words) }; | |
| 362 | + const body = { mode: 'paywell', walletAddr: wallet.w.address(0) }; | |
| 363 | + if (S.me.payout === 'own') { const c2 = await getPasskey(c.payload.id); body.credential = c2.payload; } | |
| 364 | + await api('/api/app/payout', body); | |
| 365 | + } | |
| 366 | + window._signupCred = null; | |
| 367 | + S = await api('/api/app/me'); cur = mode === 'own' ? 'home' : 'wallet'; chainState = null; render(); loadPrice(); | |
| 368 | + return; | |
| 369 | + } | |
| 370 | + if (f.classList.contains('peer')) { | |
| 371 | + const st = f.querySelector('input[name=st]:checked'); | |
| 372 | + if (!st) return fail('Pick 1 to 5 stars.'); | |
| 373 | + await api('/api/app/peer', { person: f.dataset.person, stars: Number(st.value), note: f.note.value }); | |
| 374 | + S = await api('/api/app/me'); render(); return; | |
| 375 | + } | |
| 376 | + if (f.id === 'visitf') { | |
| 377 | + const j = await api('/api/app/visit', { service: $('#vsvc').value }); | |
| 378 | + $('#vout').innerHTML = '<div class="center"><div class="qrbox">' + PWW.qrSvg(j.url) + '</div><p class="mono small">' + esc(j.url) + '</p><p><button class="btn o sm" type="button" data-copy="' + esc(j.url) + '">Copy link</button> <a class="btn o sm" href="' + esc(j.url) + '" target="_blank" rel="noopener">Open it as the customer</a></p><p class="small">Works once, for 14 days. Refresh this tab after rating to see it count.</p></div>'; | |
| 379 | + btn.disabled = false; return; | |
| 380 | + } | |
| 381 | + if (f.id === 'takef') { | |
| 382 | + const dollars = parseFloat($('#tamt').value) || 0; | |
| 383 | + if (!price) await loadPrice(); | |
| 384 | + const addr = S.me.payout === 'own' ? S.me.payoutAddr : wallet.w.address(chainState ? chainState.nextReceive : 0); | |
| 385 | + const visit = await api('/api/app/visit', { service: $('#tfor').value || 'Payment' }); | |
| 386 | + const btcAmt = dollars && price ? (dollars / price).toFixed(8).replace(/0+$/, '').replace(/\.$/, '') : ''; | |
| 387 | + const bip21 = 'bitcoin:' + addr + (btcAmt ? '?amount=' + btcAmt : '') + ($('#tfor').value ? (btcAmt ? '&' : '?') + 'label=' + encodeURIComponent($('#tfor').value) : ''); | |
| 388 | + const link = 'https://paywell.company/pay/?u=' + encodeURIComponent(bip21) + '&r=' + encodeURIComponent(visit.url); | |
| 389 | + $('#tbox').innerHTML = '<div class="tile center"><h3>' + (dollars ? usd(Math.round(dollars * 100)) : 'Any amount') + '</h3><div class="qrbox">' + PWW.qrSvg(link) + '</div><p>Ask them to scan this with their phone camera. It opens the payment, then asks them to rate the visit. No tip.</p>' + | |
| 390 | + ('NDEFReader' in window ? '<button class="btn o sm" type="button" id="nfcw" data-link="' + esc(link) + '">Write to an NFC tag</button> ' : '') + '<button class="btn o sm" type="button" data-copy="' + esc(link) + '">Copy link</button><p class="small" id="nfcmsg"></p></div>'; | |
| 391 | + btn.disabled = false; return; | |
| 392 | + } | |
| 393 | + if (f.id === 'sendf') { | |
| 394 | + const to = $('#sto').value.trim(), dollars = parseFloat($('#samt').value) || 0; | |
| 395 | + if (!price) await loadPrice(); | |
| 396 | + if (!dollars || !price) return fail('Enter an amount in dollars.'); | |
| 397 | + const sats = Math.round(dollars / price * 1e8); | |
| 398 | + const fees = await api('/api/chain/fees').catch(() => ({})); | |
| 399 | + const rate = Math.max(1, Math.ceil(fees['3'] || 2)); | |
| 400 | + if (!chainState) chainState = await PWW.sync(wallet.w); | |
| 401 | + const tx = PWW.buildPayment(wallet.w, chainState, to, sats, rate); | |
| 402 | + if (!confirm('Send ' + usd(Math.round(dollars * 100)) + ' (' + sats.toLocaleString() + ' test sats) plus a network fee of about ' + usdSats(tx.fee) + '? You’ll confirm with your passkey next.')) { btn.disabled = false; return; } | |
| 403 | + await getPasskey(lastCred || undefined); // a fresh face, fingerprint or screen-lock check before money moves | |
| 404 | + const r = await fetch('/api/chain/tx', { method: 'POST', body: tx.hex }).then((x) => x.json()); | |
| 405 | + if (r.error) return fail('The network didn’t take it: ' + r.error); | |
| 406 | + $('#wbox').innerHTML = '<div class="tile center"><div class="big-ok">✓</div><h3>Sent</h3><p class="mono small">' + esc(r.txid) + '</p></div>'; | |
| 407 | + setTimeout(refreshWallet, 3000); return; | |
| 408 | + } | |
| 409 | + if (f.id === 'invitef') { | |
| 410 | + const j = await api('/api/app/invite', { name: $('#iname').value, tier: Number($('#itier').value) }); | |
| 411 | + $('#iout').innerHTML = '<p class="mono small">' + esc(j.url) + '</p><p><button class="btn o sm" type="button" data-copy="' + esc(j.url) + '">Copy setup link</button></p><p class="small">Good for 24 hours, works once.</p>'; | |
| 412 | + btn.disabled = false; await refresh(); return; | |
| 413 | + } | |
| 414 | + if (f.id === 'say') { | |
| 415 | + const v = $('#sayin').value.trim(); if (!v) { btn.disabled = false; return; } | |
| 416 | + $('#sayin').value = ''; await pollChat(v); btn.disabled = false; $('#sayin').focus(); return; | |
| 417 | + } | |
| 418 | + } catch (x) { fail(passkeyError(x)); } | |
| 419 | + }); | |
| 420 | + document.addEventListener('click', async (e) => { | |
| 421 | + const b = e.target.closest('#nfcw'); if (!b) return; | |
| 422 | + try { const w = new NDEFReader(); await w.write({ records: [{ recordType: 'url', data: b.dataset.link }] }); $('#nfcmsg').textContent = 'Written. Customers can tap that tag with their phone to pay.'; } | |
| 423 | + catch (x) { $('#nfcmsg').textContent = 'Couldn’t write the tag: ' + (x.message || x); } | |
| 424 | + }); | |
| 425 | + | |
| 426 | + // ---------- Start ---------- | |
| 427 | + (async () => { | |
| 428 | + loadPrice(); | |
| 429 | + if (/setup=/.test(location.hash)) { gate(); return; } | |
| 430 | + try { S = await api('/api/app/me'); render(); } | |
| 431 | + catch (e) { gate(e.status === 401 ? '' : e.message); } | |
| 432 | + })(); | |
| 433 | + window.addEventListener('hashchange', () => { if (/setup=/.test(location.hash)) gate(); }); | |
| 434 | + })(); |
open/src/bonus_diagram.html.txt added
| 1 | + <div class="pgflow" aria-label="How daily Bitcoin bonuses are worked out"> | |
| 2 | + <style> | |
| 3 | + .pgflow{margin:18px 0 8px;display:grid;grid-template-columns:1.2fr auto 1fr auto 1fr auto 1.1fr;gap:10px;align-items:center;text-align:left} | |
| 4 | + .pgflow .pc{display:grid;gap:10px} | |
| 5 | + .pgflow .pb{border:1px solid rgba(127,127,127,.35);border-radius:18px;padding:14px 16px;display:grid;gap:3px;line-height:1.35} | |
| 6 | + .pgflow .pb b{font-size:16px}.pgflow .pb span{font-size:14px;opacity:.8}.pgflow .pb em{font-style:normal;font-weight:700;font-size:13px;opacity:.9} | |
| 7 | + .pgflow .pm{background:rgba(127,127,127,.12);border-color:transparent} | |
| 8 | + .pgflow .pg{border:2px solid currentColor} | |
| 9 | + .pgflow .po{font-size:26px;font-weight:800;text-align:center;opacity:.75} | |
| 10 | + .pgflow .pw{grid-column:1/-1;border:2px dashed rgba(127,127,127,.4);border-radius:18px;padding:12px 16px;font-size:15px} | |
| 11 | + .pgflow .pt{grid-column:1/-1;display:grid;grid-template-columns:repeat(3,1fr);gap:10px} | |
| 12 | + .pgflow .pt div{border:1px solid rgba(127,127,127,.35);border-radius:16px;padding:12px 14px;font-size:14px;line-height:1.35} | |
| 13 | + @media (max-width:820px){.pgflow,.pgflow .pt{grid-template-columns:1fr}.pgflow .pa{display:inline-block;transform:rotate(90deg)}} | |
| 14 | + </style> | |
| 15 | + <div class="pc"><div class="pb"><b>Customer reviews</b><span>Free stars after each visit</span><em>60% of the score</em></div><div class="pb"><b>Peer reviews</b><span>Teammates rate teamwork each week</span><em>40% of the score</em></div></div> | |
| 16 | + <div class="po" aria-hidden="true"><span class="pa">→</span></div> | |
| 17 | + <div class="pb pm"><b>Score</b><span>0 to 100, from recent ratings, updated daily</span></div> | |
| 18 | + <div class="po" aria-hidden="true">×</div> | |
| 19 | + <div class="pb pm"><b>Tier</b><span>Explorer, Builder or Guide. Higher tier, bigger bonus</span></div> | |
| 20 | + <div class="po" aria-hidden="true">=</div> | |
| 21 | + <div class="pb pg"><b>Daily Bitcoin bonus</b><span>Paid by us, automatically, every day. Shown in dollars</span></div> | |
| 22 | + <div class="pt"><div><b>Explorer</b><br>Everyone starts here, learning the work.</div><div><b>Builder</b><br>Growing, with steady high scores and teammates’ backing.</div><div><b>Guide</b><br>On the way to mastery, helping others grow.</div></div> | |
| 23 | + <div class="pw"><b>Plus a guaranteed wage</b>, at least the minimum wage where they work, through normal payroll. Reviews and tier never lower it.</div> | |
| 24 | + </div> |
open/src/build.py.txt added
| 1 | + # Builds the static pages of domain-sites/paywell.company (not the app or rate pages, which are hand-written). | |
| 2 | + # python3 tools/paywell-gen/build.py | |
| 3 | + import os, html | |
| 4 | + ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..", "domain-sites", "paywell.company") | |
| 5 | + D = "https://paywell.company" | |
| 6 | + LOGO = '<svg viewBox="0 0 32 32" aria-hidden="true"><rect width="32" height="32" rx="9" fill="#0f3d2e"/><circle cx="16" cy="14.5" r="8.5" fill="#e0a526"/><circle cx="16" cy="14.5" r="6.6" fill="none" stroke="#0f3d2e" stroke-opacity=".35" stroke-width="1"/><path d="M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z" fill="#0f3d2e"/><path d="M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4" fill="none" stroke="#7fd1a3" stroke-width="2.2" stroke-linecap="round"/></svg>' | |
| 7 | + FAV = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='9' fill='%230f3d2e'/%3E%3Ccircle cx='16' cy='14.5' r='8.5' fill='%23e0a526'/%3E%3Ccircle cx='16' cy='14.5' r='6.6' fill='none' stroke='%230f3d2e' stroke-opacity='.35' stroke-width='1'/%3E%3Cpath d='M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z' fill='%230f3d2e'/%3E%3Cpath d='M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4' fill='none' stroke='%237fd1a3' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E" | |
| 8 | + NAV = [("/how-it-works/", "How it works"), ("/fair-pay/", "Fair pay"), ("/learn/", "Bitcoin basics"), ("/rate/", "Rate a visit"), ("/app/", "Team app"), ("/open/", "Open code")] | |
| 9 | + | |
| 10 | + def head(path, title, desc, extra=""): | |
| 11 | + nav = "".join(f'<a href="{h}"{" aria-current=page" if h == path else ""}>{t}</a>' for h, t in NAV) | |
| 12 | + return f'''<!doctype html> | |
| 13 | + <html lang="en"> | |
| 14 | + <head> | |
| 15 | + <meta charset="utf-8"> | |
| 16 | + <meta name="viewport" content="width=device-width,initial-scale=1"> | |
| 17 | + <title>{html.escape(title)}</title> | |
| 18 | + <meta name="description" content="{html.escape(desc)}"> | |
| 19 | + <link rel="canonical" href="{D}{path}"> | |
| 20 | + <meta property="og:type" content="website"><meta property="og:site_name" content="Paywell"> | |
| 21 | + <meta property="og:title" content="{html.escape(title)}"><meta property="og:description" content="{html.escape(desc)}"> | |
| 22 | + <meta property="og:url" content="{D}{path}"><meta property="og:image" content="{D}/img/og.jpg"> | |
| 23 | + <meta name="twitter:card" content="summary_large_image"> | |
| 24 | + <meta name="theme-color" content="#0f3d2e"> | |
| 25 | + <link rel="icon" href="{FAV}"> | |
| 26 | + <link rel="manifest" href="/app/manifest.webmanifest"> | |
| 27 | + <link rel="stylesheet" href="/assets/site.css"> | |
| 28 | + {extra}</head> | |
| 29 | + <body> | |
| 30 | + <a class="skip" href="#main">Skip to content</a> | |
| 31 | + <div class="wrap"> | |
| 32 | + <header class="top"><a class="brand" href="/">{LOGO}Paywell</a><nav class="main" aria-label="Main">{nav}</nav></header> | |
| 33 | + </div> | |
| 34 | + <main id="main"> | |
| 35 | + ''' | |
| 36 | + | |
| 37 | + FOOT = '''</main> | |
| 38 | + <div class="wrap"><footer class="site">Paywell <span aria-hidden="true">·</span> <a href="/careers/">Careers</a></footer></div> | |
| 39 | + </body> | |
| 40 | + </html> | |
| 41 | + ''' | |
| 42 | + DIAGRAM = open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'bonus_diagram.html'), encoding='utf-8').read().strip() | |
| 43 | + RANKS_HTML = '''<div class="ranks"> | |
| 44 | + <div class="rank"><i>1</i><b>Explorer</b><span>Everyone starts here, learning the work. 1 bonus share.</span></div> | |
| 45 | + <div class="rank"><i>2</i><b>Builder</b><span>Growing: steady high scores and teammates’ backing. 1½ bonus shares.</span></div> | |
| 46 | + <div class="rank"><i>3</i><b>Guide</b><span>On the way to mastery, helping others grow. 2 bonus shares.</span></div> | |
| 47 | + </div>''' | |
| 48 | + | |
| 49 | + def ic(d): return f'<div class="ic"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">{d}</svg></div>' | |
| 50 | + I_SHIELD = '<path d="M12 3l8 3v6c0 5-3.5 8-8 9-4.5-1-8-4-8-9V6z"/><path d="M9 12l2 2 4-4"/>' | |
| 51 | + I_COIN = '<circle cx="12" cy="12" r="9"/><path d="M12 7v10M9.5 9.5h4a1.5 1.5 0 010 3h-3a1.5 1.5 0 000 3h4"/>' | |
| 52 | + I_STAR = '<path d="M12 3l2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9z"/>' | |
| 53 | + I_HEART = '<path d="M20.5 8.5c0 5-8.5 11-8.5 11s-8.5-6-8.5-11A4.5 4.5 0 0112 6a4.5 4.5 0 018.5 2.5z"/>' | |
| 54 | + I_QR = '<rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/><path d="M14 14h3v3M21 14v7h-4M14 18v3"/>' | |
| 55 | + I_SCALE = '<path d="M12 3v18M5 7h14M5 7l-3 7a3.5 3.5 0 006 0zM19 7l-3 7a3.5 3.5 0 006 0z"/>' | |
| 56 | + I_LOCK = '<rect x="4" y="10" width="16" height="11" rx="2"/><path d="M8 10V7a4 4 0 018 0v3"/>' | |
| 57 | + I_BOOK = '<path d="M4 5a2 2 0 012-2h13v16H6a2 2 0 00-2 2z"/><path d="M4 19V5"/>' | |
| 58 | + I_USD = '<path d="M3 12h18M12 3c3 3 3 15 0 18M12 3c-3 3-3 15 0 18"/><circle cx="12" cy="12" r="9"/>' | |
| 59 | + | |
| 60 | + def write(rel, s): | |
| 61 | + p = os.path.join(ROOT, rel); os.makedirs(os.path.dirname(p), exist_ok=True) | |
| 62 | + open(p, "w").write(s) | |
| 63 | + | |
| 64 | + ORG = '''<script type="application/ld+json">{"@context":"https://schema.org","@type":"Organization","name":"Paywell","url":"https://paywell.company","logo":"https://paywell.company/img/og.jpg","description":"Fair pay, daily Bitcoin bonuses shown in dollars, and no-tip customer ratings."}</script> | |
| 65 | + ''' | |
| 66 | + | |
| 67 | + # ---------------- Home ---------------- | |
| 68 | + write("index.html", head("/", "Paywell | Fair pay you can see", "Paywell pays team members a guaranteed wage plus daily Bitcoin bonuses shown in dollars, and lets customers thank great service with a rating instead of a tip.", ORG) + f'''<div class="wrap"> | |
| 69 | + <section class="hero"> | |
| 70 | + <div> | |
| 71 | + <p class="status">Open now in test mode. Test coins only, no real money moves.</p> | |
| 72 | + <h1>Fair pay you can see.</h1> | |
| 73 | + <p class="lede">A guaranteed wage, a daily Bitcoin bonus shown in plain dollars, and a simple way for customers to say thank you without spending a cent. No tip jars. No tip screens.</p> | |
| 74 | + <div class="btns"><a class="btn" href="/app/">Start a test team</a><a class="btn o" href="/how-it-works/">How it works</a></div> | |
| 75 | + </div> | |
| 76 | + <div class="art"><img src="/img/hero.webp" width="1536" height="1024" alt="A dog groomer in a bright salon smiling at her phone during a short break"></div> | |
| 77 | + </section> | |
| 78 | + </div> | |
| 79 | + | |
| 80 | + <section class="sec"><div class="wrap"> | |
| 81 | + <p class="eyebrow">How Paywell works</p> | |
| 82 | + <h2>Do great work, earn more Bitcoin.</h2> | |
| 83 | + <p class="sub">Your wage is always guaranteed. On top of it, a daily Bitcoin bonus grows with what customers and teammates say about your work, and with your tier. There are only three tiers.</p> | |
| 84 | + {DIAGRAM} | |
| 85 | + {RANKS_HTML} | |
| 86 | + <p style="margin-top:22px"><a class="btn o" href="/how-it-works/">See the full rules</a></p> | |
| 87 | + </div></section> | |
| 88 | + | |
| 89 | + <section class="sec"><div class="wrap split"> | |
| 90 | + <div class="photo"><img src="/img/rate.webp" width="1536" height="1024" alt="A customer holding a phone above a receipt with a small printed code on a shop counter" loading="lazy"></div> | |
| 91 | + <div> | |
| 92 | + <p class="eyebrow">For customers</p> | |
| 93 | + <h2>Say thanks in ten seconds.</h2> | |
| 94 | + <p class="sub">Scan the code on your receipt or tap the link in your text or email. Pick a rating. That’s it. No app, no account, no tip.</p> | |
| 95 | + <ol class="steps"> | |
| 96 | + <li><b>Open your link</b><span>Each visit gets its own one-time link.</span></li> | |
| 97 | + <li><b>Tap a rating</b><span>Big, simple buttons. Add a note if you like.</span></li> | |
| 98 | + <li><b>Done</b><span>Great ratings raise that person’s daily bonus. The company pays it, not you.</span></li> | |
| 99 | + </ol> | |
| 100 | + <p style="margin-top:22px"><a class="btn o" href="/rate/">Rate a visit</a></p> | |
| 101 | + </div> | |
| 102 | + </div></section> | |
| 103 | + | |
| 104 | + <section class="sec"><div class="wrap split"> | |
| 105 | + <div> | |
| 106 | + <p class="eyebrow">Daily check-in</p> | |
| 107 | + <h2>Thirty seconds at the end of each shift.</h2> | |
| 108 | + <p class="sub">Before you head home, rate each teammate you worked with today: one to five stars and a kind, honest note if you like. It takes less than a minute, and it is how good teamwork gets noticed.</p> | |
| 109 | + <ol class="steps"> | |
| 110 | + <li><b>Only people you worked with</b><span>One check-in per teammate per day. You can’t rate yourself.</span></li> | |
| 111 | + <li><b>Private to your company</b><span>Check-ins stay inside your own team. Nobody outside it ever sees them, and teammates see the stars and notes, not who wrote them.</span></li> | |
| 112 | + <li><b>Skipping is fine</b><span>A missing check-in is never counted as a yes or a no. It simply doesn’t count.</span></li> | |
| 113 | + </ol> | |
| 114 | + </div> | |
| 115 | + <div class="photo"><img src="/img/checkin.webp" width="1536" height="1024" alt="Two coworkers at a café counter after closing, one tapping stars on a phone while the other smiles" loading="lazy"></div> | |
| 116 | + </div></section> | |
| 117 | + | |
| 118 | + <section class="sec"><div class="wrap"> | |
| 119 | + <p class="eyebrow">Our promises</p> | |
| 120 | + <h2>What a rating can never do.</h2> | |
| 121 | + <p class="sub">Ratings are a way to reward great work. They are not a way to take pay away.</p> | |
| 122 | + <div class="never"> | |
| 123 | + <div>Lower your hourly wage</div><div>Move your payday</div><div>Take back pay you’ve earned</div><div>Touch your wallet balance</div><div>Claw back a bonus already paid</div> | |
| 124 | + </div> | |
| 125 | + <p class="sub">A low rating only counts after it is checked, and you can always dispute it. If the facts are unclear, the team member gets the benefit of the doubt. <a href="/how-it-works/#safeguards">Read the safeguards</a>.</p> | |
| 126 | + </div></section> | |
| 127 | + | |
| 128 | + <section class="sec"><div class="wrap split"> | |
| 129 | + <div> | |
| 130 | + <p class="eyebrow">The team app</p> | |
| 131 | + <h2>Dollars first. Always.</h2> | |
| 132 | + <p class="sub">Your bonus is held in Bitcoin, but the app shows what it’s worth in U.S. dollars, right now. Bitcoin amounts and rates are one tap away when you want them. The point is to show what your money can buy, not to get you trading.</p> | |
| 133 | + <div class="cards" style="grid-template-columns:1fr 1fr"> | |
| 134 | + <div class="card"><h3>See every paycheck</h3><p>Wage, score, tier and Bitcoin bonus, day by day.</p></div> | |
| 135 | + <div class="card"><h3>Your wallet, your keys</h3><p>We make a wallet that only you can open, or you use your own. Hold it, send it, or turn it into dollars through a licensed provider.</p></div> | |
| 136 | + <div class="card"><h3>Your ratings</h3><p>See each rating and dispute any you think is wrong.</p></div> | |
| 137 | + <div class="card"><h3>Learn as you go</h3><p>Short lessons on fees, price swings, taxes and keeping it safe.</p></div> | |
| 138 | + <div class="card"><h3>Team chat</h3><p>Channels for your crew, shout-outs, GIFs and shift swaps. Friendly, not corporate.</p></div> | |
| 139 | + <div class="card"><h3>Take payment</h3><p>Show a code or tap phones. The customer pays, then rates the visit. No kiosks, no tip screens.</p></div> | |
| 140 | + <div class="card"><h3>Daily check-in</h3><p>Rate the teammates you worked with today, in under a minute.</p></div> | |
| 141 | + <div class="card"><h3>Passkey sign-in</h3><p>Your face or fingerprint is your login. No usernames, no passwords.</p></div> | |
| 142 | + </div> | |
| 143 | + <p style="margin-top:22px"><a class="btn" href="/app/">Open the team app</a></p> | |
| 144 | + </div> | |
| 145 | + <div class="photo"><img src="/img/payday.webp" width="1536" height="1024" alt="A plumber sitting on the tailgate of a work truck at sunset, smiling at his phone" loading="lazy"></div> | |
| 146 | + </div></section> | |
| 147 | + | |
| 148 | + <section class="sec"><div class="wrap split"> | |
| 149 | + <div class="photo"><img src="/img/crew.webp" width="1536" height="1024" alt="A home-repair crew of four having a cheerful morning huddle beside a service van" loading="lazy"></div> | |
| 150 | + <div> | |
| 151 | + <p class="eyebrow">Fair pay. No tipping.</p> | |
| 152 | + <h2>One policy, every company.</h2> | |
| 153 | + <p class="sub">Every company that pays through Paywell follows the same promise: part-time roles paid by the hour, as much or as little as each person wants up to 39 hours a week, days off whenever they want, a guaranteed wage, daily performance bonuses, paid out automatically funded by the company, and no tips asked for or accepted. Customers never see a tip prompt.</p> | |
| 154 | + <p><a class="btn o" href="/fair-pay/">Read the fair pay policy</a></p> | |
| 155 | + </div> | |
| 156 | + </div></section> | |
| 157 | + | |
| 158 | + <section class="sec"><div class="wrap"> | |
| 159 | + <div class="callout"><b>Where things stand.</b> The team app works today in test mode: start a team, invite teammates, check in, send rating links, take test payments and chat. It uses Bitcoin’s test network, so the coins have no value. Real wages and bonuses will go through a licensed payroll provider, and no real money moves through Paywell until every legal and tax check is done. Everything we build is open for anyone to copy: <a href="/open/">see the code</a>.</div> | |
| 160 | + </div></section> | |
| 161 | + ''' + FOOT) | |
| 162 | + | |
| 163 | + # ---------------- How it works ---------------- | |
| 164 | + write("how-it-works/index.html", head("/how-it-works/", "How Paywell works | Wages, bonuses and ratings", "How Paywell pays a guaranteed wage plus a daily Bitcoin bonus based on customer reviews, peer reviews and one of three tiers, and how reviews are checked, disputed and protected from fraud.") + f'''<div class="wrap"> | |
| 165 | + <section class="hero" style="padding-bottom:40px"> | |
| 166 | + <div> | |
| 167 | + <p class="eyebrow">How it works</p> | |
| 168 | + <h1 class="sm">Simple rules, written down.</h1> | |
| 169 | + <p class="lede">Here is exactly how pay, bonuses and ratings fit together, and how we keep the system fair for team members and customers.</p> | |
| 170 | + </div> | |
| 171 | + <div class="art"><img src="/img/crew.webp" width="1536" height="1024" alt="A home-repair crew having a morning huddle beside a service van"></div> | |
| 172 | + </section> | |
| 173 | + </div> | |
| 174 | + | |
| 175 | + <section class="sec"><div class="wrap prose"> | |
| 176 | + <h2 id="pay">1. Your pay</h2> | |
| 177 | + <p>Your pay has two parts. The wage is fixed. The Bitcoin bonus grows with your reviews and your tier.</p> | |
| 178 | + ''' + DIAGRAM + ''' | |
| 179 | + <table class="t"> | |
| 180 | + <tr><th>Part</th><th>How it’s paid</th><th>Can reviews change it?</th></tr> | |
| 181 | + <tr><td><b>Guaranteed wage</b></td><td>Hourly, in U.S. dollars, through regular payroll with normal tax withholding. At or above the legal minimum wage where you work, plus overtime as the law requires. Paid on the same payday every time.</td><td>Never. Base pay and payday never depend on ratings.</td></tr> | |
| 182 | + <tr><td><b>Daily Bitcoin bonus</b></td><td>Your score × your tier’s bonus shares × the value of one share, set by your company and shown to the team. Paid automatically every day in Bitcoin to your wallet, shown in dollars.</td><td>Only today’s bonus, before it’s paid. It never goes below zero.</td></tr> | |
| 183 | + </table> | |
| 184 | + <p>Bonuses are wages too. They show on your pay stub at their dollar value on the day they’re paid, and taxes are withheld and reported the same way as the rest of your pay. If you work overtime, these bonuses are counted in your regular rate, so your overtime pay goes up with them, as federal law requires.</p> | |
| 185 | + | |
| 186 | + <h2 id="score">2. Your score: customers and teammates</h2> | |
| 187 | + <p>Your score runs from 0 to 100 and uses recent reviews and updates every day, so one bad day can’t sink it.</p> | |
| 188 | + <table class="t"> | |
| 189 | + <tr><th>Part of your score</th><th>Where it comes from</th><th>Weight</th></tr> | |
| 190 | + <tr><td><b>Customer reviews</b></td><td>After each visit, the customer can give 1 to 5 stars through a one-time link. No app, no account, no tip.</td><td>60%</td></tr> | |
| 191 | + <tr><td><b>Peer reviews</b></td><td>The daily check-in: at the end of each shift, teammates who worked with you give 1 to 5 stars on teamwork, care and reliability, with an optional note.</td><td>40%</td></tr> | |
| 192 | + </table> | |
| 193 | + <p>Five stars counts as 100 and one star counts as 0. Customer reviews of 1 or 2 stars count only after they’re checked. No new reviews? Your score stays where it was. A missing check-in is never counted as a yes or a no.</p> | |
| 194 | + <ul> | |
| 195 | + <li><b>Peer reviews are private.</b> You see the stars and notes, not who wrote them. Managers can’t see who wrote what either, and nobody outside your company ever sees them.</li> | |
| 196 | + <li><b>One check-in per teammate per day.</b> You can’t review yourself, and trading five-star reviews or ganging up on someone is flagged and removed.</li> | |
| 197 | + </ul> | |
| 198 | + <div class="callout"><b>Example.</b> Maya’s customers gave her 4.8 stars on average (that’s 95) and her teammates 4.6 stars (that’s 90). Her score is 95 × 60% + 90 × 40% = 93. She’s a Builder (tier 2), so her bonus today is 93% of 1½ shares.</div> | |
| 199 | + | |
| 200 | + <h2 id="tiers">3. Three tiers</h2> | |
| 201 | + <p>There are only three tiers. Your tier sets how many bonus shares you get each day.</p> | |
| 202 | + ''' + RANKS_HTML + ''' | |
| 203 | + <ul> | |
| 204 | + <li><b>Moving up</b> is reviewed every three months. It looks at your score over that time and at what your teammates say.</li> | |
| 205 | + <li><b>Moving down</b> only happens after a full three months of low scores, with written notice first and the right to dispute it.</li> | |
| 206 | + <li>Your tier never lowers your wage.</li> | |
| 207 | + </ul> | |
| 208 | + | |
| 209 | + <h2 id="safeguards">4. Safeguards for team members</h2> | |
| 210 | + <div class="never"> | |
| 211 | + <div>No cut to hourly wages</div><div>No cut to earned pay</div><div>No cut to wallet balances</div><div>No clawback of paid bonuses</div> | |
| 212 | + </div> | |
| 213 | + <ul> | |
| 214 | + <li><b>Low ratings are checked first.</b> A 1 or 2 star rating is held for review before it counts. The reviewer looks at the visit record and any note from the customer.</li> | |
| 215 | + <li><b>You see every rating.</b> Each one shows in your app with the date, the visit and any comment. Customer contact details stay private.</li> | |
| 216 | + <li><b>Things outside your control don’t count against you.</b> Prices, wait times caused by scheduling, weather and company policies are filtered out.</li> | |
| 217 | + <li><b>Ratings only follow the law.</b> Where local law limits how bonuses can change, the stricter rule wins, and a low rating simply won’t lower anything.</li> | |
| 218 | + </ul> | |
| 219 | + | |
| 220 | + <h2 id="disputes">5. Disputing a review</h2> | |
| 221 | + <div class="split top" style="gap:28px"> | |
| 222 | + <ol class="steps"> | |
| 223 | + <li><b>Tap “Dispute”</b><span>Any rating in your app, within 14 days. Say what happened in your own words.</span></li> | |
| 224 | + <li><b>The rating is paused</b><span>A disputed rating has no effect on your bonus while it’s reviewed.</span></li> | |
| 225 | + <li><b>Someone fair reviews it</b><span>A trained reviewer outside your own team, never your direct manager.</span></li> | |
| 226 | + <li><b>Decision in 5 business days</b><span>You get the reason in writing. If it’s unclear, you win.</span></li> | |
| 227 | + </ol> | |
| 228 | + <div class="photo"><img src="/img/dispute.webp" width="1536" height="1024" alt="Two coworkers talking calmly at a break room table" loading="lazy"></div> | |
| 229 | + </div> | |
| 230 | + <p>Disputes never count against you, and nobody can be punished for raising one. You can also ask for a second review by a different person.</p> | |
| 231 | + | |
| 232 | + <h2 id="fraud">6. Keeping reviews honest</h2> | |
| 233 | + <div class="photo" style="margin:14px 0 18px"><img src="/img/takepay.webp" width="1536" height="1024" alt="A florist showing a code on her phone to a customer who scans it with his own phone" loading="lazy"></div> | |
| 234 | + <ul> | |
| 235 | + <li><b>One visit, one link.</b> Each rating link is signed, tied to one real completed visit, works once, and expires after 14 days.</li> | |
| 236 | + <li><b>Links go to the customer.</b> Links are printed on the receipt, sent to the contact the customer gave, or shown to them once as a code at the end of the visit. A team member can’t rate their own visit, and a link can’t be used twice.</li> | |
| 237 | + <li><b>Unusual patterns are flagged.</b> Bursts of ratings, many ratings from one device, or ratings from people connected to the team member are set aside for review.</li> | |
| 238 | + <li><b>Nobody can edit a rating.</b> Not managers, not team members. Every change, review and decision is logged.</li> | |
| 239 | + <li><b>No personal tracking.</b> We don’t use ad trackers. Rating pages keep only what’s needed to check the rating.</li> | |
| 240 | + </ul> | |
| 241 | + | |
| 242 | + <h2 id="wallet">7. Your wallet, your choice</h2> | |
| 243 | + <div class="photo" style="margin:14px 0 18px"><img src="/img/keys.webp" width="1536" height="1024" alt="A person unlocking a phone with their face at a bus stop in the morning" loading="lazy"></div> | |
| 244 | + <p>When you sign up, you choose where your Bitcoin goes: <b>we create a wallet for you</b> with your account (your passkey locks its backup, nothing to write down), or <b>you paste the address of a wallet you already have</b> and bonuses go straight there. You can switch any time.</p> | |
| 245 | + <p>Bonuses paid to your Paywell wallet land in the app. You can keep them there, send them to another wallet you control, spend them where Bitcoin is accepted, or turn them into dollars through a licensed provider. It works the other way too: if you’d like, you can choose to turn some of your own dollars into Bitcoin after payday, through a licensed provider, always your choice and never required. <a href="/learn/">Learn the basics</a> before you move anything.</p> | |
| 246 | + <p><b>Your keys, not ours.</b> A wallet we make for you is opened only by your passkey. We keep a locked backup we cannot open, so we can never move your coins, and neither can anyone who breaks into our servers.</p> | |
| 247 | + </div></section> | |
| 248 | + ''' + FOOT) | |
| 249 | + | |
| 250 | + # ---------------- Fair pay ---------------- | |
| 251 | + write("fair-pay/index.html", head("/fair-pay/", "Fair pay. No tipping. | Paywell", "The fair pay policy every Paywell company follows: part-time roles, a guaranteed wage, daily company-funded Bitcoin bonuses, paid out automatically, and no tips.") + f'''<div class="wrap"> | |
| 252 | + <section class="hero" style="padding-bottom:40px"> | |
| 253 | + <div> | |
| 254 | + <p class="eyebrow">Our employment policy</p> | |
| 255 | + <h1 class="sm">Fair pay. No tipping.</h1> | |
| 256 | + <p class="lede">The same promise at every company that pays through Paywell. Good work is rewarded by the company, never by asking customers for more.</p> | |
| 257 | + </div> | |
| 258 | + <div class="art"><img src="/img/payday.webp" width="1536" height="1024" alt="A plumber smiling at his phone on the tailgate of his truck"></div> | |
| 259 | + </section> | |
| 260 | + </div> | |
| 261 | + <section class="sec"><div class="wrap prose"> | |
| 262 | + <h2>The policy</h2> | |
| 263 | + <div class="never yes"> | |
| 264 | + <div>Part-time, paid hourly</div><div>Work as much or as little as you want</div><div>Days off whenever you want</div><div>A guaranteed wage</div><div>Daily Bitcoin bonuses</div><div>Rewards paid by the company</div><div>Thanks through ratings</div> | |
| 265 | + </div> | |
| 266 | + <ol class="steps"> | |
| 267 | + <li><b>Part-time roles.</b><span>Every role is part-time and paid by the hour. Team members work as much or as little as they want, up to 39 hours a week, and take days off whenever they want.</span></li> | |
| 268 | + <li><b>A guaranteed wage.</b><span>Every team member gets a steady hourly wage that meets or beats every wage law where they work, paid through normal payroll.</span></li> | |
| 269 | + <li><b>Daily Bitcoin bonuses.</b><span>On top of that wage, team members get a bonus every day, paid out automatically, shown in dollars and paid in Bitcoin. It grows with customer reviews, peer reviews and tier (there are three).</span></li> | |
| 270 | + <li><b>No tips.</b><span>Team members don’t ask for or accept tips. Customers never see a tip jar, tip line or tip screen.</span></li> | |
| 271 | + <li><b>Thanks without spending.</b><span>Customers who loved the service can leave a rating. Great ratings raise that person’s bonus.</span></li> | |
| 272 | + <li><b>The company pays the reward.</b><span>Every bonus comes from the company. Customers never pay extra for good service.</span></li> | |
| 273 | + <li><b>Holistic health care.</b><span>Team members get their health care through the holistic clinics we work with. Care outside those clinics is not covered.</span></li> | |
| 274 | + </ol> | |
| 275 | + <h2>What it means for customers</h2> | |
| 276 | + <p>The price you see is the whole price. Nobody will hand you a screen asking for 20%. If someone did a great job, a quick rating is the best way to thank them, and it costs you nothing.</p> | |
| 277 | + <h2>What it means for team members</h2> | |
| 278 | + <p>You know what you’ll earn before the week starts. Great days earn more. Hard days never take away what you’re owed. You can always dispute a rating, and you can always see how your bonus was worked out. <a href="/how-it-works/">See the full rules</a>.</p> | |
| 279 | + <h2>Bonuses and taxes</h2> | |
| 280 | + <p>Bonuses are part of your pay. They are reported at their dollar value when paid, and taxes are withheld the same way as your wage, so there are no surprises at tax time.</p> | |
| 281 | + <h2>New to Bitcoin?</h2> | |
| 282 | + <p>Read <a href="/learn/">Bitcoin basics</a>: what it is, how to keep it safe, how to turn it into dollars, and what fees, price swings and taxes mean for you.</p> | |
| 283 | + </div></section> | |
| 284 | + ''' + FOOT) | |
| 285 | + | |
| 286 | + # ---------------- Learn ---------------- | |
| 287 | + lessons = [ | |
| 288 | + ("hold", "Hold Bitcoin without a bank", "Bitcoin lives in a wallet, not a bank account. Your Paywell wallet works on your phone. You don’t need a bank account to receive your bonus or to keep it.", | |
| 289 | + "<p>A wallet holds the keys that prove the Bitcoin is yours. Think of it like the key to a safe: whoever has the key can open it. That’s why your Paywell wallet keeps a locked backup, opened only by your passkey.</p>"), | |
| 290 | + ("send", "Send it to another wallet", "You can move your Bitcoin to any other wallet you control, like a hardware wallet or another app.", | |
| 291 | + "<p>Every wallet has an address, a long string of letters and numbers or a QR code. Always copy and paste or scan it, never type it by hand, and send a small test amount first. Bitcoin sent to the wrong address can’t be pulled back.</p><p>Sending uses a network fee. The app shows the fee in dollars before you confirm.</p>"), | |
| 292 | + ("spend", "Spend it where it’s accepted", "Some shops, websites and services take Bitcoin directly. You scan their code and confirm the amount in dollars.", | |
| 293 | + "<p>Most places still want dollars, so spending usually means converting first. Spending Bitcoin can count as selling it for tax purposes, so the app keeps a record for you.</p>"), | |
| 294 | + ("convert", "Turn it into dollars", "Supported providers can convert your Bitcoin into U.S. dollars and send them to a bank account or debit card.", | |
| 295 | + "<p>The app will show the provider’s rate and fee in dollars before you agree, so you know exactly how many dollars you’ll get. Providers are licensed and may ask you to verify your identity the first time.</p>"), | |
| 296 | + ] | |
| 297 | + L = "".join(f'<div class="card" id="{i}"><h3>{t}</h3><p>{p}</p></div>' for i, t, p, _ in lessons) | |
| 298 | + LD = "".join(f'<h3>{t}</h3>{d}' for i, t, p, d in lessons) | |
| 299 | + write("learn/index.html", head("/learn/", "Bitcoin basics | Paywell", "Plain-English Bitcoin basics for team members: holding, sending, spending and converting Bitcoin, plus fees, price swings, taxes, wallet security and passkey-locked backups.") + f'''<div class="wrap"> | |
| 300 | + <section class="hero" style="padding-bottom:40px"> | |
| 301 | + <div> | |
| 302 | + <p class="eyebrow">Bitcoin basics</p> | |
| 303 | + <h1 class="sm">What your bonus is, and what you can do with it.</h1> | |
| 304 | + <p class="lede">Plain English, no hype. Your bonus is paid in Bitcoin and always shown in dollars. Here’s what that means for you.</p> | |
| 305 | + </div> | |
| 306 | + <div class="art"><img src="/img/learn.webp" width="1536" height="1024" alt="A young woman at a kitchen table carefully writing on a small paper card"></div> | |
| 307 | + </section> | |
| 308 | + </div> | |
| 309 | + <section class="sec"><div class="wrap"> | |
| 310 | + <h2>Four things you can do</h2> | |
| 311 | + <p class="sub">It’s your money. You choose what happens to it.</p> | |
| 312 | + <div class="cards">{L}</div> | |
| 313 | + </div></section> | |
| 314 | + <section class="sec"><div class="wrap prose"> | |
| 315 | + {LD} | |
| 316 | + <h2 id="fees">Fees</h2> | |
| 317 | + <p>Moving Bitcoin isn’t free. Sending it pays a network fee that changes with how busy the network is. Converting it to dollars usually has a provider fee or a spread. Paywell always shows the full cost in dollars before you confirm. Paying your bonus into your wallet costs you nothing.</p> | |
| 318 | + <h2 id="volatility">Price swings</h2> | |
| 319 | + <p>Bitcoin’s price in dollars moves up and down, sometimes a lot in a single day. A bonus worth $100 today could be worth more or less next week. That’s why the app shows today’s dollar value first. If you need that money for rent or bills, you can turn it into dollars soon after it arrives. Holding Bitcoin is your choice, not a requirement, and we’ll never push you to trade.</p> | |
| 320 | + <div class="callout warn"><b>Good rule of thumb:</b> don’t hold more in Bitcoin than you could handle seeing drop by half. Keep money for bills in dollars.</div> | |
| 321 | + <h2 id="taxes">Taxes</h2> | |
| 322 | + <ul> | |
| 323 | + <li><b>When you get it:</b> your bonus is taxable pay at its dollar value on the day it’s paid. It shows on your pay stub and your year-end tax form, and taxes are withheld for you.</li> | |
| 324 | + <li><b>When you sell, spend or convert it:</b> if the price went up since you got it, the gain may be taxable. If it went down, you may have a loss.</li> | |
| 325 | + <li><b>Records:</b> the app keeps the date and dollar value of everything that comes in and goes out, so you or your tax preparer have what you need.</li> | |
| 326 | + </ul> | |
| 327 | + <p class="small">This is general information, not tax advice. Rules differ by state and change over time.</p> | |
| 328 | + <h2 id="security">Keeping your wallet safe</h2> | |
| 329 | + <div class="split top" style="gap:28px"> | |
| 330 | + <ul> | |
| 331 | + <li>Lock the app with your phone’s face, fingerprint or passcode.</li> | |
| 332 | + <li>Sign in with your passkey (your face or fingerprint). There’s no password to steal.</li> | |
| 333 | + <li>Never share a passkey setup link or any recovery words with anyone, including anyone who says they work for us. We will never ask.</li> | |
| 334 | + <li>Watch out for messages that rush you or promise to double your money. Those are scams.</li> | |
| 335 | + <li>Check addresses carefully, and send a small test first.</li> | |
| 336 | + </ul> | |
| 337 | + <div class="photo"><img src="/img/secure.webp" width="1536" height="1024" alt="A small fireproof box on a shelf holding a folded paper card and a steel plate" loading="lazy"></div> | |
| 338 | + </div> | |
| 339 | + <h2 id="recovery">Your backup, locked by your passkey</h2> | |
| 340 | + <p>Every wallet has secret keys. Most apps make you write down 12 or 24 recovery words and keep them safe forever. With Paywell you don’t have to.</p> | |
| 341 | + <ul> | |
| 342 | + <li>When you create your wallet, your phone locks a backup of its keys with your passkey (your face or fingerprint) and stores the locked backup with us.</li> | |
| 343 | + <li>Only your passkey can open it. We keep a locked box we can’t open, so nobody here can see or move your Bitcoin.</li> | |
| 344 | + <li>Your passkey syncs through your phone’s password manager. On a new phone, sign in with it and your wallet comes back.</li> | |
| 345 | + <li>Keep your phone’s password manager account safe, and add a second device you trust, so you never lose your passkey.</li> | |
| 346 | + </ul> | |
| 347 | + <p>Moving from another wallet app? Enter its recovery words once, and from then on your passkey keeps the backup.</p> | |
| 348 | + <h2>Questions?</h2> | |
| 349 | + <p>The team app has short lessons on each of these, and you can ask your own AI assistant to explain anything here in more detail.</p> | |
| 350 | + </div></section> | |
| 351 | + ''' + FOOT) | |
| 352 | + | |
| 353 | + # ---------------- Privacy ---------------- | |
| 354 | + write("privacy/index.html", head("/privacy/", "Privacy | Paywell", "How Paywell handles information on this site, the rating pages and the team app.") + '''<div class="wrap"><section class="prose" style="padding:24px 0 60px"> | |
| 355 | + <h1 class="sm">Privacy</h1> | |
| 356 | + <p>We keep this short because we keep very little.</p> | |
| 357 | + <h2>This website</h2> | |
| 358 | + <p>No ad trackers, no analytics scripts and no cookies for tracking. We count page views as a single number per page, with no cookies and no personal details. The site is hosted on Cloudflare, which keeps standard server logs for security.</p> | |
| 359 | + <h2>Rating pages</h2> | |
| 360 | + <p>When you rate a visit we keep the rating, any note you write, the visit it belongs to, and the time. We use basic signals such as how many ratings come from one network to stop fraud, and we don’t sell or share them. Team members see your rating and note, never your contact details.</p> | |
| 361 | + <h2>Team app</h2> | |
| 362 | + <p>Team chat messages are visible to your company’s team and kept until they’re deleted. Sign-in uses passkeys, so we never hold a password; your face or fingerprint never leaves your device.</p> | |
| 363 | + <p>For team members we keep what’s needed to pay you correctly and follow the law: pay records, bonus records, ratings, disputes, wallet activity and tax records. Payroll and money conversion are handled by licensed partners who follow their own privacy rules. Your wallet backup is locked on your phone with your passkey before it reaches us. We store it but can’t open it, and only you can get it back.</p> | |
| 364 | + <h2>Careers requests</h2> | |
| 365 | + <p>If you send a request on our Careers page, we keep your message so we can reply.</p> | |
| 366 | + <h2>Your choices</h2> | |
| 367 | + <p>You can ask us to show you, correct or delete what we hold about you, except records the law requires us to keep, such as pay and tax records.</p> | |
| 368 | + </section></div> | |
| 369 | + ''' + FOOT) | |
| 370 | + | |
| 371 | + # ---------------- Careers ---------------- | |
| 372 | + write("careers/index.html", head("/careers/", "Careers | Paywell", "Careers at Paywell. Send us a short request to work with us.", '<link rel="stylesheet" href="/careers/careers.css">\n') + '''<div class="cr"> | |
| 373 | + <h1>Careers</h1> | |
| 374 | + <p>We’re always glad to hear from people who want to build with us. Tell us what kind of work you’d like to do and how we can reach you.</p> | |
| 375 | + <p class="cr-bonus">All our roles are part-time and paid by the hour. Work as much or as little as you want, up to 39 hours a week, and take days off whenever you want. Team members get a Bitcoin bonus every day, paid out automatically, that grows with performance, and get their health care through the holistic clinics we work with. Care outside those clinics is not covered.</p> | |
| 376 | + <form id="cr-form" novalidate> | |
| 377 | + <label for="cr-request">Your request</label> | |
| 378 | + <textarea id="cr-request" name="request" required maxlength="4000" placeholder="What work would you like to do with us? Add an email or phone number so we can reply."></textarea> | |
| 379 | + <div class="cr-hp" aria-hidden="true"><label>Leave this empty <input name="website" tabindex="-1" autocomplete="off"></label></div> | |
| 380 | + <button type="submit">Send request</button> | |
| 381 | + <p id="cr-msg" class="cr-msg" role="status" aria-live="polite"></p> | |
| 382 | + </form> | |
| 383 | + </div> | |
| 384 | + <script src="/careers/careers.js" defer></script> | |
| 385 | + ''' + FOOT) | |
| 386 | + | |
| 387 | + # ---------------- 404 ---------------- | |
| 388 | + write("404.html", head("/404", "Page not found | Paywell", "This page doesn’t exist.") + '''<div class="wrap"><section style="padding:60px 0 90px"><h1 class="sm">We couldn’t find that page.</h1><p class="lede">If you were trying to rate a visit, check the link on your receipt, text or email, or enter your code.</p><div class="btns"><a class="btn" href="/rate/">Rate a visit</a><a class="btn o" href="/">Home</a></div></section></div> | |
| 389 | + ''' + FOOT) | |
| 390 | + | |
| 391 | + # ---------------- Rate ---------------- | |
| 392 | + write("rate/index.html", head("/rate/", "Rate your visit | Paywell", "Rate a visit in seconds. No app, no account, no tip. Great ratings raise the team member’s bonus, paid by the company.", '<meta name="robots" content="noindex">\n<link rel="stylesheet" href="/assets/rate.css">\n') + """<div class="wrap rate"> | |
| 393 | + <section id="r-start"> | |
| 394 | + <p class="eyebrow">Rate your visit</p> | |
| 395 | + <h1 class="sm">Say thanks in ten seconds.</h1> | |
| 396 | + <p class="lede">No app, no account and no tip. Your rating is the thank-you.</p> | |
| 397 | + <div id="r-loading" class="callout" hidden>Checking your link…</div> | |
| 398 | + <div id="r-err" class="callout warn" role="alert" hidden></div> | |
| 399 | + <form id="r-code" class="r-codeform"> | |
| 400 | + <label for="r-code-in">Enter the code from your receipt</label> | |
| 401 | + <div class="r-row"><input id="r-code-in" name="code" autocomplete="off" autocapitalize="characters" inputmode="text" placeholder="K7Q2-M9XA" maxlength="40"><button class="btn" type="submit">Continue</button></div> | |
| 402 | + <p class="small">Or scan the QR code on your receipt, or tap the link in your text or email.</p> | |
| 403 | + </form> | |
| 404 | + <p id="r-sample-wrap"><button id="r-sample" class="btn o" type="button">Try a sample visit</button></p> | |
| 405 | + </section> | |
| 406 | + | |
| 407 | + <section id="r-form-wrap" hidden> | |
| 408 | + <p class="r-sample-badge" id="r-test" hidden>Sample visit. Nothing is recorded.</p> | |
| 409 | + <p class="eyebrow" id="r-where"></p> | |
| 410 | + <h1 class="sm" id="r-q">How was your visit?</h1> | |
| 411 | + <form id="r-form"> | |
| 412 | + <fieldset class="stars"><legend class="small">Tap a rating</legend> | |
| 413 | + <div class="r-stars" role="radiogroup"> | |
| 414 | + <label><input type="radio" name="stars" value="5"><span><b>★★★★★</b>Great</span></label> | |
| 415 | + <label><input type="radio" name="stars" value="4"><span><b>★★★★</b>Good</span></label> | |
| 416 | + <label><input type="radio" name="stars" value="3"><span><b>★★★</b>Okay</span></label> | |
| 417 | + <label><input type="radio" name="stars" value="2"><span><b>★★</b>Not good</span></label> | |
| 418 | + <label><input type="radio" name="stars" value="1"><span><b>★</b>Poor</span></label> | |
| 419 | + </div></fieldset> | |
| 420 | + <label for="r-note" class="r-notelabel">Anything you’d like to add? <span class="small">(optional)</span></label> | |
| 421 | + <textarea id="r-note" name="note" maxlength="1000" rows="3" placeholder="What stood out?"></textarea> | |
| 422 | + <div class="r-hp" aria-hidden="true"><label>Leave empty <input name="website" tabindex="-1" autocomplete="off"></label></div> | |
| 423 | + <button class="btn r-send" type="submit">Send rating</button> | |
| 424 | + <p id="r-ferr" class="r-ferr" role="alert"></p> | |
| 425 | + </form> | |
| 426 | + <p class="small">Your rating and note go to the team. Your contact details never do. <a href="/privacy/">Privacy</a></p> | |
| 427 | + </section> | |
| 428 | + | |
| 429 | + <section id="r-done" hidden> | |
| 430 | + <h1 class="sm" id="r-done-h">Thank you!</h1> | |
| 431 | + <p class="lede" id="r-done-p"></p> | |
| 432 | + <div class="callout" id="r-done-test" hidden>This was a sample, so nothing was recorded. When Paywell opens, the link on your receipt, text or email works the same way.</div> | |
| 433 | + <p class="small" style="margin-top:20px">Ratings never lower anyone’s wage, earned pay or savings. <a href="/how-it-works/#safeguards">How ratings work</a></p> | |
| 434 | + </section> | |
| 435 | + | |
| 436 | + <section class="sec r-how"> | |
| 437 | + <div class="cards"> | |
| 438 | + <div class="card"><h3>No tip, ever</h3><p>The price you paid is the whole price. Great service is rewarded by the company.</p></div> | |
| 439 | + <div class="card"><h3>Great ratings help</h3><p>A 4 or 5 star rating raises that person’s daily bonus right away.</p></div> | |
| 440 | + <div class="card"><h3>Low ratings are checked</h3><p>A 1 or 2 star rating is reviewed first, and the team member can respond.</p></div> | |
| 441 | + </div> | |
| 442 | + </section> | |
| 443 | + </div> | |
| 444 | + <script src="/assets/rate.js" defer></script> | |
| 445 | + """ + FOOT) | |
| 446 | + | |
| 447 | + # ---------------- Team app ---------------- | |
| 448 | + write("app/index.html", head("/app/", "Team app | Paywell", "The Paywell team app: start a team, sign in with a passkey, check in on teammates, send rating links, take payment, hold a Bitcoin wallet and chat. Test mode: test coins only.", '<link rel="stylesheet" href="/app/app.css">\n<meta name="apple-mobile-web-app-capable" content="yes">\n') + """<div class="wrap"> | |
| 449 | + <div class="app-intro"> | |
| 450 | + <div><p class="eyebrow">Team app · test mode</p><h1 class="sm">Your pay, in plain dollars.</h1> | |
| 451 | + <p class="lede">Start a test team, add your teammates, and use every part of Paywell: daily check-ins, customer rating links, taking payment, your own Bitcoin wallet and team chat. It all runs here on the web, on any phone or computer. Test mode uses test coins, and no real money moves.</p></div> | |
| 452 | + </div> | |
| 453 | + <div class="app out" id="app"> | |
| 454 | + <nav class="tabs" aria-label="Team app"> | |
| 455 | + <button data-tab="home" aria-current="page">Home</button><button data-tab="checkin">Check-in</button><button data-tab="ratings">Ratings</button><button data-tab="take">Take payment</button><button data-tab="wallet">Wallet</button><button data-tab="chat">Team chat</button><button data-tab="team">Team</button><button data-tab="security">Security</button> | |
| 456 | + </nav> | |
| 457 | + <div class="panel" id="panel" tabindex="-1" aria-live="polite"><p class="small center">Loading…</p></div> | |
| 458 | + </div> | |
| 459 | + <p class="small" style="margin:18px 0 40px">Sign-in is a passkey only: your face, fingerprint or screen lock. No passwords. The wallet runs on Bitcoin’s test network (signet), and its backup is locked by your passkey so we can never open it. All of this code is open: see <a href="/open/">Open code</a>.</p> | |
| 460 | + </div> | |
| 461 | + <script src="/app/wallet.js" defer></script> | |
| 462 | + <script src="/app/app.js" defer></script> | |
| 463 | + """ + FOOT) | |
| 464 | + | |
| 465 | + # ---------------- Open code ---------------- | |
| 466 | + import shutil | |
| 467 | + GH = "https://github.com/projectatomai/hosting-research/blob/main/" | |
| 468 | + SRC = [ | |
| 469 | + ("domain-sites/functions/paywell-app.js", "paywell-app.js", "Team app server: passkey sign-up and sign-in (WebAuthn checked on our server), teams, setup links, daily check-ins, scores, daily bonus math, chat, rating links, and the test-network Bitcoin proxy."), | |
| 470 | + ("domain-sites/functions/paywell-api.js", "paywell-api.js", "Customer rating links (signed, one use, 14 days) and the wallet vault that stores a passkey-locked backup we cannot open."), | |
| 471 | + ("tools/paywell-gen/schema.sql", "schema.sql", "The whole database: teams, people, passkeys, sessions, check-ins, ratings, chat, vault."), | |
| 472 | + ("domain-sites/paywell.company/app/app.js", "app.js", "The team app in the browser: screens, passkeys, wallet lock (PRF + HKDF + AES-GCM), check-ins, payments, chat."), | |
| 473 | + ("tools/paywell-gen/app-src/wallet-src.js", "wallet-src.js", "The wallet: BIP39 words, BIP84 addresses, building and signing payments, QR codes. Built with audited open libraries (@scure)."), | |
| 474 | + ("domain-sites/paywell.company/assets/rate.js", "rate.js", "The customer rating page."), | |
| 475 | + ("tools/paywell-gen/bonus_diagram.html", "bonus_diagram.html", "The daily bonus diagram used on this site and on every brand’s fair pay page."), | |
| 476 | + ("tools/paywell-gen/logo.svg", "logo.svg", "Our logo: a gold coin with a rating star, over a smile."), | |
| 477 | + ("tools/paywell-gen/build.py", "build.py", "Builds every page of this website."), | |
| 478 | + ] | |
| 479 | + REPO = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "..") | |
| 480 | + os.makedirs(os.path.join(ROOT, "open", "src"), exist_ok=True) | |
| 481 | + for rel, name, _ in SRC: | |
| 482 | + shutil.copyfile(os.path.join(REPO, rel), os.path.join(ROOT, "open", "src", name + ".txt")) | |
| 483 | + rows = "".join(f'<tr><td><b>{html.escape(n)}</b></td><td>{html.escape(d)}</td><td><a href="/open/src/{n}.txt">Read it here</a> · <a href="{GH}{r}">Source</a></td></tr>' for r, n, d in SRC) | |
| 484 | + write("open/index.html", head("/open/", "Open code | Paywell", "All of Paywell is open: the team app, the server, the database, the wallet, the rating links, the logo and the pay model. Copy any of it, free, no permission needed.") + f'''<div class="wrap"> | |
| 485 | + <section class="hero"> | |
| 486 | + <div> | |
| 487 | + <p class="eyebrow">Open code</p> | |
| 488 | + <h1>Take it. It’s yours too.</h1> | |
| 489 | + <p class="lede">Every line of Paywell is public and free to copy, change and use, for any reason, with no permission needed. The code, the database, the designs, the logo and the full pay model are all here. We give it away on purpose: fair pay should be easy for every company to start.</p> | |
| 490 | + <div class="btns"><a class="btn" href="https://github.com/projectatomai/hosting-research">See it all on GitHub</a><a class="btn o" href="/research/">Read the research</a></div> | |
| 491 | + </div> | |
| 492 | + <div class="art"><img src="/img/open.webp" width="1536" height="1024" alt="A laptop on a workbench showing code beside a notebook with a hand-drawn diagram of the bonus formula" loading="lazy"></div> | |
| 493 | + </section> | |
| 494 | + </div> | |
| 495 | + | |
| 496 | + <section class="sec"><div class="wrap prose"> | |
| 497 | + <h2>What’s open</h2> | |
| 498 | + <div class="scroll"><table class="t"> | |
| 499 | + <tr><th>File</th><th>What it does</th><th>Get it</th></tr> | |
| 500 | + {rows} | |
| 501 | + </table></div> | |
| 502 | + <p>Everything is dedicated to the public domain (CC0 for words and pictures, the Unlicense for code). You don’t need to credit us.</p> | |
| 503 | + | |
| 504 | + <h2>How it fits together</h2> | |
| 505 | + <ol class="steps"> | |
| 506 | + <li><b>A website, nothing to install</b><span>The site, the team app and the rating pages are plain web pages served from the edge. They work on any phone or computer, and you can add the app to your home screen.</span></li> | |
| 507 | + <li><b>Passkeys only</b><span>Sign-in uses WebAuthn passkeys: your face, fingerprint or screen lock. There are no passwords to steal. Our server checks every passkey signature itself.</span></li> | |
| 508 | + <li><b>A small database</b><span>One SQLite database (Cloudflare D1) holds teams, people, check-ins, ratings and chat. Sessions are stored only as a fingerprint (hash) of the token.</span></li> | |
| 509 | + <li><b>A wallet we can’t open</b><span>The wallet is made in your browser. Its backup words are locked with a key that only your passkey can produce (the WebAuthn PRF extension), then stored with us as a sealed box.</span></li> | |
| 510 | + <li><b>Signed rating links</b><span>Each visit gets a link signed by the server (HMAC-SHA256). It works once, for 14 days, and can’t be faked or reused.</span></li> | |
| 511 | + <li><b>The math is public</b><span>Score = customer reviews 60% + peer check-ins 40%, from 0 to 100. Daily bonus = score × tier shares × the value of one share. Tiers: Explorer 1, Builder 1½, Guide 2.</span></li> | |
| 512 | + </ol> | |
| 513 | + | |
| 514 | + <h2>Run your own copy</h2> | |
| 515 | + <ol> | |
| 516 | + <li>Copy the <code>domain-sites</code> folder and the <code>tools/paywell-gen</code> folder from the repository.</li> | |
| 517 | + <li>Create a D1 database and load <code>schema.sql</code> into it.</li> | |
| 518 | + <li>Deploy to Cloudflare Pages with that database bound as <code>PAYWELL_DB</code>.</li> | |
| 519 | + <li>Change the domain name in <code>paywell-app.js</code> (it’s the passkey website ID), and you have your own Paywell.</li> | |
| 520 | + </ol> | |
| 521 | + <div class="callout"><b>Before real money moves.</b> Test mode uses Bitcoin’s test network. Paying real wages needs a licensed payroll provider, normal tax withholding and reporting, and the money transmitter rules in each state. Our <a href="/research/">research page</a> lists the sources.</div> | |
| 522 | + </div></section> | |
| 523 | + ''' + FOOT) | |
| 524 | + | |
| 525 | + # ---------------- Pay (opened by an NFC tap or QR from a Paywell phone) ---------------- | |
| 526 | + write("pay/index.html", head("/pay/", "Pay | Paywell", "Pay with Bitcoin by tapping phones. Shown in dollars.", '<meta name="robots" content="noindex">\n<link rel="stylesheet" href="/assets/rate.css">\n') + """<div class="wrap rate"> | |
| 527 | + <p class="status">Test mode: test coins only, no real value.</p> | |
| 528 | + <section id="p-none"><h1 class="sm">Pay by tapping phones</h1><p class="lede">Hold your phone to a Paywell phone, or scan its code. This page opens with the payment ready.</p></section> | |
| 529 | + <section id="p-req" hidden> | |
| 530 | + <p class="eyebrow">Payment request</p> | |
| 531 | + <h1 class="sm" id="p-usd"></h1> | |
| 532 | + <p class="lede" id="p-for"></p> | |
| 533 | + <p class="small" id="p-btc"></p> | |
| 534 | + <div class="btns"><a class="btn" id="p-open" href="#">Pay in my Bitcoin wallet</a><button class="btn o" id="p-copy" type="button">Copy address</button></div> | |
| 535 | + <p class="small" style="margin-top:14px">The Paywell app pays with one tap and your face or fingerprint. Any Bitcoin wallet works too.</p> | |
| 536 | + <div id="p-rate" hidden class="callout" style="margin-top:28px"><b>After you pay:</b> how was your visit? No tip. A great rating raises their bonus, and the company pays it.<p style="margin:14px 0 0"><a class="btn" id="p-rate-a" href="#">Rate your visit</a></p></div> | |
| 537 | + </section> | |
| 538 | + </div> | |
| 539 | + <script src="/assets/pay.js" defer></script> | |
| 540 | + """ + FOOT) | |
| 541 | + | |
| 542 | + pages = ["/", "/how-it-works/", "/fair-pay/", "/learn/", "/rate/", "/app/", "/open/", "/research/", "/careers/", "/privacy/"] | |
| 543 | + write("sitemap.xml", '<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n' + "".join(f"<url><loc>{D}{p}</loc></url>\n" for p in pages) + "</urlset>\n") | |
| 544 | + write("robots.txt", "User-agent: *\nAllow: /\nDisallow: /r/\nSitemap: https://paywell.company/sitemap.xml\n") | |
| 545 | + write("llms.txt", """# Paywell | |
| 546 | + > Paywell is an open pay and customer-ratings platform, working today in test mode. Team members get a guaranteed wage through normal payroll, a daily company-funded Bitcoin bonus, paid out automatically always shown in U.S. dollars, that grows with customer reviews (60%), peer reviews (40%) and tier (three tiers). Customers rate visits through a one-time link (receipt QR code, text or email) with no app, no account and no tip. | |
| 547 | + | |
| 548 | + - [How it works](https://paywell.company/how-it-works/): pay parts, score, three tiers, safeguards, disputes, fraud checks | |
| 549 | + - [Fair pay. No tipping.](https://paywell.company/fair-pay/): the employment policy every Paywell company follows | |
| 550 | + - [Bitcoin basics](https://paywell.company/learn/): holding, sending, spending, converting, fees, price swings, taxes, security, passkey-locked wallet backup | |
| 551 | + - [Rate a visit](https://paywell.company/rate/): customer rating page | |
| 552 | + - [Team app](https://paywell.company/app/): working test-mode app: passkeys, teams, daily check-ins, rating links, take payment, test-network wallet, chat | |
| 553 | + - [Open code](https://paywell.company/open/): all source code, database, logo and pay model, public domain | |
| 554 | + - [Research](https://paywell.company/research/): sources and the full operating model | |
| 555 | + | |
| 556 | + Ratings never lower wages, earned pay, wallet balances or paid bonuses. Status: test mode; no real money moves yet. | |
| 557 | + """) | |
| 558 | + print("built", ROOT) |
open/src/logo.svg.txt added
| 1 | + <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><rect width="32" height="32" rx="9" fill="#0f3d2e"/><circle cx="16" cy="14.5" r="8.5" fill="#e0a526"/><circle cx="16" cy="14.5" r="6.6" fill="none" stroke="#0f3d2e" stroke-opacity=".35" stroke-width="1"/><path d="M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z" fill="#0f3d2e"/><path d="M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4" fill="none" stroke="#7fd1a3" stroke-width="2.2" stroke-linecap="round"/></svg> |
open/src/paywell-api.js.txt added
| 1 | + // Paywell customer-rating API (paywell.company/api/rate/*). No accounts, no cookies. | |
| 2 | + // A rating link carries a signed token: base64url(JSON visit) + "." + base64url(HMAC-SHA256 truncated to 12 bytes). | |
| 3 | + // Test mode (default): signs with a public test key, accepts sample links, and records nothing. | |
| 4 | + // Live mode needs PAYWELL_LIVE=1, a secret PAYWELL_LINK_KEY and a D1 binding PAYWELL_DB (see tools/paywell-gen/schema.sql). | |
| 5 | + const TEST_KEY = 'paywell-test-key-not-for-production'; | |
| 6 | + const enc = new TextEncoder(); | |
| 7 | + import { appApi, setSigner } from './paywell-app.js'; | |
| 8 | + const b64u = (bytes) => btoa(String.fromCharCode(...bytes)).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, ''); | |
| 9 | + const unb64u = (s) => Uint8Array.from(atob(s.replace(/-/g, '+').replace(/_/g, '/') + '==='.slice((s.length + 3) % 4)), (c) => c.charCodeAt(0)); | |
| 10 | + const json = (o, status = 200) => new Response(JSON.stringify(o), { status, headers: { 'content-type': 'application/json', 'cache-control': 'no-store', 'x-robots-tag': 'noindex' } }); | |
| 11 | + | |
| 12 | + function live(env) { return env.PAYWELL_LIVE === '1' && env.PAYWELL_LINK_KEY && env.PAYWELL_DB; } | |
| 13 | + async function hmac(env, data) { | |
| 14 | + const key = await crypto.subtle.importKey('raw', enc.encode(live(env) ? env.PAYWELL_LINK_KEY : TEST_KEY), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']); | |
| 15 | + return new Uint8Array(await crypto.subtle.sign('HMAC', key, enc.encode(data))).slice(0, 12); | |
| 16 | + } | |
| 17 | + async function sign(env, visit) { | |
| 18 | + const p = b64u(enc.encode(JSON.stringify(visit))); | |
| 19 | + return p + '.' + b64u(await hmac(env, p)); | |
| 20 | + } | |
| 21 | + async function verify(env, token) { | |
| 22 | + if (typeof token !== 'string' || token.length > 800 || !token.includes('.')) return { error: 'This link doesn’t look right. Check that you copied all of it.' }; | |
| 23 | + const [p, s] = token.split('.'); | |
| 24 | + let good; | |
| 25 | + try { good = await hmac(env, p); } catch { return { error: 'This link doesn’t look right.' }; } | |
| 26 | + let given; | |
| 27 | + try { given = unb64u(s); } catch { return { error: 'This link doesn’t look right.' }; } | |
| 28 | + let diff = given.length ^ good.length; | |
| 29 | + for (let i = 0; i < good.length; i++) diff |= (given[i] | 0) ^ good[i]; | |
| 30 | + if (diff) return { error: 'We couldn’t verify this link. Please use the link from your receipt, text or email.' }; | |
| 31 | + let v; | |
| 32 | + try { v = JSON.parse(new TextDecoder().decode(unb64u(p))); } catch { return { error: 'This link doesn’t look right.' }; } | |
| 33 | + if (!v.v || !v.p) return { error: 'This link doesn’t look right.' }; | |
| 34 | + if (v.x && Date.now() > v.x) return { error: 'This rating link has expired. Links work for 14 days after a visit.', expired: true }; | |
| 35 | + return { visit: v }; | |
| 36 | + } | |
| 37 | + const pub = (v) => ({ brand: v.b || '', service: v.s || '', person: v.p, date: v.d || '', sample: !!v.t }); | |
| 38 | + | |
| 39 | + // Wallet vault (paywell.company/api/vault/*): keeps each person's wallet backup so they never write down recovery words. | |
| 40 | + // The phone encrypts the backup with a key that only their passkey can produce (WebAuthn PRF), so we store a locked box | |
| 41 | + // we cannot open. `auth` is a second value from the same passkey; we keep only its SHA-256, and it is needed to read, | |
| 42 | + // replace or delete the box. Needs only the D1 binding PAYWELL_DB. | |
| 43 | + const B64U = /^[A-Za-z0-9_-]+$/; | |
| 44 | + async function sha(s) { return b64u(new Uint8Array(await crypto.subtle.digest('SHA-256', enc.encode(s)))); } | |
| 45 | + async function vault(request, env, path) { | |
| 46 | + if (!env.PAYWELL_DB) return json({ error: 'Backups are not switched on yet.' }, 503); | |
| 47 | + if (request.method !== 'POST') return json({ error: 'method' }, 405); | |
| 48 | + const db = env.PAYWELL_DB, now = Date.now(); | |
| 49 | + const ipHash = (await sha((request.headers.get('cf-connecting-ip') || '') + (env.PAYWELL_LINK_KEY || TEST_KEY))).slice(0, 16); | |
| 50 | + const hits = await db.prepare('SELECT COUNT(*) AS n FROM vault_hits WHERE ip_hash=? AND at>?').bind(ipHash, now - 6e5).first(); | |
| 51 | + if (hits && hits.n >= 30) return json({ error: 'Too many tries. Wait a few minutes and try again.' }, 429); | |
| 52 | + await db.batch([ | |
| 53 | + db.prepare('INSERT INTO vault_hits (ip_hash, at) VALUES (?,?)').bind(ipHash, now), | |
| 54 | + db.prepare('DELETE FROM vault_hits WHERE at<?').bind(now - 864e5), | |
| 55 | + ]); | |
| 56 | + let b = {}; | |
| 57 | + try { b = await request.json(); } catch {} | |
| 58 | + const cred = String(b.cred || ''), auth = String(b.auth || ''); | |
| 59 | + if (!B64U.test(cred) || cred.length < 16 || cred.length > 400 || !B64U.test(auth) || auth.length !== 43) return json({ error: 'bad request' }, 400); | |
| 60 | + const authHash = await sha(auth); | |
| 61 | + const row = await db.prepare('SELECT auth, blob, salt, updated FROM vault WHERE cred=?').bind(cred).first(); | |
| 62 | + const owns = row && row.auth === authHash; | |
| 63 | + if (path === '/api/vault/get') { | |
| 64 | + if (!owns) return json({ error: 'No backup found for this passkey.' }, 404); | |
| 65 | + return json({ blob: row.blob, salt: row.salt, updated: row.updated }); | |
| 66 | + } | |
| 67 | + if (path === '/api/vault/save') { | |
| 68 | + const blob = String(b.blob || ''), salt = String(b.salt || ''); | |
| 69 | + if (!B64U.test(blob) || blob.length > 4096 || !B64U.test(salt) || salt.length > 64) return json({ error: 'bad request' }, 400); | |
| 70 | + if (row && !owns) return json({ error: 'This passkey already has a different backup.' }, 409); | |
| 71 | + await db.prepare('INSERT INTO vault (cred, auth, blob, salt, created, updated) VALUES (?,?,?,?,?,?) ON CONFLICT(cred) DO UPDATE SET blob=excluded.blob, salt=excluded.salt, updated=excluded.updated') | |
| 72 | + .bind(cred, authHash, blob, salt, now, now).run(); | |
| 73 | + return json({ ok: true, updated: now }); | |
| 74 | + } | |
| 75 | + if (path === '/api/vault/delete') { | |
| 76 | + if (!owns) return json({ error: 'No backup found for this passkey.' }, 404); | |
| 77 | + await db.prepare('DELETE FROM vault WHERE cred=?').bind(cred).run(); | |
| 78 | + return json({ ok: true }); | |
| 79 | + } | |
| 80 | + return json({ error: 'not found' }, 404); | |
| 81 | + } | |
| 82 | + | |
| 83 | + export async function paywellApi(request, env, path) { | |
| 84 | + if (path.startsWith('/api/app/') || path.startsWith('/api/chain/')) return appApi(request, env, path); | |
| 85 | + if (path.startsWith('/api/vault/')) return vault(request, env, path); | |
| 86 | + const isLive = !!live(env); | |
| 87 | + if (path === '/api/rate/price') { | |
| 88 | + // USD per BTC, cached at the edge for a minute so pages never call third parties from the browser. | |
| 89 | + const r = await fetch('https://mempool.space/api/v1/prices', { cf: { cacheTtl: 60, cacheEverything: true } }).catch(() => null); | |
| 90 | + const j = r && r.ok ? await r.json().catch(() => null) : null; | |
| 91 | + return json({ usd: j && j.USD ? j.USD : null }); | |
| 92 | + } | |
| 93 | + if (path === '/api/rate/sample' && request.method === 'GET') { | |
| 94 | + if (isLive) return json({ error: 'not available' }, 404); | |
| 95 | + const d = new Date(); | |
| 96 | + const token = await sign(env, { v: 'sample-' + crypto.randomUUID().slice(0, 8), b: 'Sample visit', s: 'Dog grooming', p: 'Maya', d: d.toISOString().slice(0, 10), x: Date.now() + 14 * 864e5, t: 1 }); | |
| 97 | + return json({ token }); | |
| 98 | + } | |
| 99 | + if (request.method !== 'POST') return json({ error: 'method' }, 405); | |
| 100 | + let body = {}; | |
| 101 | + try { body = await request.json(); } catch {} | |
| 102 | + if (path === '/api/rate/code') { | |
| 103 | + const code = String(body.code || '').toUpperCase().replace(/[^A-Z0-9]/g, ''); | |
| 104 | + if (code.length < 6 || code.length > 16) return json({ error: 'Codes are 8 letters and numbers, like K7Q2-M9XA.' }, 400); | |
| 105 | + if (!isLive) return json({ error: 'Codes from real receipts start working when Paywell opens. Try the sample visit below.' }, 404); | |
| 106 | + const row = await env.PAYWELL_DB.prepare('SELECT token FROM codes WHERE code=?').bind(code).first(); | |
| 107 | + return row ? json({ token: row.token }) : json({ error: 'We couldn’t find that code. Check it and try again.' }, 404); | |
| 108 | + } | |
| 109 | + const r = await verify(env, body.token); | |
| 110 | + if (r.error) return json({ error: r.error, expired: !!r.expired }, 400); | |
| 111 | + const v = r.visit; | |
| 112 | + if (path === '/api/rate/check') { | |
| 113 | + if (isLive || (v.pid && env.PAYWELL_DB)) { | |
| 114 | + const used = await env.PAYWELL_DB.prepare('SELECT 1 FROM ratings WHERE visit=?').bind(v.v).first(); | |
| 115 | + if (used) return json({ error: 'This visit has already been rated. Thank you!', used: true }, 409); | |
| 116 | + } | |
| 117 | + return json({ ok: true, visit: pub(v), test: !isLive }); | |
| 118 | + } | |
| 119 | + if (path === '/api/rate/submit') { | |
| 120 | + if (body.website) return json({ ok: true, test: !isLive }); | |
| 121 | + const stars = Number(body.stars); | |
| 122 | + if (!Number.isInteger(stars) || stars < 1 || stars > 5) return json({ error: 'Please pick a rating from 1 to 5.' }, 400); | |
| 123 | + const note = String(body.note || '').slice(0, 1000); | |
| 124 | + const effect = stars >= 4 ? 'bonus' : stars === 3 ? 'none' : 'review'; | |
| 125 | + if (v.pid && env.PAYWELL_DB) { | |
| 126 | + // A visit from a team in the working test app: record it so it counts in that person's score (no money moves). | |
| 127 | + const res = await env.PAYWELL_DB.prepare('INSERT OR IGNORE INTO ratings (visit, brand, person, stars, note, status, ip_hash, created) VALUES (?,?,?,?,?,?,?,?)') | |
| 128 | + .bind(v.v, v.b || '', v.pid, stars, note, effect === 'review' ? 'held' : 'counted', '', Date.now()).run(); | |
| 129 | + if (!res.meta.changes) return json({ error: 'This visit has already been rated. Thank you!', used: true }, 409); | |
| 130 | + return json({ ok: true, effect, person: v.p, recorded: true, test: !isLive }); | |
| 131 | + } | |
| 132 | + if (isLive) { | |
| 133 | + const ip = request.headers.get('cf-connecting-ip') || ''; | |
| 134 | + const ipHash = b64u(new Uint8Array(await crypto.subtle.digest('SHA-256', enc.encode(ip + env.PAYWELL_LINK_KEY)))).slice(0, 16); | |
| 135 | + const res = await env.PAYWELL_DB.prepare('INSERT OR IGNORE INTO ratings (visit, brand, person, stars, note, status, ip_hash, created) VALUES (?,?,?,?,?,?,?,?)') | |
| 136 | + .bind(v.v, v.b || '', v.p, stars, note, effect === 'review' ? 'held' : 'counted', ipHash, Date.now()).run(); | |
| 137 | + if (!res.meta.changes) return json({ error: 'This visit has already been rated. Thank you!', used: true }, 409); | |
| 138 | + } | |
| 139 | + return json({ ok: true, effect, person: v.p, recorded: isLive, test: !isLive }); | |
| 140 | + } | |
| 141 | + return json({ error: 'not found' }, 404); | |
| 142 | + } | |
| 143 | + | |
| 144 | + setSigner(sign); |
open/src/paywell-app.js.txt added
| 1 | + // Paywell team app API (paywell.company/api/app/* and /api/chain/*). Open source, public domain. | |
| 2 | + // | |
| 3 | + // TEST MODE: everything works for real (passkey accounts, teams, setup links, customer ratings, peer reviews, | |
| 4 | + // scores, tiers, daily bonus amounts, team chat, a Bitcoin wallet on the signet test network) but no real money | |
| 5 | + // moves. Daily bonuses are worked out and shown; paying them needs a licensed payroll and custody partner first. | |
| 6 | + // | |
| 7 | + // Sign-in is passkeys only (WebAuthn). We store each passkey's public key, never a password. | |
| 8 | + // Needs the D1 binding PAYWELL_DB (schema: tools/paywell-gen/schema.sql). | |
| 9 | + | |
| 10 | + const RP_ID = 'paywell.company'; | |
| 11 | + const ORIGINS = ['https://paywell.company']; | |
| 12 | + const TIERS = { 1: { name: 'Explorer', shares: 1 }, 2: { name: 'Builder', shares: 1.5 }, 3: { name: 'Guide', shares: 2 } }; | |
| 13 | + const START_SCORE = 70; // new team members start here until reviews come in | |
| 14 | + const TEST_SHARE_CENTS = 1000; // test teams: one bonus share is worth $10 a day (sample value, no money moves) | |
| 15 | + const WINDOW_DAYS = 28; // score uses the last four weeks of reviews | |
| 16 | + const ESPLORA = 'https://mempool.space/signet/api'; | |
| 17 | + const SESSION_DAYS = 30; | |
| 18 | + | |
| 19 | + const enc = new TextEncoder(); | |
| 20 | + const b64u = (bytes) => { let s = ''; const b = new Uint8Array(bytes); for (let i = 0; i < b.length; i++) s += String.fromCharCode(b[i]); return btoa(s).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, ''); }; | |
| 21 | + const unb64u = (s) => Uint8Array.from(atob(String(s).replace(/-/g, '+').replace(/_/g, '/') + '==='.slice((String(s).length + 3) % 4)), (c) => c.charCodeAt(0)); | |
| 22 | + const json = (o, status = 200, headers = {}) => new Response(JSON.stringify(o), { status, headers: { 'content-type': 'application/json', 'cache-control': 'no-store', 'x-robots-tag': 'noindex', ...headers } }); | |
| 23 | + const rid = (n = 16) => b64u(crypto.getRandomValues(new Uint8Array(n))); | |
| 24 | + const sha256 = async (data) => new Uint8Array(await crypto.subtle.digest('SHA-256', typeof data === 'string' ? enc.encode(data) : data)); | |
| 25 | + const day = (t) => new Date(t).toISOString().slice(0, 10); | |
| 26 | + const clean = (s, n) => String(s || '').replace(/[\u0000-\u001f\u007f]/g, ' ').trim().slice(0, n); | |
| 27 | + | |
| 28 | + let signVisit = null; // rating-link signer, shared with the rating API | |
| 29 | + export function setSigner(fn) { signVisit = fn; } | |
| 30 | + | |
| 31 | + // ---------- Minimal CBOR (enough for WebAuthn attestation objects and COSE keys) ---------- | |
| 32 | + function cbor(buf) { | |
| 33 | + let i = 0; | |
| 34 | + const u8 = buf; | |
| 35 | + const len = (ai) => { | |
| 36 | + if (ai < 24) return ai; | |
| 37 | + if (ai === 24) return u8[i++]; | |
| 38 | + if (ai === 25) { const v = (u8[i] << 8) | u8[i + 1]; i += 2; return v; } | |
| 39 | + if (ai === 26) { const v = ((u8[i] << 24) >>> 0) + ((u8[i + 1] << 16) | (u8[i + 2] << 8) | u8[i + 3]); i += 4; return v; } | |
| 40 | + throw new Error('cbor length'); | |
| 41 | + }; | |
| 42 | + const item = () => { | |
| 43 | + const b = u8[i++], mt = b >> 5, ai = b & 31; | |
| 44 | + if (mt === 0) return len(ai); | |
| 45 | + if (mt === 1) return -1 - len(ai); | |
| 46 | + if (mt === 2) { const n = len(ai); const v = u8.slice(i, i + n); i += n; return v; } | |
| 47 | + if (mt === 3) { const n = len(ai); const v = new TextDecoder().decode(u8.slice(i, i + n)); i += n; return v; } | |
| 48 | + if (mt === 4) { const n = len(ai); const a = []; for (let k = 0; k < n; k++) a.push(item()); return a; } | |
| 49 | + if (mt === 5) { const n = len(ai); const m = new Map(); for (let k = 0; k < n; k++) { const key = item(); m.set(key, item()); } return m; } | |
| 50 | + if (mt === 7) { if (ai === 20) return false; if (ai === 21) return true; if (ai === 22) return null; } | |
| 51 | + throw new Error('cbor type'); | |
| 52 | + }; | |
| 53 | + const v = item(); | |
| 54 | + return { value: v, end: i }; | |
| 55 | + } | |
| 56 | + | |
| 57 | + // ---------- WebAuthn ---------- | |
| 58 | + function parseAuthData(ad) { | |
| 59 | + const flags = ad[32]; | |
| 60 | + const out = { rpIdHash: ad.slice(0, 32), up: !!(flags & 1), uv: !!(flags & 4), counter: new DataView(ad.buffer, ad.byteOffset + 33, 4).getUint32(0) }; | |
| 61 | + if (flags & 64) { | |
| 62 | + const credLen = (ad[53] << 8) | ad[54]; | |
| 63 | + out.credId = ad.slice(55, 55 + credLen); | |
| 64 | + const rest = ad.slice(55 + credLen); | |
| 65 | + out.cose = cbor(rest).value; | |
| 66 | + } | |
| 67 | + return out; | |
| 68 | + } | |
| 69 | + function coseToJwk(m) { | |
| 70 | + const kty = m.get(1), alg = m.get(3); | |
| 71 | + if (kty === 2 && alg === -7) return { kty: 'EC', crv: 'P-256', x: b64u(m.get(-2)), y: b64u(m.get(-3)), alg: 'ES256' }; | |
| 72 | + if (kty === 3 && alg === -257) return { kty: 'RSA', n: b64u(m.get(-1)), e: b64u(m.get(-2)), alg: 'RS256' }; | |
| 73 | + throw new Error('Unsupported passkey type'); | |
| 74 | + } | |
| 75 | + function derToRaw(der) { // ECDSA DER signature -> 64-byte r||s | |
| 76 | + let i = 2; if (der[1] & 0x80) i = 2 + (der[1] & 0x7f); | |
| 77 | + const read = () => { i++; const n = der[i++]; let v = der.slice(i, i + n); i += n; while (v.length > 32 && v[0] === 0) v = v.slice(1); const o = new Uint8Array(32); o.set(v, 32 - v.length); return o; }; | |
| 78 | + const r = read(), s = read(); const out = new Uint8Array(64); out.set(r); out.set(s, 32); return out; | |
| 79 | + } | |
| 80 | + async function checkClientData(db, cdj, type, request) { | |
| 81 | + const cd = JSON.parse(new TextDecoder().decode(unb64u(cdj))); | |
| 82 | + if (cd.type !== type) throw new Error('Wrong passkey step'); | |
| 83 | + const origin = new URL(request.url).origin; | |
| 84 | + if (!ORIGINS.includes(cd.origin) && cd.origin !== origin) throw new Error('Wrong website'); | |
| 85 | + const row = await db.prepare('SELECT exp FROM chal WHERE id=?').bind(cd.challenge).first(); | |
| 86 | + if (!row || row.exp < Date.now()) throw new Error('This sign-in took too long. Try again.'); | |
| 87 | + await db.prepare('DELETE FROM chal WHERE id=? OR exp<?').bind(cd.challenge, Date.now()).run(); | |
| 88 | + return cd; | |
| 89 | + } | |
| 90 | + async function verifyAssertion(db, c, request) { | |
| 91 | + await checkClientData(db, c.clientDataJSON, 'webauthn.get', request); | |
| 92 | + const cred = await db.prepare('SELECT * FROM creds WHERE id=?').bind(c.id).first(); | |
| 93 | + if (!cred) throw new Error('We don’t know this passkey. Use your setup link first.'); | |
| 94 | + const ad = unb64u(c.authenticatorData); | |
| 95 | + const a = parseAuthData(ad); | |
| 96 | + if (b64u(a.rpIdHash) !== b64u(await sha256(RP_ID))) throw new Error('Wrong website'); | |
| 97 | + if (!a.up || !a.uv) throw new Error('Face, fingerprint or screen lock is needed.'); | |
| 98 | + const jwk = JSON.parse(cred.jwk); | |
| 99 | + const data = new Uint8Array(ad.length + 32); data.set(ad); data.set(await sha256(unb64u(c.clientDataJSON)), ad.length); | |
| 100 | + let ok; | |
| 101 | + if (jwk.kty === 'EC') { | |
| 102 | + const key = await crypto.subtle.importKey('jwk', jwk, { name: 'ECDSA', namedCurve: 'P-256' }, false, ['verify']); | |
| 103 | + ok = await crypto.subtle.verify({ name: 'ECDSA', hash: 'SHA-256' }, key, derToRaw(unb64u(c.signature)), data); | |
| 104 | + } else { | |
| 105 | + const key = await crypto.subtle.importKey('jwk', jwk, { name: 'RSASSA-PKCS1-v1_5', hash: 'SHA-256' }, false, ['verify']); | |
| 106 | + ok = await crypto.subtle.verify('RSASSA-PKCS1-v1_5', key, unb64u(c.signature), data); | |
| 107 | + } | |
| 108 | + if (!ok) throw new Error('Passkey check failed.'); | |
| 109 | + await db.prepare('UPDATE creds SET counter=?, used=? WHERE id=?').bind(a.counter, Date.now(), c.id).run(); | |
| 110 | + return cred.person; | |
| 111 | + } | |
| 112 | + | |
| 113 | + // ---------- Sessions ---------- | |
| 114 | + function cookie(request, name) { | |
| 115 | + const m = (request.headers.get('cookie') || '').match(new RegExp('(?:^|; )' + name + '=([^;]+)')); | |
| 116 | + return m ? m[1] : null; | |
| 117 | + } | |
| 118 | + async function startSession(db, person) { | |
| 119 | + const token = rid(24); | |
| 120 | + await db.prepare('INSERT INTO sessions (hash, person, exp) VALUES (?,?,?)').bind(b64u(await sha256(token)), person, Date.now() + SESSION_DAYS * 864e5).run(); | |
| 121 | + return `pw_s=${token}; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=${SESSION_DAYS * 86400}`; | |
| 122 | + } | |
| 123 | + async function me(db, request) { | |
| 124 | + const t = cookie(request, 'pw_s'); | |
| 125 | + if (!t) return null; | |
| 126 | + const row = await db.prepare('SELECT p.* FROM sessions s JOIN people p ON p.id=s.person WHERE s.hash=? AND s.exp>?').bind(b64u(await sha256(t)), Date.now()).first(); | |
| 127 | + return row || null; | |
| 128 | + } | |
| 129 | + | |
| 130 | + // ---------- Scores and daily bonuses ---------- | |
| 131 | + const to100 = (avg) => Math.round(((avg - 1) / 4) * 100); | |
| 132 | + async function scoreAt(db, person, until) { | |
| 133 | + const from = until - WINDOW_DAYS * 864e5; | |
| 134 | + const c = await db.prepare("SELECT AVG(stars) a, COUNT(*) n FROM ratings WHERE person=? AND status='counted' AND created>? AND created<=?").bind(person, from, until).first(); | |
| 135 | + const p = await db.prepare('SELECT AVG(stars) a, COUNT(*) n FROM peer WHERE target=? AND created>? AND created<=?').bind(person, from, until).first(); | |
| 136 | + const cs = c.n ? to100(c.a) : null, ps = p.n ? to100(p.a) : null; | |
| 137 | + let score = START_SCORE; | |
| 138 | + if (cs !== null && ps !== null) score = Math.round(cs * 0.6 + ps * 0.4); | |
| 139 | + else if (cs !== null) score = cs; else if (ps !== null) score = ps; | |
| 140 | + return { score, customer: cs, customerN: c.n, customerAvg: c.a ? Math.round(c.a * 10) / 10 : null, peer: ps, peerN: p.n, peerAvg: p.a ? Math.round(p.a * 10) / 10 : null }; | |
| 141 | + } | |
| 142 | + const bonusCents = (share, tier, score) => Math.round(share * TIERS[tier].shares * score / 100); | |
| 143 | + | |
| 144 | + async function summary(db, person) { | |
| 145 | + const org = await db.prepare('SELECT * FROM orgs WHERE id=?').bind(person.org).first(); | |
| 146 | + const now = Date.now(); | |
| 147 | + const s = await scoreAt(db, person.id, now); | |
| 148 | + const days = []; | |
| 149 | + const joined = new Date(day(person.created) + 'T00:00:00Z').getTime(); | |
| 150 | + for (let k = 0; k < 14; k++) { | |
| 151 | + const end = new Date(day(now) + 'T00:00:00Z').getTime() - k * 864e5; // end of the previous day | |
| 152 | + if (end <= joined) break; | |
| 153 | + const sc = (await scoreAt(db, person.id, end)).score; | |
| 154 | + days.push({ day: day(end - 1), score: sc, tier: person.tier, cents: bonusCents(org.share_cents, person.tier, sc) }); | |
| 155 | + } | |
| 156 | + const team = (await db.prepare('SELECT id, name, tier, admin FROM people WHERE org=? ORDER BY created').bind(person.org).all()).results; | |
| 157 | + const today = day(now); | |
| 158 | + const reviewed = (await db.prepare('SELECT target FROM peer WHERE author=? AND day=?').bind(person.id, today).all()).results.map((r) => r.target); | |
| 159 | + const ratings = (await db.prepare('SELECT visit, brand, stars, note, status, created FROM ratings WHERE person=? ORDER BY created DESC LIMIT 30').bind(person.id).all()).results; | |
| 160 | + const peers = (await db.prepare('SELECT stars, note, day FROM peer WHERE target=? ORDER BY created DESC LIMIT 30').bind(person.id).all()).results; | |
| 161 | + return { | |
| 162 | + me: { id: person.id, name: person.name, tier: person.tier, tierName: TIERS[person.tier].name, shares: TIERS[person.tier].shares, admin: !!person.admin, payout: person.payout_mode, payoutAddr: person.payout_addr, joined: person.created }, | |
| 163 | + org: { name: org.name, shareCents: org.share_cents, test: true }, | |
| 164 | + score: s, todayCents: bonusCents(org.share_cents, person.tier, s.score), days, team, reviewedToday: reviewed, ratings, peers, | |
| 165 | + tiers: TIERS, | |
| 166 | + }; | |
| 167 | + } | |
| 168 | + | |
| 169 | + // ---------- Rate limit ---------- | |
| 170 | + async function limited(db, request, key, max, windowMs) { | |
| 171 | + const ip = request.headers.get('cf-connecting-ip') || ''; | |
| 172 | + const h = b64u(await sha256(ip + '|' + key)).slice(0, 16), now = Date.now(); | |
| 173 | + const r = await db.prepare('SELECT COUNT(*) n FROM vault_hits WHERE ip_hash=? AND at>?').bind(h, now - windowMs).first(); | |
| 174 | + if (r && r.n >= max) return true; | |
| 175 | + await db.prepare('INSERT INTO vault_hits (ip_hash, at) VALUES (?,?)').bind(h, now).run(); | |
| 176 | + return false; | |
| 177 | + } | |
| 178 | + | |
| 179 | + // ---------- Chain proxy (signet test network): the browser never calls third parties directly ---------- | |
| 180 | + async function chain(request, path) { | |
| 181 | + const sub = path.slice('/api/chain/'.length); | |
| 182 | + if (request.method === 'POST' && sub === 'tx') { | |
| 183 | + const hex = (await request.text()).trim(); | |
| 184 | + if (!/^[0-9a-f]{100,200000}$/i.test(hex)) return json({ error: 'bad transaction' }, 400); | |
| 185 | + const r = await fetch(ESPLORA + '/tx', { method: 'POST', body: hex }); | |
| 186 | + const t = await r.text(); | |
| 187 | + return r.ok ? json({ txid: t }) : json({ error: t.slice(0, 300) }, 400); | |
| 188 | + } | |
| 189 | + let target = null; | |
| 190 | + if (sub === 'fees') target = '/fee-estimates'; | |
| 191 | + else if (sub === 'price') { const r = await fetch('https://mempool.space/api/v1/prices', { cf: { cacheTtl: 60, cacheEverything: true } }).catch(() => null); const j = r && r.ok ? await r.json().catch(() => null) : null; return json({ usd: j && j.USD ? j.USD : null }); } | |
| 192 | + else { const m = sub.match(/^address\/((?:tb1|bc1)[0-9a-z]{20,90})\/(utxo|txs)$/); if (m) target = `/address/${m[1]}/${m[2]}`; } | |
| 193 | + if (!target) return json({ error: 'not found' }, 404); | |
| 194 | + const r = await fetch(ESPLORA + target, { cf: { cacheTtl: 10, cacheEverything: true } }); | |
| 195 | + return new Response(await r.text(), { status: r.status, headers: { 'content-type': 'application/json', 'cache-control': 'no-store' } }); | |
| 196 | + } | |
| 197 | + | |
| 198 | + // ---------- Routes ---------- | |
| 199 | + export async function appApi(request, env, path) { | |
| 200 | + if (path.startsWith('/api/chain/')) return chain(request, path); | |
| 201 | + const db = env.PAYWELL_DB; | |
| 202 | + if (!db) return json({ error: 'The app isn’t switched on yet.' }, 503); | |
| 203 | + const method = request.method; | |
| 204 | + let b = {}; | |
| 205 | + if (method === 'POST') { try { b = await request.json(); } catch {} } | |
| 206 | + try { | |
| 207 | + // A fresh challenge for any passkey step (5 minutes). | |
| 208 | + if (path === '/api/app/challenge' && method === 'POST') { | |
| 209 | + if (await limited(db, request, 'chal', 60, 6e5)) return json({ error: 'Too many tries. Wait a few minutes.' }, 429); | |
| 210 | + const id = rid(32); | |
| 211 | + await db.prepare('INSERT INTO chal (id, exp) VALUES (?,?)').bind(id, Date.now() + 3e5).run(); | |
| 212 | + return json({ challenge: id, rpId: RP_ID }); | |
| 213 | + } | |
| 214 | + // What a setup link is for (team name, the person's name). | |
| 215 | + if (path === '/api/app/setup' && method === 'POST') { | |
| 216 | + const row = await db.prepare('SELECT s.name, o.name team, s.exp, s.used FROM setup s JOIN orgs o ON o.id=s.org WHERE s.token=?').bind(clean(b.token, 64)).first(); | |
| 217 | + if (!row || row.used || row.exp < Date.now()) return json({ error: 'This setup link has expired or was already used. Ask your team for a new one.' }, 404); | |
| 218 | + return json({ name: row.name, team: row.team }); | |
| 219 | + } | |
| 220 | + // Create an account with a new passkey: either start a test team, or join one with a setup link. | |
| 221 | + if (path === '/api/app/register' && method === 'POST') { | |
| 222 | + if (await limited(db, request, 'reg', 20, 36e5)) return json({ error: 'Too many new accounts from here. Try again later.' }, 429); | |
| 223 | + const c = b.credential || {}; | |
| 224 | + await checkClientData(db, c.clientDataJSON, 'webauthn.create', request); | |
| 225 | + const att = cbor(unb64u(c.attestationObject)).value; | |
| 226 | + const a = parseAuthData(att.get('authData')); | |
| 227 | + if (b64u(a.rpIdHash) !== b64u(await sha256(RP_ID))) throw new Error('Wrong website'); | |
| 228 | + if (!a.up || !a.uv) throw new Error('Face, fingerprint or screen lock is needed.'); | |
| 229 | + const jwk = coseToJwk(a.cose); | |
| 230 | + const credId = b64u(a.credId); | |
| 231 | + let org, name, tier = 1, admin = 0, setupToken = null; | |
| 232 | + if (b.setup) { | |
| 233 | + setupToken = clean(b.setup, 64); | |
| 234 | + const s = await db.prepare('SELECT * FROM setup WHERE token=?').bind(setupToken).first(); | |
| 235 | + if (!s || s.used || s.exp < Date.now()) throw new Error('This setup link has expired or was already used.'); | |
| 236 | + org = s.org; name = s.name; tier = s.tier; | |
| 237 | + } else { | |
| 238 | + const team = clean(b.team, 60); name = clean(b.name, 40); | |
| 239 | + if (!team || !name) throw new Error('Add your name and a team name.'); | |
| 240 | + org = rid(9); | |
| 241 | + await db.prepare('INSERT INTO orgs (id, name, share_cents, created) VALUES (?,?,?,?)').bind(org, team, TEST_SHARE_CENTS, Date.now()).run(); | |
| 242 | + tier = 3; admin = 1; // whoever starts a team guides it | |
| 243 | + } | |
| 244 | + const person = rid(9), now = Date.now(); | |
| 245 | + const stmts = [ | |
| 246 | + db.prepare('INSERT INTO people (id, org, name, tier, admin, payout_mode, payout_addr, created) VALUES (?,?,?,?,?,?,?,?)').bind(person, org, name, tier, admin, 'paywell', null, now), | |
| 247 | + db.prepare('INSERT INTO creds (id, person, jwk, counter, created, used) VALUES (?,?,?,?,?,?)').bind(credId, person, JSON.stringify(jwk), a.counter, now, now), | |
| 248 | + ]; | |
| 249 | + if (setupToken) stmts.push(db.prepare('UPDATE setup SET used=? WHERE token=?').bind(now, setupToken)); | |
| 250 | + await db.batch(stmts); | |
| 251 | + return json({ ok: true, credId }, 200, { 'set-cookie': await startSession(db, person) }); | |
| 252 | + } | |
| 253 | + if (path === '/api/app/login' && method === 'POST') { | |
| 254 | + if (await limited(db, request, 'login', 40, 6e5)) return json({ error: 'Too many tries. Wait a few minutes.' }, 429); | |
| 255 | + const person = await verifyAssertion(db, b.credential || {}, request); | |
| 256 | + return json({ ok: true }, 200, { 'set-cookie': await startSession(db, person) }); | |
| 257 | + } | |
| 258 | + if (path === '/api/app/logout' && method === 'POST') { | |
| 259 | + const t = cookie(request, 'pw_s'); | |
| 260 | + if (t) await db.prepare('DELETE FROM sessions WHERE hash=?').bind(b64u(await sha256(t))).run(); | |
| 261 | + return json({ ok: true }, 200, { 'set-cookie': 'pw_s=; Path=/; HttpOnly; Secure; SameSite=Lax; Max-Age=0' }); | |
| 262 | + } | |
| 263 | + | |
| 264 | + // Everything below needs a signed-in person. | |
| 265 | + const p = await me(db, request); | |
| 266 | + if (!p) return json({ error: 'signed out' }, 401); | |
| 267 | + | |
| 268 | + if (path === '/api/app/me' && method === 'GET') return json(await summary(db, p)); | |
| 269 | + | |
| 270 | + // Where the daily bonus goes. Changing it needs a fresh passkey check. | |
| 271 | + if (path === '/api/app/payout' && method === 'POST') { | |
| 272 | + const mode = b.mode === 'own' ? 'own' : 'paywell'; | |
| 273 | + const addr = clean(b.addr, 100); | |
| 274 | + if (mode === 'own' && !/^(bc1|tb1)[02-9ac-hj-np-z]{20,90}$|^[13mn2][a-km-zA-HJ-NP-Z1-9]{25,34}$/.test(addr)) throw new Error('That doesn’t look like a Bitcoin address.'); | |
| 275 | + if (mode === 'own' || p.payout_mode === 'own') { | |
| 276 | + const who = await verifyAssertion(db, b.credential || {}, request); | |
| 277 | + if (who !== p.id) throw new Error('Use your own passkey.'); | |
| 278 | + } | |
| 279 | + await db.prepare('UPDATE people SET payout_mode=?, payout_addr=? WHERE id=?').bind(mode, mode === 'own' ? addr : (b.walletAddr ? clean(b.walletAddr, 100) : null), p.id).run(); | |
| 280 | + return json({ ok: true }); | |
| 281 | + } | |
| 282 | + // The wallet's first receive address, so the team can see where bonuses go. | |
| 283 | + if (path === '/api/app/wallet-address' && method === 'POST') { | |
| 284 | + if (p.payout_mode !== 'paywell') return json({ ok: true }); | |
| 285 | + const addr = clean(b.addr, 100); | |
| 286 | + if (!/^tb1[02-9ac-hj-np-z]{20,90}$/.test(addr)) throw new Error('bad address'); | |
| 287 | + await db.prepare('UPDATE people SET payout_addr=? WHERE id=?').bind(addr, p.id).run(); | |
| 288 | + return json({ ok: true }); | |
| 289 | + } | |
| 290 | + // A one-time setup link for a new teammate (only the team's guide in test mode). | |
| 291 | + if (path === '/api/app/invite' && method === 'POST') { | |
| 292 | + if (!p.admin) throw new Error('Only the person who started the team can add people.'); | |
| 293 | + const name = clean(b.name, 40); const tier = [1, 2, 3].includes(Number(b.tier)) ? Number(b.tier) : 1; | |
| 294 | + if (!name) throw new Error('Add their first name.'); | |
| 295 | + const n = await db.prepare('SELECT COUNT(*) n FROM people WHERE org=?').bind(p.org).first(); | |
| 296 | + if (n.n >= 50) throw new Error('Test teams can have up to 50 people.'); | |
| 297 | + const token = rid(18); | |
| 298 | + await db.prepare('INSERT INTO setup (token, org, name, tier, exp, used, created) VALUES (?,?,?,?,?,?,?)').bind(token, p.org, name, tier, Date.now() + 864e5, 0, Date.now()).run(); | |
| 299 | + return json({ url: 'https://paywell.company/app/#setup=' + token, expires: Date.now() + 864e5 }); | |
| 300 | + } | |
| 301 | + // Change a teammate's tier (the team's guide; written notice is the live rule). | |
| 302 | + if (path === '/api/app/tier' && method === 'POST') { | |
| 303 | + if (!p.admin) throw new Error('Only the person who started the team can change tiers.'); | |
| 304 | + const tier = Number(b.tier); if (![1, 2, 3].includes(tier)) throw new Error('Pick a tier.'); | |
| 305 | + await db.prepare('UPDATE people SET tier=? WHERE id=? AND org=?').bind(tier, clean(b.person, 20), p.org).run(); | |
| 306 | + return json({ ok: true }); | |
| 307 | + } | |
| 308 | + // A customer rating link for a visit you just did (in live mode this comes from the shop's checkout). | |
| 309 | + if (path === '/api/app/visit' && method === 'POST') { | |
| 310 | + if (await limited(db, request, 'visit:' + p.id, 60, 36e5)) throw new Error('That’s a lot of visits. Try again later.'); | |
| 311 | + const org = await db.prepare('SELECT name FROM orgs WHERE id=?').bind(p.org).first(); | |
| 312 | + const service = clean(b.service, 60) || 'Visit'; | |
| 313 | + const token = await signVisit(env, { v: 'v-' + rid(9), b: org.name, s: service, p: p.name, pid: p.id, d: day(Date.now()), x: Date.now() + 14 * 864e5 }); | |
| 314 | + return json({ url: 'https://paywell.company/r/' + token }); | |
| 315 | + } | |
| 316 | + // Peer review: one per teammate per day, never yourself, kept private from the person reviewed. | |
| 317 | + if (path === '/api/app/peer' && method === 'POST') { | |
| 318 | + const target = clean(b.person, 20), stars = Number(b.stars); | |
| 319 | + if (target === p.id) throw new Error('You can’t review yourself.'); | |
| 320 | + if (!Number.isInteger(stars) || stars < 1 || stars > 5) throw new Error('Pick 1 to 5 stars.'); | |
| 321 | + const t = await db.prepare('SELECT id FROM people WHERE id=? AND org=?').bind(target, p.org).first(); | |
| 322 | + if (!t) throw new Error('They’re not on your team.'); | |
| 323 | + const r = await db.prepare('INSERT OR IGNORE INTO peer (author, target, day, stars, note, created) VALUES (?,?,?,?,?,?)').bind(p.id, target, day(Date.now()), stars, clean(b.note, 500), Date.now()).run(); | |
| 324 | + if (!r.meta.changes) throw new Error('You already reviewed them today.'); | |
| 325 | + return json({ ok: true }); | |
| 326 | + } | |
| 327 | + // Team chat: channels per team, newest 100 messages, polled by the app. | |
| 328 | + if (path === '/api/app/chat') { | |
| 329 | + const ch = ['general', 'shout-outs', 'random'].includes(new URL(request.url).searchParams.get('c') || b.channel) ? (new URL(request.url).searchParams.get('c') || b.channel) : 'general'; | |
| 330 | + if (method === 'POST') { | |
| 331 | + const body = clean(b.body, 1000); if (!body) throw new Error('Write something first.'); | |
| 332 | + if (await limited(db, request, 'chat:' + p.id, 120, 6e5)) throw new Error('Slow down a little.'); | |
| 333 | + await db.prepare('INSERT INTO messages (org, channel, person, body, created) VALUES (?,?,?,?,?)').bind(p.org, ch, p.id, body, Date.now()).run(); | |
| 334 | + } | |
| 335 | + const since = Number(new URL(request.url).searchParams.get('since') || 0); | |
| 336 | + const rows = (await db.prepare('SELECT m.id, m.body, m.created, m.person, p.name FROM messages m JOIN people p ON p.id=m.person WHERE m.org=? AND m.channel=? AND m.id>? ORDER BY m.id DESC LIMIT 100').bind(p.org, ch, since).all()).results.reverse(); | |
| 337 | + return json({ messages: rows, me: p.id }); | |
| 338 | + } | |
| 339 | + return json({ error: 'not found' }, 404); | |
| 340 | + } catch (e) { | |
| 341 | + return json({ error: e.message || 'Something went wrong.' }, 400); | |
| 342 | + } | |
| 343 | + } |
open/src/rate.js.txt added
| 1 | + (function(){ | |
| 2 | + var $=function(id){return document.getElementById(id)}; | |
| 3 | + var token=null; | |
| 4 | + function show(id){['r-start','r-form-wrap','r-done'].forEach(function(s){$(s).hidden=(s!==id)});window.scrollTo(0,0);} | |
| 5 | + function err(msg){var e=$('r-err');e.textContent=msg;e.hidden=!msg;$('r-loading').hidden=true;} | |
| 6 | + function post(path,body){return fetch('/api/rate/'+path,{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify(body)}).then(function(r){return r.json().then(function(j){j._ok=r.ok;return j})});} | |
| 7 | + function tokenFromUrl(){ | |
| 8 | + var m=location.pathname.match(/^\/r\/([A-Za-z0-9_.-]+)/); if(m) return m[1]; | |
| 9 | + var q=new URLSearchParams(location.search); if(q.get('t')) return q.get('t'); | |
| 10 | + return null; | |
| 11 | + } | |
| 12 | + function load(t){ | |
| 13 | + err('');$('r-loading').hidden=false; | |
| 14 | + post('check',{token:t}).then(function(j){ | |
| 15 | + $('r-loading').hidden=true; | |
| 16 | + if(!j._ok){err(j.error||'Something went wrong. Please try again.');show('r-start');return;} | |
| 17 | + token=t;var v=j.visit; | |
| 18 | + $('r-test').hidden=!j.test; | |
| 19 | + $('r-where').textContent=[v.brand,v.service,v.date?new Date(v.date+'T12:00:00').toLocaleDateString(undefined,{month:'long',day:'numeric'}):''].filter(Boolean).join(' · '); | |
| 20 | + $('r-q').textContent='How was your visit with '+v.person+'?'; | |
| 21 | + show('r-form-wrap'); | |
| 22 | + }).catch(function(){err('We couldn’t reach Paywell. Check your connection and try again.');}); | |
| 23 | + } | |
| 24 | + $('r-code').addEventListener('submit',function(e){ | |
| 25 | + e.preventDefault();var c=$('r-code-in').value.trim(); | |
| 26 | + if(!c){err('Please enter the code from your receipt.');return;} | |
| 27 | + var m=c.match(/\/r\/([A-Za-z0-9_.-]+)/); if(m){load(m[1]);return;} | |
| 28 | + if(c.indexOf('.')>0&&c.length>40){load(c);return;} | |
| 29 | + err('');post('code',{code:c}).then(function(j){if(j._ok&&j.token)load(j.token);else err(j.error||'We couldn’t find that code.');}).catch(function(){err('We couldn’t reach Paywell. Try again in a minute.');}); | |
| 30 | + }); | |
| 31 | + $('r-sample').addEventListener('click',function(){ | |
| 32 | + fetch('/api/rate/sample').then(function(r){return r.json()}).then(function(j){if(j.token)load(j.token);else err('The sample isn’t available right now.');}).catch(function(){err('We couldn’t reach Paywell. Try again in a minute.');}); | |
| 33 | + }); | |
| 34 | + $('r-form').addEventListener('submit',function(e){ | |
| 35 | + e.preventDefault();var f=e.target;var s=f.querySelector('input[name=stars]:checked'); | |
| 36 | + if(!s){$('r-ferr').textContent='Please tap a rating first.';return;} | |
| 37 | + var b=f.querySelector('.r-send');b.disabled=true;$('r-ferr').textContent=''; | |
| 38 | + post('submit',{token:token,stars:+s.value,note:f.note.value,website:f.website.value}).then(function(j){ | |
| 39 | + b.disabled=false; | |
| 40 | + if(!j._ok){$('r-ferr').textContent=j.error||'That didn’t go through. Please try again.';return;} | |
| 41 | + var p=j.person||'them'; | |
| 42 | + var msg={bonus:'Your rating raises '+p+'’s bonus today. The company pays it, not you.',none:'Thanks for letting us know. An okay rating doesn’t change anyone’s pay.',review:'Thanks for telling us. A low rating is checked before it counts, and '+p+' gets a chance to respond. It never touches their wage or earned pay.'}[j.effect]; | |
| 43 | + $('r-done-h').textContent=j.effect==='review'?'Thanks for your honesty.':'Thank you!'; | |
| 44 | + $('r-done-p').textContent=msg;$('r-done-test').hidden=!j.test;show('r-done'); | |
| 45 | + }).catch(function(){b.disabled=false;$('r-ferr').textContent='We couldn’t reach Paywell. Please try again.';}); | |
| 46 | + }); | |
| 47 | + var t=tokenFromUrl(); if(t) load(t); | |
| 48 | + })(); |
open/src/schema.sql.txt added
| 1 | + -- Paywell D1 schema (binding PAYWELL_DB, database "paywell"). Public domain. | |
| 2 | + -- Customer ratings (one per visit). person = Paywell person id for team visits, or first name for sample links. | |
| 3 | + CREATE TABLE IF NOT EXISTS ratings (visit TEXT PRIMARY KEY, brand TEXT, person TEXT, stars INTEGER NOT NULL, note TEXT, status TEXT NOT NULL, ip_hash TEXT, created INTEGER NOT NULL); | |
| 4 | + CREATE INDEX IF NOT EXISTS ratings_person ON ratings(person, created); | |
| 5 | + CREATE INDEX IF NOT EXISTS ratings_ip ON ratings(ip_hash, created); | |
| 6 | + -- Short receipt codes that map to a signed link. | |
| 7 | + CREATE TABLE IF NOT EXISTS codes (code TEXT PRIMARY KEY, token TEXT NOT NULL, created INTEGER NOT NULL); | |
| 8 | + -- Wallet vault: passkey-locked wallet backups we cannot open. | |
| 9 | + CREATE TABLE IF NOT EXISTS vault (cred TEXT PRIMARY KEY, auth TEXT NOT NULL, blob TEXT NOT NULL, salt TEXT NOT NULL, created INTEGER NOT NULL, updated INTEGER NOT NULL); | |
| 10 | + CREATE TABLE IF NOT EXISTS vault_hits (ip_hash TEXT NOT NULL, at INTEGER NOT NULL); | |
| 11 | + CREATE INDEX IF NOT EXISTS vault_hits_ip ON vault_hits(ip_hash, at); | |
| 12 | + -- Teams, people, passkeys, sessions, setup links. | |
| 13 | + CREATE TABLE IF NOT EXISTS orgs (id TEXT PRIMARY KEY, name TEXT NOT NULL, share_cents INTEGER NOT NULL, created INTEGER NOT NULL); | |
| 14 | + CREATE TABLE IF NOT EXISTS people (id TEXT PRIMARY KEY, org TEXT NOT NULL, name TEXT NOT NULL, tier INTEGER NOT NULL, admin INTEGER NOT NULL DEFAULT 0, payout_mode TEXT NOT NULL, payout_addr TEXT, created INTEGER NOT NULL); | |
| 15 | + CREATE INDEX IF NOT EXISTS people_org ON people(org, created); | |
| 16 | + CREATE TABLE IF NOT EXISTS creds (id TEXT PRIMARY KEY, person TEXT NOT NULL, jwk TEXT NOT NULL, counter INTEGER, created INTEGER NOT NULL, used INTEGER); | |
| 17 | + CREATE TABLE IF NOT EXISTS sessions (hash TEXT PRIMARY KEY, person TEXT NOT NULL, exp INTEGER NOT NULL); | |
| 18 | + CREATE TABLE IF NOT EXISTS chal (id TEXT PRIMARY KEY, exp INTEGER NOT NULL); | |
| 19 | + CREATE TABLE IF NOT EXISTS setup (token TEXT PRIMARY KEY, org TEXT NOT NULL, name TEXT NOT NULL, tier INTEGER NOT NULL, exp INTEGER NOT NULL, used INTEGER NOT NULL DEFAULT 0, created INTEGER NOT NULL); | |
| 20 | + -- Peer reviews: one per author, teammate and day. | |
| 21 | + CREATE TABLE IF NOT EXISTS peer (author TEXT NOT NULL, target TEXT NOT NULL, day TEXT NOT NULL, stars INTEGER NOT NULL, note TEXT, created INTEGER NOT NULL, PRIMARY KEY (author, target, day)); | |
| 22 | + CREATE INDEX IF NOT EXISTS peer_target ON peer(target, created); | |
| 23 | + -- Team chat. | |
| 24 | + CREATE TABLE IF NOT EXISTS messages (id INTEGER PRIMARY KEY AUTOINCREMENT, org TEXT NOT NULL, channel TEXT NOT NULL, person TEXT NOT NULL, body TEXT NOT NULL, created INTEGER NOT NULL); | |
| 25 | + CREATE INDEX IF NOT EXISTS messages_org ON messages(org, channel, id); |
open/src/wallet-src.js.txt added
| 1 | + // Paywell browser wallet (signet test network while in test mode). Public domain. | |
| 2 | + // Keys are made and used only in the browser. The backup leaves the browser only after it is locked | |
| 3 | + // with the person's passkey (see app.js), so we never see the words or keys. | |
| 4 | + import * as btc from '@scure/btc-signer'; | |
| 5 | + import { HDKey } from '@scure/bip32'; | |
| 6 | + import { generateMnemonic, mnemonicToSeedSync, validateMnemonic } from '@scure/bip39'; | |
| 7 | + import { wordlist } from '@scure/bip39/wordlists/english'; | |
| 8 | + import qrcode from 'qrcode-generator'; | |
| 9 | + | |
| 10 | + const NET = btc.TEST_NETWORK; // signet uses the testnet address format (tb1...) | |
| 11 | + const PATH = "m/84'/1'/0'"; | |
| 12 | + const GAP = 10; | |
| 13 | + | |
| 14 | + export function newWords() { return generateMnemonic(wordlist, 128); } | |
| 15 | + export function validWords(w) { return validateMnemonic(String(w || '').trim().toLowerCase().replace(/\s+/g, ' '), wordlist); } | |
| 16 | + | |
| 17 | + export function open(words) { | |
| 18 | + const seed = mnemonicToSeedSync(String(words).trim().toLowerCase().replace(/\s+/g, ' ')); | |
| 19 | + const acct = HDKey.fromMasterSeed(seed).derive(PATH); | |
| 20 | + const key = (change, i) => acct.deriveChild(change).deriveChild(i); | |
| 21 | + const addr = (change, i) => btc.p2wpkh(key(change, i).publicKey, NET); | |
| 22 | + return { | |
| 23 | + address: (i = 0, change = 0) => addr(change, i).address, | |
| 24 | + key, addr, | |
| 25 | + }; | |
| 26 | + } | |
| 27 | + | |
| 28 | + async function get(url) { const r = await fetch(url); if (!r.ok) throw new Error('Network busy, try again.'); return r.json(); } | |
| 29 | + | |
| 30 | + // Look at the first addresses on both chains and collect coins and history. | |
| 31 | + export async function sync(w) { | |
| 32 | + const utxos = [], txs = new Map(); | |
| 33 | + let nextReceive = 0, nextChange = 0; | |
| 34 | + for (const change of [0, 1]) { | |
| 35 | + let empty = 0; | |
| 36 | + for (let i = 0; i < 40 && empty < (change ? 4 : GAP); i++) { | |
| 37 | + const a = w.addr(change, i); | |
| 38 | + const [u, t] = await Promise.all([get(`/api/chain/address/${a.address}/utxo`), get(`/api/chain/address/${a.address}/txs`)]); | |
| 39 | + if (!t.length) { empty++; continue; } | |
| 40 | + empty = 0; | |
| 41 | + if (change) nextChange = i + 1; else nextReceive = i + 1; | |
| 42 | + for (const x of u) utxos.push({ txid: x.txid, vout: x.vout, value: x.value, confirmed: x.status && x.status.confirmed, change, i, script: a.script }); | |
| 43 | + for (const x of t) txs.set(x.txid, x); | |
| 44 | + } | |
| 45 | + } | |
| 46 | + const mine = new Set(); | |
| 47 | + for (const change of [0, 1]) for (let i = 0; i < (change ? nextChange : nextReceive) + 1; i++) mine.add(w.address(i, change)); | |
| 48 | + const history = [...txs.values()].map((t) => { | |
| 49 | + let delta = 0; | |
| 50 | + for (const o of t.vout) if (mine.has(o.scriptpubkey_address)) delta += o.value; | |
| 51 | + for (const v of t.vin) if (v.prevout && mine.has(v.prevout.scriptpubkey_address)) delta -= v.prevout.value; | |
| 52 | + return { txid: t.txid, delta, time: t.status && t.status.block_time ? t.status.block_time * 1000 : null, confirmed: !!(t.status && t.status.confirmed) }; | |
| 53 | + }).sort((a, b) => (b.time || 9e15) - (a.time || 9e15)); | |
| 54 | + const balance = utxos.reduce((s, u) => s + u.value, 0); | |
| 55 | + return { utxos, balance, history, nextReceive, nextChange }; | |
| 56 | + } | |
| 57 | + | |
| 58 | + export function validAddress(a) { | |
| 59 | + try { btc.Address(NET).decode(String(a).trim()); return true; } catch { return false; } | |
| 60 | + } | |
| 61 | + | |
| 62 | + // Build and sign a payment. Returns { hex, fee, txid }. | |
| 63 | + export function buildPayment(w, s, to, sats, feeRate) { | |
| 64 | + to = String(to).trim(); | |
| 65 | + if (!validAddress(to)) throw new Error('That isn’t a test-network Bitcoin address (they start with tb1).'); | |
| 66 | + sats = Math.floor(sats); | |
| 67 | + if (!(sats >= 330)) throw new Error('That amount is too small to send.'); | |
| 68 | + const coins = [...s.utxos].sort((a, b) => b.value - a.value); | |
| 69 | + const picked = []; let total = 0, fee = 0; | |
| 70 | + for (const c of coins) { | |
| 71 | + picked.push(c); total += c.value; | |
| 72 | + fee = Math.ceil((11 + 68 * picked.length + 31 * 2) * feeRate); | |
| 73 | + if (total >= sats + fee) break; | |
| 74 | + } | |
| 75 | + if (total < sats + fee) throw new Error('Not enough in your wallet for this payment and the network fee.'); | |
| 76 | + const tx = new btc.Transaction(); | |
| 77 | + for (const c of picked) tx.addInput({ txid: c.txid, index: c.vout, witnessUtxo: { script: c.script, amount: BigInt(c.value) } }); | |
| 78 | + tx.addOutputAddress(to, BigInt(sats), NET); | |
| 79 | + const change = total - sats - fee; | |
| 80 | + if (change >= 546) tx.addOutputAddress(w.address(s.nextChange, 1), BigInt(change), NET); | |
| 81 | + else fee += change; | |
| 82 | + picked.forEach((c, idx) => tx.signIdx(w.key(c.change, c.i).privateKey, idx)); | |
| 83 | + tx.finalize(); | |
| 84 | + return { hex: tx.hex, fee, txid: tx.id }; | |
| 85 | + } | |
| 86 | + | |
| 87 | + export function qrSvg(text) { | |
| 88 | + const q = qrcode(0, 'M'); q.addData(text); q.make(); | |
| 89 | + return q.createSvgTag({ cellSize: 6, margin: 2, scalable: true }); | |
| 90 | + } |
pay/index.html added
| 1 | + <!doctype html> | |
| 2 | + <html lang="en"> | |
| 3 | + <head> | |
| 4 | + <meta charset="utf-8"> | |
| 5 | + <meta name="viewport" content="width=device-width,initial-scale=1"> | |
| 6 | + <title>Pay | Paywell</title> | |
| 7 | + <meta name="description" content="Pay with Bitcoin by tapping phones. Shown in dollars."> | |
| 8 | + <link rel="canonical" href="https://paywell.company/pay/"> | |
| 9 | + <meta property="og:type" content="website"><meta property="og:site_name" content="Paywell"> | |
| 10 | + <meta property="og:title" content="Pay | Paywell"><meta property="og:description" content="Pay with Bitcoin by tapping phones. Shown in dollars."> | |
| 11 | + <meta property="og:url" content="https://paywell.company/pay/"><meta property="og:image" content="https://paywell.company/img/og.jpg"> | |
| 12 | + <meta name="twitter:card" content="summary_large_image"> | |
| 13 | + <meta name="theme-color" content="#0f3d2e"> | |
| 14 | + <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='9' fill='%230f3d2e'/%3E%3Ccircle cx='16' cy='14.5' r='8.5' fill='%23e0a526'/%3E%3Ccircle cx='16' cy='14.5' r='6.6' fill='none' stroke='%230f3d2e' stroke-opacity='.35' stroke-width='1'/%3E%3Cpath d='M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z' fill='%230f3d2e'/%3E%3Cpath d='M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4' fill='none' stroke='%237fd1a3' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E"> | |
| 15 | + <link rel="manifest" href="/app/manifest.webmanifest"> | |
| 16 | + <link rel="stylesheet" href="/assets/site.css"> | |
| 17 | + <meta name="robots" content="noindex"> | |
| 18 | + <link rel="stylesheet" href="/assets/rate.css"> | |
| 19 | + </head> | |
| 20 | + <body> | |
| 21 | + <a class="skip" href="#main">Skip to content</a> | |
| 22 | + <div class="wrap"> | |
| 23 | + <header class="top"><a class="brand" href="/"><svg viewBox="0 0 32 32" aria-hidden="true"><rect width="32" height="32" rx="9" fill="#0f3d2e"/><circle cx="16" cy="14.5" r="8.5" fill="#e0a526"/><circle cx="16" cy="14.5" r="6.6" fill="none" stroke="#0f3d2e" stroke-opacity=".35" stroke-width="1"/><path d="M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z" fill="#0f3d2e"/><path d="M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4" fill="none" stroke="#7fd1a3" stroke-width="2.2" stroke-linecap="round"/></svg>Paywell</a><nav class="main" aria-label="Main"><a href="/how-it-works/">How it works</a><a href="/fair-pay/">Fair pay</a><a href="/learn/">Bitcoin basics</a><a href="/rate/">Rate a visit</a><a href="/app/">Team app</a><a href="/open/">Open code</a><a href="/careers/">Careers</a></nav></header> | |
| 24 | + </div> | |
| 25 | + <main id="main"> | |
| 26 | + <div class="wrap rate"> | |
| 27 | + <p class="status">Test mode: test coins only, no real value.</p> | |
| 28 | + <section id="p-none"><h1 class="sm">Pay by tapping phones</h1><p class="lede">Hold your phone to a Paywell phone, or scan its code. This page opens with the payment ready.</p></section> | |
| 29 | + <section id="p-req" hidden> | |
| 30 | + <p class="eyebrow">Payment request</p> | |
| 31 | + <h1 class="sm" id="p-usd"></h1> | |
| 32 | + <p class="lede" id="p-for"></p> | |
| 33 | + <p class="small" id="p-btc"></p> | |
| 34 | + <div class="btns"><a class="btn" id="p-open" href="#">Pay in my Bitcoin wallet</a><button class="btn o" id="p-copy" type="button">Copy address</button></div> | |
| 35 | + <p class="small" style="margin-top:14px">The Paywell app pays with one tap and your face or fingerprint. Any Bitcoin wallet works too.</p> | |
| 36 | + <div id="p-rate" hidden class="callout" style="margin-top:28px"><b>After you pay:</b> how was your visit? No tip. A great rating raises their bonus, and the company pays it.<p style="margin:14px 0 0"><a class="btn" id="p-rate-a" href="#">Rate your visit</a></p></div> | |
| 37 | + </section> | |
| 38 | + </div> | |
| 39 | + <script src="/assets/pay.js" defer></script> | |
| 40 | + </main> | |
| 41 | + <div class="wrap"><footer class="site">Paywell <span aria-hidden="true">·</span> <a href="/careers/">Careers</a></footer></div> | |
| 42 | + </body> | |
| 43 | + </html> |
privacy/index.html added
| 1 | + <!doctype html> | |
| 2 | + <html lang="en"> | |
| 3 | + <head> | |
| 4 | + <meta charset="utf-8"> | |
| 5 | + <meta name="viewport" content="width=device-width,initial-scale=1"> | |
| 6 | + <title>Privacy | Paywell</title> | |
| 7 | + <meta name="description" content="How Paywell handles information on this site, the rating pages and the team app."> | |
| 8 | + <link rel="canonical" href="https://paywell.company/privacy/"> | |
| 9 | + <meta property="og:type" content="website"><meta property="og:site_name" content="Paywell"> | |
| 10 | + <meta property="og:title" content="Privacy | Paywell"><meta property="og:description" content="How Paywell handles information on this site, the rating pages and the team app."> | |
| 11 | + <meta property="og:url" content="https://paywell.company/privacy/"><meta property="og:image" content="https://paywell.company/img/og.jpg"> | |
| 12 | + <meta name="twitter:card" content="summary_large_image"> | |
| 13 | + <meta name="theme-color" content="#0f3d2e"> | |
| 14 | + <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='9' fill='%230f3d2e'/%3E%3Ccircle cx='16' cy='14.5' r='8.5' fill='%23e0a526'/%3E%3Ccircle cx='16' cy='14.5' r='6.6' fill='none' stroke='%230f3d2e' stroke-opacity='.35' stroke-width='1'/%3E%3Cpath d='M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z' fill='%230f3d2e'/%3E%3Cpath d='M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4' fill='none' stroke='%237fd1a3' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E"> | |
| 15 | + <link rel="manifest" href="/app/manifest.webmanifest"> | |
| 16 | + <link rel="stylesheet" href="/assets/site.css"> | |
| 17 | + </head> | |
| 18 | + <body> | |
| 19 | + <a class="skip" href="#main">Skip to content</a> | |
| 20 | + <div class="wrap"> | |
| 21 | + <header class="top"><a class="brand" href="/"><svg viewBox="0 0 32 32" aria-hidden="true"><rect width="32" height="32" rx="9" fill="#0f3d2e"/><circle cx="16" cy="14.5" r="8.5" fill="#e0a526"/><circle cx="16" cy="14.5" r="6.6" fill="none" stroke="#0f3d2e" stroke-opacity=".35" stroke-width="1"/><path d="M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z" fill="#0f3d2e"/><path d="M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4" fill="none" stroke="#7fd1a3" stroke-width="2.2" stroke-linecap="round"/></svg>Paywell</a><nav class="main" aria-label="Main"><a href="/how-it-works/">How it works</a><a href="/fair-pay/">Fair pay</a><a href="/learn/">Bitcoin basics</a><a href="/rate/">Rate a visit</a><a href="/app/">Team app</a><a href="/open/">Open code</a><a href="/careers/">Careers</a></nav></header> | |
| 22 | + </div> | |
| 23 | + <main id="main"> | |
| 24 | + <div class="wrap"><section class="prose" style="padding:24px 0 60px"> | |
| 25 | + <h1 class="sm">Privacy</h1> | |
| 26 | + <p>We keep this short because we keep very little.</p> | |
| 27 | + <h2>This website</h2> | |
| 28 | + <p>No ad trackers, no analytics scripts and no cookies for tracking. We count page views as a single number per page, with no cookies and no personal details. The site is hosted on Cloudflare, which keeps standard server logs for security.</p> | |
| 29 | + <h2>Rating pages</h2> | |
| 30 | + <p>When you rate a visit we keep the rating, any note you write, the visit it belongs to, and the time. We use basic signals such as how many ratings come from one network to stop fraud, and we don’t sell or share them. Team members see your rating and note, never your contact details.</p> | |
| 31 | + <h2>Team app</h2> | |
| 32 | + <p>Team chat messages are visible to your company’s team and kept until they’re deleted. Sign-in uses passkeys, so we never hold a password; your face or fingerprint never leaves your device.</p> | |
| 33 | + <p>For team members we keep what’s needed to pay you correctly and follow the law: pay records, bonus records, ratings, disputes, wallet activity and tax records. Payroll and money conversion are handled by licensed partners who follow their own privacy rules. Your wallet backup is locked on your phone with your passkey before it reaches us. We store it but can’t open it, and only you can get it back.</p> | |
| 34 | + <h2>Careers requests</h2> | |
| 35 | + <p>If you send a request on our Careers page, we keep your message so we can reply.</p> | |
| 36 | + <h2>Your choices</h2> | |
| 37 | + <p>You can ask us to show you, correct or delete what we hold about you, except records the law requires us to keep, such as pay and tax records.</p> | |
| 38 | + </section></div> | |
| 39 | + </main> | |
| 40 | + <div class="wrap"><footer class="site">Paywell <span aria-hidden="true">·</span> <a href="/careers/">Careers</a></footer></div> | |
| 41 | + </body> | |
| 42 | + </html> |
rate/index.html added
| 1 | + <!doctype html> | |
| 2 | + <html lang="en"> | |
| 3 | + <head> | |
| 4 | + <meta charset="utf-8"> | |
| 5 | + <meta name="viewport" content="width=device-width,initial-scale=1"> | |
| 6 | + <title>Rate your visit | Paywell</title> | |
| 7 | + <meta name="description" content="Rate a visit in seconds. No app, no account, no tip. Great ratings raise the team member’s bonus, paid by the company."> | |
| 8 | + <link rel="canonical" href="https://paywell.company/rate/"> | |
| 9 | + <meta property="og:type" content="website"><meta property="og:site_name" content="Paywell"> | |
| 10 | + <meta property="og:title" content="Rate your visit | Paywell"><meta property="og:description" content="Rate a visit in seconds. No app, no account, no tip. Great ratings raise the team member’s bonus, paid by the company."> | |
| 11 | + <meta property="og:url" content="https://paywell.company/rate/"><meta property="og:image" content="https://paywell.company/img/og.jpg"> | |
| 12 | + <meta name="twitter:card" content="summary_large_image"> | |
| 13 | + <meta name="theme-color" content="#0f3d2e"> | |
| 14 | + <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='9' fill='%230f3d2e'/%3E%3Ccircle cx='16' cy='14.5' r='8.5' fill='%23e0a526'/%3E%3Ccircle cx='16' cy='14.5' r='6.6' fill='none' stroke='%230f3d2e' stroke-opacity='.35' stroke-width='1'/%3E%3Cpath d='M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z' fill='%230f3d2e'/%3E%3Cpath d='M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4' fill='none' stroke='%237fd1a3' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E"> | |
| 15 | + <link rel="manifest" href="/app/manifest.webmanifest"> | |
| 16 | + <link rel="stylesheet" href="/assets/site.css"> | |
| 17 | + <meta name="robots" content="noindex"> | |
| 18 | + <link rel="stylesheet" href="/assets/rate.css"> | |
| 19 | + </head> | |
| 20 | + <body> | |
| 21 | + <a class="skip" href="#main">Skip to content</a> | |
| 22 | + <div class="wrap"> | |
| 23 | + <header class="top"><a class="brand" href="/"><svg viewBox="0 0 32 32" aria-hidden="true"><rect width="32" height="32" rx="9" fill="#0f3d2e"/><circle cx="16" cy="14.5" r="8.5" fill="#e0a526"/><circle cx="16" cy="14.5" r="6.6" fill="none" stroke="#0f3d2e" stroke-opacity=".35" stroke-width="1"/><path d="M16 9.6l1.5 3.1 3.4.5-2.5 2.4.6 3.4-3-1.6-3 1.6.6-3.4-2.5-2.4 3.4-.5z" fill="#0f3d2e"/><path d="M8.5 25.5c2.2 1.6 4.7 2.4 7.5 2.4s5.3-.8 7.5-2.4" fill="none" stroke="#7fd1a3" stroke-width="2.2" stroke-linecap="round"/></svg>Paywell</a><nav class="main" aria-label="Main"><a href="/how-it-works/">How it works</a><a href="/fair-pay/">Fair pay</a><a href="/learn/">Bitcoin basics</a><a href="/rate/" aria-current=page>Rate a visit</a><a href="/app/">Team app</a><a href="/open/">Open code</a><a href="/careers/">Careers</a></nav></header> | |
| 24 | + </div> | |
| 25 | + <main id="main"> | |
| 26 | + <div class="wrap rate"> | |
| 27 | + <section id="r-start"> | |
| 28 | + <p class="eyebrow">Rate your visit</p> | |
| 29 | + <h1 class="sm">Say thanks in ten seconds.</h1> | |
| 30 | + <p class="lede">No app, no account and no tip. Your rating is the thank-you.</p> | |
| 31 | + <div id="r-loading" class="callout" hidden>Checking your link…</div> | |
| 32 | + <div id="r-err" class="callout warn" role="alert" hidden></div> | |
| 33 | + <form id="r-code" class="r-codeform"> | |
| 34 | + <label for="r-code-in">Enter the code from your receipt</label> | |
| 35 | + <div class="r-row"><input id="r-code-in" name="code" autocomplete="off" autocapitalize="characters" inputmode="text" placeholder="K7Q2-M9XA" maxlength="40"><button class="btn" type="submit">Continue</button></div> | |
| 36 | + <p class="small">Or scan the QR code on your receipt, or tap the link in your text or email.</p> | |
| 37 | + </form> | |
| 38 | + <p id="r-sample-wrap"><button id="r-sample" class="btn o" type="button">Try a sample visit</button></p> | |
| 39 | + </section> | |
| 40 | + | |
| 41 | + <section id="r-form-wrap" hidden> | |
| 42 | + <p class="r-sample-badge" id="r-test" hidden>Sample visit. Nothing is recorded.</p> | |
| 43 | + <p class="eyebrow" id="r-where"></p> | |
| 44 | + <h1 class="sm" id="r-q">How was your visit?</h1> | |
| 45 | + <form id="r-form"> | |
| 46 | + <fieldset class="stars"><legend class="small">Tap a rating</legend> | |
| 47 | + <div class="r-stars" role="radiogroup"> | |
| 48 | + <label><input type="radio" name="stars" value="5"><span><b>★★★★★</b>Great</span></label> | |
| 49 | + <label><input type="radio" name="stars" value="4"><span><b>★★★★</b>Good</span></label> | |
| 50 | + <label><input type="radio" name="stars" value="3"><span><b>★★★</b>Okay</span></label> | |
| 51 | + <label><input type="radio" name="stars" value="2"><span><b>★★</b>Not good</span></label> | |
| 52 | + <label><input type="radio" name="stars" value="1"><span><b>★</b>Poor</span></label> | |
| 53 | + </div></fieldset> | |
| 54 | + <label for="r-note" class="r-notelabel">Anything you’d like to add? <span class="small">(optional)</span></label> | |
| 55 | + <textarea id="r-note" name="note" maxlength="1000" rows="3" placeholder="What stood out?"></textarea> | |
| 56 | + <div class="r-hp" aria-hidden="true"><label>Leave empty <input name="website" tabindex="-1" autocomplete="off"></label></div> | |
| 57 | + <button class="btn r-send" type="submit">Send rating</button> | |
| 58 | + <p id="r-ferr" class="r-ferr" role="alert"></p> | |
| 59 | + </form> | |
| 60 | + <p class="small">Your rating and note go to the team. Your contact details never do. <a href="/privacy/">Privacy</a></p> | |
| 61 | + </section> | |
| 62 | + | |
| 63 | + <section id="r-done" hidden> | |
| 64 | + <h1 class="sm" id="r-done-h">Thank you!</h1> | |
| 65 | + <p class="lede" id="r-done-p"></p> | |
| 66 | + <div class="callout" id="r-done-test" hidden>This was a sample, so nothing was recorded. When Paywell opens, the link on your receipt, text or email works the same way.</div> | |
| 67 | + <p class="small" style="margin-top:20px">Ratings never lower anyone’s wage, earned pay or savings. <a href="/how-it-works/#safeguards">How ratings work</a></p> | |
| 68 | + </section> | |
| 69 | + | |
| 70 | + <section class="sec r-how"> | |
| 71 | + <div class="cards"> | |
| 72 | + <div class="card"><h3>No tip, ever</h3><p>The price you paid is the whole price. Great service is rewarded by the company.</p></div> | |
| 73 | + <div class="card"><h3>Great ratings help</h3><p>A 4 or 5 star rating raises that person’s daily bonus right away.</p></div> | |
| 74 | + <div class="card"><h3>Low ratings are checked</h3><p>A 1 or 2 star rating is reviewed first, and the team member can respond.</p></div> | |
| 75 | + </div> | |
| 76 | + </section> | |
| 77 | + </div> | |
| 78 | + <script src="/assets/rate.js" defer></script> | |
| 79 | + </main> | |
| 80 | + <div class="wrap"><footer class="site">Paywell <span aria-hidden="true">·</span> <a href="/careers/">Careers</a></footer></div> | |
| 81 | + </body> | |
| 82 | + </html> |
research/img/detail.webp added
Not a text file.
research/img/hero.webp added
Not a text file.
6 more files changed.