Guest copy: $5 -> $2 credit in panel invite/requests/guest rows

This commit is contained in:
inference-bot committed 2026-11-08 20:14:42 +00:00
1 parent 3e83139393
commit 7f48caf8fe
1 file changed
+7 -7
+7 -7
View File
@@ -543,7 +543,7 @@ PAGE_HTML = """<!DOCTYPE html>
<div id="guest-invite-section"> <div id="guest-invite-section">
<div class="guest-invite-card"> <div class="guest-invite-card">
<h3 class="guest-invite-title">Invite a guest</h3> <h3 class="guest-invite-title">Invite a guest</h3>
<p class="guest-invite-sub">Sends $5 of credits and 60 days of chat + dashboard access. The invitation comes from the co-op (admin) — no monthly cap.</p> <p class="guest-invite-sub">Sends $2 of credits and 60 days of chat + dashboard access. The invitation comes from the co-op (admin) — no monthly cap.</p>
<form class="guest-invite-form" id="guest-invite-form" onsubmit="sendGuestAccess(event)"> <form class="guest-invite-form" id="guest-invite-form" onsubmit="sendGuestAccess(event)">
<label class="guest-invite-label" for="guest-email">Their email</label> <label class="guest-invite-label" for="guest-email">Their email</label>
<input id="guest-email" type="email" required placeholder="friend@example.com" autocomplete="off" inputmode="email" maxlength="254" /> <input id="guest-email" type="email" required placeholder="friend@example.com" autocomplete="off" inputmode="email" maxlength="254" />
@@ -624,7 +624,7 @@ PAGE_HTML = """<!DOCTYPE html>
<div id="guestrequests-section" style="display:none;"> <div id="guestrequests-section" style="display:none;">
<h3 style="margin:20px 0 8px;">Pending guest requests</h3> <h3 style="margin:20px 0 8px;">Pending guest requests</h3>
<p style="color:var(--muted);font-size:12px;margin:0 0 8px;">Member-initiated guest invitations waiting for a decision. Approve runs the full guest pipeline ($5 credit, 60-day box, invitation email naming the inviting member); nothing has gone to the recipient before approval. Reject tells the inviting member 'not approved' in their own dashboard trail.</p> <p style="color:var(--muted);font-size:12px;margin:0 0 8px;">Member-initiated guest invitations waiting for a decision. Approve runs the full guest pipeline ($2 credit, 60-day box, invitation email naming the inviting member); nothing has gone to the recipient before approval. Reject tells the inviting member 'not approved' in their own dashboard trail.</p>
<div class="table-scroll"> <div class="table-scroll">
<table id="table-guestrequests"> <table id="table-guestrequests">
<thead> <thead>
@@ -1394,7 +1394,7 @@ function renderMembers() {
const src = m.account_type === 'guest' const src = m.account_type === 'guest'
? '<span class="pill guest" title="' + esc('Guest account — from ' + (m.guest_inviter || '?') + ? '<span class="pill guest" title="' + esc('Guest account — from ' + (m.guest_inviter || '?') +
' · expires ' + (m.guest_expires_at ? String(m.guest_expires_at).slice(0, 10) : '?') + ' · expires ' + (m.guest_expires_at ? String(m.guest_expires_at).slice(0, 10) : '?') +
' · $5 credit, no OC membership, never swept for dues') + '">guest</span>' ' · $2 credit, no OC membership, never swept for dues') + '">guest</span>'
: (m.manual : (m.manual
? '<span class="pill manual" title="Manual member (no OC subscription; exempt from sweep)">manual</span>' ? '<span class="pill manual" title="Manual member (no OC subscription; exempt from sweep)">manual</span>'
: '<span class="pill active" title="Open Collective Membership subscription">OC</span>'); : '<span class="pill active" title="Open Collective Membership subscription">OC</span>');
@@ -1545,7 +1545,7 @@ async function addBalance(email) {
} catch (e) { flash(e.message, false); } } catch (e) { flash(e.message, false); }
} }
// Guest action: provision a $5 guest account — the standard guest-invite form // Guest action: provision a $2 guest account — the standard guest-invite form
// (the guest's email, required, plus an OPTIONAL display name; if left empty // (the guest's email, required, plus an OPTIONAL display name; if left empty
// the guest sets their own at Cloudron setup and the invitation greets // the guest sets their own at Cloudron setup and the invitation greets
// neutrally). The inviter is always the co-op's ADMIN account, recorded by // neutrally). The inviter is always the co-op's ADMIN account, recorded by
@@ -1609,7 +1609,7 @@ function grPill(status) {
active: ['active', 'guest', 'Guest account live'], active: ['active', 'guest', 'Guest account live'],
converted:['converted', 'manual', 'The guest became a member'], converted:['converted', 'manual', 'The guest became a member'],
expired: ['expired', 'inactive', 'Time box ran out'], expired: ['expired', 'inactive', 'Time box ran out'],
depleted: ['depleted', 'inactive', 'The $5 credit was spent'], depleted: ['depleted', 'inactive', 'The $2 credit was spent'],
'cancelled by recipient': ['cancelled', 'inactive', 'Ended at the recipient\u2019s own request'], 'cancelled by recipient': ['cancelled', 'inactive', 'Ended at the recipient\u2019s own request'],
}; };
const [label, cls, title] = map[status] || [status || '—', 'grace', '']; const [label, cls, title] = map[status] || [status || '—', 'grace', ''];
@@ -1671,13 +1671,13 @@ async function loadGuestRequests() {
} }
async function approveGuestRequest(id, btn) { async function approveGuestRequest(id, btn) {
if (!window.confirm('Approve this guest request? The account is created, the $5 credit is granted and the invitation email goes out to the recipient.')) return; if (!window.confirm('Approve this guest request? The account is created, the $2 credit is granted and the invitation email goes out to the recipient.')) return;
btn.disabled = true; btn.disabled = true;
try { try {
const r = await fetch('/api/guest-requests/' + id + '/approve', { method: 'POST' }); const r = await fetch('/api/guest-requests/' + id + '/approve', { method: 'POST' });
const d = await r.json().catch(() => ({})); const d = await r.json().catch(() => ({}));
if (!r.ok || d.error) { flash(d.error || ('Approval failed (' + r.status + ')'), false); } if (!r.ok || d.error) { flash(d.error || ('Approval failed (' + r.status + ')'), false); }
else { flash('Approved — ' + d.recipient + ' is provisioned ($5 credit, ' + (d.expires_in_days || 60) + '-day box). The invitation email is on its way.', true); } else { flash('Approved — ' + d.recipient + ' is provisioned ($2 credit, ' + (d.expires_in_days || 60) + '-day box). The invitation email is on its way.', true); }
} catch (e) { flash('Approval failed: ' + e.message, false); } } catch (e) { flash('Approval failed: ' + e.message, false); }
await loadGuestRequests(); await loadGuestRequests();
load(); // a new guest row changes the guests list + counts load(); // a new guest row changes the guests list + counts