Add 'business' profile type and category

Business accounts are cli profiles with businessAddress=True, so each connecting
customer gets their own group chat (handled via the existing chat UI) with an
optional welcome auto-reply. New BUSINESS_TYPES, a /business page + sidebar entry,
and a business variant of the create form. profile/chat pages route via a
_category helper. Adds business_test.py (customer connects -> lands in a business
group, not a direct contact) — passes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Jon
2026-06-05 17:09:00 +01:00
parent 6232c1589d
commit 609e91c6de
5 changed files with 160 additions and 11 deletions

View File

@@ -266,6 +266,7 @@
</a>
<nav class="side-nav">
<a href="/users" {% if nav_active == 'users' %}class="active"{% endif %}><span class="ico">👤</span><span class="lbl">Users</span></a>
<a href="/business" {% if nav_active == 'business' %}class="active"{% endif %}><span class="ico">💼</span><span class="lbl">Business</span></a>
<a href="/bots" {% if nav_active == 'bots' %}class="active"{% endif %}><span class="ico">🤖</span><span class="lbl">Bots</span></a>
<a href="https://simplex.chat/file/" target="_blank" rel="noopener"><span class="ico">📁</span><span class="lbl">File upload</span></a>
<a href="/notifications" class="nav-sep {% if nav_active == 'notifications' %}active{% endif %}"><span class="ico">🔔</span><span class="lbl">Notifications</span><span class="notif-badge" id="notif-badge" style="display:none;"></span></a>

View File

@@ -23,13 +23,25 @@
{% endblock %}
{% block content %}
{% set new_label = 'User' if tab == 'users' else ('Business' if tab == 'business' else 'Bot') %}
<div class="flex-between" style="margin-bottom: 24px;">
<h1 style="margin:0;">{{ tab | title }}</h1>
<button class="btn btn-primary" onclick="openCreate()">
+ New {{ 'User' if tab == 'users' else 'Bot' }}
+ New {{ new_label }}
</button>
</div>
{% if tab == 'business' %}
<div class="card bot-types-card" style="margin-bottom:24px;">
<h2 style="font-size:15px;margin-bottom:8px;">Business accounts</h2>
<p class="muted" style="font-size:13px;">
A business account uses a <strong>business address</strong>: each customer who connects gets
their own group chat (so teammates can be added). You handle those conversations here, the same
way you chat in a group. Set an optional welcome message to auto-greet new customers.
</p>
</div>
{% endif %}
{% if tab == 'bots' %}
<div class="card bot-types-card" style="margin-bottom:24px;">
<h2 style="font-size:15px;margin-bottom:12px;">Available bot types</h2>
@@ -87,6 +99,9 @@
{% if tab == 'users' %}
<strong>No users yet</strong>
<p>Create a SimpleX user account to manage contacts and channels.</p>
{% elif tab == 'business' %}
<strong>No business accounts yet</strong>
<p>Create a business account; each customer who connects gets their own group chat.</p>
{% else %}
<strong>No bots yet</strong>
<p>Bots can echo messages, broadcast to subscribers, or run automated tasks.</p>
@@ -96,11 +111,11 @@
<!-- Create dialog -->
<dialog id="create-dialog">
<h2 style="margin-bottom:20px;">New {{ 'User' if tab == 'users' else 'Bot' }}</h2>
<h2 style="margin-bottom:20px;">New {{ new_label }}</h2>
<form id="create-form">
<div class="field">
<label>Name</label>
<input type="text" name="name" placeholder="{{ 'Alice' if tab == 'users' else 'My Bot' }}" required>
<input type="text" name="name" placeholder="{{ 'Alice' if tab == 'users' else ('Acme Inc' if tab == 'business' else 'My Bot') }}" required>
</div>
<div class="field">
<label>Bio / Description <span class="muted" style="font-weight:400;">(optional)</span></label>
@@ -113,6 +128,12 @@
<input type="file" name="avatar_file" accept="image/*" onchange="onAvatarChange(this)" style="flex:1;">
</div>
</div>
{% if tab == 'business' %}
<div class="field">
<label>Welcome Message <span class="muted" style="font-weight:400;">(optional auto-reply to new customers)</span></label>
<input type="text" name="welcome_message" placeholder="Thanks for reaching out! How can we help?">
</div>
{% endif %}
{% if tab == 'bots' %}
<div class="field">
<label>Bot Type</label>