human hand off
This commit is contained in:
parent
d0fee5c8f7
commit
7af776196a
34 changed files with 2941 additions and 195 deletions
|
|
@ -28,23 +28,25 @@ export default function HumanHandoffDrawer({
|
|||
onSave,
|
||||
onTest,
|
||||
}) {
|
||||
const [ruleName, setRuleName] = useState("");
|
||||
const [priority, setPriority] = useState(0);
|
||||
const [ownerEmail, setOwnerEmail] = useState("");
|
||||
const [labels, setLabels] = useState([]);
|
||||
const [emailTypes, setEmailTypes] = useState([]);
|
||||
const [instructions, setInstructions] = useState("");
|
||||
const [allowReplies, setAllowReplies] = useState(true);
|
||||
const [replyAs, setReplyAs] = useState("agent");
|
||||
const [active, setActive] = useState(true);
|
||||
const [labelQuery, setLabelQuery] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
setRuleName(rule?.name || "");
|
||||
setPriority(rule?.priority ?? 0);
|
||||
setOwnerEmail(rule?.owner_email || "");
|
||||
setLabels(rule?.labels || []);
|
||||
setEmailTypes(rule?.email_types || []);
|
||||
setInstructions(rule?.instructions || "");
|
||||
setAllowReplies(rule?.allow_replies ?? true);
|
||||
setReplyAs(rule?.reply_as || "agent");
|
||||
setActive(rule?.active ?? true);
|
||||
setLabelQuery("");
|
||||
}, [open, rule]);
|
||||
|
|
@ -124,6 +126,30 @@ export default function HumanHandoffDrawer({
|
|||
</header>
|
||||
|
||||
<div className="handoff-drawer-body">
|
||||
<section className="handoff-form-section">
|
||||
<h3>Rule</h3>
|
||||
<label className="handoff-field-label" htmlFor="handoff-rule-name">Rule name</label>
|
||||
<input
|
||||
id="handoff-rule-name"
|
||||
className="handoff-text-input"
|
||||
value={ruleName}
|
||||
maxLength={120}
|
||||
placeholder="Finance approvals"
|
||||
onChange={(event) => setRuleName(event.target.value)}
|
||||
/>
|
||||
<label className="handoff-field-label" htmlFor="handoff-rule-priority">Priority</label>
|
||||
<input
|
||||
id="handoff-rule-priority"
|
||||
className="handoff-text-input"
|
||||
type="number"
|
||||
min="0"
|
||||
max="10000"
|
||||
value={priority}
|
||||
onChange={(event) => setPriority(Number(event.target.value) || 0)}
|
||||
/>
|
||||
<p className="handoff-helper">When multiple rules match, the lowest priority number wins.</p>
|
||||
</section>
|
||||
|
||||
<section className="handoff-form-section">
|
||||
<h3>Human owner</h3>
|
||||
<label className="handoff-field-label" htmlFor="handoff-owner-email">Owner email address</label>
|
||||
|
|
@ -244,31 +270,9 @@ export default function HumanHandoffDrawer({
|
|||
onChange={setAllowReplies}
|
||||
/>
|
||||
<p className="handoff-helper">
|
||||
Saved for future use. Human reply handling is not active yet — all email uses the normal Gentic inbox and outbox.
|
||||
A reply from this Human Owner is stored in Handoff Inbox and relayed through the
|
||||
original Gentic address. Their private address is never exposed.
|
||||
</p>
|
||||
{allowReplies && (
|
||||
<div className="handoff-reply-as">
|
||||
<strong>Replies will be sent as</strong>
|
||||
<label>
|
||||
<input
|
||||
type="radio"
|
||||
name="reply-as"
|
||||
checked={replyAs === "agent"}
|
||||
onChange={() => setReplyAs("agent")}
|
||||
/>
|
||||
<span>Original AGMail address</span>
|
||||
</label>
|
||||
<label>
|
||||
<input
|
||||
type="radio"
|
||||
name="reply-as"
|
||||
checked={replyAs === "human"}
|
||||
onChange={() => setReplyAs("human")}
|
||||
/>
|
||||
<span>Human's email address</span>
|
||||
</label>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
|
||||
<section className="handoff-form-section">
|
||||
|
|
@ -294,14 +298,16 @@ export default function HumanHandoffDrawer({
|
|||
<button
|
||||
type="button"
|
||||
className="handoff-btn primary"
|
||||
disabled={saving || !ownerEmail.trim()}
|
||||
disabled={saving || !ruleName.trim() || !ownerEmail.trim()}
|
||||
onClick={() => onSave({
|
||||
name: ruleName.trim(),
|
||||
priority,
|
||||
owner_email: ownerEmail.trim(),
|
||||
labels,
|
||||
email_types: emailTypes,
|
||||
instructions: instructions.trim(),
|
||||
allow_replies: allowReplies,
|
||||
reply_as: replyAs,
|
||||
reply_as: "agent",
|
||||
active,
|
||||
})}
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue