@fayz-ai/plugin-support 0.3.0-canary.20261028142749 → 0.3.0

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.
Files changed (105) hide show
  1. package/dist/{HelpdeskConsole-QY534ASZ.js → HelpdeskConsole-EATEBVLN.js} +10 -7
  2. package/dist/HelpdeskConsole-EATEBVLN.js.map +1 -0
  3. package/dist/{LiveChatAgentWatcher-J6PNLYWT.js → LiveChatAgentWatcher-WEUHRRLC.js} +17 -23
  4. package/dist/LiveChatAgentWatcher-WEUHRRLC.js.map +1 -0
  5. package/dist/{OpenTicketFromConversation-KDXK7A6L.js → OpenTicketFromConversation-RC26KHN3.js} +4 -4
  6. package/dist/{OpenTicketFromConversation-KDXK7A6L.js.map → OpenTicketFromConversation-RC26KHN3.js.map} +1 -1
  7. package/dist/{SupportCenter-JBBBJTKU.js → SupportCenter-HGQL4PBX.js} +12 -9
  8. package/dist/SupportCenter-HGQL4PBX.js.map +1 -0
  9. package/dist/{SupportSettingsPage-PB6A3VCI.js → SupportSettingsPage-LIVZY2XQ.js} +3 -3
  10. package/dist/{SupportSettingsPage-PB6A3VCI.js.map → SupportSettingsPage-LIVZY2XQ.js.map} +1 -1
  11. package/dist/chunk-3WPESEK2.js +136 -0
  12. package/dist/chunk-3WPESEK2.js.map +1 -0
  13. package/dist/chunk-5MGCM5C4.js +181 -0
  14. package/dist/chunk-5MGCM5C4.js.map +1 -0
  15. package/dist/{chunk-PIMV3VRT.js → chunk-DTO5R6GN.js} +26 -126
  16. package/dist/chunk-DTO5R6GN.js.map +1 -0
  17. package/dist/chunk-E5242OSS.js +88 -0
  18. package/dist/chunk-E5242OSS.js.map +1 -0
  19. package/dist/{chunk-M4LUNCKI.js → chunk-E5EXC7QW.js} +57 -16
  20. package/dist/chunk-E5EXC7QW.js.map +1 -0
  21. package/dist/chunk-JOS2QQML.js +17 -0
  22. package/dist/chunk-JOS2QQML.js.map +1 -0
  23. package/dist/{chunk-WOZTA5LS.js → chunk-L2HGTGW4.js} +6 -4
  24. package/dist/chunk-L2HGTGW4.js.map +1 -0
  25. package/dist/{chunk-37ZZRVI7.js → chunk-P4VNMWIT.js} +79 -186
  26. package/dist/chunk-P4VNMWIT.js.map +1 -0
  27. package/dist/{chunk-CWCN5PDE.js → chunk-PHIPTZSD.js} +48 -5
  28. package/dist/chunk-PHIPTZSD.js.map +1 -0
  29. package/dist/chunk-QBOQYER7.js +1603 -0
  30. package/dist/chunk-QBOQYER7.js.map +1 -0
  31. package/dist/{chunk-MQXGB4IO.js → chunk-S766CRAY.js} +42 -239
  32. package/dist/chunk-S766CRAY.js.map +1 -0
  33. package/dist/chunk-WHEJ63CM.js +156 -0
  34. package/dist/chunk-WHEJ63CM.js.map +1 -0
  35. package/dist/chunk-Y673XGDK.js +261 -0
  36. package/dist/chunk-Y673XGDK.js.map +1 -0
  37. package/dist/data/api.d.ts +5 -0
  38. package/dist/data/api.d.ts.map +1 -1
  39. package/dist/data/console.d.ts +6 -0
  40. package/dist/data/console.d.ts.map +1 -1
  41. package/dist/data/mock-host.d.ts.map +1 -1
  42. package/dist/data/provider.d.ts +12 -0
  43. package/dist/data/provider.d.ts.map +1 -1
  44. package/dist/host.d.ts +21 -0
  45. package/dist/host.d.ts.map +1 -1
  46. package/dist/host.js +24 -10
  47. package/dist/host.js.map +1 -1
  48. package/dist/in-chat-install-2BTKBF2Z.js +11 -0
  49. package/dist/in-chat-install-2BTKBF2Z.js.map +1 -0
  50. package/dist/index.js +18 -191
  51. package/dist/index.js.map +1 -1
  52. package/dist/lib/imported.d.ts +27 -0
  53. package/dist/lib/imported.d.ts.map +1 -0
  54. package/dist/lib/report-tool.d.ts +54 -9
  55. package/dist/lib/report-tool.d.ts.map +1 -1
  56. package/dist/lib/vocabulary.d.ts.map +1 -1
  57. package/dist/livechat/LiveChatAgentWatcher.d.ts +3 -2
  58. package/dist/livechat/LiveChatAgentWatcher.d.ts.map +1 -1
  59. package/dist/livechat/in-chat-install.d.ts +19 -0
  60. package/dist/livechat/in-chat-install.d.ts.map +1 -0
  61. package/dist/livechat/in-chat-link.d.ts +10 -0
  62. package/dist/livechat/in-chat-link.d.ts.map +1 -0
  63. package/dist/livechat/in-chat-machine.d.ts +99 -0
  64. package/dist/livechat/in-chat-machine.d.ts.map +1 -0
  65. package/dist/livechat/in-chat-request-machine.d.ts +147 -0
  66. package/dist/livechat/in-chat-request-machine.d.ts.map +1 -0
  67. package/dist/livechat/in-chat-request.d.ts +94 -0
  68. package/dist/livechat/in-chat-request.d.ts.map +1 -0
  69. package/dist/livechat/in-chat-widgets.d.ts +39 -0
  70. package/dist/livechat/in-chat-widgets.d.ts.map +1 -0
  71. package/dist/livechat/in-chat.d.ts +119 -0
  72. package/dist/livechat/in-chat.d.ts.map +1 -0
  73. package/dist/livechat/report-intake.d.ts +45 -0
  74. package/dist/livechat/report-intake.d.ts.map +1 -0
  75. package/dist/livechat/screen-capture.d.ts +7 -0
  76. package/dist/livechat/screen-capture.d.ts.map +1 -0
  77. package/dist/migrations/index.d.ts +2 -0
  78. package/dist/migrations/index.d.ts.map +1 -1
  79. package/dist/migrations/main.browser.js +3 -1
  80. package/dist/migrations/main.browser.js.map +1 -1
  81. package/dist/migrations/main.js +1181 -2
  82. package/dist/migrations/main.js.map +1 -1
  83. package/dist/realtime-HQVWBTML.js +3 -0
  84. package/dist/realtime-HQVWBTML.js.map +1 -0
  85. package/dist/screen-capture-FRMTTRUY.js +77 -0
  86. package/dist/screen-capture-FRMTTRUY.js.map +1 -0
  87. package/dist/types.d.ts +5 -1
  88. package/dist/types.d.ts.map +1 -1
  89. package/dist/views/SupportRequestsPanel.d.ts.map +1 -1
  90. package/dist/views/TicketSheet.d.ts +11 -1
  91. package/dist/views/TicketSheet.d.ts.map +1 -1
  92. package/package.json +5 -5
  93. package/dist/HelpdeskConsole-QY534ASZ.js.map +0 -1
  94. package/dist/LiveChatAgentWatcher-J6PNLYWT.js.map +0 -1
  95. package/dist/SupportCenter-JBBBJTKU.js.map +0 -1
  96. package/dist/chunk-37ZZRVI7.js.map +0 -1
  97. package/dist/chunk-CWCN5PDE.js.map +0 -1
  98. package/dist/chunk-JT4ZPWH7.js +0 -61
  99. package/dist/chunk-JT4ZPWH7.js.map +0 -1
  100. package/dist/chunk-M4LUNCKI.js.map +0 -1
  101. package/dist/chunk-MQXGB4IO.js.map +0 -1
  102. package/dist/chunk-PIMV3VRT.js.map +0 -1
  103. package/dist/chunk-STEDUFNR.js +0 -42
  104. package/dist/chunk-STEDUFNR.js.map +0 -1
  105. package/dist/chunk-WOZTA5LS.js.map +0 -1
package/dist/host.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/data/host-provider.ts","../src/data/mock-host.ts","../src/host.tsx"],"names":["row","t"],"mappings":";;;;;;;;;;;;;;;;AA+BA,IAAM,GAAA,GAAM,CAAC,CAAA,KAA+B,OAAO,MAAM,QAAA,IAAY,CAAA,KAAM,KAAK,CAAA,GAAI,IAAA;AAE7E,SAAS,cAAc,CAAA,EAAwB;AACpD,EAAA,OAAO;AAAA,IACL,IAAI,CAAA,CAAE,EAAA;AAAA,IACN,UAAU,CAAA,CAAE,SAAA;AAAA,IACZ,QAAQ,CAAA,CAAE,MAAA;AAAA,IACV,MAAM,CAAA,CAAE,IAAA;AAAA,IACR,OAAA,EAAS,EAAE,OAAA,IAAW,IAAA;AAAA,IACtB,WAAA,EAAa,EAAE,WAAA,IAAe,EAAA;AAAA,IAC9B,QAAQ,CAAA,CAAE,MAAA;AAAA,IACV,KAAA,EAAO,EAAE,KAAA,IAAS,IAAA;AAAA,IAClB,MAAA,EAAQ,EAAE,OAAA,IAAW,IAAA;AAAA,IACrB,cAAA,EAAgB,CAAA,CAAE,eAAA,IAAmB,EAAC;AAAA,IACtC,oBAAA,EAAsB,EAAE,sBAAA,IAA0B,IAAA;AAAA,IAClD,cAAA,EAAgB,EAAE,eAAA,IAAmB,IAAA;AAAA,IACrC,IAAA,EAAM,EAAE,IAAA,IAAQ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AAA,CAAQ,YAAA;AAAA,IAClB,aAAA;AAAA,IACA,IAAA,EAAM,WAAA;AAAA,IACN,WAAA,EAAa,kBAAA;AAAA,IACb,aAAA,EAAe,oBAAA;AAAA,IACf,aAAA;AAAA,IACA,eAAA;AAAA,IACA,QAAQ,CAAC,EAAA,KAAO,gBAAgB,QAAA,EAAS,CAAE,OAAO,EAAE,CAAA;AAAA,IACpD,SAAS,MAAM;AACb,MAAA,sBAAA,CAAuB,IAAI,CAAA;AAC3B,MAAA,eAAA,CAAgB,QAAA,GAAW,KAAA,EAAM;AAAA,IACnC;AAAA,GACF;AACF","file":"host.js","sourcesContent":["// A SupportDataProvider for a HOST whose browser has no session in this pool\n// (the V1): every call is one operation of the `support.host` request\n// (@fayz-ai/contracts/v1-bridge) handed to the host's transport — in the V1, its\n// edge `support-v2`, which proves the V1 session, signs and forwards to the\n// V2 bridge. The answers are support_host_call rows (support 030), mapped here\n// to the same domain types the platform screens use.\n//\n// Files go straight to this pool's storage: `open` answers one signed upload\n// link per attachment and the browser PUTs the file there (no key crosses).\nimport type {\n SupportRequest, SupportRequestDetail, SupportMessage, SupportEvent, SupportAttachment,\n CreateSupportRequestInput, PendingAttachment, SupportScope, SupportFilter,\n} from '../types'\nimport { MAX_ATTACHMENTS } from '../types'\nimport type { ChatAvailability, ChatState } from '../livechat/api'\nimport type { SupportBusinessHours } from '../lib/support-settings'\nimport type { ChatThreadMessage, SupportDataProvider } from './provider'\n\n/** One `support.host` operation: resolves with `result`, rejects with an Error whose message the screen shows. */\nexport type SupportHostTransport = (op: string, args: Record<string, unknown>) => Promise<Record<string, unknown>>\n\nexport interface SupportHostProviderOptions {\n call: SupportHostTransport\n /** The house as the host knows it (shown on the team's card). */\n house?: () => { houseName?: string | null; unitName?: string | null }\n /** PUT one file to a signed upload link. Default: fetch PUT with the file as the body. */\n upload?: (url: string, file: Blob, contentType: string) => Promise<void>\n /** Re-read cadence without Realtime (ms). Default: detail 10 s, chat 4 s, door 30 s. */\n pollMs?: { detail?: number; chat?: number; door?: number }\n}\n\nconst str = (v: unknown): string | null => (typeof v === 'string' && v !== '' ? v : null)\n\nexport function toHostRequest(r: any): SupportRequest {\n return {\n id: r.id,\n tenantId: r.tenant_id,\n number: r.number,\n kind: r.kind,\n subject: r.subject ?? null,\n description: r.description ?? '',\n status: r.status,\n route: r.route ?? null,\n unitId: r.unit_id ?? null,\n screenSnapshot: r.screen_snapshot ?? {},\n originConversationId: r.origin_conversation_id ?? null,\n conversationId: r.conversation_id ?? null,\n area: r.area ?? null,\n createdBy: r.created_by ?? '',\n createdAt: r.created_at,\n updatedAt: r.updated_at ?? r.created_at,\n resolvedAt: r.resolved_at ?? null,\n metadata: r.metadata ?? {},\n }\n}\n\nconst toMessage = (requestId: string) => (m: any): SupportMessage => ({\n id: m.id, requestId, authorKind: m.author_kind === 'team' ? 'team' : 'user', authorId: null,\n body: m.body ?? '', createdAt: m.created_at, legacy: m.legacy === true,\n})\nconst toEvent = (e: any): SupportEvent => ({ id: e.id, requestId: e.request_id, type: e.type, note: e.note ?? null, createdAt: e.created_at })\nconst toAttachment = (a: any): SupportAttachment => ({\n id: a.id, requestId: a.request_id, storagePath: a.storage_path, name: a.name, sizeBytes: a.size_bytes ?? null,\n contentType: a.content_type ?? null, createdAt: a.created_at, url: a.url ?? null,\n})\n\nasync function defaultUpload(url: string, file: Blob, contentType: string): Promise<void> {\n const res = await fetch(url, { method: 'PUT', body: file, headers: { 'content-type': contentType, 'x-upsert': 'false' } })\n if (!res.ok) throw new Error(`upload ${res.status}`)\n}\n\nexport function createSupportHostProvider(options: SupportHostProviderOptions): SupportDataProvider {\n const { call } = options\n const upload = options.upload ?? defaultUpload\n const house = () => {\n const h = options.house?.() ?? {}\n return { house_name: h.houseName ?? null, unit_name: h.unitName ?? null }\n }\n\n // ChatView reads the state and the messages together: one 'chat' round trip serves both.\n let inflight: { id: string; at: number; p: Promise<Record<string, unknown>> } | null = null\n const chatOf = (id: string) => {\n if (inflight && inflight.id === id && Date.now() - inflight.at < 1_000) return inflight.p\n const p = call('chat', { request_id: id })\n inflight = { id, at: Date.now(), p }\n p.catch(() => { if (inflight?.p === p) inflight = null })\n return p\n }\n\n return {\n realtime: false,\n pollMs: { detail: 10_000, chat: 4_000, door: 30_000, ...options.pollMs },\n\n async listRequests(scope: SupportScope, filter: SupportFilter) {\n const r = await call('list', { scope, filter })\n return ((r.requests as unknown[]) ?? []).map(toHostRequest)\n },\n\n async getRequestDetail(id) {\n const r: any = await call('detail', { request_id: id })\n if (!r?.id) return null\n const detail: SupportRequestDetail = {\n ...toHostRequest(r),\n messages: ((r.messages as unknown[]) ?? []).map(toMessage(id)),\n events: ((r.events as unknown[]) ?? []).map(toEvent),\n attachments: ((r.attachments as unknown[]) ?? []).map(toAttachment),\n }\n return detail\n },\n\n async unreadCount() {\n const r = await call('list', { scope: 'mine', filter: 'waiting' })\n return typeof r.attention === 'number' ? r.attention : ((r.requests as unknown[]) ?? []).length\n },\n\n async createRequest(input: CreateSupportRequestInput, attachments: PendingAttachment[]) {\n const files = attachments.slice(0, MAX_ATTACHMENTS)\n const r: any = await call('open', {\n kind: input.kind,\n description: input.description.trim(),\n subject: input.subject?.trim() || null,\n route: input.route ?? null,\n screen_snapshot: input.screenSnapshot ?? {},\n origin_conversation_id: input.originConversationId ?? null,\n attachments: files.map((f) => ({ name: f.name, content_type: f.contentType || 'application/octet-stream', size_bytes: Math.max(1, f.sizeBytes) })),\n ...house(),\n })\n const uploads: any[] = Array.isArray(r.uploads) ? r.uploads : []\n await Promise.all(files.map(async (f, i) => {\n const target = uploads[i]\n if (!target?.upload_url) return\n // One failed upload does not fail the request (the platform's rule too).\n try { await upload(target.upload_url, f.file, f.contentType || 'application/octet-stream') } catch { /* the card shows it without a link */ }\n }))\n return { id: r.id, number: r.number }\n },\n\n async addMessage(requestId, body) { await call('reply', { request_id: requestId, body: body.trim() }) },\n async cancelRequest(requestId) { await call('status', { request_id: requestId, action: 'cancel' }) },\n async validateRequest(requestId, ok, reason) {\n await call('status', { request_id: requestId, action: ok ? 'accept' : 'reopen', reason: reason ?? null })\n },\n // The host's notices are its own; nothing to mark in this pool.\n async markNotificationsRead() {},\n async attachmentUrl(att) { return att.url ?? null },\n\n async chatAvailability(): Promise<ChatAvailability | null> {\n const d: any = await call('chat_availability', {})\n return {\n homeId: str(d.home_id),\n enabled: d.enabled === true,\n offlineMessage: str(d.offline_message),\n businessHours: (d.business_hours ?? {}) as SupportBusinessHours,\n timezone: str(d.timezone) ?? 'America/Sao_Paulo',\n activeChat: d.active_chat ? { id: d.active_chat.id, number: d.active_chat.number } : null,\n online: Math.max(0, Number(d.online) || 0),\n }\n },\n\n async openChat(input) {\n const d: any = await call('chat_open', {\n subject: input.subject ?? null,\n description: input.description ?? null,\n route: input.route ?? null,\n origin_conversation_id: input.originConversationId ?? null,\n screen_snapshot: input.screenSnapshot ?? {},\n ...house(),\n })\n return { id: d.id, number: d.number, conversationId: d.conversation_id ?? null, reused: d.reused === true }\n },\n\n async chatState(requestId): Promise<ChatState> {\n const d: any = ((await chatOf(requestId)) as any).state ?? {}\n return {\n id: d.id, number: d.number, status: d.status, waiting: d.waiting === true,\n position: typeof d.position === 'number' ? d.position : null,\n teamReplied: d.team_replied === true, agentName: d.agent_name ?? null,\n conversationId: d.conversation_id ?? null, homeId: d.home_id ?? null,\n }\n },\n\n async chatThread(requestId): Promise<ChatThreadMessage[]> {\n const d: any = await chatOf(requestId)\n return ((d.messages as any[]) ?? []).map((m) => ({\n id: m.id, mine: m.author_kind !== 'team', author: m.author ?? null, body: m.body ?? '', at: m.created_at,\n }))\n },\n }\n}\n","// An in-memory `support.host` transport: the same rows support_host_call\n// (support 030) answers, kept in the page. For a host to draw the screens before\n// its edge or the V2 are deployed (dev, QA without writes, tests) — never real data.\nimport type { SupportHostTransport } from './host-provider'\n\nexport interface MockSupportHostSeed {\n /** Who is asking (the V1 user). */\n me?: { id: string; name: string }\n /** Agents online at the central (the live-chat door). Default 1. */\n online?: number\n /** The live chat is taken by \"Ana Souza (Suporte)\" after this many ms. Default 6000; null = never. */\n acceptAfterMs?: number | null\n /** Start with the sample tickets (default true). */\n samples?: boolean\n}\n\ntype Row = Record<string, any>\n\nconst iso = (msAgo = 0) => new Date(Date.now() - msAgo).toISOString()\nconst uuid = () => (globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(16)}-0000-4000-8000-${Math.random().toString(16).slice(2, 14).padEnd(12, '0')}`)\n\nclass MockError extends Error {}\n\nexport function createMockSupportHostTransport(seed: MockSupportHostSeed = {}): SupportHostTransport {\n const me = seed.me ?? { id: '7a1b2c3d-0000-4000-8000-00000000a0a0', name: 'Ana (demonstração)' }\n const tenant = 'mock-platform'\n let number = 40\n const tickets: Row[] = []\n const messages = new Map<string, Row[]>()\n const events = new Map<string, Row[]>()\n const files = new Map<string, Row[]>()\n const chatOpenedAt = new Map<string, number>()\n\n function add(kind: string, subject: string, description: string, status: string, msAgo: number): Row {\n const id = uuid()\n const row: Row = {\n id, tenant_id: tenant, number: ++number, kind, subject, description, status, route: null, unit_id: null,\n screen_snapshot: {}, origin_conversation_id: null, conversation_id: uuid(), area: null, created_by: me.id,\n created_at: iso(msAgo), updated_at: iso(msAgo), resolved_at: null, metadata: { opened_by_name: me.name }, assignee: null,\n }\n tickets.unshift(row)\n messages.set(id, [])\n events.set(id, [{ id: uuid(), request_id: id, type: 'opened', note: null, created_at: row.created_at }])\n files.set(id, [])\n return row\n }\n const say = (id: string, team: boolean, body: string, msAgo = 0, author: string | null = null) =>\n messages.get(id)!.push({ id: uuid(), author_kind: team ? 'team' : 'user', author: team ? (author ?? 'Suporte') : null, body, created_at: iso(msAgo), legacy: false })\n const event = (id: string, type: string, note: string | null = null) =>\n events.get(id)!.push({ id: uuid(), request_id: id, type, note, created_at: iso() })\n\n if (seed.samples !== false) {\n const a = add('problem', 'A impressora da cozinha não imprime a comanda', 'Desde ontem à noite a comanda não sai na impressora da cozinha.', 'waiting_you', 26 * 3600_000)\n say(a.id, false, 'Já reiniciei a impressora e nada.', 25 * 3600_000)\n say(a.id, true, 'Oi! Pode mandar um print da tela de impressoras em Configurações?', 3 * 3600_000, 'Bia Atendente')\n event(a.id, 'status_changed', 'waiting_you')\n const b = add('improvement', 'Atalho para dividir a conta no PDV', 'Seria ótimo ter um botão direto para dividir a conta por pessoa.', 'in_service', 3 * 86400_000)\n say(b.id, true, 'Boa ideia! Levamos para o time de produto.', 2 * 86400_000, 'Bia Atendente')\n add('other', 'Treinamento para a equipe nova', 'Gostaria de agendar um treinamento para três pessoas.', 'closed', 9 * 86400_000)\n }\n\n const find = (id: unknown) => {\n const t = tickets.find((x) => x.id === id)\n if (!t) throw new MockError('Solicitação não encontrada.')\n return t\n }\n const row = (t: Row) => { const { assignee: _a, ...r } = t; return { ...r } }\n const attention = () => tickets.filter((t) => ['waiting_you', 'resolved_check'].includes(t.status)).length\n const touch = (t: Row, status?: string) => { if (status) t.status = status; t.updated_at = iso() }\n\n /** The mock \"agent\": takes the chat a few seconds after it opened, and greets. */\n function tick(t: Row) {\n if (t.kind !== 'chat' || t.assignee || seed.acceptAfterMs === null) return\n const opened = chatOpenedAt.get(t.id) ?? 0\n if (Date.now() - opened < (seed.acceptAfterMs ?? 6_000)) return\n t.assignee = 'Ana Souza (Suporte)'\n touch(t, 'in_service')\n say(t.id, true, 'Olá! Aqui é Ana, do suporte. Já li a sua conversa com o atendimento automático. Como posso ajudar?', 0, 'Ana Souza (Suporte)')\n }\n\n return async (op, args) => {\n await new Promise((r) => setTimeout(r, 150))\n switch (op) {\n case 'list': {\n const want = args.filter === 'waiting' ? ['waiting_you', 'resolved_check']\n : args.filter === 'in_progress' ? ['received', 'triage', 'in_service', 'in_development']\n : args.filter === 'closed' ? ['closed', 'cancelled'] : null\n return { requests: tickets.filter((t) => !want || want.includes(t.status)).map(row), attention: attention() }\n }\n case 'detail': {\n const t = find(args.request_id)\n return { ...row(t), messages: messages.get(t.id), events: events.get(t.id), attachments: files.get(t.id) }\n }\n case 'open': {\n const desc = String(args.description ?? '').trim()\n if (desc.length < 5) throw new MockError('Descreva com pelo menos 5 caracteres.')\n const t = add(String(args.kind), String(args.subject ?? '').trim() || desc.split('\\n')[0]!.slice(0, 80), desc, 'received', 0)\n const uploads = ((args.attachments as Row[]) ?? []).map((f) => {\n const aid = uuid()\n files.get(t.id)!.push({ id: aid, request_id: t.id, storage_path: `${tenant}/${t.id}/${aid}/${f.name}`, name: f.name, size_bytes: f.size_bytes, content_type: f.content_type, created_at: iso(), url: null })\n return { attachment_id: aid, name: f.name, storage_path: `${tenant}/${t.id}/${aid}/${f.name}`, upload_url: null }\n })\n return { id: t.id, number: t.number, conversation_id: t.conversation_id, uploads }\n }\n case 'reply': {\n const t = find(args.request_id)\n if (['closed', 'cancelled'].includes(t.status)) throw new MockError('Esta solicitação está encerrada.')\n say(t.id, false, String(args.body ?? ''))\n if (t.status === 'waiting_you') touch(t, 'in_service')\n return { conversation_id: t.conversation_id, messages: messages.get(t.id) }\n }\n case 'status': {\n const t = find(args.request_id)\n if (args.action === 'cancel') {\n if (!['received', 'triage', 'waiting_you'].includes(t.status)) throw new MockError('Esta solicitação não pode mais ser cancelada.')\n touch(t, 'cancelled'); event(t.id, 'cancelled')\n } else if (args.action === 'accept') {\n touch(t, 'closed'); event(t.id, 'validated_ok')\n } else {\n touch(t, 'received'); event(t.id, 'reopened', (args.reason as string) ?? null)\n }\n return row(t)\n }\n case 'chat_availability': {\n const active = tickets.find((t) => t.kind === 'chat' && !['resolved_check', 'closed', 'cancelled'].includes(t.status))\n return {\n home_id: 'mock-central', enabled: true, online: seed.online ?? 1,\n offline_message: 'Abra uma solicitação e respondemos por aqui e por e-mail.',\n business_hours: {}, timezone: 'America/Sao_Paulo',\n active_chat: active ? { id: active.id, number: active.number } : null,\n }\n }\n case 'chat_open': {\n const active = tickets.find((t) => t.kind === 'chat' && !['resolved_check', 'closed', 'cancelled'].includes(t.status))\n if (active) return { id: active.id, number: active.number, conversation_id: active.conversation_id, reused: true }\n const t = add('chat', String(args.subject ?? '') || 'Conversa com atendente', String(args.description ?? '') || 'A pessoa pediu para falar com um atendente.', 'received', 0)\n chatOpenedAt.set(t.id, Date.now())\n return { id: t.id, number: t.number, conversation_id: t.conversation_id, reused: false }\n }\n case 'chat': {\n const t = find(args.request_id)\n tick(t)\n const waiting = t.kind === 'chat' && !t.assignee && !['resolved_check', 'closed', 'cancelled'].includes(t.status)\n return {\n state: {\n id: t.id, number: t.number, kind: t.kind, status: t.status, waiting, position: waiting ? 1 : null,\n team_replied: (messages.get(t.id) ?? []).some((m) => m.author_kind === 'team'),\n agent_name: t.assignee ? String(t.assignee).split(' ')[0] : null, conversation_id: t.conversation_id, home_id: 'mock-central',\n },\n messages: messages.get(t.id),\n }\n }\n default:\n throw new MockError(`operação desconhecida: ${op}`)\n }\n }\n}\n","// `@fayz-ai/plugin-support/host` — the requester's support screens for a host\n// that does not run AdminShell nor the plugin runtime (the V1 drawing them slot\n// by slot), the way `@fayz-ai/plugin-getting-started/host` hosts the journey.\n//\n// The screens are the platform's own (SupportRequestsPanel, SupportMenu,\n// SupportRequestForm, SupportRequestDetail, LiveChatPanel); only the data port\n// changes: `dataProvider` is injected and nothing below touches this pool's\n// Supabase client. A host whose browser has no session here builds it with\n// `createSupportHostProvider({ call })` over its own transport — the V1 sends\n// each operation through its edge `support-v2`, signed to the V2 bridge\n// (`support.host`, @fayz-ai/contracts/v1-bridge) — and the ticket is born and\n// lives in the V2 (plugin-support 030).\nimport * as React from 'react'\nimport { registerTranslations } from '@fayz-ai/core'\nimport { supportLocales } from './locales'\nimport { useSupportStore } from './store'\nimport { setSupportDataProvider, type SupportDataProvider } from './data/provider'\nimport { SupportRequestsPanel, type SupportRequestsPanelProps } from './views/SupportRequestsPanel'\nimport { SupportRequestForm, type SupportRequestFormProps } from './views/SupportRequestForm'\nimport { SupportRequestDetail, type SupportRequestDetailProps } from './views/SupportRequestDetail'\nimport { SupportMenu, type SupportMenuProps } from './views/SupportMenu'\nimport { LiveChatPanel, type LiveChatPanelProps } from './livechat/LiveChatPanel'\nimport { useLiveChatDoor, type LiveChatDoor } from './livechat/door'\n\nexport interface SupportHostOptions {\n /** Where every read and write goes. Required: there is no platform default in a host. */\n dataProvider: SupportDataProvider\n /** \"Toda a empresa\" — the host's own permission (the V1: support_tickets_license). Default false. */\n canSeeAll?: boolean\n}\n\nexport interface SupportHost {\n provider: SupportDataProvider\n /** \"Minhas solicitações\": list ↔ detail ↔ menu ↔ form ↔ live chat, in one column. */\n RequestsPanel: React.ComponentType<SupportRequestsPanelProps>\n /** The four doors (\"Em que podemos ajudar?\"). */\n Menu: React.ComponentType<SupportMenuProps>\n /** One door's form (description, subject, prints and files). */\n RequestForm: React.ComponentType<SupportRequestFormProps>\n /** The selected request (use the store's `select(id)` first, or the panel). */\n RequestDetail: React.ComponentType<SupportRequestDetailProps>\n /** \"Conversar com um atendente\": connecting, the absence screen, the chat. */\n LiveChatPanel: React.ComponentType<LiveChatPanelProps>\n /** The door's state (who is online, the open chat) for a host's own button. */\n useLiveChatDoor: (refreshKey?: unknown) => LiveChatDoor\n /** Opens a request in the store (the detail surface reads it). */\n select: (id: string | null) => Promise<void>\n /** Restores the platform provider and empties the store. */\n dispose: () => void\n}\n\nexport function createSupportHost(options: SupportHostOptions): SupportHost {\n registerTranslations(supportLocales)\n setSupportDataProvider(options.dataProvider)\n useSupportStore.getState().reset()\n\n const canSeeAll = options.canSeeAll ?? false\n function RequestsPanel(props: SupportRequestsPanelProps) {\n return <SupportRequestsPanel canSeeAll={canSeeAll} {...props} />\n }\n RequestsPanel.displayName = 'SupportHost(RequestsPanel)'\n\n return {\n provider: options.dataProvider,\n RequestsPanel,\n Menu: SupportMenu,\n RequestForm: SupportRequestForm,\n RequestDetail: SupportRequestDetail,\n LiveChatPanel,\n useLiveChatDoor,\n select: (id) => useSupportStore.getState().select(id),\n dispose: () => {\n setSupportDataProvider(null)\n useSupportStore.getState().reset()\n },\n }\n}\n\nexport { createSupportHostProvider, toHostRequest, type SupportHostTransport, type SupportHostProviderOptions } from './data/host-provider'\nexport { createMockSupportHostTransport, type MockSupportHostSeed } from './data/mock-host'\nexport type { SupportDataProvider, ChatThreadMessage } from './data/provider'\nexport { useSupportStore } from './store'\nexport { requestLiveChat, useLiveChatDoor, liveChatHint, type LiveChatHandoff, type LiveChatDoor } from './livechat/door'\nexport { buildTranscript, chatSubject, type TranscriptMessage } from './livechat/rules'\nexport type { SupportRequestsPanelProps } from './views/SupportRequestsPanel'\nexport type { SupportRailChrome } from './lib/rail-chrome'\nexport type { SupportRequestFormProps } from './views/SupportRequestForm'\nexport type { SupportRequestDetailProps } from './views/SupportRequestDetail'\nexport type { SupportMenuProps } from './views/SupportMenu'\nexport type { LiveChatPanelProps } from './livechat/LiveChatPanel'\nexport type { ChatAvailability, ChatState } from './livechat/api'\nexport * from './types'\n"]}
1
+ {"version":3,"sources":["../src/data/host-provider.ts","../src/data/mock-host.ts","../src/host.tsx"],"names":["row","t"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA+BA,IAAM,GAAA,GAAM,CAAC,CAAA,KAA+B,OAAO,MAAM,QAAA,IAAY,CAAA,KAAM,KAAK,CAAA,GAAI,IAAA;AAE7E,SAAS,cAAc,CAAA,EAAwB;AACpD,EAAA,OAAO;AAAA,IACL,IAAI,CAAA,CAAE,EAAA;AAAA,IACN,UAAU,CAAA,CAAE,SAAA;AAAA,IACZ,QAAQ,CAAA,CAAE,MAAA;AAAA,IACV,MAAM,CAAA,CAAE,IAAA;AAAA,IACR,OAAA,EAAS,EAAE,OAAA,IAAW,IAAA;AAAA,IACtB,WAAA,EAAa,EAAE,WAAA,IAAe,EAAA;AAAA,IAC9B,QAAQ,CAAA,CAAE,MAAA;AAAA,IACV,KAAA,EAAO,EAAE,KAAA,IAAS,IAAA;AAAA,IAClB,MAAA,EAAQ,EAAE,OAAA,IAAW,IAAA;AAAA,IACrB,cAAA,EAAgB,CAAA,CAAE,eAAA,IAAmB,EAAC;AAAA,IACtC,oBAAA,EAAsB,EAAE,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Aa,KAAA;AACvC,EAAA,MAAM,SAAA,GAAY,OAAA,CAAQ,MAAA,KAAW,KAAA,GAAQ,OAAO,oBAAA,EAAqB;AACzE,EAAA,IAAI,SAAA,OAAgB,qBAAA,EAAsB;AAC1C,EAAA,SAAS,cAAc,KAAA,EAAkC;AACvD,IAAA,uBAAO,GAAA,CAAC,oBAAA,EAAA,EAAqB,SAAA,EAAuB,GAAG,KAAA,EAAO,CAAA;AAAA,EAChE;AACA,EAAA,aAAA,CAAc,WAAA,GAAc,4BAAA;AAE5B,EAAA,OAAO;AAAA,IACL,UAAU,OAAA,CAAQ,YAAA;AAAA,IAClB,aAAA;AAAA,IACA,IAAA,EAAM,WAAA;AAAA,IACN,WAAA,EAAa,kBAAA;AAAA,IACb,aAAA,EAAe,oBAAA;AAAA,IACf,aAAA;AAAA,IACA,eAAA;AAAA,IACA,QAAQ,CAAC,EAAA,KAAO,gBAAgB,QAAA,EAAS,CAAE,OAAO,EAAE,CAAA;AAAA,IACpD,OAAA,EAAS,cAAA;AAAA,IACT,qBAAA;AAAA,IACA,SAAS,MAAM;AACb,MAAA,SAAA,IAAY;AACZ,MAAA,sBAAA,CAAuB,IAAI,CAAA;AAC3B,MAAA,eAAA,CAAgB,QAAA,GAAW,KAAA,EAAM;AAAA,IACnC;AAAA,GACF;AACF","file":"host.js","sourcesContent":["// A SupportDataProvider for a HOST whose browser has no session in this pool\n// (the V1): every call is one operation of the `support.host` request\n// (@fayz-ai/contracts/v1-bridge) handed to the host's transport — in the V1, its\n// edge `support-v2`, which proves the V1 session, signs and forwards to the\n// V2 bridge. The answers are support_host_call rows (support 030), mapped here\n// to the same domain types the platform screens use.\n//\n// Files go straight to this pool's storage: `open` answers one signed upload\n// link per attachment and the browser PUTs the file there (no key crosses).\nimport type {\n SupportRequest, SupportRequestDetail, SupportMessage, SupportEvent, SupportAttachment,\n CreateSupportRequestInput, PendingAttachment, SupportScope, SupportFilter,\n} from '../types'\nimport { MAX_ATTACHMENTS } from '../types'\nimport type { ChatAvailability, ChatState } from '../livechat/api'\nimport type { SupportBusinessHours } from '../lib/support-settings'\nimport type { ChatThreadMessage, SupportDataProvider } from './provider'\n\n/** One `support.host` operation: resolves with `result`, rejects with an Error whose message the screen shows. */\nexport type SupportHostTransport = (op: string, args: Record<string, unknown>) => Promise<Record<string, unknown>>\n\nexport interface SupportHostProviderOptions {\n call: SupportHostTransport\n /** The house as the host knows it (shown on the team's card). */\n house?: () => { houseName?: string | null; unitName?: string | null }\n /** PUT one file to a signed upload link. Default: fetch PUT with the file as the body. */\n upload?: (url: string, file: Blob, contentType: string) => Promise<void>\n /** Re-read cadence without Realtime (ms). Default: detail 10 s, chat 4 s, door 30 s. */\n pollMs?: { detail?: number; chat?: number; door?: number }\n}\n\nconst str = (v: unknown): string | null => (typeof v === 'string' && v !== '' ? v : null)\n\nexport function toHostRequest(r: any): SupportRequest {\n return {\n id: r.id,\n tenantId: r.tenant_id,\n number: r.number,\n kind: r.kind,\n subject: r.subject ?? null,\n description: r.description ?? '',\n status: r.status,\n route: r.route ?? null,\n unitId: r.unit_id ?? null,\n screenSnapshot: r.screen_snapshot ?? {},\n originConversationId: r.origin_conversation_id ?? null,\n conversationId: r.conversation_id ?? null,\n area: r.area ?? null,\n createdBy: r.created_by ?? '',\n createdAt: r.created_at,\n updatedAt: r.updated_at ?? r.created_at,\n resolvedAt: r.resolved_at ?? null,\n metadata: r.metadata ?? {},\n }\n}\n\nconst toMessage = (requestId: string) => (m: any): SupportMessage => ({\n id: m.id, requestId, authorKind: m.author_kind === 'team' ? 'team' : 'user', authorId: null,\n body: m.body ?? '', createdAt: m.created_at, legacy: m.legacy === true,\n})\nconst toEvent = (e: any): SupportEvent => ({ id: e.id, requestId: e.request_id, type: e.type, note: e.note ?? null, createdAt: e.created_at })\nconst toAttachment = (a: any): SupportAttachment => ({\n id: a.id, requestId: a.request_id, storagePath: a.storage_path, name: a.name, sizeBytes: a.size_bytes ?? null,\n contentType: a.content_type ?? null, createdAt: a.created_at, url: a.url ?? null,\n})\n\nasync function defaultUpload(url: string, file: Blob, contentType: string): Promise<void> {\n const res = await fetch(url, { method: 'PUT', body: file, headers: { 'content-type': contentType, 'x-upsert': 'false' } })\n if (!res.ok) throw new Error(`upload ${res.status}`)\n}\n\nexport function createSupportHostProvider(options: SupportHostProviderOptions): SupportDataProvider {\n const { call } = options\n const upload = options.upload ?? defaultUpload\n const house = () => {\n const h = options.house?.() ?? {}\n return { house_name: h.houseName ?? null, unit_name: h.unitName ?? null }\n }\n\n // ChatView reads the state and the messages together: one 'chat' round trip serves both.\n let inflight: { id: string; at: number; p: Promise<Record<string, unknown>> } | null = null\n const chatOf = (id: string) => {\n if (inflight && inflight.id === id && Date.now() - inflight.at < 1_000) return inflight.p\n const p = call('chat', { request_id: id })\n inflight = { id, at: Date.now(), p }\n p.catch(() => { if (inflight?.p === p) inflight = null })\n return p\n }\n\n return {\n realtime: false,\n pollMs: { detail: 10_000, chat: 4_000, door: 30_000, ...options.pollMs },\n\n async listRequests(scope: SupportScope, filter: SupportFilter) {\n const r = await call('list', { scope, filter })\n return ((r.requests as unknown[]) ?? []).map(toHostRequest)\n },\n\n async getRequestDetail(id) {\n const r: any = await call('detail', { request_id: id })\n if (!r?.id) return null\n const detail: SupportRequestDetail = {\n ...toHostRequest(r),\n messages: ((r.messages as unknown[]) ?? []).map(toMessage(id)),\n events: ((r.events as unknown[]) ?? []).map(toEvent),\n attachments: ((r.attachments as unknown[]) ?? []).map(toAttachment),\n }\n return detail\n },\n\n async unreadCount() {\n const r = await call('list', { scope: 'mine', filter: 'waiting' })\n return typeof r.attention === 'number' ? r.attention : ((r.requests as unknown[]) ?? []).length\n },\n\n async createRequest(input: CreateSupportRequestInput, attachments: PendingAttachment[]) {\n const files = attachments.slice(0, MAX_ATTACHMENTS)\n const r: any = await call('open', {\n kind: input.kind,\n description: input.description.trim(),\n subject: input.subject?.trim() || null,\n route: input.route ?? null,\n screen_snapshot: input.screenSnapshot ?? {},\n origin_conversation_id: input.originConversationId ?? null,\n attachments: files.map((f) => ({ name: f.name, content_type: f.contentType || 'application/octet-stream', size_bytes: Math.max(1, f.sizeBytes) })),\n ...house(),\n })\n const uploads: any[] = Array.isArray(r.uploads) ? r.uploads : []\n await Promise.all(files.map(async (f, i) => {\n const target = uploads[i]\n if (!target?.upload_url) return\n // One failed upload does not fail the request (the platform's rule too).\n try { await upload(target.upload_url, f.file, f.contentType || 'application/octet-stream') } catch { /* the card shows it without a link */ }\n }))\n return { id: r.id, number: r.number }\n },\n\n async addMessage(requestId, body) { await call('reply', { request_id: requestId, body: body.trim() }) },\n async cancelRequest(requestId) { await call('status', { request_id: requestId, action: 'cancel' }) },\n async validateRequest(requestId, ok, reason) {\n await call('status', { request_id: requestId, action: ok ? 'accept' : 'reopen', reason: reason ?? null })\n },\n // The host's notices are its own; nothing to mark in this pool.\n async markNotificationsRead() {},\n async attachmentUrl(att) { return att.url ?? null },\n\n async chatAvailability(): Promise<ChatAvailability | null> {\n const d: any = await call('chat_availability', {})\n return {\n homeId: str(d.home_id),\n enabled: d.enabled === true,\n offlineMessage: str(d.offline_message),\n businessHours: (d.business_hours ?? {}) as SupportBusinessHours,\n timezone: str(d.timezone) ?? 'America/Sao_Paulo',\n activeChat: d.active_chat ? { id: d.active_chat.id, number: d.active_chat.number } : null,\n online: Math.max(0, Number(d.online) || 0),\n }\n },\n\n async openChat(input) {\n const d: any = await call('chat_open', {\n subject: input.subject ?? null,\n description: input.description ?? null,\n route: input.route ?? null,\n origin_conversation_id: input.originConversationId ?? null,\n screen_snapshot: input.screenSnapshot ?? {},\n ...house(),\n })\n return { id: d.id, number: d.number, conversationId: d.conversation_id ?? null, reused: d.reused === true }\n },\n\n async chatState(requestId): Promise<ChatState> {\n const d: any = ((await chatOf(requestId)) as any).state ?? {}\n return {\n id: d.id, number: d.number, status: d.status, waiting: d.waiting === true,\n position: typeof d.position === 'number' ? d.position : null,\n teamReplied: d.team_replied === true, agentName: d.agent_name ?? null,\n conversationId: d.conversation_id ?? null, homeId: d.home_id ?? null,\n }\n },\n\n async chatThread(requestId): Promise<ChatThreadMessage[]> {\n const d: any = await chatOf(requestId)\n return ((d.messages as any[]) ?? []).map((m) => ({\n id: m.id, mine: m.author_kind !== 'team', author: m.author ?? null, body: m.body ?? '', at: m.created_at,\n }))\n },\n }\n}\n","// An in-memory `support.host` transport: the same rows support_host_call\n// (support 030) answers, kept in the page. For a host to draw the screens before\n// its edge or the V2 are deployed (dev, QA without writes, tests) — never real data.\nimport type { SupportHostTransport } from './host-provider'\n\nexport interface MockSupportHostSeed {\n /** Who is asking (the V1 user). */\n me?: { id: string; name: string }\n /** Agents online at the central (the live-chat door). Default 1. */\n online?: number\n /** The live chat is taken by \"Ana Souza (Suporte)\" after this many ms. Default 6000; null = never. */\n acceptAfterMs?: number | null\n /** Start with the sample tickets (default true). */\n samples?: boolean\n}\n\ntype Row = Record<string, any>\n\nconst iso = (msAgo = 0) => new Date(Date.now() - msAgo).toISOString()\nconst uuid = () => (globalThis.crypto?.randomUUID?.() ?? `${Date.now().toString(16)}-0000-4000-8000-${Math.random().toString(16).slice(2, 14).padEnd(12, '0')}`)\n\nclass MockError extends Error {}\n\nexport function createMockSupportHostTransport(seed: MockSupportHostSeed = {}): SupportHostTransport {\n const me = seed.me ?? { id: '7a1b2c3d-0000-4000-8000-00000000a0a0', name: 'Ana (demonstração)' }\n const tenant = 'mock-platform'\n let number = 40\n const tickets: Row[] = []\n const messages = new Map<string, Row[]>()\n const events = new Map<string, Row[]>()\n const files = new Map<string, Row[]>()\n const chatOpenedAt = new Map<string, number>()\n\n function add(kind: string, subject: string, description: string, status: string, msAgo: number): Row {\n const id = uuid()\n const row: Row = {\n id, tenant_id: tenant, number: ++number, kind, subject, description, status, route: null, unit_id: null,\n screen_snapshot: {}, origin_conversation_id: null, conversation_id: uuid(), area: null, created_by: me.id,\n created_at: iso(msAgo), updated_at: iso(msAgo), resolved_at: null, metadata: { opened_by_name: me.name }, assignee: null,\n }\n tickets.unshift(row)\n messages.set(id, [])\n events.set(id, [{ id: uuid(), request_id: id, type: 'opened', note: null, created_at: row.created_at }])\n files.set(id, [])\n return row\n }\n const say = (id: string, team: boolean, body: string, msAgo = 0, author: string | null = null) =>\n messages.get(id)!.push({ id: uuid(), author_kind: team ? 'team' : 'user', author: team ? (author ?? 'Suporte') : null, body, created_at: iso(msAgo), legacy: false })\n const event = (id: string, type: string, note: string | null = null) =>\n events.get(id)!.push({ id: uuid(), request_id: id, type, note, created_at: iso() })\n\n if (seed.samples !== false) {\n const a = add('problem', 'A impressora da cozinha não imprime a comanda', 'Desde ontem à noite a comanda não sai na impressora da cozinha.', 'waiting_you', 26 * 3600_000)\n say(a.id, false, 'Já reiniciei a impressora e nada.', 25 * 3600_000)\n say(a.id, true, 'Oi! Pode mandar um print da tela de impressoras em Configurações?', 3 * 3600_000, 'Bia Atendente')\n event(a.id, 'status_changed', 'waiting_you')\n const b = add('improvement', 'Atalho para dividir a conta no PDV', 'Seria ótimo ter um botão direto para dividir a conta por pessoa.', 'in_service', 3 * 86400_000)\n say(b.id, true, 'Boa ideia! Levamos para o time de produto.', 2 * 86400_000, 'Bia Atendente')\n add('other', 'Treinamento para a equipe nova', 'Gostaria de agendar um treinamento para três pessoas.', 'closed', 9 * 86400_000)\n }\n\n const find = (id: unknown) => {\n const t = tickets.find((x) => x.id === id)\n if (!t) throw new MockError('Solicitação não encontrada.')\n return t\n }\n const row = (t: Row) => { const { assignee: _a, ...r } = t; return { ...r } }\n const attention = () => tickets.filter((t) => ['waiting_you', 'resolved_check'].includes(t.status)).length\n const touch = (t: Row, status?: string) => { if (status) t.status = status; t.updated_at = iso() }\n\n /** The mock \"agent\": takes the chat a few seconds after it opened, and greets. */\n function tick(t: Row) {\n if (t.kind !== 'chat' || t.assignee || seed.acceptAfterMs === null) return\n const opened = chatOpenedAt.get(t.id) ?? 0\n if (Date.now() - opened < (seed.acceptAfterMs ?? 6_000)) return\n t.assignee = 'Ana Souza (Suporte)'\n touch(t, 'in_service')\n say(t.id, true, 'Olá! Aqui é Ana, do suporte. Já li a sua conversa com o atendimento automático. Como posso ajudar?', 0, 'Ana Souza (Suporte)')\n }\n\n return async (op, args) => {\n await new Promise((r) => setTimeout(r, 150))\n switch (op) {\n case 'list': {\n const want = args.filter === 'waiting' ? ['waiting_you', 'resolved_check']\n : args.filter === 'in_progress' ? ['received', 'triage', 'in_service', 'in_development']\n : args.filter === 'closed' ? ['closed', 'cancelled'] : null\n return { requests: tickets.filter((t) => !want || want.includes(t.status)).map(row), attention: attention() }\n }\n case 'detail': {\n const t = find(args.request_id)\n return { ...row(t), messages: messages.get(t.id), events: events.get(t.id), attachments: files.get(t.id) }\n }\n case 'open': {\n const desc = String(args.description ?? '').trim()\n if (desc.length < 5) throw new MockError('Descreva com pelo menos 5 caracteres.')\n const t = add(String(args.kind), String(args.subject ?? '').trim() || desc.split('\\n')[0]!.slice(0, 80), desc, 'received', 0)\n const uploads = ((args.attachments as Row[]) ?? []).map((f) => {\n const aid = uuid()\n files.get(t.id)!.push({ id: aid, request_id: t.id, storage_path: `${tenant}/${t.id}/${aid}/${f.name}`, name: f.name, size_bytes: f.size_bytes, content_type: f.content_type, created_at: iso(), url: null })\n return { attachment_id: aid, name: f.name, storage_path: `${tenant}/${t.id}/${aid}/${f.name}`, upload_url: null }\n })\n return { id: t.id, number: t.number, conversation_id: t.conversation_id, uploads }\n }\n case 'reply': {\n const t = find(args.request_id)\n if (['closed', 'cancelled'].includes(t.status)) throw new MockError('Esta solicitação está encerrada.')\n say(t.id, false, String(args.body ?? ''))\n if (t.status === 'waiting_you') touch(t, 'in_service')\n return { conversation_id: t.conversation_id, messages: messages.get(t.id) }\n }\n case 'status': {\n const t = find(args.request_id)\n if (args.action === 'cancel') {\n if (!['received', 'triage', 'waiting_you'].includes(t.status)) throw new MockError('Esta solicitação não pode mais ser cancelada.')\n touch(t, 'cancelled'); event(t.id, 'cancelled')\n } else if (t.status !== 'resolved_check') {\n // The bridge's rule (support 030 'status'): only a request waiting on the\n // person's confirmation takes \"Ficou bom\" / \"Ainda não\". The mock used to\n // accept it on a running chat — and so the tests never saw the refusal\n // that locked \"Encerrar\" in the V1.\n throw new MockError('Esta solicitação não está esperando a sua confirmação.')\n } else if (args.action === 'accept') {\n touch(t, 'closed'); event(t.id, 'validated_ok')\n } else {\n touch(t, 'received'); event(t.id, 'reopened', (args.reason as string) ?? null)\n }\n return row(t)\n }\n case 'chat_availability': {\n const active = tickets.find((t) => t.kind === 'chat' && !['resolved_check', 'closed', 'cancelled'].includes(t.status))\n return {\n home_id: 'mock-central', enabled: true, online: seed.online ?? 1,\n offline_message: 'Abra uma solicitação e respondemos por aqui e por e-mail.',\n business_hours: {}, timezone: 'America/Sao_Paulo',\n active_chat: active ? { id: active.id, number: active.number } : null,\n }\n }\n case 'chat_open': {\n const active = tickets.find((t) => t.kind === 'chat' && !['resolved_check', 'closed', 'cancelled'].includes(t.status))\n if (active) return { id: active.id, number: active.number, conversation_id: active.conversation_id, reused: true }\n const t = add('chat', String(args.subject ?? '') || 'Conversa com atendente', String(args.description ?? '') || 'A pessoa pediu para falar com um atendente.', 'received', 0)\n chatOpenedAt.set(t.id, Date.now())\n return { id: t.id, number: t.number, conversation_id: t.conversation_id, reused: false }\n }\n case 'chat': {\n const t = find(args.request_id)\n tick(t)\n const waiting = t.kind === 'chat' && !t.assignee && !['resolved_check', 'closed', 'cancelled'].includes(t.status)\n return {\n state: {\n id: t.id, number: t.number, kind: t.kind, status: t.status, waiting, position: waiting ? 1 : null,\n team_replied: (messages.get(t.id) ?? []).some((m) => m.author_kind === 'team'),\n agent_name: t.assignee ? String(t.assignee).split(' ')[0] : null, conversation_id: t.conversation_id, home_id: 'mock-central',\n },\n messages: messages.get(t.id),\n }\n }\n default:\n throw new MockError(`operação desconhecida: ${op}`)\n }\n }\n}\n","// `@fayz-ai/plugin-support/host` — the requester's support screens for a host\n// that does not run AdminShell nor the plugin runtime (the V1 drawing them slot\n// by slot), the way `@fayz-ai/plugin-getting-started/host` hosts the journey.\n//\n// The screens are the platform's own (SupportRequestsPanel, SupportMenu,\n// SupportRequestForm, SupportRequestDetail, LiveChatPanel); only the data port\n// changes: `dataProvider` is injected and nothing below touches this pool's\n// Supabase client. A host whose browser has no session here builds it with\n// `createSupportHostProvider({ call })` over its own transport — the V1 sends\n// each operation through its edge `support-v2`, signed to the V2 bridge\n// (`support.host`, @fayz-ai/contracts/v1-bridge) — and the ticket is born and\n// lives in the V2 (plugin-support 030).\nimport * as React from 'react'\nimport { registerTranslations, type PluginAITool } from '@fayz-ai/core'\nimport { supportLocales } from './locales'\nimport { useSupportStore } from './store'\nimport { setSupportDataProvider, type SupportDataProvider } from './data/provider'\nimport { SupportRequestsPanel, type SupportRequestsPanelProps } from './views/SupportRequestsPanel'\nimport { SupportRequestForm, type SupportRequestFormProps } from './views/SupportRequestForm'\nimport { SupportRequestDetail, type SupportRequestDetailProps } from './views/SupportRequestDetail'\nimport { SupportMenu, type SupportMenuProps } from './views/SupportMenu'\nimport { LiveChatPanel, type LiveChatPanelProps } from './livechat/LiveChatPanel'\nimport { useLiveChatDoor, type LiveChatDoor } from './livechat/door'\nimport { supportAITools } from './lib/report-tool'\nimport { installSupportInChat, refreshSupportHandler } from './livechat/in-chat-install'\n\nexport interface SupportHostOptions {\n /** Where every read and write goes. Required: there is no platform default in a host. */\n dataProvider: SupportDataProvider\n /** \"Toda a empresa\" — the host's own permission (the V1: support_tickets_license). Default false. */\n canSeeAll?: boolean\n /**\n * Install the support INSIDE the assistant's conversation (default true): the\n * support chips with their deterministic paths, the cards in the thread, the\n * header's \"Atendente\" turning the same thread into the live chat, and the\n * executors of `aiTools` (registerAIToolHandler). A host whose assistant is\n * the SDK chat leaves it on; it is what makes the V1 and the V2 the same.\n */\n inChat?: boolean\n}\n\nexport interface SupportHost {\n provider: SupportDataProvider\n /** \"Minhas solicitações\": list ↔ detail ↔ menu ↔ form ↔ live chat, in one column. */\n RequestsPanel: React.ComponentType<SupportRequestsPanelProps>\n /** The four doors (\"Em que podemos ajudar?\"). */\n Menu: React.ComponentType<SupportMenuProps>\n /** One door's form (description, subject, prints and files). */\n RequestForm: React.ComponentType<SupportRequestFormProps>\n /** The selected request (use the store's `select(id)` first, or the panel). */\n RequestDetail: React.ComponentType<SupportRequestDetailProps>\n /** \"Conversar com um atendente\": connecting, the absence screen, the chat. */\n LiveChatPanel: React.ComponentType<LiveChatPanelProps>\n /** The door's state (who is online, the open chat) for a host's own button. */\n useLiveChatDoor: (refreshKey?: unknown) => LiveChatDoor\n /** Opens a request in the store (the detail surface reads it). */\n select: (id: string | null) => Promise<void>\n /**\n * The support tools for the assistant's catalog (reportIssue,\n * findSupportRequests, startLiveChat, openSupportRequest) — the V1 declares\n * them with `registerModuleAITools` so its brain can call them; the executors\n * are already registered (inChat).\n */\n aiTools: PluginAITool[]\n /** Re-checks whether this account has a live chat and (un)registers the header's \"Atendente\". */\n refreshSupportHandler: () => Promise<boolean>\n /** Restores the platform provider and empties the store. */\n dispose: () => void\n}\n\nexport function createSupportHost(options: SupportHostOptions): SupportHost {\n registerTranslations(supportLocales)\n setSupportDataProvider(options.dataProvider)\n useSupportStore.getState().reset()\n\n const canSeeAll = options.canSeeAll ?? false\n const uninstall = options.inChat === false ? null : installSupportInChat()\n if (uninstall) void refreshSupportHandler()\n function RequestsPanel(props: SupportRequestsPanelProps) {\n return <SupportRequestsPanel canSeeAll={canSeeAll} {...props} />\n }\n RequestsPanel.displayName = 'SupportHost(RequestsPanel)'\n\n return {\n provider: options.dataProvider,\n RequestsPanel,\n Menu: SupportMenu,\n RequestForm: SupportRequestForm,\n RequestDetail: SupportRequestDetail,\n LiveChatPanel,\n useLiveChatDoor,\n select: (id) => useSupportStore.getState().select(id),\n aiTools: supportAITools,\n refreshSupportHandler,\n dispose: () => {\n uninstall?.()\n setSupportDataProvider(null)\n useSupportStore.getState().reset()\n },\n }\n}\n\nexport { createSupportHostProvider, toHostRequest, type SupportHostTransport, type SupportHostProviderOptions } from './data/host-provider'\nexport { createMockSupportHostTransport, type MockSupportHostSeed } from './data/mock-host'\nexport type { SupportDataProvider, ChatThreadMessage } from './data/provider'\nexport { useSupportStore } from './store'\nexport { requestLiveChat, useLiveChatDoor, liveChatHint, type LiveChatHandoff, type LiveChatDoor } from './livechat/door'\nexport { buildTranscript, chatSubject, type TranscriptMessage } from './livechat/rules'\nexport { supportAITools, supportToolHandlers, SUPPORT_DOOR_SUGGESTIONS } from './lib/report-tool'\nexport { installSupportInChat, refreshSupportHandler, getInChatController } from './livechat/in-chat-install'\nexport { stepInChat, statusLine, INITIAL_IN_CHAT, type InChatState, type InChatPhase, type InChatEvent } from './livechat/in-chat-machine'\nexport type { SupportRequestsPanelProps } from './views/SupportRequestsPanel'\nexport type { SupportRailChrome } from './lib/rail-chrome'\nexport type { SupportRequestFormProps } from './views/SupportRequestForm'\nexport type { SupportRequestDetailProps } from './views/SupportRequestDetail'\nexport type { SupportMenuProps } from './views/SupportMenu'\nexport type { LiveChatPanelProps } from './livechat/LiveChatPanel'\nexport type { ChatAvailability, ChatState } from './livechat/api'\nexport * from './types'\n"]}
@@ -0,0 +1,11 @@
1
+ export { getInChatController, getRequestFlow, installSupportInChat, refreshSupportHandler, supportInChatActive } from './chunk-QBOQYER7.js';
2
+ import './chunk-JOS2QQML.js';
3
+ import './chunk-Y673XGDK.js';
4
+ import './chunk-WHEJ63CM.js';
5
+ import './chunk-S766CRAY.js';
6
+ import './chunk-ZEHBREG5.js';
7
+ import './chunk-3WPESEK2.js';
8
+ import './chunk-PHIPTZSD.js';
9
+ import './chunk-L2HGTGW4.js';
10
+ //# sourceMappingURL=in-chat-install-2BTKBF2Z.js.map
11
+ //# sourceMappingURL=in-chat-install-2BTKBF2Z.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"in-chat-install-2BTKBF2Z.js"}
package/dist/index.js CHANGED
@@ -1,198 +1,25 @@
1
- import { supportLocales } from './chunk-7RHEXUVI.js';
2
1
  import { defaultStatusComponents, defaultWhatsNew, defaultFaq } from './chunk-5WQPAYG4.js';
3
- import { useSupportStore } from './chunk-PIMV3VRT.js';
4
- export { LiveChatPanel, useSupportStore } from './chunk-PIMV3VRT.js';
5
- import './chunk-STEDUFNR.js';
6
- import { setConversationSurface, setSlaPolicySource, supportSettingsPath, SETTINGS_TAB_ID, LEGACY_SETTINGS_SEGMENT } from './chunk-M4LUNCKI.js';
7
- export { LiveChatQueue, supportSettingsPath } from './chunk-M4LUNCKI.js';
8
- import { helpdeskConsolePath, setHelpdeskConsolePath } from './chunk-3BKE4U6Y.js';
9
- import { createRequest, uploadAttachment, listRequests } from './chunk-MQXGB4IO.js';
10
- export { MAX_ATTACHMENTS, MAX_ATTACHMENT_BYTES, SUPPORT_BUCKET, acceptChat, buildTranscript, chatAvailability, chatQueue, chatState, chatSubject, closeChat, openChat } from './chunk-MQXGB4IO.js';
11
- import { consoleListRequests, ticketsForConversation } from './chunk-CWCN5PDE.js';
2
+ import { setConversationSurface, setSlaPolicySource, supportSettingsPath, SETTINGS_TAB_ID, LEGACY_SETTINGS_SEGMENT } from './chunk-E5EXC7QW.js';
3
+ export { LiveChatQueue, supportSettingsPath } from './chunk-E5EXC7QW.js';
12
4
  import { setSupportSettingsProvider, getSupportSettings } from './chunk-WM5SYARV.js';
13
5
  export { SupportSettingsError, createMockSupportSettingsProvider, createSupabaseSupportSettingsProvider, getMySupportAgent, getSupportAccess, getSupportSettings, listSupportAgents } from './chunk-WM5SYARV.js';
6
+ import { supportLocales } from './chunk-7RHEXUVI.js';
7
+ export { LiveChatPanel } from './chunk-DTO5R6GN.js';
8
+ import './chunk-E5242OSS.js';
9
+ import { registerSupportAITools, supportAITools } from './chunk-Y673XGDK.js';
10
+ export { useSupportStore } from './chunk-WHEJ63CM.js';
11
+ export { MAX_ATTACHMENTS, MAX_ATTACHMENT_BYTES, SUPPORT_BUCKET, acceptChat, buildTranscript, chatAvailability, chatQueue, chatState, chatSubject, closeChat, openChat } from './chunk-S766CRAY.js';
14
12
  export { SUPPORT_SETTINGS_DEFAULTS, WEEKDAY_LABEL, describeBusinessHours, isWithinBusinessHours, slaTargets } from './chunk-ZEHBREG5.js';
15
- import { STATUS_LABEL, STATUS_TONE } from './chunk-WOZTA5LS.js';
13
+ import './chunk-3WPESEK2.js';
14
+ import { helpdeskConsolePath, setHelpdeskConsolePath } from './chunk-3BKE4U6Y.js';
15
+ import { consoleListRequests, ticketsForConversation } from './chunk-PHIPTZSD.js';
16
+ import { STATUS_LABEL, STATUS_TONE } from './chunk-L2HGTGW4.js';
16
17
  import React2 from 'react';
17
- import { lazyComponent, registerTranslations, navigateApp, replaceApp, getRecentActivity, useNavHistoryStore } from '@fayz-ai/core';
18
+ import { lazyComponent, registerTranslations, navigateApp, replaceApp } from '@fayz-ai/core';
18
19
  import { MIGRATIONS } from '#migrations/main';
19
20
  import { Skeleton, Badge } from '@fayz-ai/ui';
20
21
  import { jsx, jsxs } from 'react/jsx-runtime';
21
22
 
22
- var takeTurnReportFiles = null;
23
- function normalizeKind(raw) {
24
- const s = String(raw ?? "").trim().toLowerCase();
25
- if (["improvement", "melhoria", "sugestao", "sugest\xE3o", "suggestion"].some((k) => s.includes(k))) return "improvement";
26
- if (["other", "outra", "outras", "outro", "solicitacao", "solicita\xE7\xE3o", "request"].some((k) => s.includes(k))) return "other";
27
- return "problem";
28
- }
29
- function recentScreens(limit = 10) {
30
- try {
31
- const stack = useNavHistoryStore.getState().stack;
32
- return stack.slice(-limit).reverse().map((e) => ({ path: e.path, label: e.label }));
33
- } catch {
34
- return [];
35
- }
36
- }
37
- function currentRoute() {
38
- if (typeof location === "undefined") return null;
39
- return location.hash || location.pathname || null;
40
- }
41
- var supportAITools = [
42
- {
43
- id: "support.report-issue",
44
- name: "reportIssue",
45
- description: `REGISTERS a support request (problema, melhoria ou outra solicita\xE7\xE3o) for the Fayz team. 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 \u2014 "n\xE3o consigo\u2026", "deu erro", "n\xE3o aparece a op\xE7\xE3o de\u2026", "seria bom se\u2026". 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) \u2014 a complaint is not a work order, and guessing at a fix does nothing the user asked for. Before registering: call findSupportRequests to check the issue is not ALREADY open (if it is, do not duplicate \u2014 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. It returns the request number \u2014 tell the user "registrei a sua solicita\xE7\xE3o, n\xFAmero #N, a equipe vai acompanhar" and STOP. The route and the recent screens are captured automatically; you do not pass them.`,
46
- icon: "LifeBuoy",
47
- mode: "persist",
48
- // No confirmation card: the user already asked for it and the agent confirms
49
- // in prose. The card would just show the technical params.
50
- requiresConfirmation: false,
51
- parameters: {
52
- type: "object",
53
- properties: {
54
- kind: {
55
- type: "string",
56
- enum: ["problem", "improvement", "other"],
57
- description: "problem = algo n\xE3o funcionou; improvement = sugest\xE3o de melhoria; other = treinamento, acesso, dados, comercial. Default problem."
58
- },
59
- description: {
60
- type: "string",
61
- description: "O que aconteceu, na linguagem do usu\xE1rio: o que ele fazia, o que esperava e o que apareceu."
62
- },
63
- subject: {
64
- type: "string",
65
- description: "Opcional. Um t\xEDtulo curto para a solicita\xE7\xE3o."
66
- }
67
- },
68
- required: ["description"]
69
- },
70
- category: "Suporte",
71
- suggestions: [
72
- { label: "Quero reportar um problema", prompt: "Quero reportar um problema" },
73
- { label: "Quero sugerir uma melhoria", prompt: "Quero sugerir uma melhoria" },
74
- { label: "Tenho uma d\xFAvida", prompt: "Tenho uma d\xFAvida" },
75
- { label: "Outra solicita\xE7\xE3o", prompt: "Tenho outra solicita\xE7\xE3o para a equipe" }
76
- ]
77
- },
78
- {
79
- id: "support.find-requests",
80
- name: "findSupportRequests",
81
- description: "Lists the user's OPEN support requests (solicita\xE7\xF5es em aberto). CALL THIS BEFORE registering a problem or improvement, to check whether the same thing is ALREADY reported. 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. Optional `query` filters by words from the user's complaint.",
82
- icon: "Search",
83
- mode: "read",
84
- parameters: {
85
- type: "object",
86
- properties: {
87
- query: { type: "string", description: "Palavras do que o usu\xE1rio est\xE1 relatando, para achar uma solicita\xE7\xE3o parecida. Opcional." }
88
- }
89
- },
90
- category: "Suporte"
91
- }
92
- ];
93
- async function executeReportIssue(args) {
94
- const description = String(args.description ?? "").trim();
95
- if (description.length < 5) {
96
- return {
97
- ok: false,
98
- error: "missing_description",
99
- message: "Antes de registrar, pergunte ao usu\xE1rio o que aconteceu e descreva com as palavras dele (m\xEDnimo de uma frase)."
100
- };
101
- }
102
- const kind = normalizeKind(args.kind);
103
- const subject = typeof args.subject === "string" && args.subject.trim() ? args.subject.trim() : null;
104
- try {
105
- const res = await createRequest({
106
- kind,
107
- description,
108
- subject,
109
- route: currentRoute(),
110
- // What the user was doing travels with the request, so the team reads it
111
- // without a second round-trip. `activity` is the rich trail (routes +
112
- // buttons pressed); `recentScreens` stays for tickets opened before it.
113
- screenSnapshot: { activity: getRecentActivity(10), recentScreens: recentScreens() }
114
- });
115
- let attached = 0;
116
- const files = takeTurnReportFiles ? takeTurnReportFiles() : [];
117
- for (const file of files) {
118
- const pending = {
119
- id: crypto.randomUUID(),
120
- file,
121
- name: file.name || "anexo",
122
- contentType: file.type || "application/octet-stream",
123
- sizeBytes: file.size
124
- };
125
- try {
126
- await uploadAttachment(res.id, pending);
127
- attached += 1;
128
- } catch {
129
- }
130
- }
131
- try {
132
- void useSupportStore.getState().loadList();
133
- } catch {
134
- }
135
- return {
136
- ok: true,
137
- id: res.id,
138
- number: res.number,
139
- status: "received",
140
- attachments: attached,
141
- ref: { id: res.id, label: `Solicita\xE7\xE3o #${res.number}`, path: `/support/ticket/${res.id}` },
142
- message: `Solicita\xE7\xE3o #${res.number} registrada${attached ? ` com ${attached} anexo(s)` : ""}. Diga ao usu\xE1rio o n\xFAmero e que a equipe vai acompanhar. N\xC3O chame mais nenhuma ferramenta \u2014 o relato est\xE1 registrado.`
143
- };
144
- } catch (error) {
145
- return {
146
- ok: false,
147
- error: "write_failed",
148
- message: error instanceof Error ? error.message : "N\xE3o consegui registrar a solicita\xE7\xE3o."
149
- };
150
- }
151
- }
152
- function isOpen(status) {
153
- return status !== "closed" && status !== "cancelled";
154
- }
155
- async function executeFindRequests(args) {
156
- const query = String(args.query ?? "").trim().toLowerCase();
157
- const terms = query.split(/[^\p{L}\p{N}]+/u).filter((w) => w.length > 2);
158
- let open;
159
- try {
160
- open = (await listRequests("mine", "all")).filter((r) => isOpen(r.status));
161
- } catch (error) {
162
- return { error: "read_failed", message: error instanceof Error ? error.message : "N\xE3o consegui ler as solicita\xE7\xF5es." };
163
- }
164
- const scored = open.map((r) => {
165
- const hay = `${r.subject ?? ""} ${r.description}`.toLowerCase();
166
- const score = terms.length ? terms.filter((t) => hay.includes(t)).length : 0;
167
- return { r, score };
168
- }).sort((a, b) => b.score - a.score || b.r.number - a.r.number);
169
- const picked = (terms.length ? scored.filter((s) => s.score > 0) : scored).slice(0, 10);
170
- return {
171
- total: picked.length,
172
- openTotal: open.length,
173
- requests: picked.map(({ r }) => ({
174
- number: r.number,
175
- kind: r.kind,
176
- subject: r.subject || r.description.slice(0, 80),
177
- status: r.status,
178
- createdAt: r.createdAt,
179
- ref: { id: r.id, label: `Solicita\xE7\xE3o #${r.number}`, path: `/support/ticket/${r.id}` }
180
- })),
181
- hint: picked.length ? "If one of these is clearly the SAME issue the user is reporting now, do not open a duplicate \u2014 say it is already registered (#number + status) and offer to add a note." : "Nothing similar is open \u2014 go ahead and register the new request."
182
- };
183
- }
184
- var registered = false;
185
- function registerSupportAITools() {
186
- if (registered || typeof document === "undefined") return;
187
- registered = true;
188
- void import('@fayz-ai/admin').then((admin) => {
189
- takeTurnReportFiles = admin.takeTurnReportFiles;
190
- admin.registerAIToolHandler("reportIssue", (args) => executeReportIssue(args));
191
- admin.registerAIToolHandler("findSupportRequests", (args) => executeFindRequests(args));
192
- }).catch(() => {
193
- registered = false;
194
- });
195
- }
196
23
  function ConsoleSkeleton() {
197
24
  return /* @__PURE__ */ jsx("div", { className: "flex gap-3 overflow-hidden", "aria-busy": "true", children: [0, 1, 2, 3].map((i) => /* @__PURE__ */ jsxs("div", { className: "w-72 shrink-0 space-y-3 rounded-card bg-muted/30 p-3", children: [
198
25
  /* @__PURE__ */ jsx(Skeleton, { className: "h-5 w-32" }),
@@ -360,14 +187,14 @@ var supportConversationLinks = {
360
187
  canAct: canOpen && conversation.channel !== "support" && !!conversation.contactPersonId
361
188
  };
362
189
  },
363
- Action: lazyComponent(() => import('./OpenTicketFromConversation-KDXK7A6L.js').then((m) => m.OpenTicketFromConversation))
190
+ Action: lazyComponent(() => import('./OpenTicketFromConversation-RC26KHN3.js').then((m) => m.OpenTicketFromConversation))
364
191
  };
365
192
 
366
193
  // src/index.ts
367
- var LazySupportCenter = React2.lazy(() => import('./SupportCenter-JBBBJTKU.js'));
368
- var LazyHelpdeskConsole = React2.lazy(() => import('./HelpdeskConsole-QY534ASZ.js'));
369
- var LazySupportSettings = React2.lazy(() => import('./SupportSettingsPage-PB6A3VCI.js'));
370
- var LazyLiveChatWatcher = React2.lazy(() => import('./LiveChatAgentWatcher-J6PNLYWT.js'));
194
+ var LazySupportCenter = React2.lazy(() => import('./SupportCenter-HGQL4PBX.js'));
195
+ var LazyHelpdeskConsole = React2.lazy(() => import('./HelpdeskConsole-EATEBVLN.js'));
196
+ var LazySupportSettings = React2.lazy(() => import('./SupportSettingsPage-LIVZY2XQ.js'));
197
+ var LazyLiveChatWatcher = React2.lazy(() => import('./LiveChatAgentWatcher-WEUHRRLC.js'));
371
198
  var LiveChatWatcherControl = () => React2.createElement(React2.Suspense, { fallback: null }, React2.createElement(LazyLiveChatWatcher, null));
372
199
  var SupportSettingsTab = () => React2.createElement(
373
200
  React2.Suspense,