@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.
- package/dist/{HelpdeskConsole-QY534ASZ.js → HelpdeskConsole-EATEBVLN.js} +10 -7
- package/dist/HelpdeskConsole-EATEBVLN.js.map +1 -0
- package/dist/{LiveChatAgentWatcher-J6PNLYWT.js → LiveChatAgentWatcher-WEUHRRLC.js} +17 -23
- package/dist/LiveChatAgentWatcher-WEUHRRLC.js.map +1 -0
- package/dist/{OpenTicketFromConversation-KDXK7A6L.js → OpenTicketFromConversation-RC26KHN3.js} +4 -4
- package/dist/{OpenTicketFromConversation-KDXK7A6L.js.map → OpenTicketFromConversation-RC26KHN3.js.map} +1 -1
- package/dist/{SupportCenter-JBBBJTKU.js → SupportCenter-HGQL4PBX.js} +12 -9
- package/dist/SupportCenter-HGQL4PBX.js.map +1 -0
- package/dist/{SupportSettingsPage-PB6A3VCI.js → SupportSettingsPage-LIVZY2XQ.js} +3 -3
- package/dist/{SupportSettingsPage-PB6A3VCI.js.map → SupportSettingsPage-LIVZY2XQ.js.map} +1 -1
- package/dist/chunk-3WPESEK2.js +136 -0
- package/dist/chunk-3WPESEK2.js.map +1 -0
- package/dist/chunk-5MGCM5C4.js +181 -0
- package/dist/chunk-5MGCM5C4.js.map +1 -0
- package/dist/{chunk-PIMV3VRT.js → chunk-DTO5R6GN.js} +26 -126
- package/dist/chunk-DTO5R6GN.js.map +1 -0
- package/dist/chunk-E5242OSS.js +88 -0
- package/dist/chunk-E5242OSS.js.map +1 -0
- package/dist/{chunk-M4LUNCKI.js → chunk-E5EXC7QW.js} +57 -16
- package/dist/chunk-E5EXC7QW.js.map +1 -0
- package/dist/chunk-JOS2QQML.js +17 -0
- package/dist/chunk-JOS2QQML.js.map +1 -0
- package/dist/{chunk-WOZTA5LS.js → chunk-L2HGTGW4.js} +6 -4
- package/dist/chunk-L2HGTGW4.js.map +1 -0
- package/dist/{chunk-37ZZRVI7.js → chunk-P4VNMWIT.js} +79 -186
- package/dist/chunk-P4VNMWIT.js.map +1 -0
- package/dist/{chunk-CWCN5PDE.js → chunk-PHIPTZSD.js} +48 -5
- package/dist/chunk-PHIPTZSD.js.map +1 -0
- package/dist/chunk-QBOQYER7.js +1603 -0
- package/dist/chunk-QBOQYER7.js.map +1 -0
- package/dist/{chunk-MQXGB4IO.js → chunk-S766CRAY.js} +42 -239
- package/dist/chunk-S766CRAY.js.map +1 -0
- package/dist/chunk-WHEJ63CM.js +156 -0
- package/dist/chunk-WHEJ63CM.js.map +1 -0
- package/dist/chunk-Y673XGDK.js +261 -0
- package/dist/chunk-Y673XGDK.js.map +1 -0
- package/dist/data/api.d.ts +5 -0
- package/dist/data/api.d.ts.map +1 -1
- package/dist/data/console.d.ts +6 -0
- package/dist/data/console.d.ts.map +1 -1
- package/dist/data/mock-host.d.ts.map +1 -1
- package/dist/data/provider.d.ts +12 -0
- package/dist/data/provider.d.ts.map +1 -1
- package/dist/host.d.ts +21 -0
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +24 -10
- package/dist/host.js.map +1 -1
- package/dist/in-chat-install-2BTKBF2Z.js +11 -0
- package/dist/in-chat-install-2BTKBF2Z.js.map +1 -0
- package/dist/index.js +18 -191
- package/dist/index.js.map +1 -1
- package/dist/lib/imported.d.ts +27 -0
- package/dist/lib/imported.d.ts.map +1 -0
- package/dist/lib/report-tool.d.ts +54 -9
- package/dist/lib/report-tool.d.ts.map +1 -1
- package/dist/lib/vocabulary.d.ts.map +1 -1
- package/dist/livechat/LiveChatAgentWatcher.d.ts +3 -2
- package/dist/livechat/LiveChatAgentWatcher.d.ts.map +1 -1
- package/dist/livechat/in-chat-install.d.ts +19 -0
- package/dist/livechat/in-chat-install.d.ts.map +1 -0
- package/dist/livechat/in-chat-link.d.ts +10 -0
- package/dist/livechat/in-chat-link.d.ts.map +1 -0
- package/dist/livechat/in-chat-machine.d.ts +99 -0
- package/dist/livechat/in-chat-machine.d.ts.map +1 -0
- package/dist/livechat/in-chat-request-machine.d.ts +147 -0
- package/dist/livechat/in-chat-request-machine.d.ts.map +1 -0
- package/dist/livechat/in-chat-request.d.ts +94 -0
- package/dist/livechat/in-chat-request.d.ts.map +1 -0
- package/dist/livechat/in-chat-widgets.d.ts +39 -0
- package/dist/livechat/in-chat-widgets.d.ts.map +1 -0
- package/dist/livechat/in-chat.d.ts +119 -0
- package/dist/livechat/in-chat.d.ts.map +1 -0
- package/dist/livechat/report-intake.d.ts +45 -0
- package/dist/livechat/report-intake.d.ts.map +1 -0
- package/dist/livechat/screen-capture.d.ts +7 -0
- package/dist/livechat/screen-capture.d.ts.map +1 -0
- package/dist/migrations/index.d.ts +2 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/main.browser.js +3 -1
- package/dist/migrations/main.browser.js.map +1 -1
- package/dist/migrations/main.js +1181 -2
- package/dist/migrations/main.js.map +1 -1
- package/dist/realtime-HQVWBTML.js +3 -0
- package/dist/realtime-HQVWBTML.js.map +1 -0
- package/dist/screen-capture-FRMTTRUY.js +77 -0
- package/dist/screen-capture-FRMTTRUY.js.map +1 -0
- package/dist/types.d.ts +5 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/views/SupportRequestsPanel.d.ts.map +1 -1
- package/dist/views/TicketSheet.d.ts +11 -1
- package/dist/views/TicketSheet.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/HelpdeskConsole-QY534ASZ.js.map +0 -1
- package/dist/LiveChatAgentWatcher-J6PNLYWT.js.map +0 -1
- package/dist/SupportCenter-JBBBJTKU.js.map +0 -1
- package/dist/chunk-37ZZRVI7.js.map +0 -1
- package/dist/chunk-CWCN5PDE.js.map +0 -1
- package/dist/chunk-JT4ZPWH7.js +0 -61
- package/dist/chunk-JT4ZPWH7.js.map +0 -1
- package/dist/chunk-M4LUNCKI.js.map +0 -1
- package/dist/chunk-MQXGB4IO.js.map +0 -1
- package/dist/chunk-PIMV3VRT.js.map +0 -1
- package/dist/chunk-STEDUFNR.js +0 -42
- package/dist/chunk-STEDUFNR.js.map +0 -1
- package/dist/chunk-WOZTA5LS.js.map +0 -1
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
export type RequestKind = 'problem' | 'improvement' | 'other';
|
|
2
|
+
export interface RequestQuestion {
|
|
3
|
+
key: string;
|
|
4
|
+
/** What the assistant asks. */
|
|
5
|
+
ask: string;
|
|
6
|
+
/** The row's name in the summary card. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Quick replies (chips). Typing an answer instead is fine. */
|
|
9
|
+
options: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare const REQUEST_QUESTIONS: Record<RequestKind, RequestQuestion[]>;
|
|
12
|
+
export declare const REQUEST_LABEL: Record<RequestKind, string>;
|
|
13
|
+
/** The composer's hint while the person describes it — the question itself. */
|
|
14
|
+
export declare const DESCRIBE_PLACEHOLDER: Record<RequestKind, string>;
|
|
15
|
+
export declare const REQUEST_INTRO: Record<RequestKind, string>;
|
|
16
|
+
export declare const MIN_DESCRIPTION = 5;
|
|
17
|
+
export type RequestPhase = 'idle' | 'describe' | 'thinking' | 'ask' | 'review' | 'sending';
|
|
18
|
+
export interface RequestScreen {
|
|
19
|
+
label: string | null;
|
|
20
|
+
route: string | null;
|
|
21
|
+
}
|
|
22
|
+
/** What the model made of the description (report-intake), as the steps use it. */
|
|
23
|
+
export interface RequestIntake {
|
|
24
|
+
onTopic: boolean;
|
|
25
|
+
reply: string | null;
|
|
26
|
+
title: string;
|
|
27
|
+
summary: string;
|
|
28
|
+
question: {
|
|
29
|
+
ask: string;
|
|
30
|
+
label: string;
|
|
31
|
+
options: string[];
|
|
32
|
+
} | null;
|
|
33
|
+
}
|
|
34
|
+
export interface RequestState {
|
|
35
|
+
phase: RequestPhase;
|
|
36
|
+
kind: RequestKind;
|
|
37
|
+
description: string;
|
|
38
|
+
answers: Record<string, string>;
|
|
39
|
+
/** Index of the question being asked (phase 'ask'). */
|
|
40
|
+
q: number;
|
|
41
|
+
/** Back from "Ajustar": after the new text, straight to the summary. */
|
|
42
|
+
adjusting: boolean;
|
|
43
|
+
/** The model reads the description first. False = the fixed questions only. */
|
|
44
|
+
smart: boolean;
|
|
45
|
+
/** The model's title and summary for the team (smart only). */
|
|
46
|
+
title: string;
|
|
47
|
+
summary: string;
|
|
48
|
+
/** The model's one follow-up, asked before the fixed questions. */
|
|
49
|
+
extra: RequestQuestion | null;
|
|
50
|
+
/** The screen the report is about, known without asking. */
|
|
51
|
+
screen: RequestScreen | null;
|
|
52
|
+
/** Off-topic texts already sent back (once; the next one goes as written). */
|
|
53
|
+
redirects: number;
|
|
54
|
+
}
|
|
55
|
+
export declare const INITIAL_REQUEST: RequestState;
|
|
56
|
+
export declare const EXTRA_QUESTION_KEY = "extra";
|
|
57
|
+
export type RequestEvent = {
|
|
58
|
+
t: 'start';
|
|
59
|
+
kind: RequestKind;
|
|
60
|
+
description?: string;
|
|
61
|
+
smart?: boolean;
|
|
62
|
+
screen?: RequestScreen | null;
|
|
63
|
+
}
|
|
64
|
+
/** The model's reading of the description (phase 'thinking'). */
|
|
65
|
+
| {
|
|
66
|
+
t: 'intake';
|
|
67
|
+
result: RequestIntake;
|
|
68
|
+
}
|
|
69
|
+
/** No reading: late, failed or not usable — the fixed questions take over. */
|
|
70
|
+
| {
|
|
71
|
+
t: 'intake_failed';
|
|
72
|
+
}
|
|
73
|
+
/** What the person typed in the composer (empty text with only a file is fine: nothing to read). */
|
|
74
|
+
| {
|
|
75
|
+
t: 'text';
|
|
76
|
+
text: string;
|
|
77
|
+
}
|
|
78
|
+
/** A chip of the current question. */
|
|
79
|
+
| {
|
|
80
|
+
t: 'choose';
|
|
81
|
+
value: string;
|
|
82
|
+
} | {
|
|
83
|
+
t: 'adjust';
|
|
84
|
+
} | {
|
|
85
|
+
t: 'send';
|
|
86
|
+
} | {
|
|
87
|
+
t: 'sent';
|
|
88
|
+
number: number;
|
|
89
|
+
} | {
|
|
90
|
+
t: 'failed';
|
|
91
|
+
message: string;
|
|
92
|
+
} | {
|
|
93
|
+
t: 'cancel';
|
|
94
|
+
};
|
|
95
|
+
export type RequestEffect =
|
|
96
|
+
/** A line from the assistant (with quick replies when the step has them). */
|
|
97
|
+
{
|
|
98
|
+
k: 'say';
|
|
99
|
+
text: string;
|
|
100
|
+
options?: string[];
|
|
101
|
+
}
|
|
102
|
+
/** The intro of a door (the controller adds the print chip to a problem). */
|
|
103
|
+
| {
|
|
104
|
+
k: 'intro';
|
|
105
|
+
text: string;
|
|
106
|
+
}
|
|
107
|
+
/** The summary card with "Enviar" / "Ajustar". */
|
|
108
|
+
| {
|
|
109
|
+
k: 'summary';
|
|
110
|
+
}
|
|
111
|
+
/** Put the description back in the field to be rewritten. */
|
|
112
|
+
| {
|
|
113
|
+
k: 'prefill';
|
|
114
|
+
text: string;
|
|
115
|
+
}
|
|
116
|
+
/** Ask the model to read the description (the controller answers with intake / intake_failed). */
|
|
117
|
+
| {
|
|
118
|
+
k: 'intake';
|
|
119
|
+
} | {
|
|
120
|
+
k: 'create';
|
|
121
|
+
} | {
|
|
122
|
+
k: 'done';
|
|
123
|
+
number: number;
|
|
124
|
+
} | {
|
|
125
|
+
k: 'cancelled';
|
|
126
|
+
};
|
|
127
|
+
export declare function isRequestActive(state: RequestState): boolean;
|
|
128
|
+
/** The questions this request asks, in order: the model's one first, then the fixed ones. */
|
|
129
|
+
export declare function questionsOf(state: RequestState): RequestQuestion[];
|
|
130
|
+
export declare function stepRequest(state: RequestState, event: RequestEvent): {
|
|
131
|
+
state: RequestState;
|
|
132
|
+
effects: RequestEffect[];
|
|
133
|
+
};
|
|
134
|
+
/** The composer's hint at each step. */
|
|
135
|
+
export declare function requestPlaceholder(state: RequestState): string;
|
|
136
|
+
/** The summary rows: the screen when known without asking, then the answers in the order asked. */
|
|
137
|
+
export declare function requestDetails(state: RequestState): Array<{
|
|
138
|
+
label: string;
|
|
139
|
+
value: string;
|
|
140
|
+
}>;
|
|
141
|
+
/**
|
|
142
|
+
* What the team reads. With the model: its summary, the rows, and the person's
|
|
143
|
+
* words verbatim at the end. Without: the person's words first, the answers
|
|
144
|
+
* under them. The words are never rewritten either way.
|
|
145
|
+
*/
|
|
146
|
+
export declare function requestDescription(state: RequestState, route?: string | null): string;
|
|
147
|
+
//# sourceMappingURL=in-chat-request-machine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in-chat-request-machine.d.ts","sourceRoot":"","sources":["../../src/livechat/in-chat-request-machine.ts"],"names":[],"mappings":"AAsBA,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,aAAa,GAAG,OAAO,CAAA;AAE7D,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAA;IACX,+BAA+B;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAA;IACb,+DAA+D;IAC/D,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,WAAW,EAAE,eAAe,EAAE,CAWpE,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAIrD,CAAA;AAED,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAI5D,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAIrD,CAAA;AAED,eAAO,MAAM,eAAe,IAAI,CAAA;AAEhC,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAA;AAE1F,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB;AAED,mFAAmF;AACnF,MAAM,WAAW,aAAa;IAC5B,OAAO,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CAMlE;AA6BD,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAG;IAAE,KAAK,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,aAAa,EAAE,CAAA;CAAE,CAqFvH;AAED,wCAAwC;AACxC,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAS9D;AAED,mGAAmG;AACnG,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,GAAG,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAK3F;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM,CAa3F"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { ChatComposerMode, ChatMessage, ChatMessageAction, ChatWidgetRef } from '@fayz-ai/admin';
|
|
2
|
+
import { type RequestKind, type RequestScreen, type RequestState } from './in-chat-request-machine';
|
|
3
|
+
import type { ReportIntake } from './report-intake';
|
|
4
|
+
export declare const REQUEST_SUMMARY_WIDGET = "support.request-summary";
|
|
5
|
+
export declare const REQUEST_RESULT_WIDGET_TYPE = "support.request-result";
|
|
6
|
+
export interface RequestSurface {
|
|
7
|
+
assistantLine(content: string, options?: {
|
|
8
|
+
id?: string;
|
|
9
|
+
widget?: ChatWidgetRef;
|
|
10
|
+
actions?: ChatMessageAction[];
|
|
11
|
+
}): string;
|
|
12
|
+
userLine(text: string): void;
|
|
13
|
+
/** A line the person sent from the composer, with what it carried. */
|
|
14
|
+
upsert(message: ChatMessage): void;
|
|
15
|
+
patchMessage(id: string, patch: {
|
|
16
|
+
content?: string;
|
|
17
|
+
widget?: ChatWidgetRef;
|
|
18
|
+
}): void;
|
|
19
|
+
publishMode(mode: ChatComposerMode | null): void;
|
|
20
|
+
/** Text back in the field ("Ajustar"). */
|
|
21
|
+
setDraft(text: string): void;
|
|
22
|
+
/** A file into the composer's staged attachments (the print taken from a chip). */
|
|
23
|
+
stage(file: File): void;
|
|
24
|
+
/** Drop what is staged and not sent (Cancelar). */
|
|
25
|
+
clearStaged(): void;
|
|
26
|
+
focusComposer(): void;
|
|
27
|
+
showSuggestions(): void;
|
|
28
|
+
}
|
|
29
|
+
export interface CreateInput {
|
|
30
|
+
kind: RequestKind;
|
|
31
|
+
/** The model's summary and the answers, with the person's words verbatim — or their words, then the answers. */
|
|
32
|
+
description: string;
|
|
33
|
+
/** The model's title, when it read the request. */
|
|
34
|
+
subject: string | null;
|
|
35
|
+
details: Array<{
|
|
36
|
+
label: string;
|
|
37
|
+
value: string;
|
|
38
|
+
}>;
|
|
39
|
+
files: File[];
|
|
40
|
+
route: string | null;
|
|
41
|
+
}
|
|
42
|
+
export interface RequestFlowDeps {
|
|
43
|
+
surface: RequestSurface;
|
|
44
|
+
create: (input: CreateInput) => Promise<{
|
|
45
|
+
id: string;
|
|
46
|
+
number: number;
|
|
47
|
+
}>;
|
|
48
|
+
/** A print of the screen behind the assistant (null = cancelled / not possible). */
|
|
49
|
+
capture?: () => Promise<File | null>;
|
|
50
|
+
route?: () => string | null;
|
|
51
|
+
/** The model reads the description once. Absent (no agent in this app) = the fixed questions. */
|
|
52
|
+
intake?: ReportIntake;
|
|
53
|
+
/** The screen the person is on, named — so the request does not ask "nesta tela?". */
|
|
54
|
+
screen?: () => RequestScreen | null;
|
|
55
|
+
/** What the person did right before, for the model ("Conciliação → clicou "Sincronizar""). */
|
|
56
|
+
trail?: () => string | null;
|
|
57
|
+
/** Image previews in the summary (object URLs); a test passes a stub. */
|
|
58
|
+
previewOf?: (file: File) => string | null;
|
|
59
|
+
}
|
|
60
|
+
export declare class RequestFlow {
|
|
61
|
+
private state;
|
|
62
|
+
private files;
|
|
63
|
+
private previews;
|
|
64
|
+
private summaryId;
|
|
65
|
+
private flowId;
|
|
66
|
+
private readonly deps;
|
|
67
|
+
constructor(deps: RequestFlowDeps);
|
|
68
|
+
get snapshot(): RequestState;
|
|
69
|
+
get active(): boolean;
|
|
70
|
+
get id(): string;
|
|
71
|
+
/** A door ("Reportar um problema", …) or the model with the person's words already. */
|
|
72
|
+
start(kind: RequestKind, options?: {
|
|
73
|
+
echo?: string;
|
|
74
|
+
description?: string;
|
|
75
|
+
}): void;
|
|
76
|
+
/** What the composer sent while the mode lasts. */
|
|
77
|
+
send(text: string, files?: File[]): void;
|
|
78
|
+
choose(value: string): void;
|
|
79
|
+
/** From the summary card. Ignored for a card of an earlier request (or an earlier summary). */
|
|
80
|
+
act(flowId: string, action: 'send' | 'adjust'): void;
|
|
81
|
+
/** "Cancelar" in the composer — or quietly, when the person went to talk to the team. */
|
|
82
|
+
cancel(quiet?: boolean): void;
|
|
83
|
+
private preview;
|
|
84
|
+
private dispatch;
|
|
85
|
+
private apply;
|
|
86
|
+
private summaryProps;
|
|
87
|
+
private create;
|
|
88
|
+
private runIntake;
|
|
89
|
+
private captureToComposer;
|
|
90
|
+
private publish;
|
|
91
|
+
private cleanup;
|
|
92
|
+
private reset;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=in-chat-request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in-chat-request.d.ts","sourceRoot":"","sources":["../../src/livechat/in-chat-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AACrG,OAAO,EAEkC,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAC/F,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAanD,eAAO,MAAM,sBAAsB,4BAA4B,CAAA;AAC/D,eAAO,MAAM,0BAA0B,2BAA2B,CAAA;AAElE,MAAM,WAAW,cAAc;IAC7B,aAAa,CAAC,OAA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,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI;IAMpD,yFAAyF;IACzF,MAAM,CAAC,KAAK,UAAQ,GAAG,IAAI;IAQ3B,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,QAAQ;IAOhB,OAAO,CAAC,KAAK;IA8Cb,OAAO,CAAC,YAAY;YAYN,MAAM;YAuBN,SAAS;YAYT,iBAAiB;IAM/B,OAAO,CAAC,OAAO;IAiBf,OAAO,CAAC,OAAO;IAMf,OAAO,CAAC,KAAK;CAKd"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ChatWidgetProps } from '@fayz-ai/admin';
|
|
3
|
+
import type { SupportKind } from '../types';
|
|
4
|
+
/** What the cards need from the chat (in-chat-install builds it from the admin). */
|
|
5
|
+
export interface InChatCardHost {
|
|
6
|
+
patchMessage(id: string, patch: {
|
|
7
|
+
content?: string;
|
|
8
|
+
widget?: {
|
|
9
|
+
type: string;
|
|
10
|
+
props?: Record<string, unknown>;
|
|
11
|
+
};
|
|
12
|
+
}): void;
|
|
13
|
+
assistantLine(content: string, options?: {
|
|
14
|
+
widget?: {
|
|
15
|
+
type: string;
|
|
16
|
+
props?: Record<string, unknown>;
|
|
17
|
+
};
|
|
18
|
+
}): string;
|
|
19
|
+
resumeChat(id: string, number: number): void;
|
|
20
|
+
/** The suggestion chips come back once a card finished its job. */
|
|
21
|
+
showSuggestions(): void;
|
|
22
|
+
/** "Enviar" / "Ajustar" of a request's summary (in-chat-request). */
|
|
23
|
+
requestAction?(flowId: string, action: 'send' | 'adjust'): void;
|
|
24
|
+
}
|
|
25
|
+
export declare function setInChatCardHost(host: InChatCardHost | null): void;
|
|
26
|
+
export declare function RequestSummaryCard({ props }: ChatWidgetProps): React.JSX.Element | null;
|
|
27
|
+
export declare function RequestResultCard({ props }: ChatWidgetProps): React.JSX.Element;
|
|
28
|
+
/**
|
|
29
|
+
* "Minhas solicitações" lists requests — problems, improvements, other asks.
|
|
30
|
+
* A live chat is a conversation, not a request: it is not listed (an open one
|
|
31
|
+
* is reached from the header's support button, "Em atendimento · #N"). When a
|
|
32
|
+
* chat turns into a request the team opens a request of its own, which is.
|
|
33
|
+
*/
|
|
34
|
+
export declare function realRequests<T extends {
|
|
35
|
+
kind: SupportKind;
|
|
36
|
+
}>(rows: T[]): T[];
|
|
37
|
+
export declare function RequestsListCard({ props }: ChatWidgetProps): React.JSX.Element;
|
|
38
|
+
export declare function RequestThreadCard({ props }: ChatWidgetProps): React.JSX.Element;
|
|
39
|
+
//# sourceMappingURL=in-chat-widgets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in-chat-widgets.d.ts","sourceRoot":"","sources":["../../src/livechat/in-chat-widgets.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAGrD,OAAO,KAAK,EAAE,WAAW,EAAwC,MAAM,UAAU,CAAA;AAWjF,oFAAoF;AACpF,MAAM,WAAW,cAAc;IAC7B,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;SAAE,CAAA;KAAE,GAAG,IAAI,CAAA;IACvH,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;SAAE,CAAA;KAAE,GAAG,MAAM,CAAA;IAChH,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5C,mEAAmE;IACnE,eAAe,IAAI,IAAI,CAAA;IACvB,qEAAqE;IACrE,aAAa,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAA;CAChE;AAGD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,GAAG,IAAI,CAAoB;AAQxF,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,EAAE,eAAe,4BAwD5D;AAID,wBAAgB,iBAAiB,CAAC,EAAE,KAAK,EAAE,EAAE,eAAe,qBA2B3D;AAMD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAE5E;AAMD,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,EAAE,eAAe,qBA2C1D;AAID,wBAAgB,iBAAiB,CAAC,EAAE,KAAK,EAAE,EAAE,eAAe,qBA6E3D"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { ChatHandoffSession, ChatMessage, ChatMessageAction, ChatWidgetRef } from '@fayz-ai/admin';
|
|
2
|
+
import { type SupportDataProvider } from '../data/provider';
|
|
3
|
+
import { type TranscriptMessage } from './rules';
|
|
4
|
+
import { type InChatState } from './in-chat-machine';
|
|
5
|
+
export interface InChatSurface {
|
|
6
|
+
publish(session: ChatHandoffSession | null): void;
|
|
7
|
+
systemLine(text: string): void;
|
|
8
|
+
assistantLine(content: string, options?: {
|
|
9
|
+
id?: string;
|
|
10
|
+
widget?: ChatWidgetRef;
|
|
11
|
+
actions?: ChatMessageAction[];
|
|
12
|
+
}): string;
|
|
13
|
+
/** A line the person "said" by tapping a chip. */
|
|
14
|
+
userLine(text: string): void;
|
|
15
|
+
/** Mirror (or echo) one message by id. */
|
|
16
|
+
upsert(message: ChatMessage): void;
|
|
17
|
+
has(id: string): boolean;
|
|
18
|
+
focusComposer(): void;
|
|
19
|
+
openAssistant(): void;
|
|
20
|
+
/** The suggestion chips come back (the conversation with the team ended). */
|
|
21
|
+
showSuggestions(): void;
|
|
22
|
+
}
|
|
23
|
+
export interface InChatRealtime {
|
|
24
|
+
/** Every bell of a conversation (message / changed / typing). */
|
|
25
|
+
listen(conversationId: string, onEvent: (e: {
|
|
26
|
+
event: string;
|
|
27
|
+
payload: Record<string, unknown>;
|
|
28
|
+
}) => void): () => void;
|
|
29
|
+
/** Online agents of a central; called with null until the presence syncs. */
|
|
30
|
+
observeOnline(homeId: string, onCount: (n: number | null) => void): () => void;
|
|
31
|
+
}
|
|
32
|
+
export interface StartContext {
|
|
33
|
+
transcript: TranscriptMessage[];
|
|
34
|
+
conversationId: string | null;
|
|
35
|
+
route: string | null;
|
|
36
|
+
}
|
|
37
|
+
export interface InChatDeps {
|
|
38
|
+
surface: InChatSurface;
|
|
39
|
+
provider?: () => SupportDataProvider;
|
|
40
|
+
realtime?: InChatRealtime | null;
|
|
41
|
+
now?: () => number;
|
|
42
|
+
/** "Deixar recado para a equipe" (nobody online): the request told through the composer. */
|
|
43
|
+
leaveMessage?: (ctx: StartContext) => void;
|
|
44
|
+
/** Where the chats the person ended are remembered (so opening the assistant does not pull them back). */
|
|
45
|
+
storage?: Pick<Storage, 'getItem' | 'setItem'> | null;
|
|
46
|
+
}
|
|
47
|
+
/** The note the team reads when the person ends a chat this side cannot close on the server. */
|
|
48
|
+
export declare const LEFT_NOTE = "Encerrei a conversa por aqui (assistente). Se precisar de mais alguma coisa, abro outra.";
|
|
49
|
+
export declare function supportMessageId(providerId: string): string;
|
|
50
|
+
export declare class InChatController {
|
|
51
|
+
private state;
|
|
52
|
+
/** The chats this thread already announced ("Você está falando…" / "… retomada"): once each. */
|
|
53
|
+
private announced;
|
|
54
|
+
private readonly surface;
|
|
55
|
+
private readonly provider;
|
|
56
|
+
private readonly realtime;
|
|
57
|
+
/** provider message id → message id in the chat (an echo keeps its own id). */
|
|
58
|
+
private mirrored;
|
|
59
|
+
/** What the person typed and is still on its way (matched to the thread by body). */
|
|
60
|
+
private echoes;
|
|
61
|
+
private conversationId;
|
|
62
|
+
private timer;
|
|
63
|
+
private bellOff;
|
|
64
|
+
private typing;
|
|
65
|
+
private typingTimer;
|
|
66
|
+
private lastTypingSent;
|
|
67
|
+
private polling;
|
|
68
|
+
private resumeChecked;
|
|
69
|
+
private seq;
|
|
70
|
+
private readonly leaveMessage;
|
|
71
|
+
private readonly storage;
|
|
72
|
+
constructor(deps: InChatDeps);
|
|
73
|
+
/** Chats the person ended here that the server may still hold open (see LEFT_NOTE). */
|
|
74
|
+
endedByMe(): string[];
|
|
75
|
+
private markEnded;
|
|
76
|
+
get snapshot(): InChatState;
|
|
77
|
+
/** "Atendente" (header), "Falar com um atendente" (chip) or the model's startLiveChat. */
|
|
78
|
+
start(ctx: StartContext): Promise<{
|
|
79
|
+
ok: boolean;
|
|
80
|
+
number?: number;
|
|
81
|
+
reason?: string;
|
|
82
|
+
}>;
|
|
83
|
+
/** Back to a live chat that is still open ("Voltar à conversa #N", a reload, Minhas solicitações). */
|
|
84
|
+
resume(requestId: string, number: number, fromStart?: boolean): Promise<void>;
|
|
85
|
+
/** A person is (or is about to be) on the other side: the composer talks to them, not to the assistant. */
|
|
86
|
+
get live(): boolean;
|
|
87
|
+
/** The human mode is on the screen, even while it is still looking for someone. */
|
|
88
|
+
get busy(): boolean;
|
|
89
|
+
/** Called when the assistant opens: an open live chat takes the conversation over. */
|
|
90
|
+
checkResume(force?: boolean): Promise<void>;
|
|
91
|
+
/** "Encerrar": back to the assistant now; the server is told on the side. */
|
|
92
|
+
end(): Promise<void>;
|
|
93
|
+
/** The person ended it: close what this side can, never block the thread on it. */
|
|
94
|
+
private leave;
|
|
95
|
+
send(text: string, files?: File[]): Promise<void>;
|
|
96
|
+
/** The person is typing (platform only: the other side's "digitando…"). */
|
|
97
|
+
notifyTyping(): void;
|
|
98
|
+
/** Reads the chat now (the poll, a bell, after a send). */
|
|
99
|
+
poll(options?: {
|
|
100
|
+
baseline?: boolean;
|
|
101
|
+
}): Promise<void>;
|
|
102
|
+
/** Tears everything down (tests, a host disposing). */
|
|
103
|
+
dispose(): void;
|
|
104
|
+
private readOnce;
|
|
105
|
+
private mirror;
|
|
106
|
+
private dispatch;
|
|
107
|
+
private apply;
|
|
108
|
+
private rate;
|
|
109
|
+
private offline;
|
|
110
|
+
private countOnline;
|
|
111
|
+
private listen;
|
|
112
|
+
private startPolling;
|
|
113
|
+
private stopPolling;
|
|
114
|
+
private publish;
|
|
115
|
+
}
|
|
116
|
+
export declare const REQUEST_RESULT_WIDGET = "support.request-result";
|
|
117
|
+
export declare const REQUESTS_LIST_WIDGET = "support.requests-list";
|
|
118
|
+
export declare const REQUEST_THREAD_WIDGET = "support.request-thread";
|
|
119
|
+
//# sourceMappingURL=in-chat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in-chat.d.ts","sourceRoot":"","sources":["../../src/livechat/in-chat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AACvG,OAAO,EAAuC,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAIhG,OAAO,EAAkE,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAChH,OAAO,EACkG,KAAK,WAAW,EACxH,MAAM,mBAAmB,CAAA;AAa1B,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI,GAAG,IAAI,CAAA;IACjD,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,aAAa,CAAC;QAAC,OAAO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ChG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBjF,2GAA2G;IAC3G,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,mFAAmF;IACnF,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,sFAAsF;IAChF,WAAW,CAAC,KAAK,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAc/C,6EAA6E;IACvE,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1B,mFAAmF;YACrE,KAAK;IAeb,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,IAAI,EAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAuB3D,2EAA2E;IAC3E,YAAY,IAAI,IAAI;IAQpB,2DAA2D;IAC3D,IAAI,CAAC,OAAO,GAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAOzD,uDAAuD;IACvD,OAAO,IAAI,IAAI;YAUD,QAAQ;IAyBtB,OAAO,CAAC,MAAM;IA6Bd,OAAO,CAAC,QAAQ;IAOhB,OAAO,CAAC,KAAK;YAgCC,IAAI;IAqBlB,OAAO,CAAC,OAAO;YAmBD,WAAW;IAazB,OAAO,CAAC,MAAM;IAkBd,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,OAAO;CAuBhB;AAID,eAAO,MAAM,qBAAqB,2BAA2B,CAAA;AAC7D,eAAO,MAAM,oBAAoB,0BAA0B,CAAA;AAC3D,eAAO,MAAM,qBAAqB,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { RequestKind } from './in-chat-request-machine';
|
|
2
|
+
export interface IntakeScreen {
|
|
3
|
+
label: string | null;
|
|
4
|
+
route: string | null;
|
|
5
|
+
}
|
|
6
|
+
export interface IntakeInput {
|
|
7
|
+
kind: RequestKind;
|
|
8
|
+
/** The person's own words. */
|
|
9
|
+
description: string;
|
|
10
|
+
screen: IntakeScreen | null;
|
|
11
|
+
/** What they did right before, oldest first ("Conciliação (/x) → clicou "Sincronizar""). */
|
|
12
|
+
trail: string | null;
|
|
13
|
+
}
|
|
14
|
+
export interface IntakeQuestion {
|
|
15
|
+
ask: string;
|
|
16
|
+
/** The row's name in the summary ("Mensagem de erro"). */
|
|
17
|
+
label: string;
|
|
18
|
+
/** Quick replies; empty when the answer is free text. */
|
|
19
|
+
options: string[];
|
|
20
|
+
}
|
|
21
|
+
export interface IntakeResult {
|
|
22
|
+
onTopic: boolean;
|
|
23
|
+
/** Off topic: one kind line that brings the person back to the system. */
|
|
24
|
+
reply: string | null;
|
|
25
|
+
title: string;
|
|
26
|
+
summary: string;
|
|
27
|
+
question: IntakeQuestion | null;
|
|
28
|
+
}
|
|
29
|
+
export type ReportIntake = (input: IntakeInput) => Promise<IntakeResult | null>;
|
|
30
|
+
/** Structurally the admin's one-shot door (createOneShotAsk). */
|
|
31
|
+
export type IntakeAsk = (input: {
|
|
32
|
+
message: string;
|
|
33
|
+
signal?: AbortSignal;
|
|
34
|
+
}) => Promise<{
|
|
35
|
+
content: string;
|
|
36
|
+
}>;
|
|
37
|
+
export declare const INTAKE_TIMEOUT_MS = 8000;
|
|
38
|
+
export declare const OFF_TOPIC_REPLY = "Por aqui eu registro o que acontece no sistema para a equipe. O que aconteceu na tela que voc\u00EA quer reportar?";
|
|
39
|
+
export declare function buildIntakePrompt(input: IntakeInput): string;
|
|
40
|
+
/** The model's JSON, validated; `null` when it is not usable. */
|
|
41
|
+
export declare function parseIntake(content: string): IntakeResult | null;
|
|
42
|
+
export declare function createReportIntake(ask: IntakeAsk, options?: {
|
|
43
|
+
timeoutMs?: number;
|
|
44
|
+
}): ReportIntake;
|
|
45
|
+
//# sourceMappingURL=report-intake.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report-intake.d.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,GAAG,MAAM,CAqB5D;AAKD,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CA4BhE;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,YAAY,CAoBrG"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Never in the print: the assistant's column, its corner button, a host's panel. */
|
|
2
|
+
export declare const CAPTURE_HIDE_SELECTOR = "[data-assistant-rail], [data-chat-fab], [data-suportino-panel], [data-support-capture-exclude]";
|
|
3
|
+
/** Hides what must not be in the print; returns the restore. */
|
|
4
|
+
export declare function hideForCapture(doc?: Document): () => void;
|
|
5
|
+
/** The default "Tirar print da tela": this tab without the assistant, then the blur editor. */
|
|
6
|
+
export declare function defaultScreenCapture(): Promise<File | null>;
|
|
7
|
+
//# sourceMappingURL=screen-capture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screen-capture.d.ts","sourceRoot":"","sources":["../../src/livechat/screen-capture.tsx"],"names":[],"mappings":"AAgBA,qFAAqF;AACrF,eAAO,MAAM,qBAAqB,mGAAmG,CAAA;AAMrI,gEAAgE;AAChE,wBAAgB,cAAc,CAAC,GAAG,GAAE,QAAmB,GAAG,MAAM,IAAI,CASnE;AAmDD,+FAA+F;AAC/F,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAKjE"}
|