@fayz-ai/plugin-support 0.2.20 → 0.3.0-canary.20261027153628
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{HelpdeskConsole-XWHLJTOM.js → HelpdeskConsole-HVRQUQQA.js} +8 -7
- package/dist/HelpdeskConsole-HVRQUQQA.js.map +1 -0
- package/dist/{chunk-5K7VA5VP.js → chunk-GZCHLBT2.js} +11 -4
- package/dist/chunk-GZCHLBT2.js.map +1 -0
- package/dist/components/HelpdeskStatusPanel.d.ts.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -8
- package/dist/index.js.map +1 -1
- package/dist/lib/console-path.d.ts +3 -0
- package/dist/lib/console-path.d.ts.map +1 -0
- package/dist/views/HelpdeskConsole.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/HelpdeskConsole-XWHLJTOM.js.map +0 -1
- package/dist/chunk-5K7VA5VP.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isOperator, consoleListRequests, consoleDetail, consoleSetStatus, consoleSetPriority, consoleReply } from './chunk-
|
|
1
|
+
import { isOperator, consoleListRequests, helpdeskConsolePath, consoleDetail, consoleSetStatus, consoleSetPriority, consoleReply } from './chunk-GZCHLBT2.js';
|
|
2
2
|
import { PRIORITY_ORDER, PRIORITY_LABEL, PRIORITY_TONE, STATUS_LABEL, STATUS_TONE, KIND_LABEL, eventLine, signedUrl } from './chunk-7NVBUXTX.js';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Skeleton, Input, Badge, SubpageHeader, Button, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Textarea, ICON_MAP, ModalTask, Thumbnail, toast } from '@fayz-ai/ui';
|
|
@@ -63,7 +63,8 @@ function ticketNo(n) {
|
|
|
63
63
|
function useConsoleRoute() {
|
|
64
64
|
const read = () => {
|
|
65
65
|
if (typeof window === "undefined") return null;
|
|
66
|
-
const
|
|
66
|
+
const base = helpdeskConsolePath().replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
|
|
67
|
+
const m = currentAppPath().match(new RegExp(`^${base}/([^/?]+)`));
|
|
67
68
|
return m ? decodeURIComponent(m[1]) : null;
|
|
68
69
|
};
|
|
69
70
|
const [id, setId] = React.useState(read);
|
|
@@ -126,7 +127,7 @@ function ConsoleListView() {
|
|
|
126
127
|
/* @__PURE__ */ jsx(Badge, { variant: PRIORITY_TONE[g.priority], children: PRIORITY_LABEL[g.priority] }),
|
|
127
128
|
/* @__PURE__ */ jsx("span", { className: "text-[11px] text-muted-foreground", children: g.items.length })
|
|
128
129
|
] }),
|
|
129
|
-
g.items.map((r) => /* @__PURE__ */ jsx(TicketRow, { req: r, onClick: () => go(
|
|
130
|
+
g.items.map((r) => /* @__PURE__ */ jsx(TicketRow, { req: r, onClick: () => go(`${helpdeskConsolePath()}/${r.id}`) }, r.id))
|
|
130
131
|
] }, g.priority)) })
|
|
131
132
|
] });
|
|
132
133
|
}
|
|
@@ -151,7 +152,7 @@ function ConsoleTicketPage({ id }) {
|
|
|
151
152
|
SubpageHeader,
|
|
152
153
|
{
|
|
153
154
|
parentLabel: "Central de Chamados",
|
|
154
|
-
onBack: () => go(
|
|
155
|
+
onBack: () => go(helpdeskConsolePath()),
|
|
155
156
|
title: ready ? `Ticket ${ticketNo(detail.number)}` : "Ticket",
|
|
156
157
|
subtitle: ready ? detail.tenantName ?? void 0 : void 0,
|
|
157
158
|
titleTrailing: ready ? /* @__PURE__ */ jsx(Badge, { variant: STATUS_TONE[detail.status], children: STATUS_LABEL[detail.status] }) : void 0
|
|
@@ -162,7 +163,7 @@ function ConsoleTicketPage({ id }) {
|
|
|
162
163
|
/* @__PURE__ */ jsx(Skeleton, { className: "h-40 w-full" })
|
|
163
164
|
] }) : ready ? /* @__PURE__ */ jsx(OperatorDetail, { detail, onApplied: (d) => d && setDetail(d) }) : /* @__PURE__ */ jsxs("div", { className: "rounded-xl border bg-card p-10 text-center", children: [
|
|
164
165
|
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: "Chamado n\xE3o encontrado" }),
|
|
165
|
-
/* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => go(
|
|
166
|
+
/* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => go(helpdeskConsolePath()), children: "Voltar" }) })
|
|
166
167
|
] })
|
|
167
168
|
] });
|
|
168
169
|
}
|
|
@@ -351,5 +352,5 @@ function AttachmentCard({ att }) {
|
|
|
351
352
|
var HelpdeskConsole_default = HelpdeskConsole;
|
|
352
353
|
|
|
353
354
|
export { HelpdeskConsole, HelpdeskConsole_default as default };
|
|
354
|
-
//# sourceMappingURL=HelpdeskConsole-
|
|
355
|
-
//# sourceMappingURL=HelpdeskConsole-
|
|
355
|
+
//# sourceMappingURL=HelpdeskConsole-HVRQUQQA.js.map
|
|
356
|
+
//# sourceMappingURL=HelpdeskConsole-HVRQUQQA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/fix-prompt.ts","../src/views/HelpdeskConsole.tsx"],"names":[],"mappings":";;;;;;;;AA+BO,SAAS,cAAA,CAAe,QAAwB,OAAA,EAA0B;AAC/E,EAAA,MAAM,QAAkB,EAAC;AACzB,EAAA,MAAM,GAAA,GAAM,OAAA,EAAS,IAAA,EAAK,IAAK,cAAA;AAC/B,EAAA,KAAA,CAAM,IAAA,CAAK,CAAA,mCAAA,EAAsC,GAAG,CAAA,CAAA,CAAG,CAAA;AACvD,EAAA,KAAA,CAAM,KAAK,EAAE,CAAA;AACb,EAAA,KAAA,CAAM,IAAA,CAAK,WAAW,MAAA,CAAO,MAAA,CAAO,MAAM,CAAA,CAAE,QAAA,CAAS,GAAG,GAAG,CAAC,SAAM,UAAA,CAAW,MAAA,CAAO,IAAI,CAAC,CAAA,cAAA,EAAc,aAAa,M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CAAA;AAAA,EAC/B,GAAG,CAAC,GAAA,CAAI,WAAA,EAAa,GAAA,CAAI,WAAW,CAAC,CAAA;AACrC,EAAA,uBACE,IAAA,CAAC,GAAA,EAAA,EAAE,IAAA,EAAM,GAAA,IAAO,MAAA,EAAW,QAAO,QAAA,EAAS,GAAA,EAAI,YAAA,EAAa,SAAA,EAAU,sEAAA,EACnE,QAAA,EAAA;AAAA,IAAA,GAAA,mBAAM,GAAA,CAAC,SAAA,EAAA,EAAU,GAAA,EAAK,GAAA,EAAK,KAAK,GAAA,CAAI,IAAA,EAAM,SAAA,EAAU,gCAAA,EAAiC,CAAA,mBAAK,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,iGAAgG,QAAA,EAAA,OAAA,EAAK,CAAA;AAAA,oBAC/M,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,gCAAA,EAAkC,cAAI,IAAA,EAAK;AAAA,GAAA,EAC7D,CAAA;AAEJ;AAEA,IAAO,uBAAA,GAAQ","file":"HelpdeskConsole-HVRQUQQA.js","sourcesContent":["import type { SupportKind, SupportStatus, SupportMessage, SupportEvent, SupportAttachment } from '../types'\nimport { KIND_LABEL, STATUS_LABEL, eventLine } from './vocabulary'\n\n/** The fields the prompt needs — satisfied by both the requester's\n * SupportRequestDetail and the operator's ConsoleDetail. */\nexport interface FixPromptInput {\n number: number\n kind: SupportKind\n status: SupportStatus\n subject: string | null\n description: string\n route: string | null\n screenSnapshot: Record<string, unknown>\n messages: SupportMessage[]\n events: SupportEvent[]\n attachments: SupportAttachment[]\n /** The store (tenant) the ticket is from, and the user who reported it — so a\n * coding agent can resolve the exact account and reproduce against it. */\n tenantId?: string\n createdBy?: string\n}\n\n/**\n * The prompt an operator copies into Claude to go fix a reported issue.\n *\n * It carries everything Claude needs to find the cause without a second\n * round-trip: which app and screen, the user's own words, the trail of routes\n * and buttons that led to it, and the conversation so far. English scaffolding\n * (it is read by a coding agent) around the user's pt-BR text (left verbatim —\n * the exact words are the bug report).\n */\nexport function buildFixPrompt(detail: FixPromptInput, appName?: string): string {\n const lines: string[] = []\n const app = appName?.trim() || 'the Fayz app'\n lines.push(`Fix an issue reported by a user of ${app}.`)\n lines.push('')\n lines.push(`Ticket #${String(detail.number).padStart(4, '0')} · ${KIND_LABEL[detail.kind]} · status: ${STATUS_LABEL[detail.status]}`)\n if (detail.route) lines.push(`Screen / route: ${detail.route}`)\n // Ids so a coding agent can resolve the exact account and reproduce/test\n // against it (the store's tenant, and the user who reported it).\n if (detail.tenantId) lines.push(`Tenant (store) id: ${detail.tenantId}`)\n if (detail.createdBy) lines.push(`Reported by user id: ${detail.createdBy}`)\n lines.push('')\n lines.push('PROBLEM (in the user\\'s own words):')\n // Skip the subject when it just repeats the description (the assistant often\n // derives one from the other).\n const subject = detail.subject?.trim()\n const description = detail.description.trim()\n if (subject && !description.toLowerCase().startsWith(subject.toLowerCase())) lines.push(subject)\n lines.push(description)\n\n const activity = (detail.screenSnapshot?.activity ?? null) as Array<{ kind?: string; label?: string; path?: string }> | null\n if (Array.isArray(activity) && activity.length) {\n lines.push('')\n lines.push('WHAT THE USER DID BEFORE REPORTING (most recent last):')\n for (const e of activity) {\n if (!e?.label) continue\n lines.push(e.kind === 'action' ? `- clicked \"${e.label}\"` : `- opened ${e.label}${e.path ? ` (${e.path})` : ''}`)\n }\n }\n\n if (detail.attachments.length) {\n lines.push('')\n lines.push(`ATTACHMENTS: ${detail.attachments.map((a) => a.name).join(', ')} (screenshots of the problem).`)\n }\n\n if (detail.messages.length) {\n lines.push('')\n lines.push('CONVERSATION WITH THE TEAM:')\n for (const m of detail.messages) {\n lines.push(`- ${m.authorKind === 'team' ? 'Team' : 'User'}: ${m.body}`)\n }\n }\n\n if (detail.events.length) {\n lines.push('')\n lines.push('HISTORY:')\n for (const ev of detail.events) lines.push(`- ${eventLine(ev.type, ev.note)}`)\n }\n\n lines.push('')\n lines.push(\n 'Investigate the code path behind this screen in the Fayz SDK (and the app that renders it), ' +\n 'find the root cause, and propose a concrete fix. If you need to reproduce it, follow the trail above.',\n )\n return lines.join('\\n')\n}\n","import React from 'react'\nimport { helpdeskConsolePath } from '../lib/console-path'\nimport {\n Button, Badge, Input, Textarea, Skeleton, Thumbnail, ModalTask, toast,\n Select, SelectTrigger, SelectValue, SelectContent, SelectItem, ICON_MAP, SubpageHeader,\n} from '@fayz-ai/ui'\nimport {\n consoleListRequests, consoleDetail, consoleSetStatus, consoleSetPriority,\n consoleReply, isOperator,\n type ConsoleRequest, type ConsoleDetail,\n} from '../data/console'\nimport { signedUrl } from '../data/api'\nimport {\n KIND_LABEL, STATUS_LABEL, STATUS_TONE, PRIORITY_LABEL, PRIORITY_TONE, PRIORITY_ORDER, eventLine,\n} from '../lib/vocabulary'\nimport { buildFixPrompt } from '../lib/fix-prompt'\nimport type { SupportStatus, SupportPriority, SupportAttachment } from '../types'\nimport { navigateApp, currentAppPath, onAppPathChange } from '@fayz-ai/core'\n\nconst STATUS_OPTIONS: SupportStatus[] = ['received', 'in_service', 'waiting_you', 'in_development', 'resolved_check', 'closed', 'cancelled']\nconst OPEN_STATUSES: SupportStatus[] = ['received', 'in_service', 'waiting_you', 'in_development', 'resolved_check']\n\n/** Hash navigation, without reaching into the shell's private routing. */\nfunction go(path: string) { if (typeof window !== 'undefined') navigateApp(path) }\n\nfunction ticketNo(n: number): string { return `#${String(n).padStart(4, '0')}` }\n\n/** The ticket id when the route is #/support/console/<id>, else null. */\nfunction useConsoleRoute(): string | null {\n const read = () => {\n if (typeof window === 'undefined') return null\n const base = helpdeskConsolePath().replace(/[.*+?^${}()|[\\]\\\\/]/g, '\\\\$&')\n const m = currentAppPath().match(new RegExp(`^${base}/([^/?]+)`))\n return m ? decodeURIComponent(m[1]!) : null\n }\n const [id, setId] = React.useState<string | null>(read)\n React.useEffect(() => {\n const on = () => setId(read())\n return onAppPathChange(on)\n }, [])\n return id\n}\n\n/**\n * The GoControl helpdesk console (Zendesk/Intercom-style). An operator reads and\n * acts on the support requests of EVERY tenant through the support_console_* RPCs.\n * The triage list lives at #/support/console; clicking a card opens the ticket as\n * its own nested page (#/support/console/<id>) with a \"← Voltar\" header.\n */\nexport function HelpdeskConsole() {\n const [operator, setOperator] = React.useState<boolean | null>(null)\n React.useEffect(() => { void isOperator().then(setOperator) }, [])\n const ticketId = useConsoleRoute()\n\n if (operator === false) {\n return (\n <div className=\"rounded-xl border bg-card p-10 text-center\">\n <p className=\"text-sm font-medium\">Acesso restrito</p>\n <p className=\"mt-1 text-sm text-muted-foreground\">A Central de Chamados é para operadores do suporte.</p>\n </div>\n )\n }\n if (operator === null) return <div className=\"space-y-3\"><Skeleton className=\"h-20 w-full\" /><Skeleton className=\"h-20 w-full\" /></div>\n return ticketId ? <ConsoleTicketPage id={ticketId} /> : <ConsoleListView />\n}\n\nfunction ConsoleListView() {\n const [requests, setRequests] = React.useState<ConsoleRequest[]>([])\n const [loading, setLoading] = React.useState(true)\n const [onlyOpen, setOnlyOpen] = React.useState(true)\n const [search, setSearch] = React.useState('')\n\n React.useEffect(() => {\n let alive = true\n setLoading(true)\n consoleListRequests(onlyOpen ? OPEN_STATUSES : undefined, search)\n .then((r) => { if (alive) setRequests(r) })\n .catch(() => { if (alive) setRequests([]) })\n .finally(() => { if (alive) setLoading(false) })\n return () => { alive = false }\n }, [onlyOpen, search])\n\n const grouped = PRIORITY_ORDER\n .map((p) => ({ priority: p, items: requests.filter((r) => r.priority === p) }))\n .filter((g) => g.items.length > 0)\n\n return (\n <div className=\"mx-auto flex max-w-3xl flex-col gap-3\">\n <Input value={search} onChange={(e) => setSearch(e.target.value)} placeholder=\"Buscar chamado ou loja…\" />\n <div className=\"flex items-center gap-2 text-xs\">\n <button onClick={() => setOnlyOpen(true)} className={`rounded-full px-3 py-1 ${onlyOpen ? 'bg-foreground text-background' : 'bg-muted text-muted-foreground'}`}>Em aberto</button>\n <button onClick={() => setOnlyOpen(false)} className={`rounded-full px-3 py-1 ${!onlyOpen ? 'bg-foreground text-background' : 'bg-muted text-muted-foreground'}`}>Todos</button>\n <span className=\"ml-auto text-muted-foreground\">{requests.length} chamado(s)</span>\n </div>\n\n <div className=\"flex flex-col gap-4\">\n {loading ? (\n [0, 1, 2].map((i) => <Skeleton key={i} className=\"h-16 w-full\" />)\n ) : requests.length === 0 ? (\n <div className=\"rounded-xl border bg-card p-8 text-center text-sm text-muted-foreground\">Nenhum chamado por aqui.</div>\n ) : (\n grouped.map((g) => (\n <div key={g.priority} className=\"flex flex-col gap-1.5\">\n <div className=\"flex items-center gap-2 px-1\">\n <Badge variant={PRIORITY_TONE[g.priority]}>{PRIORITY_LABEL[g.priority]}</Badge>\n <span className=\"text-[11px] text-muted-foreground\">{g.items.length}</span>\n </div>\n {g.items.map((r) => (\n <TicketRow key={r.id} req={r} onClick={() => go(`${helpdeskConsolePath()}/${r.id}`)} />\n ))}\n </div>\n ))\n )}\n </div>\n </div>\n )\n}\n\n/** The ticket as its own nested page: \"← Voltar\" + full detail and actions. */\nfunction ConsoleTicketPage({ id }: { id: string }) {\n const [detail, setDetail] = React.useState<ConsoleDetail | null>(null)\n const [loading, setLoading] = React.useState(true)\n\n React.useEffect(() => {\n let alive = true\n setLoading(true)\n consoleDetail(id).then((d) => { if (alive) setDetail(d) }).finally(() => { if (alive) setLoading(false) })\n return () => { alive = false }\n }, [id])\n\n const ready = detail && detail.id === id\n\n return (\n <div className=\"flex flex-col gap-4\">\n <SubpageHeader\n parentLabel=\"Central de Chamados\"\n onBack={() => go(helpdeskConsolePath())}\n title={ready ? `Ticket ${ticketNo(detail.number)}` : 'Ticket'}\n subtitle={ready ? (detail.tenantName ?? undefined) : undefined}\n titleTrailing={ready ? <Badge variant={STATUS_TONE[detail.status]}>{STATUS_LABEL[detail.status]}</Badge> : undefined}\n />\n {loading && !ready ? (\n <div className=\"space-y-3\"><Skeleton className=\"h-28 w-full\" /><Skeleton className=\"h-40 w-full\" /></div>\n ) : ready ? (\n <OperatorDetail detail={detail} onApplied={(d) => d && setDetail(d)} />\n ) : (\n <div className=\"rounded-xl border bg-card p-10 text-center\">\n <p className=\"text-sm font-medium\">Chamado não encontrado</p>\n <div className=\"mt-4\"><Button variant=\"outline\" onClick={() => go(helpdeskConsolePath())}>Voltar</Button></div>\n </div>\n )}\n </div>\n )\n}\n\nfunction TicketRow({ req, onClick }: { req: ConsoleRequest; onClick: () => void }) {\n return (\n <button\n onClick={onClick}\n className=\"flex w-full flex-col gap-1 rounded-lg border bg-card p-3 text-left transition-colors hover:border-primary/40 hover:bg-accent\"\n >\n <div className=\"flex items-center justify-between gap-2 text-[11px] text-muted-foreground\">\n <span className=\"truncate font-medium text-foreground\">{req.tenantName ?? 'Loja'}</span>\n <span>{ticketNo(req.number)}</span>\n </div>\n <div className=\"truncate text-sm\">{req.subject || KIND_LABEL[req.kind]}</div>\n <div className=\"flex items-center gap-1.5\">\n <Badge variant={STATUS_TONE[req.status]}>{STATUS_LABEL[req.status]}</Badge>\n {req.createdByName && <span className=\"truncate text-[11px] text-muted-foreground\">por {req.createdByName}</span>}\n {req.messageCount > 0 && <span className=\"ml-auto text-[11px] text-muted-foreground\">{req.messageCount} msg</span>}\n </div>\n </button>\n )\n}\n\nfunction OperatorDetail({ detail, onApplied }: { detail: ConsoleDetail; onApplied: (d: ConsoleDetail | null) => void }) {\n const [busy, setBusy] = React.useState(false)\n const [reply, setReply] = React.useState('')\n\n React.useEffect(() => { setReply('') }, [detail.id])\n\n async function run(fn: () => Promise<ConsoleDetail | null>, okMsg: string) {\n setBusy(true)\n try { onApplied(await fn()); toast.success(okMsg) }\n catch (e) { toast.error((e as Error)?.message ?? 'Não consegui aplicar.') }\n finally { setBusy(false) }\n }\n\n const activity = (detail.screenSnapshot?.activity ?? null) as Array<{ kind?: string; label?: string; path?: string }> | null\n\n return (\n // Two columns, like the CRM deal card: the ticket and its controls on the\n // left, the conversation and the activity feed on the right.\n <div className=\"grid gap-5 lg:grid-cols-2 lg:items-start\">\n {/* ── LEFT: the ticket + operator controls ───────────────────────── */}\n <div className=\"flex flex-col gap-4\">\n <section className=\"rounded-xl border bg-card p-5\">\n <h1 className=\"text-lg font-semibold leading-snug\">{detail.subject || KIND_LABEL[detail.kind]}</h1>\n <p className=\"mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground\">\n <span>{KIND_LABEL[detail.kind]}</span>\n <Badge variant={PRIORITY_TONE[detail.priority]}>{PRIORITY_LABEL[detail.priority]}</Badge>\n <span>· aberto por <span className=\"font-medium text-foreground\">{detail.createdByName ?? '—'}</span></span>\n </p>\n <p className=\"mt-3 whitespace-pre-wrap text-sm leading-relaxed\">{detail.description}</p>\n {detail.route && <p className=\"mt-2 text-xs text-muted-foreground\">Tela: <span className=\"font-mono\">{detail.route}</span></p>}\n {detail.attachments.length > 0 && (\n <div className=\"mt-3 flex flex-wrap gap-2\">\n {detail.attachments.map((a) => <AttachmentCard key={a.id} att={a} />)}\n </div>\n )}\n {Array.isArray(activity) && activity.length > 0 && (\n <div className=\"mt-3 border-t pt-3 text-xs\">\n <div className=\"mb-1 text-muted-foreground\">Trilha até o relato</div>\n <ol className=\"space-y-0.5\">\n {activity.map((e, i) => (\n <li key={i}>{e.kind === 'action' ? <>clicou <span className=\"font-medium\">\"{e.label}\"</span></> : <><span className=\"font-medium\">{e.label}</span> {e.path && <span className=\"font-mono text-[10px] text-muted-foreground\">{e.path}</span>}</>}</li>\n ))}\n </ol>\n </div>\n )}\n </section>\n\n <div className=\"rounded-xl border bg-card p-4\">\n <h2 className=\"mb-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground\">Andamento</h2>\n <label className=\"mb-1 block text-xs text-muted-foreground\">Status</label>\n <Select value={detail.status} onValueChange={(v) => run(() => consoleSetStatus(detail.id, v as SupportStatus), 'Status atualizado')} disabled={busy}>\n <SelectTrigger><SelectValue /></SelectTrigger>\n <SelectContent>\n {STATUS_OPTIONS.map((s) => <SelectItem key={s} value={s}>{STATUS_LABEL[s]}</SelectItem>)}\n </SelectContent>\n </Select>\n <label className=\"mb-1 mt-3 block text-xs text-muted-foreground\">Prioridade</label>\n <Select value={detail.priority} onValueChange={(v) => run(() => consoleSetPriority(detail.id, v as SupportPriority), 'Prioridade atualizada')} disabled={busy}>\n <SelectTrigger><SelectValue /></SelectTrigger>\n <SelectContent>\n {PRIORITY_ORDER.map((p) => <SelectItem key={p} value={p}>{PRIORITY_LABEL[p]}</SelectItem>)}\n </SelectContent>\n </Select>\n </div>\n\n <div className=\"rounded-xl border bg-card p-4\">\n <h2 className=\"mb-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground\">Cliente</h2>\n {/* The client is the store that opened the chamado — already connected\n by the ticket's tenant_id, shown automatically, not linked by hand. */}\n <p className=\"text-sm font-medium\">{detail.tenantName ?? 'Loja'}</p>\n <p className=\"text-xs text-muted-foreground\">Loja que abriu o chamado — vinculada automaticamente.</p>\n <FixWithClaudeConsole detail={detail} />\n </div>\n </div>\n\n {/* ── RIGHT: conversation + activity feed ─────────────────────────── */}\n <div className=\"flex flex-col gap-4\">\n <div className=\"rounded-xl border bg-card p-4\">\n <h2 className=\"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground\">Conversa com o cliente</h2>\n {detail.messages.length === 0 ? (\n <p className=\"mt-2 text-sm text-muted-foreground\">Sem mensagens ainda.</p>\n ) : (\n <div className=\"mt-3 space-y-2\">\n {detail.messages.map((m) => (\n <div key={m.id} className={m.authorKind === 'team' ? 'flex justify-end' : 'flex justify-start'}>\n <div className={`max-w-[85%] rounded-lg px-3 py-2 text-sm ${m.authorKind === 'team' ? 'bg-primary/10' : 'bg-muted'}`}>\n <div className=\"whitespace-pre-wrap\">{m.body}</div>\n <div className=\"mt-1 text-right text-[10px] text-muted-foreground\">{fmtWhen(m.createdAt)}</div>\n </div>\n </div>\n ))}\n </div>\n )}\n <div className=\"mt-3 flex items-end gap-2\">\n <Textarea rows={2} value={reply} onChange={(e) => setReply(e.target.value)} placeholder=\"Responder ao cliente…\" className=\"flex-1\" />\n <Button disabled={busy || !reply.trim()} onClick={() => run(async () => { const d = await consoleReply(detail.id, reply); setReply(''); return d }, 'Resposta enviada')}>Responder</Button>\n </div>\n </div>\n\n <div className=\"rounded-xl border bg-card p-4\">\n <h2 className=\"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground\">Atividades</h2>\n {detail.events.length === 0 ? (\n <p className=\"mt-2 text-sm text-muted-foreground\">Sem atividades.</p>\n ) : (\n <ol className=\"mt-3 space-y-2.5\">\n {detail.events.map((e) => (\n <li key={e.id} className=\"flex gap-2 text-xs\">\n <span className=\"mt-1 h-1.5 w-1.5 shrink-0 rounded-full bg-muted-foreground/40\" />\n <div className=\"min-w-0\">\n <div>{eventLine(e.type, e.note)}</div>\n <div className=\"text-muted-foreground\">{fmtWhen(e.createdAt)}</div>\n </div>\n </li>\n ))}\n </ol>\n )}\n </div>\n </div>\n </div>\n )\n}\n\nfunction fmtWhen(iso: string): string {\n try {\n return new Date(iso).toLocaleString('pt-BR', { day: '2-digit', month: '2-digit', hour: '2-digit', minute: '2-digit' })\n } catch { return iso }\n}\n\nfunction FixWithClaudeConsole({ detail }: { detail: ConsoleDetail }) {\n const [open, setOpen] = React.useState(false)\n const prompt = React.useMemo(() => (open ? buildFixPrompt(detail, detail.tenantName ?? undefined) : ''), [open, detail])\n async function copy() {\n try { await navigator.clipboard.writeText(prompt); toast.success('Prompt copiado') }\n catch { toast.error('Não consegui copiar.') }\n }\n const Spark = (ICON_MAP as Record<string, React.ComponentType<{ className?: string }>>).Sparkles\n return (\n <>\n <Button className=\"mt-3 w-full justify-center gap-2\" onClick={() => setOpen(true)}>\n {Spark && <Spark className=\"h-4 w-4\" />} Corrigir com Claude\n </Button>\n <ModalTask open={open} title=\"Corrigir com Claude\" width=\"min(42rem, 94vw)\" onClose={() => setOpen(false)}>\n <div className=\"flex flex-col gap-3 p-4\">\n <p className=\"text-sm text-muted-foreground\">Copie e cole no Claude para investigar e corrigir.</p>\n <Textarea value={prompt} readOnly rows={14} className=\"font-mono text-xs\" onFocus={(e) => e.currentTarget.select()} />\n <div className=\"flex justify-end gap-2\">\n <Button variant=\"outline\" onClick={() => setOpen(false)}>Fechar</Button>\n <Button onClick={copy}>Copiar prompt</Button>\n </div>\n </div>\n </ModalTask>\n </>\n )\n}\n\nfunction AttachmentCard({ att }: { att: SupportAttachment }) {\n const [url, setUrl] = React.useState<string | null>(null)\n React.useEffect(() => {\n let alive = true\n if ((att.contentType ?? '').startsWith('image/')) void signedUrl(att.storagePath).then((u) => { if (alive) setUrl(u) })\n return () => { alive = false }\n }, [att.storagePath, att.contentType])\n return (\n <a href={url ?? undefined} target=\"_blank\" rel=\"noreferrer\" className=\"flex items-center gap-2 rounded-lg border bg-card p-2 hover:bg-muted\">\n {url ? <Thumbnail src={url} alt={att.name} className=\"h-12 w-12 rounded object-cover\" /> : <div className=\"flex h-12 w-12 items-center justify-center rounded bg-muted text-[10px] text-muted-foreground\">anexo</div>}\n <span className=\"max-w-[10rem] truncate text-xs\">{att.name}</span>\n </a>\n )\n}\n\nexport default HelpdeskConsole\n"]}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { getSupabaseClientOptional } from '@fayz-ai/core';
|
|
2
2
|
|
|
3
|
-
// src/
|
|
3
|
+
// src/lib/console-path.ts
|
|
4
|
+
var consolePath = "/support/console";
|
|
5
|
+
function setHelpdeskConsolePath(path) {
|
|
6
|
+
consolePath = path.trim() || "/support/console";
|
|
7
|
+
}
|
|
8
|
+
function helpdeskConsolePath() {
|
|
9
|
+
return consolePath;
|
|
10
|
+
}
|
|
4
11
|
function client() {
|
|
5
12
|
const c = getSupabaseClientOptional();
|
|
6
13
|
if (!c) throw new Error("Supabase client not available");
|
|
@@ -101,6 +108,6 @@ async function consoleReply(requestId, body) {
|
|
|
101
108
|
return toDetail(data);
|
|
102
109
|
}
|
|
103
110
|
|
|
104
|
-
export { consoleDetail, consoleListRequests, consoleReply, consoleSetPriority, consoleSetStatus, isOperator };
|
|
105
|
-
//# sourceMappingURL=chunk-
|
|
106
|
-
//# sourceMappingURL=chunk-
|
|
111
|
+
export { consoleDetail, consoleListRequests, consoleReply, consoleSetPriority, consoleSetStatus, helpdeskConsolePath, isOperator, setHelpdeskConsolePath };
|
|
112
|
+
//# sourceMappingURL=chunk-GZCHLBT2.js.map
|
|
113
|
+
//# sourceMappingURL=chunk-GZCHLBT2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/console-path.ts","../src/data/console.ts"],"names":[],"mappings":";;;AAEA,IAAI,WAAA,GAAc,kBAAA;AAEX,SAAS,uBAAuB,IAAA,EAAoB;AACzD,EAAA,WAAA,GAAc,IAAA,CAAK,MAAK,IAAK,kBAAA;AAC/B;AAEO,SAAS,mBAAA,GAA8B;AAC5C,EAAA,OAAO,WAAA;AACT;ACGA,SAAS,MAAA,GAAoB;AAC3B,EAAA,MAAM,IAAI,yBAAA,EAA0B;AACpC,EAAA,IAAI,CAAC,CAAA,EAAG,MAAM,IAAI,MAAM,+BAA+B,CAAA;AACvD,EAAA,OAAO,CAAA;AACT;AA+BA,SAAS,iBAAiB,CAAA,EAAwB;AAChD,EAAA,OAAO;AAAA,IACL,IAAI,CAAA,CAAE,EAAA;AAAA,IAAI,QAAQ,CAAA,CAAE,MAAA;AAAA,IAAQ,MAAM,CAAA,CAAE,IAAA;AAAA,IAAM,OAAA,EAAS,EAAE,OAAA,IAAW,IAAA;AAAA,IAChE,aAAa,CAAA,CAAE,WAAA;AAAA,IAAa,QAAQ,CAAA,CAAE,MAAA;AAAA,IAAQ,QAAA,EAAU,EAAE,QAAA,IAAY,QAAA;AAAA,IACtE,KAAA,EAAO,EAAE,KAAA,IAAS,IAAA;AAAA,IAAM,WAAW,CAAA,CAAE,UAAA;AAAA,IAAY,aAAA,EAAe,EAAE,eAAA,IAAmB,IAAA;AAAA,IACrF,WAAW,CAAA,CAAE,UAAA;AAAA,IAAY,WAAW,CAAA,CAAE,UAAA;AAAA,IACtC,UAAU,CAAA,CAAE,SAAA;AAAA,IAAW,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AAA,EAAW,CAAA;AAChG,EAAA,IAAI,OAAO,MAAM,KAAA;AACjB,EAAA,OAAO,SAAS,IAAI,CAAA;AACtB;AAEA,eAAsB,gBAAA,CAAiB,SAAA,EAAmB,MAAA,EAAuB,IAAA,EAA8C;AAC7H,EAAA,MAAM,EAAE,IAAA,EAAM,KAAA,EAAM,GAAI,MAAM,QAAO,CAAE,GAAA,CAAI,4BAAA,EAA8B,EAAE,cAAc,SAAA,EAAW,QAAA,EAAU,QAAQ,MAAA,EAAQ,IAAA,IAAQ,MAAM,CAAA;AAC5I,EAAA,IAAI,OAAO,MAAM,KAAA;AACjB,EAAA,OAAO,SAAS,IAAI,CAAA;AACtB;AAEA,eAAsB,kBAAA,CAAmB,WAAmB,QAAA,EAA0D;AACpH,EAAA,MAAM,EAAE,IAAA,EAAM,KAAA,EAAM,GAAI,MAAM,MAAA,EAAO,CAAE,GAAA,CAAI,8BAAA,EAAgC,EAAE,YAAA,EAAc,SAAA,EAAW,UAAA,EAAY,UAAU,CAAA;AAC5H,EAAA,IAAI,OAAO,MAAM,KAAA;AACjB,EAAA,OAAO,SAAS,IAAI,CAAA;AACtB;AAEA,eAAsB,YAAA,CAAa,WAAmB,IAAA,EAA6C;AACjG,EAAA,MAAM,EAAE,IAAA,EAAM,KAAA,EAAM,GAAI,MAAM,MAAA,EAAO,CAAE,GAAA,CAAI,uBAAA,EAAyB,EAAE,YAAA,EAAc,SAAA,EAAW,MAAA,EAAQ,MAAM,CAAA;AAC7G,EAAA,IAAI,OAAO,MAAM,KAAA;AACjB,EAAA,OAAO,SAAS,IAAI,CAAA;AACtB","file":"chunk-GZCHLBT2.js","sourcesContent":["// Where the helpdesk console lives. The app may move it (GoControl nests it under\n// \"Gestão de clientes\"); every deep link reads the path from here instead of a literal.\nlet consolePath = '/support/console'\n\nexport function setHelpdeskConsolePath(path: string): void {\n consolePath = path.trim() || '/support/console'\n}\n\nexport function helpdeskConsolePath(): string {\n return consolePath\n}\n","import { getSupabaseClientOptional } from '@fayz-ai/core'\nimport type {\n SupportKind, SupportStatus, SupportPriority,\n SupportMessage, SupportEvent, SupportAttachment,\n} from '../types'\n\n// The helpdesk (console) data layer — cross-tenant, and therefore NOT plain\n// PostgREST + RLS like data/api.ts. Every call goes through a SECURITY DEFINER\n// RPC that checks the caller is a seeded operator (plg_support_operators) and\n// carries the tenant boundary itself. A non-operator gets an error, never rows.\n\ntype AnyClient = any\n\nfunction client(): AnyClient {\n const c = getSupabaseClientOptional()\n if (!c) throw new Error('Supabase client not available')\n return c as AnyClient\n}\n\n/** A request as the operator sees it — with the originating tenant and a count. */\nexport interface ConsoleRequest {\n id: string\n number: number\n kind: SupportKind\n subject: string | null\n description: string\n status: SupportStatus\n priority: SupportPriority\n route: string | null\n createdBy: string\n createdByName: string | null\n createdAt: string\n updatedAt: string\n tenantId: string\n tenantName: string | null\n tenantSlug: string | null\n linkedLeadId: string | null\n linkedLeadName: string | null\n messageCount: number\n}\n\nexport interface ConsoleDetail extends ConsoleRequest {\n screenSnapshot: Record<string, unknown>\n messages: SupportMessage[]\n events: SupportEvent[]\n attachments: SupportAttachment[]\n}\n\nfunction toConsoleRequest(r: any): ConsoleRequest {\n return {\n id: r.id, number: r.number, kind: r.kind, subject: r.subject ?? null,\n description: r.description, status: r.status, priority: r.priority ?? 'normal',\n route: r.route ?? null, createdBy: r.created_by, createdByName: r.created_by_name ?? null,\n createdAt: r.created_at, updatedAt: r.updated_at,\n tenantId: r.tenant_id, tenantName: r.tenant_name ?? null, tenantSlug: r.tenant_slug ?? null,\n linkedLeadId: r.linked_lead_id ?? null, linkedLeadName: r.linked_lead_name ?? null,\n messageCount: Number(r.message_count ?? 0),\n }\n}\n\nconst toMessage = (r: any): SupportMessage => ({\n id: r.id, requestId: r.request_id, authorKind: r.author_kind,\n authorId: r.author_id ?? null, body: r.body, createdAt: r.created_at,\n})\nconst toEvent = (r: any): SupportEvent => ({\n id: r.id, requestId: r.request_id, type: r.type, note: r.note ?? null, createdAt: r.created_at,\n})\nconst toAttachment = (r: any): SupportAttachment => ({\n id: r.id, requestId: r.request_id, storagePath: r.storage_path, name: r.name,\n sizeBytes: r.size_bytes ?? null, contentType: r.content_type ?? null, createdAt: r.created_at,\n})\n\nfunction toDetail(payload: any): ConsoleDetail | null {\n const r = payload?.request\n if (!r) return null\n return {\n ...toConsoleRequest(r),\n screenSnapshot: r.screen_snapshot ?? {},\n messages: (payload.messages ?? []).map(toMessage),\n events: (payload.events ?? []).map(toEvent),\n attachments: (payload.attachments ?? []).map(toAttachment),\n }\n}\n\n/** Is the signed-in user a helpdesk operator? Gates the console menu entry. */\nexport async function isOperator(): Promise<boolean> {\n try {\n const { data, error } = await client().rpc('support_is_operator')\n if (error) return false\n return data === true\n } catch {\n return false\n }\n}\n\nexport async function consoleListRequests(statuses?: SupportStatus[], search?: string): Promise<ConsoleRequest[]> {\n const { data, error } = await client().rpc('support_console_requests', {\n p_statuses: statuses && statuses.length ? statuses : null,\n p_search: search && search.trim() ? search.trim() : null,\n })\n if (error) throw error\n return ((data as any[]) ?? []).map(toConsoleRequest)\n}\n\nexport async function consoleDetail(requestId: string): Promise<ConsoleDetail | null> {\n const { data, error } = await client().rpc('support_console_detail', { p_request_id: requestId })\n if (error) throw error\n return toDetail(data)\n}\n\nexport async function consoleSetStatus(requestId: string, status: SupportStatus, note?: string): Promise<ConsoleDetail | null> {\n const { data, error } = await client().rpc('support_console_set_status', { p_request_id: requestId, p_status: status, p_note: note ?? null })\n if (error) throw error\n return toDetail(data)\n}\n\nexport async function consoleSetPriority(requestId: string, priority: SupportPriority): Promise<ConsoleDetail | null> {\n const { data, error } = await client().rpc('support_console_set_priority', { p_request_id: requestId, p_priority: priority })\n if (error) throw error\n return toDetail(data)\n}\n\nexport async function consoleReply(requestId: string, body: string): Promise<ConsoleDetail | null> {\n const { data, error } = await client().rpc('support_console_reply', { p_request_id: requestId, p_body: body })\n if (error) throw error\n return toDetail(data)\n}\n\nexport async function consoleLinkLead(requestId: string, leadId: string, leadName?: string): Promise<ConsoleDetail | null> {\n const { data, error } = await client().rpc('support_console_link_lead', { p_request_id: requestId, p_lead_id: leadId, p_lead_name: leadName ?? null })\n if (error) throw error\n return toDetail(data)\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HelpdeskStatusPanel.d.ts","sourceRoot":"","sources":["../../src/components/HelpdeskStatusPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"HelpdeskStatusPanel.d.ts","sourceRoot":"","sources":["../../src/components/HelpdeskStatusPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAgBzB;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,QAAQ,EAAE,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,KAAK,CAAC,YAAY,CAmDhG;AAED,eAAe,mBAAmB,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,13 @@ export interface SupportPluginOptions {
|
|
|
11
11
|
whatsNew?: WhatsNewItem[];
|
|
12
12
|
/** Status components listed under the Status card. */
|
|
13
13
|
statusComponents?: StatusComponent[];
|
|
14
|
+
/** Where the operator console is routed (default '/support/console'). An app that
|
|
15
|
+
* nests it under another rail group points it there (e.g. '/customers/support'). */
|
|
16
|
+
consoleRoute?: string;
|
|
17
|
+
/** Rail label of the operator console (default 'Central de Chamados'). */
|
|
18
|
+
consoleLabel?: string;
|
|
19
|
+
/** Rail position of the operator console (default 45). */
|
|
20
|
+
consolePosition?: number;
|
|
14
21
|
}
|
|
15
22
|
export declare function createSupportPlugin(options?: SupportPluginOptions): PluginManifest;
|
|
16
23
|
export { useSupportStore } from './store';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAK5E,OAAO,EAEL,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,eAAe,EACtD,MAAM,eAAe,CAAA;AAmBtB,MAAM,WAAW,oBAAoB;IACnC,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,+EAA+E;IAC/E,GAAG,CAAC,EAAE,OAAO,EAAE,CAAA;IACf,mDAAmD;IACnD,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAA;IACzB,sDAAsD;IACtD,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAA;IACpC;yFACqF;IACrF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,0DAA0D;IAC1D,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,cAAc,CA4GlF;AAED,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAGzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AACtE,cAAc,SAAS,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defaultStatusComponents, defaultWhatsNew, defaultFaq, useSupportStore } from './chunk-JJPB2T3Z.js';
|
|
2
2
|
export { useSupportStore } from './chunk-JJPB2T3Z.js';
|
|
3
|
-
import { consoleListRequests } from './chunk-
|
|
3
|
+
import { consoleListRequests, helpdeskConsolePath, setHelpdeskConsolePath } from './chunk-GZCHLBT2.js';
|
|
4
4
|
import { STATUS_LABEL, STATUS_TONE, createRequest, uploadAttachment, listRequests } from './chunk-7NVBUXTX.js';
|
|
5
5
|
export { MAX_ATTACHMENTS, MAX_ATTACHMENT_BYTES, SUPPORT_BUCKET } from './chunk-7NVBUXTX.js';
|
|
6
6
|
import React2 from 'react';
|
|
@@ -253,7 +253,7 @@ function HelpdeskStatusPanel({ tenantId } = {}) {
|
|
|
253
253
|
g.items.map((r) => /* @__PURE__ */ jsxs(
|
|
254
254
|
"button",
|
|
255
255
|
{
|
|
256
|
-
onClick: () => go(
|
|
256
|
+
onClick: () => go(`${helpdeskConsolePath()}/${r.id}`),
|
|
257
257
|
className: "flex w-full flex-col gap-0.5 rounded-lg border bg-card p-2 text-left transition-colors hover:border-primary/40 hover:bg-accent",
|
|
258
258
|
children: [
|
|
259
259
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 text-[11px] text-muted-foreground", children: [
|
|
@@ -274,7 +274,7 @@ function HelpdeskStatusPanel({ tenantId } = {}) {
|
|
|
274
274
|
|
|
275
275
|
// src/index.ts
|
|
276
276
|
var LazySupportCenter = React2.lazy(() => import('./SupportCenter-YS72A72U.js'));
|
|
277
|
-
var LazyHelpdeskConsole = React2.lazy(() => import('./HelpdeskConsole-
|
|
277
|
+
var LazyHelpdeskConsole = React2.lazy(() => import('./HelpdeskConsole-HVRQUQQA.js'));
|
|
278
278
|
var HelpdeskConsolePage = () => React2.createElement(
|
|
279
279
|
React2.Suspense,
|
|
280
280
|
{ fallback: React2.createElement("div", { className: "p-6 text-sm text-muted-foreground" }, "Carregando\u2026") },
|
|
@@ -282,6 +282,10 @@ var HelpdeskConsolePage = () => React2.createElement(
|
|
|
282
282
|
);
|
|
283
283
|
function createSupportPlugin(options) {
|
|
284
284
|
const label = options?.label ?? "Suporte";
|
|
285
|
+
const consoleRoute = options?.consoleRoute?.trim() || "/support/console";
|
|
286
|
+
const consoleLabel = options?.consoleLabel ?? "Central de Chamados";
|
|
287
|
+
const consolePosition = options?.consolePosition ?? 45;
|
|
288
|
+
setHelpdeskConsolePath(consoleRoute);
|
|
285
289
|
registerTranslations(supportLocales);
|
|
286
290
|
registerSupportAITools();
|
|
287
291
|
const content = {
|
|
@@ -321,9 +325,9 @@ function createSupportPlugin(options) {
|
|
|
321
325
|
{
|
|
322
326
|
id: "support-console",
|
|
323
327
|
section: "main",
|
|
324
|
-
position:
|
|
325
|
-
label:
|
|
326
|
-
route:
|
|
328
|
+
position: consolePosition,
|
|
329
|
+
label: consoleLabel,
|
|
330
|
+
route: consoleRoute,
|
|
327
331
|
icon: "LifeBuoy",
|
|
328
332
|
// Sit right below "Clientes": land above the line the rail draws next
|
|
329
333
|
// after it (AtendeAI, then the CRM/financial block).
|
|
@@ -355,10 +359,10 @@ function createSupportPlugin(options) {
|
|
|
355
359
|
// The helpdesk console. Open to any authenticated user as a route; the
|
|
356
360
|
// view calls support_is_operator() and shows "acesso restrito" to a
|
|
357
361
|
// non-operator, and every data call is gated server-side anyway.
|
|
358
|
-
path:
|
|
362
|
+
path: consoleRoute,
|
|
359
363
|
component: HelpdeskConsolePage,
|
|
360
364
|
guard: "authenticated",
|
|
361
|
-
title:
|
|
365
|
+
title: consoleLabel
|
|
362
366
|
}
|
|
363
367
|
],
|
|
364
368
|
migrations: MIGRATIONS.map((entry) => ({
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/locales/en.ts","../src/locales/pt-BR.ts","../src/locales/index.ts","../src/lib/report-tool.ts","../src/components/HelpdeskStatusPanel.tsx","../src/index.ts"],"names":["React"],"mappings":";;;;;;;;;;;;AAAO,IAAM,EAAA,GAA6B;AAAA,EACxC,eAAA,EAAiB,SAAA;AAAA,EACjB,sBAAA,EAAwB,aAAA;AAAA,EACxB,sBAAA,EAAwB,SAAA;AAAA,EACxB,qBAAA,EAAuB;AACzB,CAAA;;;ACLO,IAAM,IAAA,GA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UAAA,CAAW,GAAA,CAAI,CAAC,KAAA,MAAW;AAAA,MACrC,EAAA,EAAI,CAAA,QAAA,EAAW,KAAA,CAAM,EAAE,CAAA,CAAA;AAAA,MACvB,OAAA,EAAS,OAAA;AAAA,MACT,KAAK,KAAA,CAAM,GAAA;AAAA,MACX,WAAA,EACE;AAAA,KACJ,CAAE,CAAA;AAAA,IAEF,OAAA,EAAS;AAAA,GACX;AACF","file":"index.js","sourcesContent":["export const en: Record<string, string> = {\n 'support.title': 'Support',\n 'support.nav.requests': 'My requests',\n 'support.feature.base': 'Support',\n 'support.feature.all': 'Whole-company requests',\n}\n","export const ptBR: Record<string, string> = {\n 'support.title': 'Suporte',\n 'support.nav.requests': 'Minhas solicitações',\n 'support.feature.base': 'Suporte',\n 'support.feature.all': 'Solicitações de toda a empresa',\n}\n","import { en } from './en'\nimport { ptBR } from './pt-BR'\n\nexport const supportLocales: Record<string, Record<string, string>> = {\n en,\n 'pt-BR': ptBR,\n}\n","import { useNavHistoryStore, getRecentActivity } from '@fayz-ai/core'\nimport type { PluginAITool } from '@fayz-ai/core'\nimport { createRequest, uploadAttachment, listRequests } from '../data/api'\nimport { useSupportStore } from '../store'\nimport type { PendingAttachment, SupportKind } from '../types'\n\n// Set once admin is loaded (registerSupportAITools) — the images/PDFs the chat\n// turn carried, so a print the user dropped reaches the ticket, not just the LLM.\nlet takeTurnReportFiles: (() => File[]) | null = null\n\n// ---------------------------------------------------------------------------\n// \"Modo relato\" — the Dico registers a support request instead of trying to\n// FIX the problem with whatever tool is lying around.\n//\n// The bug this exists to kill: told \"when I try to reconcile, it won't let me\n// create a supplier\", gpt-4o-mini treated it as a task and called a random\n// payable tool (\"Resolve Payable Context\") — doing nothing the user asked for.\n// A complaint is not a work order. So this tool is a DEAD END on purpose: it\n// writes the request, returns the number, and its description forbids every\n// other tool. The behaviour is driven from BOTH ends — this description and the\n// agent's provisioned instructions (\"report mode\").\n// ---------------------------------------------------------------------------\n\n/** Map whatever the model sends to one of the three ticket kinds. A plain\n * question (\"tenho uma dúvida\") is NOT a ticket — the agent just answers it. */\nfunction normalizeKind(raw: unknown): SupportKind {\n const s = String(raw ?? '').trim().toLowerCase()\n if (['improvement', 'melhoria', 'sugestao', 'sugestão', 'suggestion'].some((k) => s.includes(k))) return 'improvement'\n if (['other', 'outra', 'outras', 'outro', 'solicitacao', 'solicitação', 'request'].some((k) => s.includes(k))) return 'other'\n // Everything else — including \"problem\"/\"problema\"/\"bug\"/\"erro\" — is a problem.\n return 'problem'\n}\n\n/** The last screens the user passed through, newest first. Read from the global\n * nav-history ring buffer the app shell fills on every route change. */\nfunction recentScreens(limit = 10): Array<{ path: string; label: string }> {\n try {\n const stack = useNavHistoryStore.getState().stack\n return stack.slice(-limit).reverse().map((e) => ({ path: e.path, label: e.label }))\n } catch {\n return []\n }\n}\n\n/** The route the user is on right now, as the V1 form records it. */\nfunction currentRoute(): string | null {\n if (typeof location === 'undefined') return null\n return location.hash || location.pathname || null\n}\n\nexport const supportAITools: PluginAITool[] = [\n {\n id: 'support.report-issue',\n name: 'reportIssue',\n description:\n 'REGISTERS a support request (problema, melhoria ou outra solicitação) for the Fayz team. ' +\n 'Use this the moment the user is REPORTING that something is wrong, asking for a change, or raising a request you cannot resolve from the app itself — \"não consigo…\", \"deu erro\", \"não aparece a opção de…\", \"seria bom se…\". ' +\n 'This is the ONLY correct action for a report: do NOT call any other tool to investigate or \"fix\" it (no payable/reconciliation/record tools) — a complaint is not a work order, and guessing at a fix does nothing the user asked for. ' +\n 'Before registering: call findSupportRequests to check the issue is not ALREADY open (if it is, do not duplicate — point the user to that #number). Then use the recent trail you were given to say what the user was doing, confirm the problem in one short question, and offer (do not require) a print. Then call this with a clear description IN THE USER\\'S OWN WORDS. ' +\n 'It returns the request number — tell the user \"registrei a sua solicitação, número #N, a equipe vai acompanhar\" and STOP. The route and the recent screens are captured automatically; you do not pass them.',\n icon: 'LifeBuoy',\n mode: 'persist',\n // No confirmation card: the user already asked for it and the agent confirms\n // in prose. The card would just show the technical params.\n requiresConfirmation: false,\n parameters: {\n type: 'object',\n properties: {\n kind: {\n type: 'string',\n enum: ['problem', 'improvement', 'other'],\n description: 'problem = algo não funcionou; improvement = sugestão de melhoria; other = treinamento, acesso, dados, comercial. Default problem.',\n },\n description: {\n type: 'string',\n description: 'O que aconteceu, na linguagem do usuário: o que ele fazia, o que esperava e o que apareceu.',\n },\n subject: {\n type: 'string',\n description: 'Opcional. Um título curto para a solicitação.',\n },\n },\n required: ['description'],\n },\n category: 'Suporte',\n suggestions: [\n { label: 'Quero reportar um problema', prompt: 'Quero reportar um problema' },\n { label: 'Quero sugerir uma melhoria', prompt: 'Quero sugerir uma melhoria' },\n { label: 'Tenho uma dúvida', prompt: 'Tenho uma dúvida' },\n { label: 'Outra solicitação', prompt: 'Tenho outra solicitação para a equipe' },\n ],\n },\n {\n id: 'support.find-requests',\n name: 'findSupportRequests',\n description:\n 'Lists the user\\'s OPEN support requests (solicitações em aberto). ' +\n 'CALL THIS BEFORE registering a problem or improvement, to check whether the same thing is ALREADY reported. ' +\n 'If an open request clearly covers the same issue, do NOT open a duplicate: tell the user it is already registered (give the #number and its status) and offer to add a note to it instead. ' +\n 'Optional `query` filters by words from the user\\'s complaint.',\n icon: 'Search',\n mode: 'read',\n parameters: {\n type: 'object',\n properties: {\n query: { type: 'string', description: 'Palavras do que o usuário está relatando, para achar uma solicitação parecida. Opcional.' },\n },\n },\n category: 'Suporte',\n },\n]\n\nexport interface ReportIssueResult {\n ok: boolean\n id?: string\n number?: number\n status?: string\n attachments?: number\n ref?: { id: string; label: string; path: string }\n message?: string\n error?: string\n}\n\n/** Client-plane executor. Writes the request through the plugin's own data\n * layer (createRequest also opens the 'opened' event + mints the per-tenant\n * number via trigger) and hands back the number plus a goto ref the chat\n * renders as a \"Ver solicitação\" button. */\nasync function executeReportIssue(args: Record<string, unknown>): Promise<ReportIssueResult> {\n const description = String(args.description ?? '').trim()\n if (description.length < 5) {\n return {\n ok: false,\n error: 'missing_description',\n message: 'Antes de registrar, pergunte ao usuário o que aconteceu e descreva com as palavras dele (mínimo de uma frase).',\n }\n }\n const kind = normalizeKind(args.kind)\n const subject = typeof args.subject === 'string' && args.subject.trim() ? args.subject.trim() : null\n try {\n const res = await createRequest({\n kind,\n description,\n subject,\n route: currentRoute(),\n // What the user was doing travels with the request, so the team reads it\n // without a second round-trip. `activity` is the rich trail (routes +\n // buttons pressed); `recentScreens` stays for tickets opened before it.\n screenSnapshot: { activity: getRecentActivity(10), recentScreens: recentScreens() },\n })\n // Attach the print the user shared in the chat. Without this the image went\n // only to the model's vision and the ticket had no evidence on it.\n let attached = 0\n const files = takeTurnReportFiles ? takeTurnReportFiles() : []\n for (const file of files) {\n const pending: PendingAttachment = {\n id: crypto.randomUUID(),\n file,\n name: file.name || 'anexo',\n contentType: file.type || 'application/octet-stream',\n sizeBytes: file.size,\n }\n try {\n await uploadAttachment(res.id, pending)\n attached += 1\n } catch {\n // One failed upload never fails the report — the request is already open.\n }\n }\n // If the Central de Suporte is open behind the chat, the agent's write\n // bypasses its store — so \"Minhas solicitações\" would stay empty until a\n // reload. Refresh the list now so the request the user just reported shows.\n try {\n void useSupportStore.getState().loadList()\n } catch {\n // The screen may not be mounted; the list loads on next open regardless.\n }\n return {\n ok: true,\n id: res.id,\n number: res.number,\n status: 'received',\n attachments: attached,\n ref: { id: res.id, label: `Solicitação #${res.number}`, path: `/support/ticket/${res.id}` },\n message:\n `Solicitação #${res.number} registrada${attached ? ` com ${attached} anexo(s)` : ''}. ` +\n 'Diga ao usuário o número e que a equipe vai acompanhar. ' +\n 'NÃO chame mais nenhuma ferramenta — o relato está registrado.',\n }\n } catch (error) {\n return {\n ok: false,\n error: 'write_failed',\n message: error instanceof Error ? error.message : 'Não consegui registrar a solicitação.',\n }\n }\n}\n\n/** Open = still actionable (not closed/cancelled). The dedup check only cares\n * about requests the team could still be working on. */\nfunction isOpen(status: string): boolean {\n return status !== 'closed' && status !== 'cancelled'\n}\n\n/** Read-plane executor: the user's open requests, ranked by how well they match\n * the complaint, so the agent can see \"this is already #N\" before duplicating. */\nasync function executeFindRequests(args: Record<string, unknown>): Promise<unknown> {\n const query = String(args.query ?? '').trim().toLowerCase()\n const terms = query.split(/[^\\p{L}\\p{N}]+/u).filter((w) => w.length > 2)\n let open\n try {\n open = (await listRequests('mine', 'all')).filter((r) => isOpen(r.status))\n } catch (error) {\n return { error: 'read_failed', message: error instanceof Error ? error.message : 'Não consegui ler as solicitações.' }\n }\n const scored = open\n .map((r) => {\n const hay = `${r.subject ?? ''} ${r.description}`.toLowerCase()\n const score = terms.length ? terms.filter((t) => hay.includes(t)).length : 0\n return { r, score }\n })\n .sort((a, b) => b.score - a.score || b.r.number - a.r.number)\n const picked = (terms.length ? scored.filter((s) => s.score > 0) : scored).slice(0, 10)\n return {\n total: picked.length,\n openTotal: open.length,\n requests: picked.map(({ r }) => ({\n number: r.number,\n kind: r.kind,\n subject: r.subject || r.description.slice(0, 80),\n status: r.status,\n createdAt: r.createdAt,\n ref: { id: r.id, label: `Solicitação #${r.number}`, path: `/support/ticket/${r.id}` },\n })),\n hint: picked.length\n ? 'If one of these is clearly the SAME issue the user is reporting now, do not open a duplicate — say it is already registered (#number + status) and offer to add a note.'\n : 'Nothing similar is open — go ahead and register the new request.',\n }\n}\n\nlet registered = false\n\n/**\n * Register the client-plane executor for `reportIssue`.\n *\n * Done through a DYNAMIC import of @fayz-ai/admin, guarded to the browser, so\n * building the manifest (and unit-testing it) never pulls the admin React chain\n * — the same reason index.ts lazy-loads the views. Idempotent.\n */\nexport function registerSupportAITools(): void {\n if (registered || typeof document === 'undefined') return\n registered = true\n void import('@fayz-ai/admin')\n .then((admin) => {\n takeTurnReportFiles = admin.takeTurnReportFiles\n admin.registerAIToolHandler('reportIssue', (args) => executeReportIssue(args))\n admin.registerAIToolHandler('findSupportRequests', (args) => executeFindRequests(args))\n })\n .catch(() => {\n // An app with no assistant wired never calls the tool — a failed register\n // must not break the plugin's screens.\n registered = false\n })\n}\n","import React from 'react'\nimport { Badge, Skeleton } from '@fayz-ai/ui'\nimport { consoleListRequests, type ConsoleRequest } from '../data/console'\nimport { STATUS_LABEL, STATUS_TONE } from '../lib/vocabulary'\nimport type { SupportStatus } from '../types'\nimport { navigateApp } from '@fayz-ai/core'\n\n/** Hash navigation, without reaching into the shell's private routing. */\nfunction go(path: string) { if (typeof window !== 'undefined') navigateApp(path) }\n\n// Open first, then the closed ones.\nconst STATUS_ORDER: SupportStatus[] = [\n 'received', 'in_service', 'waiting_you', 'in_development', 'resolved_check', 'closed', 'cancelled',\n]\n\n/**\n * The helpdesk's chamados grouped by status. With `tenantId` it is ONE store's\n * tickets — drawn inside that store's CRM card (the store is resolved from the\n * CRM company's metadata.tenant_id_v2). Without it, every store's. Reads the same\n * cross-tenant console RPC (operator-gated); each row deep-links to the ticket.\n */\nexport function HelpdeskStatusPanel({ tenantId }: { tenantId?: string } = {}): React.ReactElement {\n const [requests, setRequests] = React.useState<ConsoleRequest[]>([])\n const [loading, setLoading] = React.useState(true)\n\n React.useEffect(() => {\n let alive = true\n setLoading(true)\n consoleListRequests(undefined, '')\n .then((r) => { if (alive) setRequests(tenantId ? r.filter((x) => x.tenantId === tenantId) : r) })\n .catch(() => { if (alive) setRequests([]) })\n .finally(() => { if (alive) setLoading(false) })\n return () => { alive = false }\n }, [tenantId])\n\n const byStatus = STATUS_ORDER\n .map((s) => ({ status: s, items: requests.filter((r) => r.status === s) }))\n .filter((g) => g.items.length > 0)\n\n if (loading) {\n return <div className=\"space-y-2 p-1\">{[0, 1].map((i) => <Skeleton key={i} className=\"h-14 w-full\" />)}</div>\n }\n if (requests.length === 0) {\n return <p className=\"text-xs text-muted-foreground\">{tenantId ? 'Esta loja não tem chamados.' : 'Nenhum chamado por aqui.'}</p>\n }\n\n return (\n <div className=\"flex flex-col gap-3\">\n {!tenantId && <p className=\"px-1 text-xs text-muted-foreground\">{requests.length} chamado(s) de todas as lojas.</p>}\n {byStatus.map((g) => (\n <div key={g.status} className=\"flex flex-col gap-1.5\">\n <div className=\"flex items-center gap-2 px-1\">\n <Badge variant={STATUS_TONE[g.status]}>{STATUS_LABEL[g.status]}</Badge>\n <span className=\"text-[11px] text-muted-foreground\">{g.items.length}</span>\n </div>\n {g.items.map((r) => (\n <button\n key={r.id}\n onClick={() => go(`/support/console/${r.id}`)}\n className=\"flex w-full flex-col gap-0.5 rounded-lg border bg-card p-2 text-left transition-colors hover:border-primary/40 hover:bg-accent\"\n >\n <div className=\"flex items-center justify-between gap-2 text-[11px] text-muted-foreground\">\n <span className=\"truncate font-medium text-foreground\">{r.tenantName ?? 'Loja'}</span>\n <span>#{r.number}</span>\n </div>\n <div className=\"truncate text-xs\">{r.subject || r.description.slice(0, 60)}</div>\n </button>\n ))}\n </div>\n ))}\n </div>\n )\n}\n\nexport default HelpdeskStatusPanel\n","import React from 'react'\nimport type { PluginManifest, PluginScope, VerticalId } from '@fayz-ai/core'\nimport { registerTranslations } from '@fayz-ai/core'\nimport { supportLocales } from './locales'\nimport { MIGRATIONS } from './migrations'\nimport {\n defaultFaq, defaultWhatsNew, defaultStatusComponents,\n type FaqItem, type WhatsNewItem, type StatusComponent,\n} from './lib/content'\nimport { supportAITools, registerSupportAITools } from './lib/report-tool'\nimport type { SupportCenterContent } from './views/SupportCenter'\n\n// Lazy so building the manifest (and unit-testing it) does not eagerly pull the\n// React views and their @fayz-ai/admin chain. The wrapper owns its own Suspense,\n// so the route renders whether or not the shell provides one.\nconst LazySupportCenter = React.lazy(() => import('./views/SupportCenter'))\nconst LazyHelpdeskConsole = React.lazy(() => import('./views/HelpdeskConsole'))\n\n/** The helpdesk console, wrapped in its own Suspense (same reason the center is\n * lazy: keep the manifest free of the React/admin chain). */\nconst HelpdeskConsolePage: React.FC<unknown> = () =>\n React.createElement(\n React.Suspense,\n { fallback: React.createElement('div', { className: 'p-6 text-sm text-muted-foreground' }, 'Carregando…') },\n React.createElement(LazyHelpdeskConsole, null),\n )\n\nexport interface SupportPluginOptions {\n /** Label for the plugin and the user-menu entry (default \"Suporte\"). */\n label?: string\n scope?: PluginScope\n verticalId?: VerticalId\n /** Knowledge-base content — overrides the sample FAQ that ships by default. */\n faq?: FaqItem[]\n /** Release notes shown in the \"Novidades\" card. */\n whatsNew?: WhatsNewItem[]\n /** Status components listed under the Status card. */\n statusComponents?: StatusComponent[]\n}\n\nexport function createSupportPlugin(options?: SupportPluginOptions): PluginManifest {\n const label = options?.label ?? 'Suporte'\n registerTranslations(supportLocales)\n // Make the Dico's \"modo relato\" tool runnable (client-plane executor). Guarded\n // to the browser inside, so this is a no-op when the manifest is built on the\n // server or in a unit test.\n registerSupportAITools()\n\n const content: SupportCenterContent = {\n faq: options?.faq ?? defaultFaq,\n whatsNew: options?.whatsNew ?? defaultWhatsNew,\n statusComponents: options?.statusComponents ?? defaultStatusComponents,\n }\n\n const SupportPage: React.FC<unknown> = () =>\n React.createElement(\n React.Suspense,\n { fallback: React.createElement('div', { className: 'p-6 text-sm text-muted-foreground' }, 'Carregando…') },\n React.createElement(LazySupportCenter, { content }),\n )\n\n return {\n id: 'support',\n name: label,\n icon: 'LifeBuoy',\n version: '0.1.0',\n scope: options?.scope ?? 'universal',\n verticalId: options?.verticalId,\n defaultEnabled: true,\n dependencies: [],\n\n // Support is for everyone, like the V1 support panel (\"nasce liberada em\n // todos os perfis\") — so the route is open to any authenticated user rather\n // than gated by a deny-by-default feature. Only `support.all` is a declared\n // permission: it unlocks the \"Toda a empresa\" view, and ships denied (the\n // admin/owner holds it).\n declaredFeatures: [\n { id: 'support.all', label: 'Solicitações de toda a empresa', group: label },\n ],\n\n // The requester reaches Suporte from the user menu. The OPERATOR console line\n // is gated by the `console` FACET — it shows ONLY in the workspace that runs\n // the helpdesk (GoControl), where the facet is on. In a store (Pertinho,\n // Artorius…) the facet is off, so the line is absent no matter who is logged\n // in. It is a per-TENANT line: you see it when you are IN the GoControl\n // workspace, not because of who you are.\n navigation: [\n {\n id: 'support-console',\n section: 'main',\n position: 45,\n label: 'Central de Chamados',\n route: '/support/console',\n icon: 'LifeBuoy',\n // Sit right below \"Clientes\": land above the line the rail draws next\n // after it (AtendeAI, then the CRM/financial block).\n before: ['/atendeai', '/sales', '/financial'],\n requiresFacet: 'console',\n },\n ],\n\n // Off for every tenant by default; enabled only for the helpdesk workspace\n // with scripts/support-enable-console.mjs. A store that turns on Suporte does\n // NOT get it.\n facets: [\n {\n id: 'console',\n label: 'Central de Chamados (operador)',\n description: 'O console cross-tenant do suporte — só no workspace que opera o helpdesk.',\n },\n ],\n\n // \"Modo relato\": the assistant registers a request instead of improvising a\n // fix. The executor is wired above (registerSupportAITools); the opener\n // suggestions ride on the tool (the V1 doors).\n aiTools: supportAITools,\n\n routes: [\n {\n path: '/support',\n component: SupportPage as React.ComponentType<unknown>,\n guard: 'authenticated',\n },\n {\n // The helpdesk console. Open to any authenticated user as a route; the\n // view calls support_is_operator() and shows \"acesso restrito\" to a\n // non-operator, and every data call is gated server-side anyway.\n path: '/support/console',\n component: HelpdeskConsolePage as React.ComponentType<unknown>,\n guard: 'authenticated',\n title: 'Central de Chamados',\n },\n ],\n\n migrations: MIGRATIONS.map((entry) => ({\n id: `support-${entry.id}`,\n version: '0.1.0',\n sql: entry.sql,\n description:\n 'Central de Suporte do Dico: the plg_support_* tables (requests, messages, events, attachments, notifications), their RLS, the per-tenant number trigger and the private support-attachments bucket.',\n })),\n\n locales: supportLocales,\n }\n}\n\nexport { useSupportStore } from './store'\n// A store's chamados by status, for embedding in that store's CRM card (the CRM\n// resolves the store tenant from company.metadata.tenant_id_v2 and passes it).\nexport { HelpdeskStatusPanel } from './components/HelpdeskStatusPanel'\nexport * from './types'\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/locales/en.ts","../src/locales/pt-BR.ts","../src/locales/index.ts","../src/lib/report-tool.ts","../src/components/HelpdeskStatusPanel.tsx","../src/index.ts"],"names":["React"],"mappings":";;;;;;;;;;;;AAAO,IAAM,EAAA,GAA6B;AAAA,EACxC,eAAA,EAAiB,SAAA;AAA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AAa;AAAA;AACf,KACF;AAAA;AAAA;AAAA;AAAA,IAKA,OAAA,EAAS,cAAA;AAAA,IAET,MAAA,EAAQ;AAAA,MACN;AAAA,QACE,IAAA,EAAM,UAAA;AAAA,QACN,SAAA,EAAW,WAAA;AAAA,QACX,KAAA,EAAO;AAAA,OACT;AAAA,MACA;AAAA;AAAA;AAAA;AAAA,QAIE,IAAA,EAAM,YAAA;AAAA,QACN,SAAA,EAAW,mBAAA;AAAA,QACX,KAAA,EAAO,eAAA;AAAA,QACP,KAAA,EAAO;AAAA;AACT,KACF;AAAA,IAEA,UAAA,EAAY,UAAA,CAAW,GAAA,CAAI,CAAC,KAAA,MAAW;AAAA,MACrC,EAAA,EAAI,CAAA,QAAA,EAAW,KAAA,CAAM,EAAE,CAAA,CAAA;AAAA,MACvB,OAAA,EAAS,OAAA;AAAA,MACT,KAAK,KAAA,CAAM,GAAA;AAAA,MACX,WAAA,EACE;AAAA,KACJ,CAAE,CAAA;AAAA,IAEF,OAAA,EAAS;AAAA,GACX;AACF","file":"index.js","sourcesContent":["export const en: Record<string, string> = {\n 'support.title': 'Support',\n 'support.nav.requests': 'My requests',\n 'support.feature.base': 'Support',\n 'support.feature.all': 'Whole-company requests',\n}\n","export const ptBR: Record<string, string> = {\n 'support.title': 'Suporte',\n 'support.nav.requests': 'Minhas solicitações',\n 'support.feature.base': 'Suporte',\n 'support.feature.all': 'Solicitações de toda a empresa',\n}\n","import { en } from './en'\nimport { ptBR } from './pt-BR'\n\nexport const supportLocales: Record<string, Record<string, string>> = {\n en,\n 'pt-BR': ptBR,\n}\n","import { useNavHistoryStore, getRecentActivity } from '@fayz-ai/core'\nimport type { PluginAITool } from '@fayz-ai/core'\nimport { createRequest, uploadAttachment, listRequests } from '../data/api'\nimport { useSupportStore } from '../store'\nimport type { PendingAttachment, SupportKind } from '../types'\n\n// Set once admin is loaded (registerSupportAITools) — the images/PDFs the chat\n// turn carried, so a print the user dropped reaches the ticket, not just the LLM.\nlet takeTurnReportFiles: (() => File[]) | null = null\n\n// ---------------------------------------------------------------------------\n// \"Modo relato\" — the Dico registers a support request instead of trying to\n// FIX the problem with whatever tool is lying around.\n//\n// The bug this exists to kill: told \"when I try to reconcile, it won't let me\n// create a supplier\", gpt-4o-mini treated it as a task and called a random\n// payable tool (\"Resolve Payable Context\") — doing nothing the user asked for.\n// A complaint is not a work order. So this tool is a DEAD END on purpose: it\n// writes the request, returns the number, and its description forbids every\n// other tool. The behaviour is driven from BOTH ends — this description and the\n// agent's provisioned instructions (\"report mode\").\n// ---------------------------------------------------------------------------\n\n/** Map whatever the model sends to one of the three ticket kinds. A plain\n * question (\"tenho uma dúvida\") is NOT a ticket — the agent just answers it. */\nfunction normalizeKind(raw: unknown): SupportKind {\n const s = String(raw ?? '').trim().toLowerCase()\n if (['improvement', 'melhoria', 'sugestao', 'sugestão', 'suggestion'].some((k) => s.includes(k))) return 'improvement'\n if (['other', 'outra', 'outras', 'outro', 'solicitacao', 'solicitação', 'request'].some((k) => s.includes(k))) return 'other'\n // Everything else — including \"problem\"/\"problema\"/\"bug\"/\"erro\" — is a problem.\n return 'problem'\n}\n\n/** The last screens the user passed through, newest first. Read from the global\n * nav-history ring buffer the app shell fills on every route change. */\nfunction recentScreens(limit = 10): Array<{ path: string; label: string }> {\n try {\n const stack = useNavHistoryStore.getState().stack\n return stack.slice(-limit).reverse().map((e) => ({ path: e.path, label: e.label }))\n } catch {\n return []\n }\n}\n\n/** The route the user is on right now, as the V1 form records it. */\nfunction currentRoute(): string | null {\n if (typeof location === 'undefined') return null\n return location.hash || location.pathname || null\n}\n\nexport const supportAITools: PluginAITool[] = [\n {\n id: 'support.report-issue',\n name: 'reportIssue',\n description:\n 'REGISTERS a support request (problema, melhoria ou outra solicitação) for the Fayz team. ' +\n 'Use this the moment the user is REPORTING that something is wrong, asking for a change, or raising a request you cannot resolve from the app itself — \"não consigo…\", \"deu erro\", \"não aparece a opção de…\", \"seria bom se…\". ' +\n 'This is the ONLY correct action for a report: do NOT call any other tool to investigate or \"fix\" it (no payable/reconciliation/record tools) — a complaint is not a work order, and guessing at a fix does nothing the user asked for. ' +\n 'Before registering: call findSupportRequests to check the issue is not ALREADY open (if it is, do not duplicate — point the user to that #number). Then use the recent trail you were given to say what the user was doing, confirm the problem in one short question, and offer (do not require) a print. Then call this with a clear description IN THE USER\\'S OWN WORDS. ' +\n 'It returns the request number — tell the user \"registrei a sua solicitação, número #N, a equipe vai acompanhar\" and STOP. The route and the recent screens are captured automatically; you do not pass them.',\n icon: 'LifeBuoy',\n mode: 'persist',\n // No confirmation card: the user already asked for it and the agent confirms\n // in prose. The card would just show the technical params.\n requiresConfirmation: false,\n parameters: {\n type: 'object',\n properties: {\n kind: {\n type: 'string',\n enum: ['problem', 'improvement', 'other'],\n description: 'problem = algo não funcionou; improvement = sugestão de melhoria; other = treinamento, acesso, dados, comercial. Default problem.',\n },\n description: {\n type: 'string',\n description: 'O que aconteceu, na linguagem do usuário: o que ele fazia, o que esperava e o que apareceu.',\n },\n subject: {\n type: 'string',\n description: 'Opcional. Um título curto para a solicitação.',\n },\n },\n required: ['description'],\n },\n category: 'Suporte',\n suggestions: [\n { label: 'Quero reportar um problema', prompt: 'Quero reportar um problema' },\n { label: 'Quero sugerir uma melhoria', prompt: 'Quero sugerir uma melhoria' },\n { label: 'Tenho uma dúvida', prompt: 'Tenho uma dúvida' },\n { label: 'Outra solicitação', prompt: 'Tenho outra solicitação para a equipe' },\n ],\n },\n {\n id: 'support.find-requests',\n name: 'findSupportRequests',\n description:\n 'Lists the user\\'s OPEN support requests (solicitações em aberto). ' +\n 'CALL THIS BEFORE registering a problem or improvement, to check whether the same thing is ALREADY reported. ' +\n 'If an open request clearly covers the same issue, do NOT open a duplicate: tell the user it is already registered (give the #number and its status) and offer to add a note to it instead. ' +\n 'Optional `query` filters by words from the user\\'s complaint.',\n icon: 'Search',\n mode: 'read',\n parameters: {\n type: 'object',\n properties: {\n query: { type: 'string', description: 'Palavras do que o usuário está relatando, para achar uma solicitação parecida. Opcional.' },\n },\n },\n category: 'Suporte',\n },\n]\n\nexport interface ReportIssueResult {\n ok: boolean\n id?: string\n number?: number\n status?: string\n attachments?: number\n ref?: { id: string; label: string; path: string }\n message?: string\n error?: string\n}\n\n/** Client-plane executor. Writes the request through the plugin's own data\n * layer (createRequest also opens the 'opened' event + mints the per-tenant\n * number via trigger) and hands back the number plus a goto ref the chat\n * renders as a \"Ver solicitação\" button. */\nasync function executeReportIssue(args: Record<string, unknown>): Promise<ReportIssueResult> {\n const description = String(args.description ?? '').trim()\n if (description.length < 5) {\n return {\n ok: false,\n error: 'missing_description',\n message: 'Antes de registrar, pergunte ao usuário o que aconteceu e descreva com as palavras dele (mínimo de uma frase).',\n }\n }\n const kind = normalizeKind(args.kind)\n const subject = typeof args.subject === 'string' && args.subject.trim() ? args.subject.trim() : null\n try {\n const res = await createRequest({\n kind,\n description,\n subject,\n route: currentRoute(),\n // What the user was doing travels with the request, so the team reads it\n // without a second round-trip. `activity` is the rich trail (routes +\n // buttons pressed); `recentScreens` stays for tickets opened before it.\n screenSnapshot: { activity: getRecentActivity(10), recentScreens: recentScreens() },\n })\n // Attach the print the user shared in the chat. Without this the image went\n // only to the model's vision and the ticket had no evidence on it.\n let attached = 0\n const files = takeTurnReportFiles ? takeTurnReportFiles() : []\n for (const file of files) {\n const pending: PendingAttachment = {\n id: crypto.randomUUID(),\n file,\n name: file.name || 'anexo',\n contentType: file.type || 'application/octet-stream',\n sizeBytes: file.size,\n }\n try {\n await uploadAttachment(res.id, pending)\n attached += 1\n } catch {\n // One failed upload never fails the report — the request is already open.\n }\n }\n // If the Central de Suporte is open behind the chat, the agent's write\n // bypasses its store — so \"Minhas solicitações\" would stay empty until a\n // reload. Refresh the list now so the request the user just reported shows.\n try {\n void useSupportStore.getState().loadList()\n } catch {\n // The screen may not be mounted; the list loads on next open regardless.\n }\n return {\n ok: true,\n id: res.id,\n number: res.number,\n status: 'received',\n attachments: attached,\n ref: { id: res.id, label: `Solicitação #${res.number}`, path: `/support/ticket/${res.id}` },\n message:\n `Solicitação #${res.number} registrada${attached ? ` com ${attached} anexo(s)` : ''}. ` +\n 'Diga ao usuário o número e que a equipe vai acompanhar. ' +\n 'NÃO chame mais nenhuma ferramenta — o relato está registrado.',\n }\n } catch (error) {\n return {\n ok: false,\n error: 'write_failed',\n message: error instanceof Error ? error.message : 'Não consegui registrar a solicitação.',\n }\n }\n}\n\n/** Open = still actionable (not closed/cancelled). The dedup check only cares\n * about requests the team could still be working on. */\nfunction isOpen(status: string): boolean {\n return status !== 'closed' && status !== 'cancelled'\n}\n\n/** Read-plane executor: the user's open requests, ranked by how well they match\n * the complaint, so the agent can see \"this is already #N\" before duplicating. */\nasync function executeFindRequests(args: Record<string, unknown>): Promise<unknown> {\n const query = String(args.query ?? '').trim().toLowerCase()\n const terms = query.split(/[^\\p{L}\\p{N}]+/u).filter((w) => w.length > 2)\n let open\n try {\n open = (await listRequests('mine', 'all')).filter((r) => isOpen(r.status))\n } catch (error) {\n return { error: 'read_failed', message: error instanceof Error ? error.message : 'Não consegui ler as solicitações.' }\n }\n const scored = open\n .map((r) => {\n const hay = `${r.subject ?? ''} ${r.description}`.toLowerCase()\n const score = terms.length ? terms.filter((t) => hay.includes(t)).length : 0\n return { r, score }\n })\n .sort((a, b) => b.score - a.score || b.r.number - a.r.number)\n const picked = (terms.length ? scored.filter((s) => s.score > 0) : scored).slice(0, 10)\n return {\n total: picked.length,\n openTotal: open.length,\n requests: picked.map(({ r }) => ({\n number: r.number,\n kind: r.kind,\n subject: r.subject || r.description.slice(0, 80),\n status: r.status,\n createdAt: r.createdAt,\n ref: { id: r.id, label: `Solicitação #${r.number}`, path: `/support/ticket/${r.id}` },\n })),\n hint: picked.length\n ? 'If one of these is clearly the SAME issue the user is reporting now, do not open a duplicate — say it is already registered (#number + status) and offer to add a note.'\n : 'Nothing similar is open — go ahead and register the new request.',\n }\n}\n\nlet registered = false\n\n/**\n * Register the client-plane executor for `reportIssue`.\n *\n * Done through a DYNAMIC import of @fayz-ai/admin, guarded to the browser, so\n * building the manifest (and unit-testing it) never pulls the admin React chain\n * — the same reason index.ts lazy-loads the views. Idempotent.\n */\nexport function registerSupportAITools(): void {\n if (registered || typeof document === 'undefined') return\n registered = true\n void import('@fayz-ai/admin')\n .then((admin) => {\n takeTurnReportFiles = admin.takeTurnReportFiles\n admin.registerAIToolHandler('reportIssue', (args) => executeReportIssue(args))\n admin.registerAIToolHandler('findSupportRequests', (args) => executeFindRequests(args))\n })\n .catch(() => {\n // An app with no assistant wired never calls the tool — a failed register\n // must not break the plugin's screens.\n registered = false\n })\n}\n","import React from 'react'\nimport { helpdeskConsolePath } from '../lib/console-path'\nimport { Badge, Skeleton } from '@fayz-ai/ui'\nimport { consoleListRequests, type ConsoleRequest } from '../data/console'\nimport { STATUS_LABEL, STATUS_TONE } from '../lib/vocabulary'\nimport type { SupportStatus } from '../types'\nimport { navigateApp } from '@fayz-ai/core'\n\n/** Hash navigation, without reaching into the shell's private routing. */\nfunction go(path: string) { if (typeof window !== 'undefined') navigateApp(path) }\n\n// Open first, then the closed ones.\nconst STATUS_ORDER: SupportStatus[] = [\n 'received', 'in_service', 'waiting_you', 'in_development', 'resolved_check', 'closed', 'cancelled',\n]\n\n/**\n * The helpdesk's chamados grouped by status. With `tenantId` it is ONE store's\n * tickets — drawn inside that store's CRM card (the store is resolved from the\n * CRM company's metadata.tenant_id_v2). Without it, every store's. Reads the same\n * cross-tenant console RPC (operator-gated); each row deep-links to the ticket.\n */\nexport function HelpdeskStatusPanel({ tenantId }: { tenantId?: string } = {}): React.ReactElement {\n const [requests, setRequests] = React.useState<ConsoleRequest[]>([])\n const [loading, setLoading] = React.useState(true)\n\n React.useEffect(() => {\n let alive = true\n setLoading(true)\n consoleListRequests(undefined, '')\n .then((r) => { if (alive) setRequests(tenantId ? r.filter((x) => x.tenantId === tenantId) : r) })\n .catch(() => { if (alive) setRequests([]) })\n .finally(() => { if (alive) setLoading(false) })\n return () => { alive = false }\n }, [tenantId])\n\n const byStatus = STATUS_ORDER\n .map((s) => ({ status: s, items: requests.filter((r) => r.status === s) }))\n .filter((g) => g.items.length > 0)\n\n if (loading) {\n return <div className=\"space-y-2 p-1\">{[0, 1].map((i) => <Skeleton key={i} className=\"h-14 w-full\" />)}</div>\n }\n if (requests.length === 0) {\n return <p className=\"text-xs text-muted-foreground\">{tenantId ? 'Esta loja não tem chamados.' : 'Nenhum chamado por aqui.'}</p>\n }\n\n return (\n <div className=\"flex flex-col gap-3\">\n {!tenantId && <p className=\"px-1 text-xs text-muted-foreground\">{requests.length} chamado(s) de todas as lojas.</p>}\n {byStatus.map((g) => (\n <div key={g.status} className=\"flex flex-col gap-1.5\">\n <div className=\"flex items-center gap-2 px-1\">\n <Badge variant={STATUS_TONE[g.status]}>{STATUS_LABEL[g.status]}</Badge>\n <span className=\"text-[11px] text-muted-foreground\">{g.items.length}</span>\n </div>\n {g.items.map((r) => (\n <button\n key={r.id}\n onClick={() => go(`${helpdeskConsolePath()}/${r.id}`)}\n className=\"flex w-full flex-col gap-0.5 rounded-lg border bg-card p-2 text-left transition-colors hover:border-primary/40 hover:bg-accent\"\n >\n <div className=\"flex items-center justify-between gap-2 text-[11px] text-muted-foreground\">\n <span className=\"truncate font-medium text-foreground\">{r.tenantName ?? 'Loja'}</span>\n <span>#{r.number}</span>\n </div>\n <div className=\"truncate text-xs\">{r.subject || r.description.slice(0, 60)}</div>\n </button>\n ))}\n </div>\n ))}\n </div>\n )\n}\n\nexport default HelpdeskStatusPanel\n","import React from 'react'\nimport type { PluginManifest, PluginScope, VerticalId } from '@fayz-ai/core'\nimport { registerTranslations } from '@fayz-ai/core'\nimport { supportLocales } from './locales'\nimport { setHelpdeskConsolePath } from './lib/console-path'\nimport { MIGRATIONS } from './migrations'\nimport {\n defaultFaq, defaultWhatsNew, defaultStatusComponents,\n type FaqItem, type WhatsNewItem, type StatusComponent,\n} from './lib/content'\nimport { supportAITools, registerSupportAITools } from './lib/report-tool'\nimport type { SupportCenterContent } from './views/SupportCenter'\n\n// Lazy so building the manifest (and unit-testing it) does not eagerly pull the\n// React views and their @fayz-ai/admin chain. The wrapper owns its own Suspense,\n// so the route renders whether or not the shell provides one.\nconst LazySupportCenter = React.lazy(() => import('./views/SupportCenter'))\nconst LazyHelpdeskConsole = React.lazy(() => import('./views/HelpdeskConsole'))\n\n/** The helpdesk console, wrapped in its own Suspense (same reason the center is\n * lazy: keep the manifest free of the React/admin chain). */\nconst HelpdeskConsolePage: React.FC<unknown> = () =>\n React.createElement(\n React.Suspense,\n { fallback: React.createElement('div', { className: 'p-6 text-sm text-muted-foreground' }, 'Carregando…') },\n React.createElement(LazyHelpdeskConsole, null),\n )\n\nexport interface SupportPluginOptions {\n /** Label for the plugin and the user-menu entry (default \"Suporte\"). */\n label?: string\n scope?: PluginScope\n verticalId?: VerticalId\n /** Knowledge-base content — overrides the sample FAQ that ships by default. */\n faq?: FaqItem[]\n /** Release notes shown in the \"Novidades\" card. */\n whatsNew?: WhatsNewItem[]\n /** Status components listed under the Status card. */\n statusComponents?: StatusComponent[]\n /** Where the operator console is routed (default '/support/console'). An app that\n * nests it under another rail group points it there (e.g. '/customers/support'). */\n consoleRoute?: string\n /** Rail label of the operator console (default 'Central de Chamados'). */\n consoleLabel?: string\n /** Rail position of the operator console (default 45). */\n consolePosition?: number\n}\n\nexport function createSupportPlugin(options?: SupportPluginOptions): PluginManifest {\n const label = options?.label ?? 'Suporte'\n const consoleRoute = options?.consoleRoute?.trim() || '/support/console'\n const consoleLabel = options?.consoleLabel ?? 'Central de Chamados'\n const consolePosition = options?.consolePosition ?? 45\n setHelpdeskConsolePath(consoleRoute)\n registerTranslations(supportLocales)\n // Make the Dico's \"modo relato\" tool runnable (client-plane executor). Guarded\n // to the browser inside, so this is a no-op when the manifest is built on the\n // server or in a unit test.\n registerSupportAITools()\n\n const content: SupportCenterContent = {\n faq: options?.faq ?? defaultFaq,\n whatsNew: options?.whatsNew ?? defaultWhatsNew,\n statusComponents: options?.statusComponents ?? defaultStatusComponents,\n }\n\n const SupportPage: React.FC<unknown> = () =>\n React.createElement(\n React.Suspense,\n { fallback: React.createElement('div', { className: 'p-6 text-sm text-muted-foreground' }, 'Carregando…') },\n React.createElement(LazySupportCenter, { content }),\n )\n\n return {\n id: 'support',\n name: label,\n icon: 'LifeBuoy',\n version: '0.1.0',\n scope: options?.scope ?? 'universal',\n verticalId: options?.verticalId,\n defaultEnabled: true,\n dependencies: [],\n\n // Support is for everyone, like the V1 support panel (\"nasce liberada em\n // todos os perfis\") — so the route is open to any authenticated user rather\n // than gated by a deny-by-default feature. Only `support.all` is a declared\n // permission: it unlocks the \"Toda a empresa\" view, and ships denied (the\n // admin/owner holds it).\n declaredFeatures: [\n { id: 'support.all', label: 'Solicitações de toda a empresa', group: label },\n ],\n\n // The requester reaches Suporte from the user menu. The OPERATOR console line\n // is gated by the `console` FACET — it shows ONLY in the workspace that runs\n // the helpdesk (GoControl), where the facet is on. In a store (Pertinho,\n // Artorius…) the facet is off, so the line is absent no matter who is logged\n // in. It is a per-TENANT line: you see it when you are IN the GoControl\n // workspace, not because of who you are.\n navigation: [\n {\n id: 'support-console',\n section: 'main',\n position: consolePosition,\n label: consoleLabel,\n route: consoleRoute,\n icon: 'LifeBuoy',\n // Sit right below \"Clientes\": land above the line the rail draws next\n // after it (AtendeAI, then the CRM/financial block).\n before: ['/atendeai', '/sales', '/financial'],\n requiresFacet: 'console',\n },\n ],\n\n // Off for every tenant by default; enabled only for the helpdesk workspace\n // with scripts/support-enable-console.mjs. A store that turns on Suporte does\n // NOT get it.\n facets: [\n {\n id: 'console',\n label: 'Central de Chamados (operador)',\n description: 'O console cross-tenant do suporte — só no workspace que opera o helpdesk.',\n },\n ],\n\n // \"Modo relato\": the assistant registers a request instead of improvising a\n // fix. The executor is wired above (registerSupportAITools); the opener\n // suggestions ride on the tool (the V1 doors).\n aiTools: supportAITools,\n\n routes: [\n {\n path: '/support',\n component: SupportPage as React.ComponentType<unknown>,\n guard: 'authenticated',\n },\n {\n // The helpdesk console. Open to any authenticated user as a route; the\n // view calls support_is_operator() and shows \"acesso restrito\" to a\n // non-operator, and every data call is gated server-side anyway.\n path: consoleRoute,\n component: HelpdeskConsolePage as React.ComponentType<unknown>,\n guard: 'authenticated',\n title: consoleLabel,\n },\n ],\n\n migrations: MIGRATIONS.map((entry) => ({\n id: `support-${entry.id}`,\n version: '0.1.0',\n sql: entry.sql,\n description:\n 'Central de Suporte do Dico: the plg_support_* tables (requests, messages, events, attachments, notifications), their RLS, the per-tenant number trigger and the private support-attachments bucket.',\n })),\n\n locales: supportLocales,\n }\n}\n\nexport { useSupportStore } from './store'\n// A store's chamados by status, for embedding in that store's CRM card (the CRM\n// resolves the store tenant from company.metadata.tenant_id_v2 and passes it).\nexport { HelpdeskStatusPanel } from './components/HelpdeskStatusPanel'\nexport * from './types'\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console-path.d.ts","sourceRoot":"","sources":["../../src/lib/console-path.ts"],"names":[],"mappings":"AAIA,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEzD;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HelpdeskConsole.d.ts","sourceRoot":"","sources":["../../src/views/HelpdeskConsole.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"HelpdeskConsole.d.ts","sourceRoot":"","sources":["../../src/views/HelpdeskConsole.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AA2CzB;;;;;GAKG;AACH,wBAAgB,eAAe,sBAe9B;AAyRD,eAAe,eAAe,CAAA"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"status": "beta",
|
|
5
5
|
"dependencies": []
|
|
6
6
|
},
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.3.0-canary.20261027153628",
|
|
8
8
|
"description": "Fayz SDK — plugin-support plugin (Central de Suporte do Dico: solicitações)",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"sideEffects": false,
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"lucide-react": ">=0.400.0 <1.0.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@fayz-ai/core": "^0.
|
|
37
|
-
"@fayz-ai/admin": "^0.
|
|
38
|
-
"@fayz-ai/ui": "^0.
|
|
36
|
+
"@fayz-ai/core": "^0.74.0-canary.20261027153628",
|
|
37
|
+
"@fayz-ai/admin": "^0.74.0-canary.20261027153628",
|
|
38
|
+
"@fayz-ai/ui": "^0.74.0-canary.20261027153628"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/react": "^18.3.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/fix-prompt.ts","../src/views/HelpdeskConsole.tsx"],"names":[],"mappings":";;;;;;;;AA+BO,SAAS,cAAA,CAAe,QAAwB,OAAA,EAA0B;AAC/E,EAAA,MAAM,QAAkB,EAAC;AACzB,EAAA,MAAM,GAAA,GAAM,OAAA,EAAS,IAAA,EAAK,IAAK,cAAA;AAC/B,EAAA,KAAA,CAAM,IAAA,CAAK,CAAA,mCAAA,EAAsC,GAAG,CAAA,CAAA,CAAG,CAAA;AACvD,EAAA,KAAA,CAAM,KAAK,EAAE,CAAA;AACb,EAAA,KAAA,CAAM,IAAA,CAAK,WAAW,MAAA,CAAO,MAAA,CAAO,MAAM,CAAA,CAAE,QAAA,CAAS,GAAG,GAAG,CAAC,SAAM,UAAA,CAAW,MAAA,CAAO,IAAI,CAAC,CAAA,cAAA,EAAc,aAAa,MAAA,CAAO,MAAM,CAAC,CAAA,CAAE,CAAA;AACpI,EAAA,IAAI,OAAO,KAAA,EAAO,KAAA,CAAM,KAAK,CAAA,gBAAA,EAAmB,MAAA,CAA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EAAK,KAAK,GAAA,CAAI,IAAA,EAAM,SAAA,EAAU,gCAAA,EAAiC,CAAA,mBAAK,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,iGAAgG,QAAA,EAAA,OAAA,EAAK,CAAA;AAAA,oBAC/M,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,gCAAA,EAAkC,cAAI,IAAA,EAAK;AAAA,GAAA,EAC7D,CAAA;AAEJ;AAEA,IAAO,uBAAA,GAAQ","file":"HelpdeskConsole-XWHLJTOM.js","sourcesContent":["import type { SupportKind, SupportStatus, SupportMessage, SupportEvent, SupportAttachment } from '../types'\nimport { KIND_LABEL, STATUS_LABEL, eventLine } from './vocabulary'\n\n/** The fields the prompt needs — satisfied by both the requester's\n * SupportRequestDetail and the operator's ConsoleDetail. */\nexport interface FixPromptInput {\n number: number\n kind: SupportKind\n status: SupportStatus\n subject: string | null\n description: string\n route: string | null\n screenSnapshot: Record<string, unknown>\n messages: SupportMessage[]\n events: SupportEvent[]\n attachments: SupportAttachment[]\n /** The store (tenant) the ticket is from, and the user who reported it — so a\n * coding agent can resolve the exact account and reproduce against it. */\n tenantId?: string\n createdBy?: string\n}\n\n/**\n * The prompt an operator copies into Claude to go fix a reported issue.\n *\n * It carries everything Claude needs to find the cause without a second\n * round-trip: which app and screen, the user's own words, the trail of routes\n * and buttons that led to it, and the conversation so far. English scaffolding\n * (it is read by a coding agent) around the user's pt-BR text (left verbatim —\n * the exact words are the bug report).\n */\nexport function buildFixPrompt(detail: FixPromptInput, appName?: string): string {\n const lines: string[] = []\n const app = appName?.trim() || 'the Fayz app'\n lines.push(`Fix an issue reported by a user of ${app}.`)\n lines.push('')\n lines.push(`Ticket #${String(detail.number).padStart(4, '0')} · ${KIND_LABEL[detail.kind]} · status: ${STATUS_LABEL[detail.status]}`)\n if (detail.route) lines.push(`Screen / route: ${detail.route}`)\n // Ids so a coding agent can resolve the exact account and reproduce/test\n // against it (the store's tenant, and the user who reported it).\n if (detail.tenantId) lines.push(`Tenant (store) id: ${detail.tenantId}`)\n if (detail.createdBy) lines.push(`Reported by user id: ${detail.createdBy}`)\n lines.push('')\n lines.push('PROBLEM (in the user\\'s own words):')\n // Skip the subject when it just repeats the description (the assistant often\n // derives one from the other).\n const subject = detail.subject?.trim()\n const description = detail.description.trim()\n if (subject && !description.toLowerCase().startsWith(subject.toLowerCase())) lines.push(subject)\n lines.push(description)\n\n const activity = (detail.screenSnapshot?.activity ?? null) as Array<{ kind?: string; label?: string; path?: string }> | null\n if (Array.isArray(activity) && activity.length) {\n lines.push('')\n lines.push('WHAT THE USER DID BEFORE REPORTING (most recent last):')\n for (const e of activity) {\n if (!e?.label) continue\n lines.push(e.kind === 'action' ? `- clicked \"${e.label}\"` : `- opened ${e.label}${e.path ? ` (${e.path})` : ''}`)\n }\n }\n\n if (detail.attachments.length) {\n lines.push('')\n lines.push(`ATTACHMENTS: ${detail.attachments.map((a) => a.name).join(', ')} (screenshots of the problem).`)\n }\n\n if (detail.messages.length) {\n lines.push('')\n lines.push('CONVERSATION WITH THE TEAM:')\n for (const m of detail.messages) {\n lines.push(`- ${m.authorKind === 'team' ? 'Team' : 'User'}: ${m.body}`)\n }\n }\n\n if (detail.events.length) {\n lines.push('')\n lines.push('HISTORY:')\n for (const ev of detail.events) lines.push(`- ${eventLine(ev.type, ev.note)}`)\n }\n\n lines.push('')\n lines.push(\n 'Investigate the code path behind this screen in the Fayz SDK (and the app that renders it), ' +\n 'find the root cause, and propose a concrete fix. If you need to reproduce it, follow the trail above.',\n )\n return lines.join('\\n')\n}\n","import React from 'react'\nimport {\n Button, Badge, Input, Textarea, Skeleton, Thumbnail, ModalTask, toast,\n Select, SelectTrigger, SelectValue, SelectContent, SelectItem, ICON_MAP, SubpageHeader,\n} from '@fayz-ai/ui'\nimport {\n consoleListRequests, consoleDetail, consoleSetStatus, consoleSetPriority,\n consoleReply, isOperator,\n type ConsoleRequest, type ConsoleDetail,\n} from '../data/console'\nimport { signedUrl } from '../data/api'\nimport {\n KIND_LABEL, STATUS_LABEL, STATUS_TONE, PRIORITY_LABEL, PRIORITY_TONE, PRIORITY_ORDER, eventLine,\n} from '../lib/vocabulary'\nimport { buildFixPrompt } from '../lib/fix-prompt'\nimport type { SupportStatus, SupportPriority, SupportAttachment } from '../types'\nimport { navigateApp, currentAppPath, onAppPathChange } from '@fayz-ai/core'\n\nconst STATUS_OPTIONS: SupportStatus[] = ['received', 'in_service', 'waiting_you', 'in_development', 'resolved_check', 'closed', 'cancelled']\nconst OPEN_STATUSES: SupportStatus[] = ['received', 'in_service', 'waiting_you', 'in_development', 'resolved_check']\n\n/** Hash navigation, without reaching into the shell's private routing. */\nfunction go(path: string) { if (typeof window !== 'undefined') navigateApp(path) }\n\nfunction ticketNo(n: number): string { return `#${String(n).padStart(4, '0')}` }\n\n/** The ticket id when the route is #/support/console/<id>, else null. */\nfunction useConsoleRoute(): string | null {\n const read = () => {\n if (typeof window === 'undefined') return null\n const m = currentAppPath().match(/^\\/support\\/console\\/([^/?]+)/)\n return m ? decodeURIComponent(m[1]!) : null\n }\n const [id, setId] = React.useState<string | null>(read)\n React.useEffect(() => {\n const on = () => setId(read())\n return onAppPathChange(on)\n }, [])\n return id\n}\n\n/**\n * The GoControl helpdesk console (Zendesk/Intercom-style). An operator reads and\n * acts on the support requests of EVERY tenant through the support_console_* RPCs.\n * The triage list lives at #/support/console; clicking a card opens the ticket as\n * its own nested page (#/support/console/<id>) with a \"← Voltar\" header.\n */\nexport function HelpdeskConsole() {\n const [operator, setOperator] = React.useState<boolean | null>(null)\n React.useEffect(() => { void isOperator().then(setOperator) }, [])\n const ticketId = useConsoleRoute()\n\n if (operator === false) {\n return (\n <div className=\"rounded-xl border bg-card p-10 text-center\">\n <p className=\"text-sm font-medium\">Acesso restrito</p>\n <p className=\"mt-1 text-sm text-muted-foreground\">A Central de Chamados é para operadores do suporte.</p>\n </div>\n )\n }\n if (operator === null) return <div className=\"space-y-3\"><Skeleton className=\"h-20 w-full\" /><Skeleton className=\"h-20 w-full\" /></div>\n return ticketId ? <ConsoleTicketPage id={ticketId} /> : <ConsoleListView />\n}\n\nfunction ConsoleListView() {\n const [requests, setRequests] = React.useState<ConsoleRequest[]>([])\n const [loading, setLoading] = React.useState(true)\n const [onlyOpen, setOnlyOpen] = React.useState(true)\n const [search, setSearch] = React.useState('')\n\n React.useEffect(() => {\n let alive = true\n setLoading(true)\n consoleListRequests(onlyOpen ? OPEN_STATUSES : undefined, search)\n .then((r) => { if (alive) setRequests(r) })\n .catch(() => { if (alive) setRequests([]) })\n .finally(() => { if (alive) setLoading(false) })\n return () => { alive = false }\n }, [onlyOpen, search])\n\n const grouped = PRIORITY_ORDER\n .map((p) => ({ priority: p, items: requests.filter((r) => r.priority === p) }))\n .filter((g) => g.items.length > 0)\n\n return (\n <div className=\"mx-auto flex max-w-3xl flex-col gap-3\">\n <Input value={search} onChange={(e) => setSearch(e.target.value)} placeholder=\"Buscar chamado ou loja…\" />\n <div className=\"flex items-center gap-2 text-xs\">\n <button onClick={() => setOnlyOpen(true)} className={`rounded-full px-3 py-1 ${onlyOpen ? 'bg-foreground text-background' : 'bg-muted text-muted-foreground'}`}>Em aberto</button>\n <button onClick={() => setOnlyOpen(false)} className={`rounded-full px-3 py-1 ${!onlyOpen ? 'bg-foreground text-background' : 'bg-muted text-muted-foreground'}`}>Todos</button>\n <span className=\"ml-auto text-muted-foreground\">{requests.length} chamado(s)</span>\n </div>\n\n <div className=\"flex flex-col gap-4\">\n {loading ? (\n [0, 1, 2].map((i) => <Skeleton key={i} className=\"h-16 w-full\" />)\n ) : requests.length === 0 ? (\n <div className=\"rounded-xl border bg-card p-8 text-center text-sm text-muted-foreground\">Nenhum chamado por aqui.</div>\n ) : (\n grouped.map((g) => (\n <div key={g.priority} className=\"flex flex-col gap-1.5\">\n <div className=\"flex items-center gap-2 px-1\">\n <Badge variant={PRIORITY_TONE[g.priority]}>{PRIORITY_LABEL[g.priority]}</Badge>\n <span className=\"text-[11px] text-muted-foreground\">{g.items.length}</span>\n </div>\n {g.items.map((r) => (\n <TicketRow key={r.id} req={r} onClick={() => go(`/support/console/${r.id}`)} />\n ))}\n </div>\n ))\n )}\n </div>\n </div>\n )\n}\n\n/** The ticket as its own nested page: \"← Voltar\" + full detail and actions. */\nfunction ConsoleTicketPage({ id }: { id: string }) {\n const [detail, setDetail] = React.useState<ConsoleDetail | null>(null)\n const [loading, setLoading] = React.useState(true)\n\n React.useEffect(() => {\n let alive = true\n setLoading(true)\n consoleDetail(id).then((d) => { if (alive) setDetail(d) }).finally(() => { if (alive) setLoading(false) })\n return () => { alive = false }\n }, [id])\n\n const ready = detail && detail.id === id\n\n return (\n <div className=\"flex flex-col gap-4\">\n <SubpageHeader\n parentLabel=\"Central de Chamados\"\n onBack={() => go('/support/console')}\n title={ready ? `Ticket ${ticketNo(detail.number)}` : 'Ticket'}\n subtitle={ready ? (detail.tenantName ?? undefined) : undefined}\n titleTrailing={ready ? <Badge variant={STATUS_TONE[detail.status]}>{STATUS_LABEL[detail.status]}</Badge> : undefined}\n />\n {loading && !ready ? (\n <div className=\"space-y-3\"><Skeleton className=\"h-28 w-full\" /><Skeleton className=\"h-40 w-full\" /></div>\n ) : ready ? (\n <OperatorDetail detail={detail} onApplied={(d) => d && setDetail(d)} />\n ) : (\n <div className=\"rounded-xl border bg-card p-10 text-center\">\n <p className=\"text-sm font-medium\">Chamado não encontrado</p>\n <div className=\"mt-4\"><Button variant=\"outline\" onClick={() => go('/support/console')}>Voltar</Button></div>\n </div>\n )}\n </div>\n )\n}\n\nfunction TicketRow({ req, onClick }: { req: ConsoleRequest; onClick: () => void }) {\n return (\n <button\n onClick={onClick}\n className=\"flex w-full flex-col gap-1 rounded-lg border bg-card p-3 text-left transition-colors hover:border-primary/40 hover:bg-accent\"\n >\n <div className=\"flex items-center justify-between gap-2 text-[11px] text-muted-foreground\">\n <span className=\"truncate font-medium text-foreground\">{req.tenantName ?? 'Loja'}</span>\n <span>{ticketNo(req.number)}</span>\n </div>\n <div className=\"truncate text-sm\">{req.subject || KIND_LABEL[req.kind]}</div>\n <div className=\"flex items-center gap-1.5\">\n <Badge variant={STATUS_TONE[req.status]}>{STATUS_LABEL[req.status]}</Badge>\n {req.createdByName && <span className=\"truncate text-[11px] text-muted-foreground\">por {req.createdByName}</span>}\n {req.messageCount > 0 && <span className=\"ml-auto text-[11px] text-muted-foreground\">{req.messageCount} msg</span>}\n </div>\n </button>\n )\n}\n\nfunction OperatorDetail({ detail, onApplied }: { detail: ConsoleDetail; onApplied: (d: ConsoleDetail | null) => void }) {\n const [busy, setBusy] = React.useState(false)\n const [reply, setReply] = React.useState('')\n\n React.useEffect(() => { setReply('') }, [detail.id])\n\n async function run(fn: () => Promise<ConsoleDetail | null>, okMsg: string) {\n setBusy(true)\n try { onApplied(await fn()); toast.success(okMsg) }\n catch (e) { toast.error((e as Error)?.message ?? 'Não consegui aplicar.') }\n finally { setBusy(false) }\n }\n\n const activity = (detail.screenSnapshot?.activity ?? null) as Array<{ kind?: string; label?: string; path?: string }> | null\n\n return (\n // Two columns, like the CRM deal card: the ticket and its controls on the\n // left, the conversation and the activity feed on the right.\n <div className=\"grid gap-5 lg:grid-cols-2 lg:items-start\">\n {/* ── LEFT: the ticket + operator controls ───────────────────────── */}\n <div className=\"flex flex-col gap-4\">\n <section className=\"rounded-xl border bg-card p-5\">\n <h1 className=\"text-lg font-semibold leading-snug\">{detail.subject || KIND_LABEL[detail.kind]}</h1>\n <p className=\"mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground\">\n <span>{KIND_LABEL[detail.kind]}</span>\n <Badge variant={PRIORITY_TONE[detail.priority]}>{PRIORITY_LABEL[detail.priority]}</Badge>\n <span>· aberto por <span className=\"font-medium text-foreground\">{detail.createdByName ?? '—'}</span></span>\n </p>\n <p className=\"mt-3 whitespace-pre-wrap text-sm leading-relaxed\">{detail.description}</p>\n {detail.route && <p className=\"mt-2 text-xs text-muted-foreground\">Tela: <span className=\"font-mono\">{detail.route}</span></p>}\n {detail.attachments.length > 0 && (\n <div className=\"mt-3 flex flex-wrap gap-2\">\n {detail.attachments.map((a) => <AttachmentCard key={a.id} att={a} />)}\n </div>\n )}\n {Array.isArray(activity) && activity.length > 0 && (\n <div className=\"mt-3 border-t pt-3 text-xs\">\n <div className=\"mb-1 text-muted-foreground\">Trilha até o relato</div>\n <ol className=\"space-y-0.5\">\n {activity.map((e, i) => (\n <li key={i}>{e.kind === 'action' ? <>clicou <span className=\"font-medium\">\"{e.label}\"</span></> : <><span className=\"font-medium\">{e.label}</span> {e.path && <span className=\"font-mono text-[10px] text-muted-foreground\">{e.path}</span>}</>}</li>\n ))}\n </ol>\n </div>\n )}\n </section>\n\n <div className=\"rounded-xl border bg-card p-4\">\n <h2 className=\"mb-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground\">Andamento</h2>\n <label className=\"mb-1 block text-xs text-muted-foreground\">Status</label>\n <Select value={detail.status} onValueChange={(v) => run(() => consoleSetStatus(detail.id, v as SupportStatus), 'Status atualizado')} disabled={busy}>\n <SelectTrigger><SelectValue /></SelectTrigger>\n <SelectContent>\n {STATUS_OPTIONS.map((s) => <SelectItem key={s} value={s}>{STATUS_LABEL[s]}</SelectItem>)}\n </SelectContent>\n </Select>\n <label className=\"mb-1 mt-3 block text-xs text-muted-foreground\">Prioridade</label>\n <Select value={detail.priority} onValueChange={(v) => run(() => consoleSetPriority(detail.id, v as SupportPriority), 'Prioridade atualizada')} disabled={busy}>\n <SelectTrigger><SelectValue /></SelectTrigger>\n <SelectContent>\n {PRIORITY_ORDER.map((p) => <SelectItem key={p} value={p}>{PRIORITY_LABEL[p]}</SelectItem>)}\n </SelectContent>\n </Select>\n </div>\n\n <div className=\"rounded-xl border bg-card p-4\">\n <h2 className=\"mb-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground\">Cliente</h2>\n {/* The client is the store that opened the chamado — already connected\n by the ticket's tenant_id, shown automatically, not linked by hand. */}\n <p className=\"text-sm font-medium\">{detail.tenantName ?? 'Loja'}</p>\n <p className=\"text-xs text-muted-foreground\">Loja que abriu o chamado — vinculada automaticamente.</p>\n <FixWithClaudeConsole detail={detail} />\n </div>\n </div>\n\n {/* ── RIGHT: conversation + activity feed ─────────────────────────── */}\n <div className=\"flex flex-col gap-4\">\n <div className=\"rounded-xl border bg-card p-4\">\n <h2 className=\"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground\">Conversa com o cliente</h2>\n {detail.messages.length === 0 ? (\n <p className=\"mt-2 text-sm text-muted-foreground\">Sem mensagens ainda.</p>\n ) : (\n <div className=\"mt-3 space-y-2\">\n {detail.messages.map((m) => (\n <div key={m.id} className={m.authorKind === 'team' ? 'flex justify-end' : 'flex justify-start'}>\n <div className={`max-w-[85%] rounded-lg px-3 py-2 text-sm ${m.authorKind === 'team' ? 'bg-primary/10' : 'bg-muted'}`}>\n <div className=\"whitespace-pre-wrap\">{m.body}</div>\n <div className=\"mt-1 text-right text-[10px] text-muted-foreground\">{fmtWhen(m.createdAt)}</div>\n </div>\n </div>\n ))}\n </div>\n )}\n <div className=\"mt-3 flex items-end gap-2\">\n <Textarea rows={2} value={reply} onChange={(e) => setReply(e.target.value)} placeholder=\"Responder ao cliente…\" className=\"flex-1\" />\n <Button disabled={busy || !reply.trim()} onClick={() => run(async () => { const d = await consoleReply(detail.id, reply); setReply(''); return d }, 'Resposta enviada')}>Responder</Button>\n </div>\n </div>\n\n <div className=\"rounded-xl border bg-card p-4\">\n <h2 className=\"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground\">Atividades</h2>\n {detail.events.length === 0 ? (\n <p className=\"mt-2 text-sm text-muted-foreground\">Sem atividades.</p>\n ) : (\n <ol className=\"mt-3 space-y-2.5\">\n {detail.events.map((e) => (\n <li key={e.id} className=\"flex gap-2 text-xs\">\n <span className=\"mt-1 h-1.5 w-1.5 shrink-0 rounded-full bg-muted-foreground/40\" />\n <div className=\"min-w-0\">\n <div>{eventLine(e.type, e.note)}</div>\n <div className=\"text-muted-foreground\">{fmtWhen(e.createdAt)}</div>\n </div>\n </li>\n ))}\n </ol>\n )}\n </div>\n </div>\n </div>\n )\n}\n\nfunction fmtWhen(iso: string): string {\n try {\n return new Date(iso).toLocaleString('pt-BR', { day: '2-digit', month: '2-digit', hour: '2-digit', minute: '2-digit' })\n } catch { return iso }\n}\n\nfunction FixWithClaudeConsole({ detail }: { detail: ConsoleDetail }) {\n const [open, setOpen] = React.useState(false)\n const prompt = React.useMemo(() => (open ? buildFixPrompt(detail, detail.tenantName ?? undefined) : ''), [open, detail])\n async function copy() {\n try { await navigator.clipboard.writeText(prompt); toast.success('Prompt copiado') }\n catch { toast.error('Não consegui copiar.') }\n }\n const Spark = (ICON_MAP as Record<string, React.ComponentType<{ className?: string }>>).Sparkles\n return (\n <>\n <Button className=\"mt-3 w-full justify-center gap-2\" onClick={() => setOpen(true)}>\n {Spark && <Spark className=\"h-4 w-4\" />} Corrigir com Claude\n </Button>\n <ModalTask open={open} title=\"Corrigir com Claude\" width=\"min(42rem, 94vw)\" onClose={() => setOpen(false)}>\n <div className=\"flex flex-col gap-3 p-4\">\n <p className=\"text-sm text-muted-foreground\">Copie e cole no Claude para investigar e corrigir.</p>\n <Textarea value={prompt} readOnly rows={14} className=\"font-mono text-xs\" onFocus={(e) => e.currentTarget.select()} />\n <div className=\"flex justify-end gap-2\">\n <Button variant=\"outline\" onClick={() => setOpen(false)}>Fechar</Button>\n <Button onClick={copy}>Copiar prompt</Button>\n </div>\n </div>\n </ModalTask>\n </>\n )\n}\n\nfunction AttachmentCard({ att }: { att: SupportAttachment }) {\n const [url, setUrl] = React.useState<string | null>(null)\n React.useEffect(() => {\n let alive = true\n if ((att.contentType ?? '').startsWith('image/')) void signedUrl(att.storagePath).then((u) => { if (alive) setUrl(u) })\n return () => { alive = false }\n }, [att.storagePath, att.contentType])\n return (\n <a href={url ?? undefined} target=\"_blank\" rel=\"noreferrer\" className=\"flex items-center gap-2 rounded-lg border bg-card p-2 hover:bg-muted\">\n {url ? <Thumbnail src={url} alt={att.name} className=\"h-12 w-12 rounded object-cover\" /> : <div className=\"flex h-12 w-12 items-center justify-center rounded bg-muted text-[10px] text-muted-foreground\">anexo</div>}\n <span className=\"max-w-[10rem] truncate text-xs\">{att.name}</span>\n </a>\n )\n}\n\nexport default HelpdeskConsole\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/data/console.ts"],"names":[],"mappings":";;;AAaA,SAAS,MAAA,GAAoB;AAC3B,EAAA,MAAM,IAAI,yBAAA,EAA0B;AACpC,EAAA,IAAI,CAAC,CAAA,EAAG,MAAM,IAAI,MAAM,+BAA+B,CAAA;AACvD,EAAA,OAAO,CAAA;AACT;AA+BA,SAAS,iBAAiB,CAAA,EAAwB;AAChD,EAAA,OAAO;AAAA,IACL,IAAI,CAAA,CAAE,EAAA;AAAA,IAAI,QAAQ,CAAA,CAAE,MAAA;AAAA,IAAQ,MAAM,CAAA,CAAE,IAAA;AAAA,IAAM,OAAA,EAAS,EAAE,OAAA,IAAW,IAAA;AAAA,IAChE,aAAa,CAAA,CAAE,WAAA;AAAA,IAAa,QAAQ,CAAA,CAAE,MAAA;AAAA,IAAQ,QAAA,EAAU,EAAE,QAAA,IAAY,QAAA;AAAA,IACtE,KAAA,EAAO,EAAE,KAAA,IAAS,IAAA;AAAA,IAAM,WAAW,CAAA,CAAE,UAAA;AAAA,IAAY,aAAA,EAAe,EAAE,eAAA,IAAmB,IAAA;AAAA,IACrF,WAAW,CAAA,CAAE,UAAA;AAAA,IAAY,WAAW,CAAA,CAAE,UAAA;AAAA,IACtC,UAAU,CAAA,CAAE,SAAA;AAAA,IAAW,UAAA,EAAY,EAAE,WAAA,IAAe,IAAA;AAAA,IAAM,UAAA,EAAY,EAAE,WAAA,IAAe,IAAA;AAAA,IACvF,YAAA,EAAc,EAAE,cAAA,IAAkB,IAAA;AAAA,IAAM,cAAA,EAAgB,EAAE,gBAAA,IAAoB,IAAA;AAAA,IAC9E,YAAA,EAA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AM,GAAI,MAAM,QAAO,CAAE,GAAA,CAAI,4BAAA,EAA8B,EAAE,cAAc,SAAA,EAAW,QAAA,EAAU,QAAQ,MAAA,EAAQ,IAAA,IAAQ,MAAM,CAAA;AAC5I,EAAA,IAAI,OAAO,MAAM,KAAA;AACjB,EAAA,OAAO,SAAS,IAAI,CAAA;AACtB;AAEA,eAAsB,kBAAA,CAAmB,WAAmB,QAAA,EAA0D;AACpH,EAAA,MAAM,EAAE,IAAA,EAAM,KAAA,EAAM,GAAI,MAAM,MAAA,EAAO,CAAE,GAAA,CAAI,8BAAA,EAAgC,EAAE,YAAA,EAAc,SAAA,EAAW,UAAA,EAAY,UAAU,CAAA;AAC5H,EAAA,IAAI,OAAO,MAAM,KAAA;AACjB,EAAA,OAAO,SAAS,IAAI,CAAA;AACtB;AAEA,eAAsB,YAAA,CAAa,WAAmB,IAAA,EAA6C;AACjG,EAAA,MAAM,EAAE,IAAA,EAAM,KAAA,EAAM,GAAI,MAAM,MAAA,EAAO,CAAE,GAAA,CAAI,uBAAA,EAAyB,EAAE,YAAA,EAAc,SAAA,EAAW,MAAA,EAAQ,MAAM,CAAA;AAC7G,EAAA,IAAI,OAAO,MAAM,KAAA;AACjB,EAAA,OAAO,SAAS,IAAI,CAAA;AACtB","file":"chunk-5K7VA5VP.js","sourcesContent":["import { getSupabaseClientOptional } from '@fayz-ai/core'\nimport type {\n SupportKind, SupportStatus, SupportPriority,\n SupportMessage, SupportEvent, SupportAttachment,\n} from '../types'\n\n// The helpdesk (console) data layer — cross-tenant, and therefore NOT plain\n// PostgREST + RLS like data/api.ts. Every call goes through a SECURITY DEFINER\n// RPC that checks the caller is a seeded operator (plg_support_operators) and\n// carries the tenant boundary itself. A non-operator gets an error, never rows.\n\ntype AnyClient = any\n\nfunction client(): AnyClient {\n const c = getSupabaseClientOptional()\n if (!c) throw new Error('Supabase client not available')\n return c as AnyClient\n}\n\n/** A request as the operator sees it — with the originating tenant and a count. */\nexport interface ConsoleRequest {\n id: string\n number: number\n kind: SupportKind\n subject: string | null\n description: string\n status: SupportStatus\n priority: SupportPriority\n route: string | null\n createdBy: string\n createdByName: string | null\n createdAt: string\n updatedAt: string\n tenantId: string\n tenantName: string | null\n tenantSlug: string | null\n linkedLeadId: string | null\n linkedLeadName: string | null\n messageCount: number\n}\n\nexport interface ConsoleDetail extends ConsoleRequest {\n screenSnapshot: Record<string, unknown>\n messages: SupportMessage[]\n events: SupportEvent[]\n attachments: SupportAttachment[]\n}\n\nfunction toConsoleRequest(r: any): ConsoleRequest {\n return {\n id: r.id, number: r.number, kind: r.kind, subject: r.subject ?? null,\n description: r.description, status: r.status, priority: r.priority ?? 'normal',\n route: r.route ?? null, createdBy: r.created_by, createdByName: r.created_by_name ?? null,\n createdAt: r.created_at, updatedAt: r.updated_at,\n tenantId: r.tenant_id, tenantName: r.tenant_name ?? null, tenantSlug: r.tenant_slug ?? null,\n linkedLeadId: r.linked_lead_id ?? null, linkedLeadName: r.linked_lead_name ?? null,\n messageCount: Number(r.message_count ?? 0),\n }\n}\n\nconst toMessage = (r: any): SupportMessage => ({\n id: r.id, requestId: r.request_id, authorKind: r.author_kind,\n authorId: r.author_id ?? null, body: r.body, createdAt: r.created_at,\n})\nconst toEvent = (r: any): SupportEvent => ({\n id: r.id, requestId: r.request_id, type: r.type, note: r.note ?? null, createdAt: r.created_at,\n})\nconst toAttachment = (r: any): SupportAttachment => ({\n id: r.id, requestId: r.request_id, storagePath: r.storage_path, name: r.name,\n sizeBytes: r.size_bytes ?? null, contentType: r.content_type ?? null, createdAt: r.created_at,\n})\n\nfunction toDetail(payload: any): ConsoleDetail | null {\n const r = payload?.request\n if (!r) return null\n return {\n ...toConsoleRequest(r),\n screenSnapshot: r.screen_snapshot ?? {},\n messages: (payload.messages ?? []).map(toMessage),\n events: (payload.events ?? []).map(toEvent),\n attachments: (payload.attachments ?? []).map(toAttachment),\n }\n}\n\n/** Is the signed-in user a helpdesk operator? Gates the console menu entry. */\nexport async function isOperator(): Promise<boolean> {\n try {\n const { data, error } = await client().rpc('support_is_operator')\n if (error) return false\n return data === true\n } catch {\n return false\n }\n}\n\nexport async function consoleListRequests(statuses?: SupportStatus[], search?: string): Promise<ConsoleRequest[]> {\n const { data, error } = await client().rpc('support_console_requests', {\n p_statuses: statuses && statuses.length ? statuses : null,\n p_search: search && search.trim() ? search.trim() : null,\n })\n if (error) throw error\n return ((data as any[]) ?? []).map(toConsoleRequest)\n}\n\nexport async function consoleDetail(requestId: string): Promise<ConsoleDetail | null> {\n const { data, error } = await client().rpc('support_console_detail', { p_request_id: requestId })\n if (error) throw error\n return toDetail(data)\n}\n\nexport async function consoleSetStatus(requestId: string, status: SupportStatus, note?: string): Promise<ConsoleDetail | null> {\n const { data, error } = await client().rpc('support_console_set_status', { p_request_id: requestId, p_status: status, p_note: note ?? null })\n if (error) throw error\n return toDetail(data)\n}\n\nexport async function consoleSetPriority(requestId: string, priority: SupportPriority): Promise<ConsoleDetail | null> {\n const { data, error } = await client().rpc('support_console_set_priority', { p_request_id: requestId, p_priority: priority })\n if (error) throw error\n return toDetail(data)\n}\n\nexport async function consoleReply(requestId: string, body: string): Promise<ConsoleDetail | null> {\n const { data, error } = await client().rpc('support_console_reply', { p_request_id: requestId, p_body: body })\n if (error) throw error\n return toDetail(data)\n}\n\nexport async function consoleLinkLead(requestId: string, leadId: string, leadName?: string): Promise<ConsoleDetail | null> {\n const { data, error } = await client().rpc('support_console_link_lead', { p_request_id: requestId, p_lead_id: leadId, p_lead_name: leadName ?? null })\n if (error) throw error\n return toDetail(data)\n}\n"]}
|