@bigbinary/neeto-assist-frontend 1.2.0 → 1.3.0-beta1
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/README.md +430 -21
- package/app/javascript/src/translations/ar.json +7 -1
- package/app/javascript/src/translations/bg.json +7 -1
- package/app/javascript/src/translations/ca.json +7 -1
- package/app/javascript/src/translations/cs.json +7 -1
- package/app/javascript/src/translations/da.json +7 -1
- package/app/javascript/src/translations/de.json +7 -1
- package/app/javascript/src/translations/en.json +39 -2
- package/app/javascript/src/translations/es-MX.json +7 -1
- package/app/javascript/src/translations/es.json +7 -1
- package/app/javascript/src/translations/et.json +7 -1
- package/app/javascript/src/translations/fi.json +7 -1
- package/app/javascript/src/translations/fil.json +7 -1
- package/app/javascript/src/translations/fr.json +7 -1
- package/app/javascript/src/translations/he.json +7 -1
- package/app/javascript/src/translations/hi.json +7 -1
- package/app/javascript/src/translations/hr.json +7 -1
- package/app/javascript/src/translations/hu.json +7 -1
- package/app/javascript/src/translations/id.json +7 -1
- package/app/javascript/src/translations/it.json +7 -1
- package/app/javascript/src/translations/ja.json +7 -1
- package/app/javascript/src/translations/ko.json +7 -1
- package/app/javascript/src/translations/lv.json +7 -1
- package/app/javascript/src/translations/nl.json +7 -1
- package/app/javascript/src/translations/pl.json +7 -1
- package/app/javascript/src/translations/pt-BR.json +7 -1
- package/app/javascript/src/translations/pt.json +7 -1
- package/app/javascript/src/translations/ro.json +7 -1
- package/app/javascript/src/translations/ru.json +7 -1
- package/app/javascript/src/translations/sk.json +7 -1
- package/app/javascript/src/translations/sl.json +7 -1
- package/app/javascript/src/translations/sv.json +7 -1
- package/app/javascript/src/translations/th.json +7 -1
- package/app/javascript/src/translations/tr.json +7 -1
- package/app/javascript/src/translations/uk.json +7 -1
- package/app/javascript/src/translations/vi.json +7 -1
- package/app/javascript/src/translations/zh-CN.json +7 -1
- package/app/javascript/src/translations/zh-TW.json +7 -1
- package/dist/.ready +1 -1
- package/dist/NeetoAssistButton.js +13 -6
- package/dist/NeetoAssistButton.js.map +1 -1
- package/dist/NeetoAssistPane.js +1469 -166
- package/dist/NeetoAssistPane.js.map +1 -1
- package/dist/cjs/NeetoAssistButton.js +16 -9
- package/dist/cjs/NeetoAssistButton.js.map +1 -1
- package/dist/cjs/NeetoAssistPane.js +1491 -188
- package/dist/cjs/NeetoAssistPane.js.map +1 -1
- package/dist/cjs/index.js +11 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/useNeetoAssistAssistant.js +43 -0
- package/dist/cjs/useNeetoAssistAssistant.js.map +1 -0
- package/dist/cjs/useNeetoAssistStatus.js +3 -1
- package/dist/cjs/useNeetoAssistStatus.js.map +1 -1
- package/dist/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/dist/neeto_assist-COp7BR77.js +249 -0
- package/dist/neeto_assist-COp7BR77.js.map +1 -0
- package/dist/neeto_assist-D1wzZ3ou.js +219 -0
- package/dist/neeto_assist-D1wzZ3ou.js.map +1 -0
- package/dist/useNeetoAssistAssistant.js +41 -0
- package/dist/useNeetoAssistAssistant.js.map +1 -0
- package/dist/useNeetoAssistStatus.js +3 -1
- package/dist/useNeetoAssistStatus.js.map +1 -1
- package/dist/useNeetoAssistStore-Bj6niQdc.js +103 -0
- package/dist/useNeetoAssistStore-Bj6niQdc.js.map +1 -0
- package/dist/useNeetoAssistStore-Dgt8aV52.js +101 -0
- package/dist/useNeetoAssistStore-Dgt8aV52.js.map +1 -0
- package/dist/{useNeetoAssistStore-InICsbe8.js → useRunsApi-BgsICthX.js} +228 -113
- package/dist/useRunsApi-BgsICthX.js.map +1 -0
- package/dist/{useNeetoAssistStore-VaZp3268.js → useRunsApi-Rh6xXOwm.js} +232 -112
- package/dist/useRunsApi-Rh6xXOwm.js.map +1 -0
- package/package.json +4 -4
- package/types.d.ts +81 -8
- package/dist/neeto_assist-CpUBA-3Z.js +0 -135
- package/dist/neeto_assist-CpUBA-3Z.js.map +0 -1
- package/dist/neeto_assist-CznTN_YY.js +0 -157
- package/dist/neeto_assist-CznTN_YY.js.map +0 -1
- package/dist/useNeetoAssistStore-InICsbe8.js.map +0 -1
- package/dist/useNeetoAssistStore-VaZp3268.js.map +0 -1
package/types.d.ts
CHANGED
|
@@ -87,11 +87,22 @@ export interface NeetoAssistButtonProps {
|
|
|
87
87
|
* send nothing: NeetoAssist never writes to the customer. Leave it out to
|
|
88
88
|
* show only "Copy".
|
|
89
89
|
*
|
|
90
|
+
* A reply that came in English and in the language the customer is sent it
|
|
91
|
+
* in has two buttons in place of "Use reply", such as "Use in Spanish" and
|
|
92
|
+
* "Use in English". Each calls this with the reading the rep picked, as
|
|
93
|
+
* `text` and as `html` made the same way, so a host has nothing more to do
|
|
94
|
+
* for it. The first hands over the run's `suggestedReplyInCustomerLanguage`,
|
|
95
|
+
* which is the reply as written unless that was English, and the second its
|
|
96
|
+
* `suggestedReplyInEnglish`.
|
|
97
|
+
*
|
|
90
98
|
* @param text The reply as NeetoAssist wrote it, in light markdown
|
|
91
|
-
* (paragraphs, `**bold**`, `1.` and `-` lists, `## ` headings).
|
|
99
|
+
* (paragraphs, `**bold**`, `1.` and `-` lists, `## ` headings). A fenced
|
|
100
|
+
* block of code is its lines: only the lines of three backticks around it
|
|
101
|
+
* are left out.
|
|
92
102
|
* @param html The same reply as HTML for a rich-text composer: escaped text
|
|
93
103
|
* inside only `p`, `br`, `strong`, `ol`, `ul`, `li` and `h2`, with no
|
|
94
|
-
* attributes, so no markup from the conversation survives as HTML.
|
|
104
|
+
* attributes, so no markup from the conversation survives as HTML. A fenced
|
|
105
|
+
* block of code is a paragraph of its lines.
|
|
95
106
|
*/
|
|
96
107
|
onUseReply?: (text: string, html: string) => void;
|
|
97
108
|
}
|
|
@@ -109,10 +120,25 @@ export const NeetoAssistButton: React.FC<NeetoAssistButtonProps>;
|
|
|
109
120
|
* NeetoAssist's chat window. Mount it once in the host's layout, as the last
|
|
110
121
|
* child of the flex row that holds the page, so it opens on the right and
|
|
111
122
|
* pushes the page to the left. It takes no props and no room until a
|
|
112
|
-
* `NeetoAssistButton` opens it
|
|
123
|
+
* `NeetoAssistButton` opens it, or `useNeetoAssistAssistant` opens the
|
|
124
|
+
* person's own assistant. Whichever was opened last is what it shows, and a
|
|
125
|
+
* host that never opens the assistant gets exactly the conversation pane. It shows what NeetoAssist did on the ticket,
|
|
113
126
|
* oldest first: the replies it suggested, and for each of the rep's own
|
|
114
|
-
* questions what it looked up, its answer
|
|
115
|
-
* suggests, with "Apply" and "Dismiss".
|
|
127
|
+
* questions what it looked up, its answer with its sources and "Copy answer",
|
|
128
|
+
* and a card for every action it suggests, with "Apply" and "Dismiss". While
|
|
129
|
+
* the rep's own question is being answered, the send button stops it, when
|
|
130
|
+
* the engine's list of runs says it can (`can_stop`). Another rep's questions
|
|
131
|
+
* are not shown.
|
|
132
|
+
* A suggested reply that came in English and in the language the customer is
|
|
133
|
+
* sent it in shows in English, with a link that turns it to the other reading
|
|
134
|
+
* and back. That is a run with `suggestedReplyLanguage`, the tag of that
|
|
135
|
+
* language, and the reply both ways (`suggestedReplyInEnglish` and
|
|
136
|
+
* `suggestedReplyInCustomerLanguage`). What the customer wrote shows in
|
|
137
|
+
* English the same way when the run has `questionInEnglish`, named by
|
|
138
|
+
* `customerLanguage`, the language the customer writes in, which can be
|
|
139
|
+
* missing or another than the reply's. A reading in a language written from
|
|
140
|
+
* right to left is set that way when it holds a letter of such a script. A
|
|
141
|
+
* run without the readings looks as it always did.
|
|
116
142
|
* It polls every 2 seconds while a run is pending and every 30 seconds
|
|
117
143
|
* otherwise. While open it sets `data-neeto-assist-open` on the document's
|
|
118
144
|
* root element, to `default` or `expanded`, for a host that needs CSS to make
|
|
@@ -120,10 +146,57 @@ export const NeetoAssistButton: React.FC<NeetoAssistButtonProps>;
|
|
|
120
146
|
*/
|
|
121
147
|
export const NeetoAssistPane: React.FC;
|
|
122
148
|
|
|
149
|
+
export interface NeetoAssistStatus {
|
|
150
|
+
/** NeetoAssist is on for the workspace. */
|
|
151
|
+
enabled: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* NeetoAssist is on, and this person may open it as their own assistant
|
|
154
|
+
* (the host adapter's `assistant?`). An older engine sends none.
|
|
155
|
+
*/
|
|
156
|
+
assistant?: boolean;
|
|
157
|
+
}
|
|
158
|
+
|
|
123
159
|
/**
|
|
124
160
|
* Whether NeetoAssist is on for the signed-in rep's workspace: the React Query
|
|
125
161
|
* result of `GET /neeto_assist/api/v1/status`, which answers
|
|
126
|
-
* `{ enabled: true | false }`. Read `data?.enabled`:
|
|
127
|
-
* and after a failure, and a failure never shows the
|
|
162
|
+
* `{ enabled: true | false, assistant: true | false }`. Read `data?.enabled`:
|
|
163
|
+
* it is empty while loading and after a failure, and a failure never shows the
|
|
164
|
+
* rep a toast.
|
|
165
|
+
*/
|
|
166
|
+
export function useNeetoAssistStatus(): UseQueryResult<NeetoAssistStatus>;
|
|
167
|
+
|
|
168
|
+
export interface NeetoAssistAssistant {
|
|
169
|
+
/**
|
|
170
|
+
* The person may use the assistant: `assistant` from the status endpoint.
|
|
171
|
+
* False while the status loads and after it failed. Show the host's entry
|
|
172
|
+
* to the assistant only when this is true.
|
|
173
|
+
*/
|
|
174
|
+
isAvailable: boolean;
|
|
175
|
+
/** The pane is open and shows the assistant, not a conversation. */
|
|
176
|
+
isOpen: boolean;
|
|
177
|
+
/** Opens the pane on the assistant, in place of any conversation. */
|
|
178
|
+
open: () => void;
|
|
179
|
+
/** Closes the pane if it shows the assistant. A conversation stays open. */
|
|
180
|
+
close: () => void;
|
|
181
|
+
/** `close` when the assistant is shown, `open` otherwise. */
|
|
182
|
+
toggle: () => void;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* The signed-in person's own assistant, for a host's own way in, such as a
|
|
187
|
+
* sidebar item or a menu entry. It opens in the `NeetoAssistPane` the host
|
|
188
|
+
* mounted once in its layout: a header with New chat, expand and close; on an
|
|
189
|
+
* empty thread the questions the host adapter's `assistant_suggestions`
|
|
190
|
+
* offers, each asked with one click; then each question with what NeetoAssist
|
|
191
|
+
* looked up, its answer, its sources and thumbs, and no cards. The thread is
|
|
192
|
+
* the one `GET /neeto_assist/api/v1/assistant/thread` names, asked for once
|
|
193
|
+
* per page load, or again on the next opening when that failed, and New chat
|
|
194
|
+
* starts an empty one. While the assistant is closed it asks for nothing.
|
|
195
|
+
* Every question carries the page it was asked on
|
|
196
|
+
* (`location.pathname` and `document.title`), without a query string or
|
|
197
|
+
* fragment. The engine strips both before the host's `assistant_context`
|
|
198
|
+
* reads the page and before it goes to NeetoAssist.
|
|
199
|
+
* It needs the host's React Query client and axios set up by
|
|
200
|
+
* neeto-commons-frontend, as the rest of the package does.
|
|
128
201
|
*/
|
|
129
|
-
export function
|
|
202
|
+
export function useNeetoAssistAssistant(): NeetoAssistAssistant;
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
|
|
3
|
-
var BASE_URL = "/neeto_assist/api/v1";
|
|
4
|
-
|
|
5
|
-
// The pane shows NeetoAssist's errors itself. Without these, the host's axios
|
|
6
|
-
// setup would raise a toast, or swap the page for an error page on a 403, 404
|
|
7
|
-
// or 429.
|
|
8
|
-
var REQUEST_OPTIONS = {
|
|
9
|
-
showToastr: false,
|
|
10
|
-
show403ErrorPage: false,
|
|
11
|
-
show404ErrorPage: false,
|
|
12
|
-
show429ErrorPage: false
|
|
13
|
-
};
|
|
14
|
-
var QUERY_KEYS = {
|
|
15
|
-
STATUS: "neeto-assist-status",
|
|
16
|
-
RUNS: "neeto-assist-runs"
|
|
17
|
-
};
|
|
18
|
-
var PENDING_POLL_INTERVAL = 2000;
|
|
19
|
-
var IDLE_POLL_INTERVAL = 30000;
|
|
20
|
-
var PENDING_STATUSES = ["queued", "running"];
|
|
21
|
-
var RATEABLE_STATUSES = ["completed", "skipped"];
|
|
22
|
-
|
|
23
|
-
// What became of a suggested action. NeetoAssist has the last word on an
|
|
24
|
-
// action in one of these: nothing a click says can be newer.
|
|
25
|
-
var SETTLED_ACTION_STATUSES = ["applied", "failed", "dismissed", "expired"];
|
|
26
|
-
|
|
27
|
-
// A suggestion nobody took up steps back to one muted line.
|
|
28
|
-
var QUIET_ACTION_STATUS_KEYS = {
|
|
29
|
-
dismissed: "neetoAssist.actions.dismissed",
|
|
30
|
-
expired: "neetoAssist.actions.expired"
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// The skips from the workspace's quiet rules, in NeetoAssist's settings. Each
|
|
34
|
-
// one holds for every visitor message until something changes, such as the
|
|
35
|
-
// agent who owns the conversation handing it back.
|
|
36
|
-
var QUIET_SKIPPED_REASONS = ["assigned_to_human", "handed_off", "no_answer_cooldown"];
|
|
37
|
-
|
|
38
|
-
// These skips come from the workspace's state, not from reading the
|
|
39
|
-
// conversation, so there is nothing for a rep to judge.
|
|
40
|
-
var UNRATEABLE_SKIPPED_REASONS = ["disabled", "no_knowledge_source", "out_of_credits"].concat(QUIET_SKIPPED_REASONS);
|
|
41
|
-
var MAX_QUESTION_LENGTH = 2000;
|
|
42
|
-
var MAX_NOTE_LENGTH = 2000;
|
|
43
|
-
|
|
44
|
-
// The same widths as Neeti's pane in NeetoCal, so Neeto's assistants feel alike.
|
|
45
|
-
var COLLAPSED_PANE_WIDTH = "min(100vw, 400px)";
|
|
46
|
-
var EXPANDED_PANE_WIDTH = "min(50vw, 800px)";
|
|
47
|
-
var EXPANDED_STORAGE_KEY = "neetoAssist.isExpanded";
|
|
48
|
-
var REPLY_SUGGESTION = "reply_suggestion";
|
|
49
|
-
var RUN_TEST_ID = "neeto-assist-run";
|
|
50
|
-
var SUGGESTION_KEYS = ["neetoAssist.suggestions.summarize", "neetoAssist.suggestions.whatToReply", "neetoAssist.suggestions.writtenBefore", "neetoAssist.suggestions.whatNext"];
|
|
51
|
-
var SKIPPED_REASON_MESSAGE_KEYS = {
|
|
52
|
-
greeting: "neetoAssist.skippedReasons.greeting",
|
|
53
|
-
acknowledgment: "neetoAssist.skippedReasons.acknowledgment",
|
|
54
|
-
agent_handoff: "neetoAssist.skippedReasons.agentHandoff",
|
|
55
|
-
unclear: "neetoAssist.skippedReasons.unclear",
|
|
56
|
-
other_product: "neetoAssist.skippedReasons.otherProduct",
|
|
57
|
-
no_knowledge_source: "neetoAssist.skippedReasons.noKnowledgeSource",
|
|
58
|
-
disabled: "neetoAssist.skippedReasons.disabled",
|
|
59
|
-
no_question: "neetoAssist.skippedReasons.noQuestion",
|
|
60
|
-
out_of_credits: "neetoAssist.skippedReasons.outOfCredits",
|
|
61
|
-
assigned_to_human: "neetoAssist.skippedReasons.assignedToHuman",
|
|
62
|
-
handed_off: "neetoAssist.skippedReasons.handedOff",
|
|
63
|
-
no_answer_cooldown: "neetoAssist.skippedReasons.noAnswerCooldown"
|
|
64
|
-
};
|
|
65
|
-
var ERROR_MESSAGE_KEYS = {
|
|
66
|
-
404: "neetoAssist.errors.notFound",
|
|
67
|
-
409: "neetoAssist.errors.disabled",
|
|
68
|
-
422: "neetoAssist.errors.invalid",
|
|
69
|
-
503: "neetoAssist.errors.unavailable"
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
// A click on a card that changed nothing. The other answers fall back to the
|
|
73
|
-
// keys above.
|
|
74
|
-
var ACTION_ERROR_MESSAGE_KEYS = {
|
|
75
|
-
403: "neetoAssist.actions.errors.forbidden",
|
|
76
|
-
503: "neetoAssist.actions.errors.unavailable"
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
var runsUrl = function runsUrl(conversationId) {
|
|
80
|
-
return "".concat(BASE_URL, "/conversations/").concat(encodeURIComponent(conversationId), "/runs");
|
|
81
|
-
};
|
|
82
|
-
var actionUrl = function actionUrl(_ref) {
|
|
83
|
-
var conversationId = _ref.conversationId,
|
|
84
|
-
actionId = _ref.actionId;
|
|
85
|
-
return "".concat(BASE_URL, "/conversations/").concat(encodeURIComponent(conversationId), "/actions/").concat(encodeURIComponent(actionId));
|
|
86
|
-
};
|
|
87
|
-
var fetchStatus = function fetchStatus() {
|
|
88
|
-
return axios.get("".concat(BASE_URL, "/status"), REQUEST_OPTIONS);
|
|
89
|
-
};
|
|
90
|
-
var fetchRuns = function fetchRuns(conversationId) {
|
|
91
|
-
return axios.get(runsUrl(conversationId), REQUEST_OPTIONS);
|
|
92
|
-
};
|
|
93
|
-
var createRun = function createRun(_ref2) {
|
|
94
|
-
var conversationId = _ref2.conversationId,
|
|
95
|
-
question = _ref2.question,
|
|
96
|
-
requestId = _ref2.requestId;
|
|
97
|
-
return axios.post(runsUrl(conversationId), {
|
|
98
|
-
run: {
|
|
99
|
-
question: question,
|
|
100
|
-
request_id: requestId
|
|
101
|
-
}
|
|
102
|
-
}, REQUEST_OPTIONS);
|
|
103
|
-
};
|
|
104
|
-
var updateFeedback = function updateFeedback(_ref3) {
|
|
105
|
-
var conversationId = _ref3.conversationId,
|
|
106
|
-
runId = _ref3.runId,
|
|
107
|
-
rating = _ref3.rating,
|
|
108
|
-
note = _ref3.note;
|
|
109
|
-
return axios.put("".concat(runsUrl(conversationId), "/").concat(encodeURIComponent(runId), "/feedback"), {
|
|
110
|
-
feedback: {
|
|
111
|
-
rating: rating,
|
|
112
|
-
note: note
|
|
113
|
-
}
|
|
114
|
-
}, REQUEST_OPTIONS);
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
// The host makes the change as the signed-in rep, so the request says only
|
|
118
|
-
// which action. Nothing about the change itself comes from the browser.
|
|
119
|
-
var applyAction = function applyAction(action) {
|
|
120
|
-
return axios.post("".concat(actionUrl(action), "/apply"), {}, REQUEST_OPTIONS);
|
|
121
|
-
};
|
|
122
|
-
var dismissAction = function dismissAction(action) {
|
|
123
|
-
return axios.post("".concat(actionUrl(action), "/dismiss"), {}, REQUEST_OPTIONS);
|
|
124
|
-
};
|
|
125
|
-
var neetoAssistApi = {
|
|
126
|
-
fetchStatus: fetchStatus,
|
|
127
|
-
fetchRuns: fetchRuns,
|
|
128
|
-
createRun: createRun,
|
|
129
|
-
updateFeedback: updateFeedback,
|
|
130
|
-
applyAction: applyAction,
|
|
131
|
-
dismissAction: dismissAction
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
export { ACTION_ERROR_MESSAGE_KEYS as A, COLLAPSED_PANE_WIDTH as C, ERROR_MESSAGE_KEYS as E, IDLE_POLL_INTERVAL as I, MAX_QUESTION_LENGTH as M, PENDING_STATUSES as P, QUERY_KEYS as Q, RATEABLE_STATUSES as R, SKIPPED_REASON_MESSAGE_KEYS as S, UNRATEABLE_SKIPPED_REASONS as U, REPLY_SUGGESTION as a, QUIET_SKIPPED_REASONS as b, PENDING_POLL_INTERVAL as c, EXPANDED_STORAGE_KEY as d, SUGGESTION_KEYS as e, SETTLED_ACTION_STATUSES as f, QUIET_ACTION_STATUS_KEYS as g, MAX_NOTE_LENGTH as h, RUN_TEST_ID as i, EXPANDED_PANE_WIDTH as j, neetoAssistApi as n };
|
|
135
|
-
//# sourceMappingURL=neeto_assist-CpUBA-3Z.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"neeto_assist-CpUBA-3Z.js","sources":["../app/javascript/src/common/constants.js","../app/javascript/src/apis/neeto_assist.js"],"sourcesContent":["export const BASE_URL = \"/neeto_assist/api/v1\";\n\n// The pane shows NeetoAssist's errors itself. Without these, the host's axios\n// setup would raise a toast, or swap the page for an error page on a 403, 404\n// or 429.\nexport const REQUEST_OPTIONS = {\n showToastr: false,\n show403ErrorPage: false,\n show404ErrorPage: false,\n show429ErrorPage: false,\n};\n\nexport const QUERY_KEYS = {\n STATUS: \"neeto-assist-status\",\n RUNS: \"neeto-assist-runs\",\n};\n\nexport const PENDING_POLL_INTERVAL = 2_000;\n\nexport const IDLE_POLL_INTERVAL = 30_000;\n\nexport const PENDING_STATUSES = [\"queued\", \"running\"];\n\nexport const RATEABLE_STATUSES = [\"completed\", \"skipped\"];\n\n// What became of a suggested action. NeetoAssist has the last word on an\n// action in one of these: nothing a click says can be newer.\nexport const SETTLED_ACTION_STATUSES = [\n \"applied\",\n \"failed\",\n \"dismissed\",\n \"expired\",\n];\n\n// A suggestion nobody took up steps back to one muted line.\nexport const QUIET_ACTION_STATUS_KEYS = {\n dismissed: \"neetoAssist.actions.dismissed\",\n expired: \"neetoAssist.actions.expired\",\n};\n\n// The skips from the workspace's quiet rules, in NeetoAssist's settings. Each\n// one holds for every visitor message until something changes, such as the\n// agent who owns the conversation handing it back.\nexport const QUIET_SKIPPED_REASONS = [\n \"assigned_to_human\",\n \"handed_off\",\n \"no_answer_cooldown\",\n];\n\n// These skips come from the workspace's state, not from reading the\n// conversation, so there is nothing for a rep to judge.\nexport const UNRATEABLE_SKIPPED_REASONS = [\n \"disabled\",\n \"no_knowledge_source\",\n \"out_of_credits\",\n ...QUIET_SKIPPED_REASONS,\n];\n\nexport const MAX_QUESTION_LENGTH = 2_000;\n\nexport const MAX_NOTE_LENGTH = 2_000;\n\n// The same widths as Neeti's pane in NeetoCal, so Neeto's assistants feel alike.\nexport const COLLAPSED_PANE_WIDTH = \"min(100vw, 400px)\";\n\nexport const EXPANDED_PANE_WIDTH = \"min(50vw, 800px)\";\n\nexport const EXPANDED_STORAGE_KEY = \"neetoAssist.isExpanded\";\n\nexport const REPLY_SUGGESTION = \"reply_suggestion\";\n\nexport const RUN_TEST_ID = \"neeto-assist-run\";\n\nexport const SUGGESTION_KEYS = [\n \"neetoAssist.suggestions.summarize\",\n \"neetoAssist.suggestions.whatToReply\",\n \"neetoAssist.suggestions.writtenBefore\",\n \"neetoAssist.suggestions.whatNext\",\n];\n\nexport const SKIPPED_REASON_MESSAGE_KEYS = {\n greeting: \"neetoAssist.skippedReasons.greeting\",\n acknowledgment: \"neetoAssist.skippedReasons.acknowledgment\",\n agent_handoff: \"neetoAssist.skippedReasons.agentHandoff\",\n unclear: \"neetoAssist.skippedReasons.unclear\",\n other_product: \"neetoAssist.skippedReasons.otherProduct\",\n no_knowledge_source: \"neetoAssist.skippedReasons.noKnowledgeSource\",\n disabled: \"neetoAssist.skippedReasons.disabled\",\n no_question: \"neetoAssist.skippedReasons.noQuestion\",\n out_of_credits: \"neetoAssist.skippedReasons.outOfCredits\",\n assigned_to_human: \"neetoAssist.skippedReasons.assignedToHuman\",\n handed_off: \"neetoAssist.skippedReasons.handedOff\",\n no_answer_cooldown: \"neetoAssist.skippedReasons.noAnswerCooldown\",\n};\n\nexport const ERROR_MESSAGE_KEYS = {\n 404: \"neetoAssist.errors.notFound\",\n 409: \"neetoAssist.errors.disabled\",\n 422: \"neetoAssist.errors.invalid\",\n 503: \"neetoAssist.errors.unavailable\",\n};\n\n// A click on a card that changed nothing. The other answers fall back to the\n// keys above.\nexport const ACTION_ERROR_MESSAGE_KEYS = {\n 403: \"neetoAssist.actions.errors.forbidden\",\n 503: \"neetoAssist.actions.errors.unavailable\",\n};\n","import axios from \"axios\";\n\nimport { BASE_URL, REQUEST_OPTIONS } from \"common/constants\";\n\nconst runsUrl = conversationId =>\n `${BASE_URL}/conversations/${encodeURIComponent(conversationId)}/runs`;\n\nconst actionUrl = ({ conversationId, actionId }) =>\n `${BASE_URL}/conversations/${encodeURIComponent(\n conversationId\n )}/actions/${encodeURIComponent(actionId)}`;\n\nconst fetchStatus = () => axios.get(`${BASE_URL}/status`, REQUEST_OPTIONS);\n\nconst fetchRuns = conversationId =>\n axios.get(runsUrl(conversationId), REQUEST_OPTIONS);\n\nconst createRun = ({ conversationId, question, requestId }) =>\n axios.post(\n runsUrl(conversationId),\n { run: { question, request_id: requestId } },\n REQUEST_OPTIONS\n );\n\nconst updateFeedback = ({ conversationId, runId, rating, note }) =>\n axios.put(\n `${runsUrl(conversationId)}/${encodeURIComponent(runId)}/feedback`,\n { feedback: { rating, note } },\n REQUEST_OPTIONS\n );\n\n// The host makes the change as the signed-in rep, so the request says only\n// which action. Nothing about the change itself comes from the browser.\nconst applyAction = action =>\n axios.post(`${actionUrl(action)}/apply`, {}, REQUEST_OPTIONS);\n\nconst dismissAction = action =>\n axios.post(`${actionUrl(action)}/dismiss`, {}, REQUEST_OPTIONS);\n\nconst neetoAssistApi = {\n fetchStatus,\n fetchRuns,\n createRun,\n updateFeedback,\n applyAction,\n dismissAction,\n};\n\nexport default neetoAssistApi;\n"],"names":["BASE_URL","REQUEST_OPTIONS","showToastr","show403ErrorPage","show404ErrorPage","show429ErrorPage","QUERY_KEYS","STATUS","RUNS","PENDING_POLL_INTERVAL","IDLE_POLL_INTERVAL","PENDING_STATUSES","RATEABLE_STATUSES","SETTLED_ACTION_STATUSES","QUIET_ACTION_STATUS_KEYS","dismissed","expired","QUIET_SKIPPED_REASONS","UNRATEABLE_SKIPPED_REASONS","concat","MAX_QUESTION_LENGTH","MAX_NOTE_LENGTH","COLLAPSED_PANE_WIDTH","EXPANDED_PANE_WIDTH","EXPANDED_STORAGE_KEY","REPLY_SUGGESTION","RUN_TEST_ID","SUGGESTION_KEYS","SKIPPED_REASON_MESSAGE_KEYS","greeting","acknowledgment","agent_handoff","unclear","other_product","no_knowledge_source","disabled","no_question","out_of_credits","assigned_to_human","handed_off","no_answer_cooldown","ERROR_MESSAGE_KEYS","ACTION_ERROR_MESSAGE_KEYS","runsUrl","conversationId","encodeURIComponent","actionUrl","_ref","actionId","fetchStatus","axios","get","fetchRuns","createRun","_ref2","question","requestId","post","run","request_id","updateFeedback","_ref3","runId","rating","note","put","feedback","applyAction","action","dismissAction","neetoAssistApi"],"mappings":";;AAAO,IAAMA,QAAQ,GAAG,sBAAsB;;AAE9C;AACA;AACA;AACO,IAAMC,eAAe,GAAG;AAC7BC,EAAAA,UAAU,EAAE,KAAK;AACjBC,EAAAA,gBAAgB,EAAE,KAAK;AACvBC,EAAAA,gBAAgB,EAAE,KAAK;AACvBC,EAAAA,gBAAgB,EAAE;AACpB,CAAC;AAEM,IAAMC,UAAU,GAAG;AACxBC,EAAAA,MAAM,EAAE,qBAAqB;AAC7BC,EAAAA,IAAI,EAAE;AACR;AAEO,IAAMC,qBAAqB,GAAG;AAE9B,IAAMC,kBAAkB,GAAG;IAErBC,gBAAgB,GAAG,C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eAAe,CAAC;AAAA,CAAA;AAEjE,IAAMqE,cAAc,GAAG;AACrBrB,EAAAA,WAAW,EAAXA,WAAW;AACXG,EAAAA,SAAS,EAATA,SAAS;AACTC,EAAAA,SAAS,EAATA,SAAS;AACTO,EAAAA,cAAc,EAAdA,cAAc;AACdO,EAAAA,WAAW,EAAXA,WAAW;AACXE,EAAAA,aAAa,EAAbA;AACF;;;;"}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var axios = require('axios');
|
|
4
|
-
|
|
5
|
-
var BASE_URL = "/neeto_assist/api/v1";
|
|
6
|
-
|
|
7
|
-
// The pane shows NeetoAssist's errors itself. Without these, the host's axios
|
|
8
|
-
// setup would raise a toast, or swap the page for an error page on a 403, 404
|
|
9
|
-
// or 429.
|
|
10
|
-
var REQUEST_OPTIONS = {
|
|
11
|
-
showToastr: false,
|
|
12
|
-
show403ErrorPage: false,
|
|
13
|
-
show404ErrorPage: false,
|
|
14
|
-
show429ErrorPage: false
|
|
15
|
-
};
|
|
16
|
-
var QUERY_KEYS = {
|
|
17
|
-
STATUS: "neeto-assist-status",
|
|
18
|
-
RUNS: "neeto-assist-runs"
|
|
19
|
-
};
|
|
20
|
-
var PENDING_POLL_INTERVAL = 2000;
|
|
21
|
-
var IDLE_POLL_INTERVAL = 30000;
|
|
22
|
-
var PENDING_STATUSES = ["queued", "running"];
|
|
23
|
-
var RATEABLE_STATUSES = ["completed", "skipped"];
|
|
24
|
-
|
|
25
|
-
// What became of a suggested action. NeetoAssist has the last word on an
|
|
26
|
-
// action in one of these: nothing a click says can be newer.
|
|
27
|
-
var SETTLED_ACTION_STATUSES = ["applied", "failed", "dismissed", "expired"];
|
|
28
|
-
|
|
29
|
-
// A suggestion nobody took up steps back to one muted line.
|
|
30
|
-
var QUIET_ACTION_STATUS_KEYS = {
|
|
31
|
-
dismissed: "neetoAssist.actions.dismissed",
|
|
32
|
-
expired: "neetoAssist.actions.expired"
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
// The skips from the workspace's quiet rules, in NeetoAssist's settings. Each
|
|
36
|
-
// one holds for every visitor message until something changes, such as the
|
|
37
|
-
// agent who owns the conversation handing it back.
|
|
38
|
-
var QUIET_SKIPPED_REASONS = ["assigned_to_human", "handed_off", "no_answer_cooldown"];
|
|
39
|
-
|
|
40
|
-
// These skips come from the workspace's state, not from reading the
|
|
41
|
-
// conversation, so there is nothing for a rep to judge.
|
|
42
|
-
var UNRATEABLE_SKIPPED_REASONS = ["disabled", "no_knowledge_source", "out_of_credits"].concat(QUIET_SKIPPED_REASONS);
|
|
43
|
-
var MAX_QUESTION_LENGTH = 2000;
|
|
44
|
-
var MAX_NOTE_LENGTH = 2000;
|
|
45
|
-
|
|
46
|
-
// The same widths as Neeti's pane in NeetoCal, so Neeto's assistants feel alike.
|
|
47
|
-
var COLLAPSED_PANE_WIDTH = "min(100vw, 400px)";
|
|
48
|
-
var EXPANDED_PANE_WIDTH = "min(50vw, 800px)";
|
|
49
|
-
var EXPANDED_STORAGE_KEY = "neetoAssist.isExpanded";
|
|
50
|
-
var REPLY_SUGGESTION = "reply_suggestion";
|
|
51
|
-
var RUN_TEST_ID = "neeto-assist-run";
|
|
52
|
-
var SUGGESTION_KEYS = ["neetoAssist.suggestions.summarize", "neetoAssist.suggestions.whatToReply", "neetoAssist.suggestions.writtenBefore", "neetoAssist.suggestions.whatNext"];
|
|
53
|
-
var SKIPPED_REASON_MESSAGE_KEYS = {
|
|
54
|
-
greeting: "neetoAssist.skippedReasons.greeting",
|
|
55
|
-
acknowledgment: "neetoAssist.skippedReasons.acknowledgment",
|
|
56
|
-
agent_handoff: "neetoAssist.skippedReasons.agentHandoff",
|
|
57
|
-
unclear: "neetoAssist.skippedReasons.unclear",
|
|
58
|
-
other_product: "neetoAssist.skippedReasons.otherProduct",
|
|
59
|
-
no_knowledge_source: "neetoAssist.skippedReasons.noKnowledgeSource",
|
|
60
|
-
disabled: "neetoAssist.skippedReasons.disabled",
|
|
61
|
-
no_question: "neetoAssist.skippedReasons.noQuestion",
|
|
62
|
-
out_of_credits: "neetoAssist.skippedReasons.outOfCredits",
|
|
63
|
-
assigned_to_human: "neetoAssist.skippedReasons.assignedToHuman",
|
|
64
|
-
handed_off: "neetoAssist.skippedReasons.handedOff",
|
|
65
|
-
no_answer_cooldown: "neetoAssist.skippedReasons.noAnswerCooldown"
|
|
66
|
-
};
|
|
67
|
-
var ERROR_MESSAGE_KEYS = {
|
|
68
|
-
404: "neetoAssist.errors.notFound",
|
|
69
|
-
409: "neetoAssist.errors.disabled",
|
|
70
|
-
422: "neetoAssist.errors.invalid",
|
|
71
|
-
503: "neetoAssist.errors.unavailable"
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
// A click on a card that changed nothing. The other answers fall back to the
|
|
75
|
-
// keys above.
|
|
76
|
-
var ACTION_ERROR_MESSAGE_KEYS = {
|
|
77
|
-
403: "neetoAssist.actions.errors.forbidden",
|
|
78
|
-
503: "neetoAssist.actions.errors.unavailable"
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
var runsUrl = function runsUrl(conversationId) {
|
|
82
|
-
return "".concat(BASE_URL, "/conversations/").concat(encodeURIComponent(conversationId), "/runs");
|
|
83
|
-
};
|
|
84
|
-
var actionUrl = function actionUrl(_ref) {
|
|
85
|
-
var conversationId = _ref.conversationId,
|
|
86
|
-
actionId = _ref.actionId;
|
|
87
|
-
return "".concat(BASE_URL, "/conversations/").concat(encodeURIComponent(conversationId), "/actions/").concat(encodeURIComponent(actionId));
|
|
88
|
-
};
|
|
89
|
-
var fetchStatus = function fetchStatus() {
|
|
90
|
-
return axios.get("".concat(BASE_URL, "/status"), REQUEST_OPTIONS);
|
|
91
|
-
};
|
|
92
|
-
var fetchRuns = function fetchRuns(conversationId) {
|
|
93
|
-
return axios.get(runsUrl(conversationId), REQUEST_OPTIONS);
|
|
94
|
-
};
|
|
95
|
-
var createRun = function createRun(_ref2) {
|
|
96
|
-
var conversationId = _ref2.conversationId,
|
|
97
|
-
question = _ref2.question,
|
|
98
|
-
requestId = _ref2.requestId;
|
|
99
|
-
return axios.post(runsUrl(conversationId), {
|
|
100
|
-
run: {
|
|
101
|
-
question: question,
|
|
102
|
-
request_id: requestId
|
|
103
|
-
}
|
|
104
|
-
}, REQUEST_OPTIONS);
|
|
105
|
-
};
|
|
106
|
-
var updateFeedback = function updateFeedback(_ref3) {
|
|
107
|
-
var conversationId = _ref3.conversationId,
|
|
108
|
-
runId = _ref3.runId,
|
|
109
|
-
rating = _ref3.rating,
|
|
110
|
-
note = _ref3.note;
|
|
111
|
-
return axios.put("".concat(runsUrl(conversationId), "/").concat(encodeURIComponent(runId), "/feedback"), {
|
|
112
|
-
feedback: {
|
|
113
|
-
rating: rating,
|
|
114
|
-
note: note
|
|
115
|
-
}
|
|
116
|
-
}, REQUEST_OPTIONS);
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
// The host makes the change as the signed-in rep, so the request says only
|
|
120
|
-
// which action. Nothing about the change itself comes from the browser.
|
|
121
|
-
var applyAction = function applyAction(action) {
|
|
122
|
-
return axios.post("".concat(actionUrl(action), "/apply"), {}, REQUEST_OPTIONS);
|
|
123
|
-
};
|
|
124
|
-
var dismissAction = function dismissAction(action) {
|
|
125
|
-
return axios.post("".concat(actionUrl(action), "/dismiss"), {}, REQUEST_OPTIONS);
|
|
126
|
-
};
|
|
127
|
-
var neetoAssistApi = {
|
|
128
|
-
fetchStatus: fetchStatus,
|
|
129
|
-
fetchRuns: fetchRuns,
|
|
130
|
-
createRun: createRun,
|
|
131
|
-
updateFeedback: updateFeedback,
|
|
132
|
-
applyAction: applyAction,
|
|
133
|
-
dismissAction: dismissAction
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
exports.ACTION_ERROR_MESSAGE_KEYS = ACTION_ERROR_MESSAGE_KEYS;
|
|
137
|
-
exports.COLLAPSED_PANE_WIDTH = COLLAPSED_PANE_WIDTH;
|
|
138
|
-
exports.ERROR_MESSAGE_KEYS = ERROR_MESSAGE_KEYS;
|
|
139
|
-
exports.EXPANDED_PANE_WIDTH = EXPANDED_PANE_WIDTH;
|
|
140
|
-
exports.EXPANDED_STORAGE_KEY = EXPANDED_STORAGE_KEY;
|
|
141
|
-
exports.IDLE_POLL_INTERVAL = IDLE_POLL_INTERVAL;
|
|
142
|
-
exports.MAX_NOTE_LENGTH = MAX_NOTE_LENGTH;
|
|
143
|
-
exports.MAX_QUESTION_LENGTH = MAX_QUESTION_LENGTH;
|
|
144
|
-
exports.PENDING_POLL_INTERVAL = PENDING_POLL_INTERVAL;
|
|
145
|
-
exports.PENDING_STATUSES = PENDING_STATUSES;
|
|
146
|
-
exports.QUERY_KEYS = QUERY_KEYS;
|
|
147
|
-
exports.QUIET_ACTION_STATUS_KEYS = QUIET_ACTION_STATUS_KEYS;
|
|
148
|
-
exports.QUIET_SKIPPED_REASONS = QUIET_SKIPPED_REASONS;
|
|
149
|
-
exports.RATEABLE_STATUSES = RATEABLE_STATUSES;
|
|
150
|
-
exports.REPLY_SUGGESTION = REPLY_SUGGESTION;
|
|
151
|
-
exports.RUN_TEST_ID = RUN_TEST_ID;
|
|
152
|
-
exports.SETTLED_ACTION_STATUSES = SETTLED_ACTION_STATUSES;
|
|
153
|
-
exports.SKIPPED_REASON_MESSAGE_KEYS = SKIPPED_REASON_MESSAGE_KEYS;
|
|
154
|
-
exports.SUGGESTION_KEYS = SUGGESTION_KEYS;
|
|
155
|
-
exports.UNRATEABLE_SKIPPED_REASONS = UNRATEABLE_SKIPPED_REASONS;
|
|
156
|
-
exports.neetoAssistApi = neetoAssistApi;
|
|
157
|
-
//# sourceMappingURL=neeto_assist-CznTN_YY.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"neeto_assist-CznTN_YY.js","sources":["../app/javascript/src/common/constants.js","../app/javascript/src/apis/neeto_assist.js"],"sourcesContent":["export const BASE_URL = \"/neeto_assist/api/v1\";\n\n// The pane shows NeetoAssist's errors itself. Without these, the host's axios\n// setup would raise a toast, or swap the page for an error page on a 403, 404\n// or 429.\nexport const REQUEST_OPTIONS = {\n showToastr: false,\n show403ErrorPage: false,\n show404ErrorPage: false,\n show429ErrorPage: false,\n};\n\nexport const QUERY_KEYS = {\n STATUS: \"neeto-assist-status\",\n RUNS: \"neeto-assist-runs\",\n};\n\nexport const PENDING_POLL_INTERVAL = 2_000;\n\nexport const IDLE_POLL_INTERVAL = 30_000;\n\nexport const PENDING_STATUSES = [\"queued\", \"running\"];\n\nexport const RATEABLE_STATUSES = [\"completed\", \"skipped\"];\n\n// What became of a suggested action. NeetoAssist has the last word on an\n// action in one of these: nothing a click says can be newer.\nexport const SETTLED_ACTION_STATUSES = [\n \"applied\",\n \"failed\",\n \"dismissed\",\n \"expired\",\n];\n\n// A suggestion nobody took up steps back to one muted line.\nexport const QUIET_ACTION_STATUS_KEYS = {\n dismissed: \"neetoAssist.actions.dismissed\",\n expired: \"neetoAssist.actions.expired\",\n};\n\n// The skips from the workspace's quiet rules, in NeetoAssist's settings. Each\n// one holds for every visitor message until something changes, such as the\n// agent who owns the conversation handing it back.\nexport const QUIET_SKIPPED_REASONS = [\n \"assigned_to_human\",\n \"handed_off\",\n \"no_answer_cooldown\",\n];\n\n// These skips come from the workspace's state, not from reading the\n// conversation, so there is nothing for a rep to judge.\nexport const UNRATEABLE_SKIPPED_REASONS = [\n \"disabled\",\n \"no_knowledge_source\",\n \"out_of_credits\",\n ...QUIET_SKIPPED_REASONS,\n];\n\nexport const MAX_QUESTION_LENGTH = 2_000;\n\nexport const MAX_NOTE_LENGTH = 2_000;\n\n// The same widths as Neeti's pane in NeetoCal, so Neeto's assistants feel alike.\nexport const COLLAPSED_PANE_WIDTH = \"min(100vw, 400px)\";\n\nexport const EXPANDED_PANE_WIDTH = \"min(50vw, 800px)\";\n\nexport const EXPANDED_STORAGE_KEY = \"neetoAssist.isExpanded\";\n\nexport const REPLY_SUGGESTION = \"reply_suggestion\";\n\nexport const RUN_TEST_ID = \"neeto-assist-run\";\n\nexport const SUGGESTION_KEYS = [\n \"neetoAssist.suggestions.summarize\",\n \"neetoAssist.suggestions.whatToReply\",\n \"neetoAssist.suggestions.writtenBefore\",\n \"neetoAssist.suggestions.whatNext\",\n];\n\nexport const SKIPPED_REASON_MESSAGE_KEYS = {\n greeting: \"neetoAssist.skippedReasons.greeting\",\n acknowledgment: \"neetoAssist.skippedReasons.acknowledgment\",\n agent_handoff: \"neetoAssist.skippedReasons.agentHandoff\",\n unclear: \"neetoAssist.skippedReasons.unclear\",\n other_product: \"neetoAssist.skippedReasons.otherProduct\",\n no_knowledge_source: \"neetoAssist.skippedReasons.noKnowledgeSource\",\n disabled: \"neetoAssist.skippedReasons.disabled\",\n no_question: \"neetoAssist.skippedReasons.noQuestion\",\n out_of_credits: \"neetoAssist.skippedReasons.outOfCredits\",\n assigned_to_human: \"neetoAssist.skippedReasons.assignedToHuman\",\n handed_off: \"neetoAssist.skippedReasons.handedOff\",\n no_answer_cooldown: \"neetoAssist.skippedReasons.noAnswerCooldown\",\n};\n\nexport const ERROR_MESSAGE_KEYS = {\n 404: \"neetoAssist.errors.notFound\",\n 409: \"neetoAssist.errors.disabled\",\n 422: \"neetoAssist.errors.invalid\",\n 503: \"neetoAssist.errors.unavailable\",\n};\n\n// A click on a card that changed nothing. The other answers fall back to the\n// keys above.\nexport const ACTION_ERROR_MESSAGE_KEYS = {\n 403: \"neetoAssist.actions.errors.forbidden\",\n 503: \"neetoAssist.actions.errors.unavailable\",\n};\n","import axios from \"axios\";\n\nimport { BASE_URL, REQUEST_OPTIONS } from \"common/constants\";\n\nconst runsUrl = conversationId =>\n `${BASE_URL}/conversations/${encodeURIComponent(conversationId)}/runs`;\n\nconst actionUrl = ({ conversationId, actionId }) =>\n `${BASE_URL}/conversations/${encodeURIComponent(\n conversationId\n )}/actions/${encodeURIComponent(actionId)}`;\n\nconst fetchStatus = () => axios.get(`${BASE_URL}/status`, REQUEST_OPTIONS);\n\nconst fetchRuns = conversationId =>\n axios.get(runsUrl(conversationId), REQUEST_OPTIONS);\n\nconst createRun = ({ conversationId, question, requestId }) =>\n axios.post(\n runsUrl(conversationId),\n { run: { question, request_id: requestId } },\n REQUEST_OPTIONS\n );\n\nconst updateFeedback = ({ conversationId, runId, rating, note }) =>\n axios.put(\n `${runsUrl(conversationId)}/${encodeURIComponent(runId)}/feedback`,\n { feedback: { rating, note } },\n REQUEST_OPTIONS\n );\n\n// The host makes the change as the signed-in rep, so the request says only\n// which action. Nothing about the change itself comes from the browser.\nconst applyAction = action =>\n axios.post(`${actionUrl(action)}/apply`, {}, REQUEST_OPTIONS);\n\nconst dismissAction = action =>\n axios.post(`${actionUrl(action)}/dismiss`, {}, REQUEST_OPTIONS);\n\nconst neetoAssistApi = {\n fetchStatus,\n fetchRuns,\n createRun,\n updateFeedback,\n applyAction,\n dismissAction,\n};\n\nexport default neetoAssistApi;\n"],"names":["BASE_URL","REQUEST_OPTIONS","showToastr","show403ErrorPage","show404ErrorPage","show429ErrorPage","QUERY_KEYS","STATUS","RUNS","PENDING_POLL_INTERVAL","IDLE_POLL_INTERVAL","PENDING_STATUSES","RATEABLE_STATUSES","SETTLED_ACTION_STATUSES","QUIET_ACTION_STATUS_KEYS","dismissed","expired","QUIET_SKIPPED_REASONS","UNRATEABLE_SKIPPED_REASONS","concat","MAX_QUESTION_LENGTH","MAX_NOTE_LENGTH","COLLAPSED_PANE_WIDTH","EXPANDED_PANE_WIDTH","EXPANDED_STORAGE_KEY","REPLY_SUGGESTION","RUN_TEST_ID","SUGGESTION_KEYS","SKIPPED_REASON_MESSAGE_KEYS","greeting","acknowledgment","agent_handoff","unclear","other_product","no_knowledge_source","disabled","no_question","out_of_credits","assigned_to_human","handed_off","no_answer_cooldown","ERROR_MESSAGE_KEYS","ACTION_ERROR_MESSAGE_KEYS","runsUrl","conversationId","encodeURIComponent","actionUrl","_ref","actionId","fetchStatus","axios","get","fetchRuns","createRun","_ref2","question","requestId","post","run","request_id","updateFeedback","_ref3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AAC;AAAA,CAAA;;AAEH;AACA;AACA,IAAMkE,WAAW,GAAG,SAAdA,WAAWA,CAAGC,MAAM,EAAA;AAAA,EAAA,OACxBlB,KAAK,CAACO,IAAI,CAAA,EAAA,CAAAtC,MAAA,CAAI2B,SAAS,CAACsB,MAAM,CAAC,EAAA,QAAA,CAAA,EAAU,EAAE,EAAEnE,eAAe,CAAC;AAAA,CAAA;AAE/D,IAAMoE,aAAa,GAAG,SAAhBA,aAAaA,CAAGD,MAAM,EAAA;AAAA,EAAA,OAC1BlB,KAAK,CAACO,IAAI,CAAA,EAAA,CAAAtC,MAAA,CAAI2B,SAAS,CAACsB,MAAM,CAAC,EAAA,UAAA,CAAA,EAAY,EAAE,EAAEnE,eAAe,CAAC;AAAA,CAAA;AAEjE,IAAMqE,cAAc,GAAG;AACrBrB,EAAAA,WAAW,EAAXA,WAAW;AACXG,EAAAA,SAAS,EAATA,SAAS;AACTC,EAAAA,SAAS,EAATA,SAAS;AACTO,EAAAA,cAAc,EAAdA,cAAc;AACdO,EAAAA,WAAW,EAAXA,WAAW;AACXE,EAAAA,aAAa,EAAbA;AACF;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useNeetoAssistStore-InICsbe8.js","sources":["../app/javascript/src/components/commons/Sparkle.jsx","../app/javascript/src/utils/commands.js","../app/javascript/src/utils/collapseRepeatedSkips.js","../app/javascript/src/utils/runs.js","../app/javascript/src/hooks/reactQuery/useRunsApi.js","../app/javascript/src/stores/useNeetoAssistStore.js"],"sourcesContent":["const Sparkle = ({ size = 18, className, ...otherProps }) => (\n <svg\n {...{ className }}\n aria-hidden=\"true\"\n fill=\"none\"\n height={size}\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"1.5\"\n viewBox=\"0 0 18 18\"\n width={size}\n xmlns=\"http://www.w3.org/2000/svg\"\n {...otherProps}\n >\n <path\n d=\"M5.658 2.99L4.395 2.569L3.974 1.306C3.837 0.898 3.162 0.898 3.025 1.306L2.604 2.569L1.341 2.99C1.137 3.058 0.999 3.249 0.999 3.464C0.999 3.679 1.137 3.87 1.341 3.938L2.604 4.359L3.025 5.622C3.093 5.826 3.285 5.964 3.5 5.964C3.715 5.964 3.906 5.826 3.975 5.622L4.396 4.359L5.659 3.938C5.863 3.87 6.001 3.679 6.001 3.464C6.001 3.249 5.862 3.058 5.658 2.99Z\"\n fill=\"currentColor\"\n stroke=\"none\"\n />\n <path d=\"M9.5 2.75L11.412 7.587L16.25 9.5L11.412 11.413L9.5 16.25L7.587 11.413L2.75 9.5L7.587 7.587L9.5 2.75Z\" />\n </svg>\n);\n\nexport default Sparkle;\n","// A command is a named way to ask NeetoAssist for one of the things it can do\n// here. A rep types \"/\" in the box, picks a command from the menu and may add\n// a few words. The engine lists the commands with the runs: NeetoAssist's own,\n// then those of the host's actions this rep is offered.\nimport { any, isEmpty, propEq } from \"ramda\";\n\nconst wordsOf = text => text.toLowerCase().split(/\\s+/).filter(Boolean);\n\n// The commands as the engine listed them with the runs. It lists only what has\n// a name, a title and a description, and an older engine lists none. Anything\n// else that turns up is left out here, so a menu never has a row it cannot\n// show.\nexport const commandsOf = commands =>\n (Array.isArray(commands) ? commands : []).filter(command =>\n [command?.name, command?.title, command?.description].every(\n text => typeof text === \"string\"\n )\n );\n\n// What a rep has typed of a command so far: the text after the \"/\", in lower\n// case, or null when the box holds no command being typed. That is so once\n// the text runs on to another line, and once a full name has a space after\n// it: the command is chosen then, and what follows are the rep's own words.\nexport const typedCommand = (text, commands) => {\n if (!text.startsWith(\"/\") || text.includes(\"\\n\")) return null;\n\n const typed = text.slice(1).toLowerCase();\n const [name, ...rest] = typed.split(/\\s/);\n const isChosen = !isEmpty(rest) && any(propEq(name, \"name\"), commands);\n\n return isChosen ? null : typed;\n};\n\n// The commands that fit what was typed, as the menu lists them: all of them\n// after a bare \"/\", otherwise those whose name starts with what was typed,\n// then those whose title has a word that starts with each word typed.\nexport const matchingCommands = (text, commands) => {\n const typed = typedCommand(text, commands);\n if (typed === null) return [];\n\n const words = wordsOf(typed);\n if (isEmpty(words)) return commands;\n\n const fitsName = ({ name }) =>\n words.length === 1 && name.startsWith(words[0]);\n\n const fitsTitle = ({ title }) =>\n words.every(word =>\n wordsOf(title).some(titleWord => titleWord.startsWith(word))\n );\n\n return [\n ...commands.filter(fitsName),\n ...commands.filter(command => !fitsName(command) && fitsTitle(command)),\n ];\n};\n\n// What the box holds once a command is picked: the command and a space, for\n// the rep to add words after or to send as it is.\nexport const pickedCommand = ({ name }) => `/${name} `;\n\n// The id of a command's row in the menu, which the box points at while the\n// row is the marked one.\nexport const optionId = (menuId, { name }) => `${menuId}-${name}`;\n\n// The command at the start of a question, as the rep typed it, or null for a\n// question that NeetoAssist did not read as a command.\nexport const commandPart = (question, command) => {\n if (!command || typeof question !== \"string\") return null;\n\n const typed = question.slice(0, command.length + 1);\n\n return typed.toLowerCase() === `/${command}`.toLowerCase() ? typed : null;\n};\n","// While a quiet rule holds, NeetoAssist skips every visitor message for the\n// same reason. One note says it, so of skips in a row for one of these\n// reasons, only the latest stays. Runs are in conversation order.\nexport const collapseRepeatedSkips = (runs, reasons) =>\n runs.filter((run, index) => {\n const next = runs[index + 1];\n\n return !(\n reasons.includes(run.skippedReason) &&\n next?.skippedReason === run.skippedReason\n );\n });\n","import { any, propEq, propOr, reverse } from \"ramda\";\n\nimport {\n ERROR_MESSAGE_KEYS,\n PENDING_STATUSES,\n QUIET_SKIPPED_REASONS,\n RATEABLE_STATUSES,\n REPLY_SUGGESTION,\n SKIPPED_REASON_MESSAGE_KEYS,\n UNRATEABLE_SKIPPED_REASONS,\n} from \"common/constants\";\nimport { collapseRepeatedSkips } from \"utils/collapseRepeatedSkips\";\n\n// A reply suggestion that is still waiting gets replaced by a newer one, which\n// answers its messages too, so only the newest shows as being worked on.\nconst withoutReplacedDrafts = runs =>\n runs.filter(\n (run, index) =>\n !(\n run.kind === REPLY_SUGGESTION &&\n run.status === \"queued\" &&\n runs.slice(index + 1).some(({ kind }) => kind === REPLY_SUGGESTION)\n )\n );\n\nexport const isPending = ({ status }) => PENDING_STATUSES.includes(status);\n\nexport const withoutRepeatedQuietSkips = runs =>\n collapseRepeatedSkips(runs, QUIET_SKIPPED_REASONS);\n\n// NeetoAssist lists the newest run first. The pane reads like the conversation\n// instead: oldest at the top, the latest at the bottom. A quiet rule skips every\n// message while it holds, and one note says so.\nexport const runsInConversationOrder = runs =>\n withoutRepeatedQuietSkips(withoutReplacedDrafts(reverse(runs)));\n\n// The newest reply NeetoAssist drafted on its own. Runs are newest first.\nexport const latestDraftId = runs =>\n runs.find(\n ({ kind, suggestedReply }) => kind === REPLY_SUGGESTION && !!suggestedReply\n )?.id;\n\n// A hello is skipped, since nothing was looked up, but it still gets a reply.\nexport const hasWrittenReply = ({ status, answer, suggestedReply }) =>\n status === \"completed\" ||\n (status === \"skipped\" && !!(answer || suggestedReply));\n\n// A rep's own hello or thanks got a friendly line, which is nothing to judge.\nexport const isRateable = ({ kind, status, skippedReason }) =>\n RATEABLE_STATUSES.includes(status) &&\n !UNRATEABLE_SKIPPED_REASONS.includes(skippedReason) &&\n !(kind === \"ask\" && status === \"skipped\");\n\n// What the pane polls quickly for: a run NeetoAssist is still working on. An\n// action someone is applying is not one. The rep who clicked has the answer\n// to the click, and an action whose end NeetoAssist never hears of would keep\n// every open pane polling quickly until NeetoAssist gives up on it.\nexport const hasPendingRun = (runs = []) => runs.some(isPending);\n\n// The lookups NeetoAssist made while answering, in the order they started. A\n// run from an older NeetoAssist carries none.\nexport const stepsOf = ({ steps }) => steps ?? [];\n\nexport const hasRunningStep = run =>\n any(propEq(\"running\", \"status\"), stepsOf(run));\n\n// A suggested action can only be applied once its run has finished. Until then\n// NeetoAssist may still take it back and start over, so its card waits.\nexport const actionsOf = ({ status, actions }) =>\n status === \"completed\" ? (actions ?? []) : [];\n\nexport const skippedReasonMessageKey = reason =>\n propOr(\"neetoAssist.run.skipped\", reason, SKIPPED_REASON_MESSAGE_KEYS);\n\n// No answer at all means the request never reached NeetoAssist.\nexport const errorMessageKey = error => {\n if (!error?.response) return ERROR_MESSAGE_KEYS[503];\n\n return propOr(\n \"neetoAssist.errors.generic\",\n error.response.status,\n ERROR_MESSAGE_KEYS\n );\n};\n\n// Sources come from a knowledge base, so only web links become links.\nexport const isWebUrl = url => /^https?:\\/\\//i.test(url ?? \"\");\n","import { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { useMutationWithInvalidation } from \"neetocommons/v2/react-utils\";\n\nimport neetoAssistApi from \"apis/neeto_assist\";\nimport {\n IDLE_POLL_INTERVAL,\n PENDING_POLL_INTERVAL,\n QUERY_KEYS,\n} from \"common/constants\";\nimport { commandsOf } from \"utils/commands\";\nimport { hasPendingRun } from \"utils/runs\";\n\n// Fresh on every mount, then polled: quickly while NeetoAssist is working on a\n// run, slowly otherwise. A failed poll is retried by the next one and never\n// shown as a toast. Comes with the workspace's credit state, and with the\n// commands a rep can pick in the box, which an older engine does not list.\nconst useFetchRuns = conversationId =>\n useQuery({\n queryKey: [QUERY_KEYS.RUNS, conversationId],\n queryFn: () => neetoAssistApi.fetchRuns(conversationId),\n select: ({ runs = [], credits = null, commands }) => ({\n runs,\n credits,\n commands: commandsOf(commands),\n }),\n staleTime: 0,\n retry: false,\n refetchInterval: ({ state: { data, error } }) =>\n !error && hasPendingRun(data?.runs)\n ? PENDING_POLL_INTERVAL\n : IDLE_POLL_INTERVAL,\n });\n\nconst useAskNeetoAssist = conversationId =>\n useMutationWithInvalidation(neetoAssistApi.createRun, {\n keysToInvalidate: [[QUERY_KEYS.RUNS, conversationId]],\n });\n\nconst useUpdateFeedback = conversationId =>\n useMutationWithInvalidation(neetoAssistApi.updateFeedback, {\n keysToInvalidate: [[QUERY_KEYS.RUNS, conversationId]],\n });\n\n// A click on a card changes what its run shows whether it worked or not: the\n// action was applied, or someone else got to it first, or it expired. So the\n// runs are fetched again either way. The card does not wait for them: the\n// answer to the click already says what happened.\nconst useActOnAction = (mutationFn, conversationId, callbacks = {}) => {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn,\n onSettled: () => {\n queryClient.invalidateQueries({\n queryKey: [QUERY_KEYS.RUNS, conversationId],\n });\n },\n ...callbacks,\n });\n};\n\n// The host hears of an applied action from here and not from the card that\n// was clicked. React Query drops what a card hands to mutate once the card is\n// off the screen, as when the rep opens another conversation before the answer\n// arrives, and the change was made all the same. The click does not wait for\n// the host's handler, so what the handler returns is left alone.\nconst useApplyAction = (conversationId, onApplied) =>\n useActOnAction(neetoAssistApi.applyAction, conversationId, {\n onSuccess: data => {\n onApplied?.(data?.action);\n },\n });\n\nconst useDismissAction = conversationId =>\n useActOnAction(neetoAssistApi.dismissAction, conversationId);\n\nexport {\n useFetchRuns,\n useAskNeetoAssist,\n useUpdateFeedback,\n useApplyAction,\n useDismissAction,\n};\n","import { withImmutableActions } from \"neetocommons/v2/react-utils\";\nimport { getFromLocalStorage, setToLocalStorage } from \"neetocommons/v2/utils\";\nimport { create } from \"zustand\";\n\nimport { EXPANDED_STORAGE_KEY } from \"common/constants\";\n\n// The pane is mounted once in the host's layout and the button sits on the\n// ticket, so this is how they talk: whether the pane is open and how wide, and\n// which conversation it is about. A reload starts closed, and the width is kept.\n/** @type {import(\"neetocommons/react-utils\").ZustandStoreHook} */\nconst useNeetoAssistStore = create(\n withImmutableActions(set => ({\n isOpen: false,\n isExpanded: getFromLocalStorage(EXPANDED_STORAGE_KEY) || false,\n conversation: null,\n seenDrafts: {},\n\n close: () => set({ isOpen: false }),\n\n toggle: () => set(state => ({ isOpen: !state.isOpen })),\n\n setExpanded: value => {\n setToLocalStorage(EXPANDED_STORAGE_KEY, value);\n set({ isExpanded: value });\n },\n\n setConversation: conversation => set({ conversation }),\n\n // Only the conversation that is leaving: the next one's button may already\n // have taken its place.\n clearConversation: conversationId =>\n set(state =>\n state.conversation?.id === conversationId ? { conversation: null } : {}\n ),\n\n markDraftSeen: (conversationId, runId) =>\n set(state => ({\n seenDrafts: { ...state.seenDrafts, [conversationId]: runId },\n })),\n }))\n);\n\nexport default useNeetoAssistStore;\n"],"names":["Sparkle","_ref","_ref$size","size","className","otherProps","_objectWithoutProperties","_excluded","_jsxs","_objectSpread","fill","height","stroke","strokeLinecap","strokeLinejoin","strokeWidth","viewBox","width","xmlns","children","_jsx","d","wordsOf","text","toLowerCase","split","filter","Boolean","commandsOf","commands","Array","isArray","command","name","title","description","every","typedCommand","startsWith","includes","typed","slice","_typed$split","_typed$split2","_toArray","rest","isChosen","isEmpty","any","propEq","matchingCommands","words","fitsName","length","fitsTitle","_ref2","word","some","titleWord","concat","_toConsumableArray","pickedCommand","_ref3","optionId","menuId","_ref4","commandPart","question","collapseRepeatedSkips","runs","reasons","run","index","next","skippedReason","withoutReplacedDrafts","kind","REPLY_SUGGESTION","status","isPending","PENDING_STATUSES","withoutRepeatedQuietSkips","QUIET_SKIPPED_REASONS","runsInConversationOrder","reverse","latestDraftId","_runs$find","find","suggestedReply","id","hasWrittenReply","answer","isRateable","_ref5","RATEABLE_STATUSES","UNRATEABLE_SKIPPED_REASONS","hasPendingRun","arguments","undefined","stepsOf","_ref6","steps","hasRunningStep","actionsOf","_ref7","actions","skippedReasonMessageKey","reason","propOr","SKIPPED_REASON_MESSAGE_KEYS","errorMessageKey","error","response","ERROR_MESSAGE_KEYS","isWebUrl","url","test","useFetchRuns","conversationId","useQuery","queryKey","QUERY_KEYS","RUNS","queryFn","neetoAssistApi","fetchRuns","select","_ref$runs","_ref$credits","credits","staleTime","retry","refetchInterval","_ref2$state","state","data","PENDING_POLL_INTERVAL","IDLE_POLL_INTERVAL","useAskNeetoAssist","useMutationWithInvalidation","createRun","keysToInvalidate","useUpdateFeedback","updateFeedback","useActOnAction","mutationFn","callbacks","queryClient","useQueryClient","useMutation","onSettled","invalidateQueries","useApplyAction","onApplied","applyAction","onSuccess","action","useDismissAction","dismissAction","useNeetoAssistStore","create","withImmutableActions","set","isOpen","isExpanded","getFromLocalStorage","EXPANDED_STORAGE_KEY","conversation","seenDrafts","close","toggle","setExpanded","value","setToLocalStorage","setConversation","clearConversation","_state$conversation","markDraftSeen","runId","_defineProperty"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAMA,OAAO,GAAG,SAAVA,OAAOA,CAAAC,IAAA,EAAA;AAAA,EAAA,IAAAC,SAAA,GAAAD,IAAA,CAAME,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,SAAA;IAAEE,SAAS,GAAAH,IAAA,CAATG,SAAS;AAAKC,IAAAA,UAAU,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA,CAAA;AAAA,EAAA,oBACpDC,IAAA,CAAA,KAAA,EAAAC,eAAA,CAAAA,eAAA,CAAA;AACQL,IAAAA,SAAS,EAATA,SAAS;AACf,IAAA,aAAA,EAAY,MAAM;AAClBM,IAAAA,IAAI,EAAC,MAAM;AACXC,IAAAA,MAAM,EAAER,IAAK;AACbS,IAAAA,MAAM,EAAC,cAAc;AACrBC,IAAAA,aAAa,EAAC,OAAO;AACrBC,IAAAA,cAAc,EAAC,OAAO;AACtBC,IAAAA,WAAW,EAAC,KAAK;AACjBC,IAAAA,OAAO,EAAC,WAAW;AACnBC,IAAAA,KAAK,EAAEd,IAAK;AACZe,IAAAA,KAAK,EAAC;AAA4B,GAAA,EAC9Bb,UAAU,CAAA,EAAA,EAAA,EAAA;AAAAc,IAAAA,QAAA,gBAEdC,GAAA,CAAA,MAAA,EAAA;AACEC,MAAAA,CAAC,EAAC,oWAAoW;AACtWX,MAAAA,IAAI,EAAC,cAAc;AACnBE,MAAAA,MAAM,EAAC;KACR,CAAC,eACFQ,GAAA,CAAA,MAAA,EAAA;AAAMC,MAAAA,CAAC,EAAC;AAAsG,KAAE,CAAC;AAAA,GAAA,CAC9G,CAAC;AAAA;;ACfR,IAAMC,OAAO,GAAG,SAAVA,OAAOA,CAAGC,IAAI,EAAA;AAAA,E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AAA;SAC3D;AAAA,MAAA,CAAC,CAAC;AAAA,IAAA;GACN;AAAA,CAAC,CACJ;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useNeetoAssistStore-VaZp3268.js","sources":["../app/javascript/src/components/commons/Sparkle.jsx","../app/javascript/src/utils/commands.js","../app/javascript/src/utils/collapseRepeatedSkips.js","../app/javascript/src/utils/runs.js","../app/javascript/src/hooks/reactQuery/useRunsApi.js","../app/javascript/src/stores/useNeetoAssistStore.js"],"sourcesContent":["const Sparkle = ({ size = 18, className, ...otherProps }) => (\n <svg\n {...{ className }}\n aria-hidden=\"true\"\n fill=\"none\"\n height={size}\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"1.5\"\n viewBox=\"0 0 18 18\"\n width={size}\n xmlns=\"http://www.w3.org/2000/svg\"\n {...otherProps}\n >\n <path\n d=\"M5.658 2.99L4.395 2.569L3.974 1.306C3.837 0.898 3.162 0.898 3.025 1.306L2.604 2.569L1.341 2.99C1.137 3.058 0.999 3.249 0.999 3.464C0.999 3.679 1.137 3.87 1.341 3.938L2.604 4.359L3.025 5.622C3.093 5.826 3.285 5.964 3.5 5.964C3.715 5.964 3.906 5.826 3.975 5.622L4.396 4.359L5.659 3.938C5.863 3.87 6.001 3.679 6.001 3.464C6.001 3.249 5.862 3.058 5.658 2.99Z\"\n fill=\"currentColor\"\n stroke=\"none\"\n />\n <path d=\"M9.5 2.75L11.412 7.587L16.25 9.5L11.412 11.413L9.5 16.25L7.587 11.413L2.75 9.5L7.587 7.587L9.5 2.75Z\" />\n </svg>\n);\n\nexport default Sparkle;\n","// A command is a named way to ask NeetoAssist for one of the things it can do\n// here. A rep types \"/\" in the box, picks a command from the menu and may add\n// a few words. The engine lists the commands with the runs: NeetoAssist's own,\n// then those of the host's actions this rep is offered.\nimport { any, isEmpty, propEq } from \"ramda\";\n\nconst wordsOf = text => text.toLowerCase().split(/\\s+/).filter(Boolean);\n\n// The commands as the engine listed them with the runs. It lists only what has\n// a name, a title and a description, and an older engine lists none. Anything\n// else that turns up is left out here, so a menu never has a row it cannot\n// show.\nexport const commandsOf = commands =>\n (Array.isArray(commands) ? commands : []).filter(command =>\n [command?.name, command?.title, command?.description].every(\n text => typeof text === \"string\"\n )\n );\n\n// What a rep has typed of a command so far: the text after the \"/\", in lower\n// case, or null when the box holds no command being typed. That is so once\n// the text runs on to another line, and once a full name has a space after\n// it: the command is chosen then, and what follows are the rep's own words.\nexport const typedCommand = (text, commands) => {\n if (!text.startsWith(\"/\") || text.includes(\"\\n\")) return null;\n\n const typed = text.slice(1).toLowerCase();\n const [name, ...rest] = typed.split(/\\s/);\n const isChosen = !isEmpty(rest) && any(propEq(name, \"name\"), commands);\n\n return isChosen ? null : typed;\n};\n\n// The commands that fit what was typed, as the menu lists them: all of them\n// after a bare \"/\", otherwise those whose name starts with what was typed,\n// then those whose title has a word that starts with each word typed.\nexport const matchingCommands = (text, commands) => {\n const typed = typedCommand(text, commands);\n if (typed === null) return [];\n\n const words = wordsOf(typed);\n if (isEmpty(words)) return commands;\n\n const fitsName = ({ name }) =>\n words.length === 1 && name.startsWith(words[0]);\n\n const fitsTitle = ({ title }) =>\n words.every(word =>\n wordsOf(title).some(titleWord => titleWord.startsWith(word))\n );\n\n return [\n ...commands.filter(fitsName),\n ...commands.filter(command => !fitsName(command) && fitsTitle(command)),\n ];\n};\n\n// What the box holds once a command is picked: the command and a space, for\n// the rep to add words after or to send as it is.\nexport const pickedCommand = ({ name }) => `/${name} `;\n\n// The id of a command's row in the menu, which the box points at while the\n// row is the marked one.\nexport const optionId = (menuId, { name }) => `${menuId}-${name}`;\n\n// The command at the start of a question, as the rep typed it, or null for a\n// question that NeetoAssist did not read as a command.\nexport const commandPart = (question, command) => {\n if (!command || typeof question !== \"string\") return null;\n\n const typed = question.slice(0, command.length + 1);\n\n return typed.toLowerCase() === `/${command}`.toLowerCase() ? typed : null;\n};\n","// While a quiet rule holds, NeetoAssist skips every visitor message for the\n// same reason. One note says it, so of skips in a row for one of these\n// reasons, only the latest stays. Runs are in conversation order.\nexport const collapseRepeatedSkips = (runs, reasons) =>\n runs.filter((run, index) => {\n const next = runs[index + 1];\n\n return !(\n reasons.includes(run.skippedReason) &&\n next?.skippedReason === run.skippedReason\n );\n });\n","import { any, propEq, propOr, reverse } from \"ramda\";\n\nimport {\n ERROR_MESSAGE_KEYS,\n PENDING_STATUSES,\n QUIET_SKIPPED_REASONS,\n RATEABLE_STATUSES,\n REPLY_SUGGESTION,\n SKIPPED_REASON_MESSAGE_KEYS,\n UNRATEABLE_SKIPPED_REASONS,\n} from \"common/constants\";\nimport { collapseRepeatedSkips } from \"utils/collapseRepeatedSkips\";\n\n// A reply suggestion that is still waiting gets replaced by a newer one, which\n// answers its messages too, so only the newest shows as being worked on.\nconst withoutReplacedDrafts = runs =>\n runs.filter(\n (run, index) =>\n !(\n run.kind === REPLY_SUGGESTION &&\n run.status === \"queued\" &&\n runs.slice(index + 1).some(({ kind }) => kind === REPLY_SUGGESTION)\n )\n );\n\nexport const isPending = ({ status }) => PENDING_STATUSES.includes(status);\n\nexport const withoutRepeatedQuietSkips = runs =>\n collapseRepeatedSkips(runs, QUIET_SKIPPED_REASONS);\n\n// NeetoAssist lists the newest run first. The pane reads like the conversation\n// instead: oldest at the top, the latest at the bottom. A quiet rule skips every\n// message while it holds, and one note says so.\nexport const runsInConversationOrder = runs =>\n withoutRepeatedQuietSkips(withoutReplacedDrafts(reverse(runs)));\n\n// The newest reply NeetoAssist drafted on its own. Runs are newest first.\nexport const latestDraftId = runs =>\n runs.find(\n ({ kind, suggestedReply }) => kind === REPLY_SUGGESTION && !!suggestedReply\n )?.id;\n\n// A hello is skipped, since nothing was looked up, but it still gets a reply.\nexport const hasWrittenReply = ({ status, answer, suggestedReply }) =>\n status === \"completed\" ||\n (status === \"skipped\" && !!(answer || suggestedReply));\n\n// A rep's own hello or thanks got a friendly line, which is nothing to judge.\nexport const isRateable = ({ kind, status, skippedReason }) =>\n RATEABLE_STATUSES.includes(status) &&\n !UNRATEABLE_SKIPPED_REASONS.includes(skippedReason) &&\n !(kind === \"ask\" && status === \"skipped\");\n\n// What the pane polls quickly for: a run NeetoAssist is still working on. An\n// action someone is applying is not one. The rep who clicked has the answer\n// to the click, and an action whose end NeetoAssist never hears of would keep\n// every open pane polling quickly until NeetoAssist gives up on it.\nexport const hasPendingRun = (runs = []) => runs.some(isPending);\n\n// The lookups NeetoAssist made while answering, in the order they started. A\n// run from an older NeetoAssist carries none.\nexport const stepsOf = ({ steps }) => steps ?? [];\n\nexport const hasRunningStep = run =>\n any(propEq(\"running\", \"status\"), stepsOf(run));\n\n// A suggested action can only be applied once its run has finished. Until then\n// NeetoAssist may still take it back and start over, so its card waits.\nexport const actionsOf = ({ status, actions }) =>\n status === \"completed\" ? (actions ?? []) : [];\n\nexport const skippedReasonMessageKey = reason =>\n propOr(\"neetoAssist.run.skipped\", reason, SKIPPED_REASON_MESSAGE_KEYS);\n\n// No answer at all means the request never reached NeetoAssist.\nexport const errorMessageKey = error => {\n if (!error?.response) return ERROR_MESSAGE_KEYS[503];\n\n return propOr(\n \"neetoAssist.errors.generic\",\n error.response.status,\n ERROR_MESSAGE_KEYS\n );\n};\n\n// Sources come from a knowledge base, so only web links become links.\nexport const isWebUrl = url => /^https?:\\/\\//i.test(url ?? \"\");\n","import { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { useMutationWithInvalidation } from \"neetocommons/v2/react-utils\";\n\nimport neetoAssistApi from \"apis/neeto_assist\";\nimport {\n IDLE_POLL_INTERVAL,\n PENDING_POLL_INTERVAL,\n QUERY_KEYS,\n} from \"common/constants\";\nimport { commandsOf } from \"utils/commands\";\nimport { hasPendingRun } from \"utils/runs\";\n\n// Fresh on every mount, then polled: quickly while NeetoAssist is working on a\n// run, slowly otherwise. A failed poll is retried by the next one and never\n// shown as a toast. Comes with the workspace's credit state, and with the\n// commands a rep can pick in the box, which an older engine does not list.\nconst useFetchRuns = conversationId =>\n useQuery({\n queryKey: [QUERY_KEYS.RUNS, conversationId],\n queryFn: () => neetoAssistApi.fetchRuns(conversationId),\n select: ({ runs = [], credits = null, commands }) => ({\n runs,\n credits,\n commands: commandsOf(commands),\n }),\n staleTime: 0,\n retry: false,\n refetchInterval: ({ state: { data, error } }) =>\n !error && hasPendingRun(data?.runs)\n ? PENDING_POLL_INTERVAL\n : IDLE_POLL_INTERVAL,\n });\n\nconst useAskNeetoAssist = conversationId =>\n useMutationWithInvalidation(neetoAssistApi.createRun, {\n keysToInvalidate: [[QUERY_KEYS.RUNS, conversationId]],\n });\n\nconst useUpdateFeedback = conversationId =>\n useMutationWithInvalidation(neetoAssistApi.updateFeedback, {\n keysToInvalidate: [[QUERY_KEYS.RUNS, conversationId]],\n });\n\n// A click on a card changes what its run shows whether it worked or not: the\n// action was applied, or someone else got to it first, or it expired. So the\n// runs are fetched again either way. The card does not wait for them: the\n// answer to the click already says what happened.\nconst useActOnAction = (mutationFn, conversationId, callbacks = {}) => {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn,\n onSettled: () => {\n queryClient.invalidateQueries({\n queryKey: [QUERY_KEYS.RUNS, conversationId],\n });\n },\n ...callbacks,\n });\n};\n\n// The host hears of an applied action from here and not from the card that\n// was clicked. React Query drops what a card hands to mutate once the card is\n// off the screen, as when the rep opens another conversation before the answer\n// arrives, and the change was made all the same. The click does not wait for\n// the host's handler, so what the handler returns is left alone.\nconst useApplyAction = (conversationId, onApplied) =>\n useActOnAction(neetoAssistApi.applyAction, conversationId, {\n onSuccess: data => {\n onApplied?.(data?.action);\n },\n });\n\nconst useDismissAction = conversationId =>\n useActOnAction(neetoAssistApi.dismissAction, conversationId);\n\nexport {\n useFetchRuns,\n useAskNeetoAssist,\n useUpdateFeedback,\n useApplyAction,\n useDismissAction,\n};\n","import { withImmutableActions } from \"neetocommons/v2/react-utils\";\nimport { getFromLocalStorage, setToLocalStorage } from \"neetocommons/v2/utils\";\nimport { create } from \"zustand\";\n\nimport { EXPANDED_STORAGE_KEY } from \"common/constants\";\n\n// The pane is mounted once in the host's layout and the button sits on the\n// ticket, so this is how they talk: whether the pane is open and how wide, and\n// which conversation it is about. A reload starts closed, and the width is kept.\n/** @type {import(\"neetocommons/react-utils\").ZustandStoreHook} */\nconst useNeetoAssistStore = create(\n withImmutableActions(set => ({\n isOpen: false,\n isExpanded: getFromLocalStorage(EXPANDED_STORAGE_KEY) || false,\n conversation: null,\n seenDrafts: {},\n\n close: () => set({ isOpen: false }),\n\n toggle: () => set(state => ({ isOpen: !state.isOpen })),\n\n setExpanded: value => {\n setToLocalStorage(EXPANDED_STORAGE_KEY, value);\n set({ isExpanded: value });\n },\n\n setConversation: conversation => set({ conversation }),\n\n // Only the conversation that is leaving: the next one's button may already\n // have taken its place.\n clearConversation: conversationId =>\n set(state =>\n state.conversation?.id === conversationId ? { conversation: null } : {}\n ),\n\n markDraftSeen: (conversationId, runId) =>\n set(state => ({\n seenDrafts: { ...state.seenDrafts, [conversationId]: runId },\n })),\n }))\n);\n\nexport default useNeetoAssistStore;\n"],"names":["Sparkle","_ref","_ref$size","size","className","otherProps","_objectWithoutProperties","_excluded","_jsxs","_objectSpread","fill","height","stroke","strokeLinecap","strokeLinejoin","strokeWidth","viewBox","width","xmlns","children","_jsx","d","wordsOf","text","toLowerCase","split","filter","Boolean","commandsOf","commands","Array","isArray","command","name","title","description","every","typedCommand","startsWith","includes","typed","slice","_typed$split","_typed$split2","_toArray","rest","isChosen","isEmpty","any","propEq","matchingCommands","words","fitsName","length","fitsTitle","_ref2","word","some","titleWord","concat","_toConsumableArray","pickedCommand","_ref3","optionId","menuId","_ref4","commandPart","question","collapseRepeatedSkips","runs","reasons","run","index","next","skippedReason","withoutReplacedDrafts","kind","REPLY_SUGGESTION","status","isPending","PENDING_STATUSES","withoutRepeatedQuietSkips","QUIET_SKIPPED_REASONS","runsInConversationOrder","reverse","latestDraftId","_runs$find","find","suggestedReply","id","hasWrittenReply","answer","isRateable","_ref5","RATEABLE_STATUSES","UNRATEABLE_SKIPPED_REASONS","hasPendingRun","arguments","undefined","stepsOf","_ref6","steps","hasRunningStep","actionsOf","_ref7","actions","skippedReasonMessageKey","reason","propOr","SKIPPED_REASON_MESSAGE_KEYS","errorMessageKey","error","response","ERROR_MESSAGE_KEYS","isWebUrl","url","test","useFetchRuns","conversationId","useQuery","queryKey","QUERY_KEYS","RUNS","queryFn","neetoAssistApi","fetchRuns","select","_ref$runs","_ref$credits","credits","staleTime","retry","refetchInterval","_ref2$state","state","data","PENDING_POLL_INTERVAL","IDLE_POLL_INTERVAL","useAskNeetoAssist","useMutationWithInvalidation","createRun","keysToInvalidate","useUpdateFeedback","updateFeedback","useActOnAction","mutationFn","callbacks","queryClient","useQueryClient","useMutation","onSettled","invalidateQueries","useApplyAction","onApplied","applyAction","onSuccess","action","useDismissAction","dismissAction","useNeetoAssistStore","create","withImmutableActions","set","isOpen","isExpanded","getFromLocalStorage","EXPANDED_STORAGE_KEY","conversation","seenDrafts","close","toggle","setExpanded","value","setToLocalStorage","setConversation","clearConversation","_state$conversation","markDraftSeen","runId","_defineProperty"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAMA,OAAO,GAAG,SAAVA,OAAOA,CAAAC,IAAA,EAAA;AAAA,EAAA,IAAAC,SAAA,GAAAD,IAAA,CAAME,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,SAAA;IAAEE,SAAS,GAAAH,IAAA,CAATG,SAAS;AAAKC,IAAAA,UAAU,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA,CAAA;AAAA,EAAA,oBACpDC,eAAA,CAAA,KAAA,EAAAC,eAAA,CAAAA,eAAA,CAAA;AACQL,IAAAA,SAAS,EAATA,SAAS;AACf,IAAA,aAAA,EAAY,MAAM;AAClBM,IAAAA,IAAI,EAAC,MAAM;AACXC,IAAAA,MAAM,EAAER,IAAK;AACbS,IAAAA,MAAM,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