@burdenoff/fe-libs 2026.1028.9 → 2026.1028.11
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/shared/assistant/attachmentAccess.d.ts +15 -0
- package/dist/shared/assistant/attachmentAccess.js +42 -0
- package/dist/shared/assistant/attachmentAccessCopy.d.ts +9 -0
- package/dist/shared/assistant/attachmentAccessCopy.js +18 -0
- package/dist/shared/assistant/attachmentCommit.d.ts +18 -5
- package/dist/shared/assistant/attachmentCommit.js +247 -191
- package/dist/shared/assistant/attachments.d.ts +2 -0
- package/dist/shared/assistant/i18nManifest.js +30 -28
- package/dist/shared/assistant/index.d.ts +2 -0
- package/dist/shared/assistant/ui/composer/AssistantAttachmentChips.js +43 -40
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +114 -112
- package/dist/shared/assistant/useAssistantAttachments.js +1 -0
- package/dist/shared/assistant/useAttachmentCommitter.js +50 -33
- package/dist/shared-assistant.js +242 -240
- package/package.json +2 -2
- package/src/shared/tokens/build/semantic.css +2 -2
- package/src/shared/tokens/build/themes.css +3 -3
|
@@ -5,92 +5,93 @@ import { useAssistantTr as r } from "../../i18n.js";
|
|
|
5
5
|
import { useAssistantStore as i } from "../../store.js";
|
|
6
6
|
import { languageDisplayName as ee } from "../../voice/speechVoices.js";
|
|
7
7
|
import { resolveAssistantLanguage as te } from "../../voice/languages.js";
|
|
8
|
+
import { attachmentEditorAccessMessage as ne } from "../../attachmentAccessCopy.js";
|
|
8
9
|
import { getSendableAttachments as a } from "../../attachments.js";
|
|
9
10
|
import { ATTACHMENT_COMMIT_CODES as o } from "../../attachmentCommit.js";
|
|
10
|
-
import { AssistantAttachmentButton as
|
|
11
|
-
import { AssistantAttachmentChips as
|
|
12
|
-
import { AssistantModeSelector as
|
|
13
|
-
import { AssistantVoiceButton as
|
|
14
|
-
import { AssistantVoiceSessionButton as
|
|
15
|
-
import { useAssistantAttachments as
|
|
16
|
-
import { useCallback as s, useEffect as c, useLayoutEffect as
|
|
17
|
-
import { ArrowUp as
|
|
11
|
+
import { AssistantAttachmentButton as re } from "./AssistantAttachmentButton.js";
|
|
12
|
+
import { AssistantAttachmentChips as ie } from "./AssistantAttachmentChips.js";
|
|
13
|
+
import { AssistantModeSelector as ae } from "./AssistantModeSelector.js";
|
|
14
|
+
import { AssistantVoiceButton as oe, ListeningDot as se } from "./AssistantVoiceButton.js";
|
|
15
|
+
import { AssistantVoiceSessionButton as ce } from "../voice/AssistantVoiceSessionButton.js";
|
|
16
|
+
import { useAssistantAttachments as le } from "../../useAssistantAttachments.js";
|
|
17
|
+
import { useCallback as s, useEffect as c, useLayoutEffect as ue, useMemo as de, useRef as l, useState as u } from "react";
|
|
18
|
+
import { ArrowUp as fe, Loader2 as pe } from "lucide-react";
|
|
18
19
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
19
20
|
//#region src/shared/assistant/ui/composer/AssistantComposer.tsx
|
|
20
|
-
var
|
|
21
|
-
let x = r(), { locale: S } = e(), C = h ||
|
|
21
|
+
var me = 200, p = ({ writeAccessDenied: p = !1, onSend: m, disabled: h = !1, readOnly: he = !1, placeholder: ge, mode: _e, availableModes: ve, attachmentCharsPerFile: ye, onModeChange: be, auto: xe, onStartVoiceSession: g, onDraftStart: _, onDraftChange: v, suspendDictation: y = !1, onVoiceStateChange: b }) => {
|
|
22
|
+
let x = r(), { locale: S } = e(), C = h || he, w = l(null), [T, E] = u(""), [Se, D] = u(!1), [O, Ce] = u(!1), k = l(!1), [A, j] = u(null), M = l(0), { attachments: N, isBusy: we, preparingCount: Te, sendBlocker: P, rejection: F, addFiles: I, remove: Ee, retry: De, clear: L, clearRejection: Oe, canAddMore: ke, commit: R, cancelCommit: z } = le({ perFileChars: ye }), B = T.trim() !== "" || N.length > 0, V = l(!1), H = l(!1);
|
|
22
23
|
c(() => {
|
|
23
|
-
|
|
24
|
-
}, [
|
|
25
|
-
|
|
24
|
+
B && !V.current ? (V.current = !0, _?.()) : B || (V.current = !1);
|
|
25
|
+
}, [B, _]), c(() => {
|
|
26
|
+
B || (H.current = !1), v?.({
|
|
26
27
|
text: T,
|
|
27
|
-
hasAttachments:
|
|
28
|
-
dictated:
|
|
28
|
+
hasAttachments: N.length > 0,
|
|
29
|
+
dictated: H.current
|
|
29
30
|
});
|
|
30
31
|
}, [
|
|
31
32
|
T,
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
N.length,
|
|
34
|
+
B,
|
|
34
35
|
v
|
|
35
36
|
]);
|
|
36
|
-
let
|
|
37
|
-
|
|
38
|
-
}, []),
|
|
39
|
-
onFinalize:
|
|
40
|
-
language:
|
|
41
|
-
}),
|
|
37
|
+
let U = s((e) => {
|
|
38
|
+
H.current = !0, E((t) => t ? `${t.replace(/\s+$/, "")} ${e}` : e);
|
|
39
|
+
}, []), W = i((e) => e.assistantLanguage), G = n({
|
|
40
|
+
onFinalize: U,
|
|
41
|
+
language: de(() => te(W, S), [W, S]).tag
|
|
42
|
+
}), K = G.isActive, q = G.interim, J = G.stop;
|
|
42
43
|
c(() => {
|
|
43
|
-
!y || !
|
|
44
|
+
!y || !K || (q.trim() !== "" && U(q.trim()), J());
|
|
44
45
|
}, [
|
|
45
46
|
y,
|
|
47
|
+
K,
|
|
46
48
|
q,
|
|
47
49
|
J,
|
|
48
|
-
|
|
49
|
-
W
|
|
50
|
+
U
|
|
50
51
|
]), c(() => {
|
|
51
52
|
b?.({
|
|
52
53
|
committing: O,
|
|
53
|
-
dictating:
|
|
54
|
+
dictating: K
|
|
54
55
|
});
|
|
55
56
|
}, [
|
|
56
57
|
b,
|
|
57
58
|
O,
|
|
58
|
-
|
|
59
|
+
K
|
|
59
60
|
]);
|
|
60
|
-
let
|
|
61
|
-
|
|
61
|
+
let Ae = ge ?? x("composer.placeholder", "Ask me anything…"), je = T.trim(), Y = a(N), X = N.filter((e) => e.status === "error"), Z = (je.length > 0 || Y.length > 0) && !C && !O && P === null, Me = Y.some((e) => !(e.fileId && e.downloadUrl) && !e.inlineOnly), Ne = l(C);
|
|
62
|
+
Ne.current = C;
|
|
62
63
|
let Q = l(!0);
|
|
63
64
|
c(() => (Q.current = !0, () => {
|
|
64
65
|
Q.current = !1;
|
|
65
|
-
}), []),
|
|
66
|
+
}), []), ue(() => {
|
|
66
67
|
let e = w.current;
|
|
67
|
-
e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight,
|
|
68
|
+
e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, me)}px`);
|
|
68
69
|
}, [T]);
|
|
69
70
|
let $ = s(async () => {
|
|
70
|
-
if (!Z ||
|
|
71
|
-
|
|
71
|
+
if (!Z || k.current) return;
|
|
72
|
+
G.isActive && G.stop();
|
|
72
73
|
let e = T.trim();
|
|
73
|
-
if (
|
|
74
|
-
m(e, Y), E(""),
|
|
74
|
+
if (j(null), !Me) {
|
|
75
|
+
m(e, Y), E(""), L();
|
|
75
76
|
return;
|
|
76
77
|
}
|
|
77
78
|
let t = i.getState().activeConversationId;
|
|
78
|
-
|
|
79
|
+
k.current = !0, Ce(!0);
|
|
79
80
|
try {
|
|
80
|
-
let n = await
|
|
81
|
+
let n = await R();
|
|
81
82
|
if (!Q.current) {
|
|
82
83
|
n.ok && await n.rollback();
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
85
86
|
if (!n.ok) {
|
|
86
|
-
n.cancelled ||
|
|
87
|
+
n.cancelled || j({
|
|
87
88
|
kind: "failed",
|
|
88
89
|
failures: n.failures
|
|
89
90
|
});
|
|
90
91
|
return;
|
|
91
92
|
}
|
|
92
|
-
if (
|
|
93
|
-
await n.rollback(), Q.current &&
|
|
93
|
+
if (Ne.current) {
|
|
94
|
+
await n.rollback(), Q.current && j({
|
|
94
95
|
kind: "busy",
|
|
95
96
|
failures: []
|
|
96
97
|
});
|
|
@@ -98,52 +99,53 @@ var pe = 200, p = ({ writeAccessDenied: p = !1, onSend: m, disabled: h = !1, rea
|
|
|
98
99
|
}
|
|
99
100
|
let r = i.getState();
|
|
100
101
|
if (!(r.activeConversationId === t && (t === null || r.conversations.some((e) => e.id === t)))) {
|
|
101
|
-
await n.rollback(), Q.current &&
|
|
102
|
+
await n.rollback(), Q.current && j({
|
|
102
103
|
kind: "moved",
|
|
103
104
|
failures: []
|
|
104
105
|
});
|
|
105
106
|
return;
|
|
106
107
|
}
|
|
107
|
-
m(e, a(n.attachments)), n.handedOver(), E(""),
|
|
108
|
+
m(e, a(n.attachments)), n.handedOver(), E(""), L();
|
|
108
109
|
} finally {
|
|
109
|
-
|
|
110
|
+
k.current = !1, Q.current && Ce(!1);
|
|
110
111
|
}
|
|
111
112
|
}, [
|
|
112
113
|
Z,
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
Me,
|
|
115
|
+
R,
|
|
115
116
|
m,
|
|
116
117
|
T,
|
|
117
118
|
Y,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
]),
|
|
121
|
-
|
|
122
|
-
}, [
|
|
119
|
+
L,
|
|
120
|
+
G
|
|
121
|
+
]), Pe = s(() => {
|
|
122
|
+
z(), w.current?.focus();
|
|
123
|
+
}, [z]);
|
|
123
124
|
c(() => {
|
|
124
|
-
|
|
125
|
-
}, [
|
|
126
|
-
let
|
|
125
|
+
j(null);
|
|
126
|
+
}, [N.length]);
|
|
127
|
+
let Fe = (e) => {
|
|
127
128
|
if (e.kind === "busy") return x("attachments.saveBusy", "The assistant started another reply, so nothing was sent. Your message and files are still here.");
|
|
128
129
|
if (e.kind === "moved") return x("attachments.saveMoved", "You switched conversations while the files were being saved, so nothing was sent. Your message and files are still here.");
|
|
129
130
|
let { failures: t } = e;
|
|
131
|
+
if (t.some((e) => e.code === o.editorAccessRequired)) return ne(x, S);
|
|
130
132
|
if (t.some((e) => e.code === o.quotaExceeded || e.code === o.quotaNotProvisioned)) return `${x("attachments.quotaFull", "File storage is full or not set up for this workspace, so the attachments couldn't be saved. Nothing was sent.")} ${x("attachments.retrySend", "Press Send to try again, or remove the file.")}`;
|
|
131
|
-
let n = t[0], r =
|
|
133
|
+
let n = t[0], r = N.find((e) => e.id === n?.id)?.filename ?? "";
|
|
132
134
|
return `${t.length <= 1 ? x("attachments.saveFailedOne", "{{name}} couldn't be saved, so nothing was sent.", { name: r }) : x("attachments.saveFailedMany", "{{count}} attachments couldn't be saved, so nothing was sent.", { count: t.length })} ${x("attachments.retrySend", "Press Send to try again, or remove the file.")}`;
|
|
133
|
-
},
|
|
135
|
+
}, Ie = s((e) => {
|
|
134
136
|
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), $());
|
|
135
|
-
}, [$]),
|
|
137
|
+
}, [$]), Le = s((e) => {
|
|
136
138
|
let t = Array.from(e.clipboardData?.files ?? []);
|
|
137
|
-
t.length !== 0 && (e.preventDefault(),
|
|
138
|
-
}, [
|
|
139
|
-
Array.from(e.dataTransfer?.types ?? []).includes("Files") && (
|
|
140
|
-
}, []),
|
|
141
|
-
|
|
142
|
-
}, []), ze = s((e) => {
|
|
143
|
-
Array.from(e.dataTransfer?.types ?? []).includes("Files") && e.preventDefault();
|
|
139
|
+
t.length !== 0 && (e.preventDefault(), I(t));
|
|
140
|
+
}, [I]), Re = s((e) => {
|
|
141
|
+
Array.from(e.dataTransfer?.types ?? []).includes("Files") && (M.current += 1, D(!0));
|
|
142
|
+
}, []), ze = s(() => {
|
|
143
|
+
M.current = Math.max(0, M.current - 1), M.current === 0 && D(!1);
|
|
144
144
|
}, []), Be = s((e) => {
|
|
145
|
-
|
|
146
|
-
}, [
|
|
145
|
+
Array.from(e.dataTransfer?.types ?? []).includes("Files") && e.preventDefault();
|
|
146
|
+
}, []), Ve = s((e) => {
|
|
147
|
+
e.preventDefault(), M.current = 0, D(!1), I(e.dataTransfer?.files ?? null);
|
|
148
|
+
}, [I]), He = (e) => {
|
|
147
149
|
switch (e) {
|
|
148
150
|
case "too-many": return x("attachments.tooMany", "You can attach up to {{max}} files per message.", { max: 5 });
|
|
149
151
|
case "too-large": return x("attachments.tooLarge", "That file is larger than 10 MB.");
|
|
@@ -152,12 +154,12 @@ var pe = 200, p = ({ writeAccessDenied: p = !1, onSend: m, disabled: h = !1, rea
|
|
|
152
154
|
case "unsupported-image": return x("attachments.unsupportedImage", "This device can't read that image format, so it can't be resized to send. Save it as JPEG and try again.");
|
|
153
155
|
case "too-large-to-save": return x("attachments.tooLargeToSave", "That file is over 5 MB, so it can't be saved to Files, and no text could be read from it.");
|
|
154
156
|
}
|
|
155
|
-
},
|
|
156
|
-
switch (
|
|
157
|
+
}, Ue = (() => {
|
|
158
|
+
switch (G.error) {
|
|
157
159
|
case "not-allowed": return x("voice.denied", "Microphone access is blocked. Allow it in your browser settings to dictate.");
|
|
158
160
|
case "audio-capture": return x("voice.noMic", "No microphone was found.");
|
|
159
161
|
case "network": return x("voice.network", "Speech recognition is offline right now.");
|
|
160
|
-
case "language-not-supported": return x("voice.languageNotSupported", "This browser cannot recognise spoken {{language}}. Try a different browser, or type instead.", { language: ee(
|
|
162
|
+
case "language-not-supported": return x("voice.languageNotSupported", "This browser cannot recognise spoken {{language}}. Try a different browser, or type instead.", { language: ee(G.language, S) });
|
|
161
163
|
case "unknown": return x("voice.failed", "Dictation stopped unexpectedly.");
|
|
162
164
|
default: return null;
|
|
163
165
|
}
|
|
@@ -166,26 +168,26 @@ var pe = 200, p = ({ writeAccessDenied: p = !1, onSend: m, disabled: h = !1, rea
|
|
|
166
168
|
className: "flex-shrink-0 px-3 pb-3 pt-1.5",
|
|
167
169
|
children: [
|
|
168
170
|
/* @__PURE__ */ f("div", {
|
|
169
|
-
onDragEnter:
|
|
170
|
-
onDragLeave:
|
|
171
|
-
onDragOver:
|
|
172
|
-
onDrop:
|
|
173
|
-
className: `rounded-2xl border p-2 shadow-sm transition-colors focus-within:border-action-primary-bg focus-within:ring-2 focus-within:ring-action-primary-bg/15 ${
|
|
171
|
+
onDragEnter: Re,
|
|
172
|
+
onDragLeave: ze,
|
|
173
|
+
onDragOver: Be,
|
|
174
|
+
onDrop: Ve,
|
|
175
|
+
className: `rounded-2xl border p-2 shadow-sm transition-colors focus-within:border-action-primary-bg focus-within:ring-2 focus-within:ring-action-primary-bg/15 ${Se ? "border-action-primary-bg border-dashed bg-action-primary-bg/5" : "border-border-default bg-bg-sunken"}`,
|
|
174
176
|
"data-testid": "assistant-composer",
|
|
175
177
|
children: [
|
|
176
|
-
/* @__PURE__ */ d(
|
|
177
|
-
attachments:
|
|
178
|
-
onRemove:
|
|
179
|
-
onRetry:
|
|
178
|
+
/* @__PURE__ */ d(ie, {
|
|
179
|
+
attachments: N,
|
|
180
|
+
onRemove: Ee,
|
|
181
|
+
onRetry: De,
|
|
180
182
|
disabled: C || O,
|
|
181
|
-
preparingCount:
|
|
183
|
+
preparingCount: Te
|
|
182
184
|
}),
|
|
183
185
|
/* @__PURE__ */ f("div", {
|
|
184
186
|
className: "flex items-end gap-2",
|
|
185
187
|
children: [
|
|
186
|
-
/* @__PURE__ */ d(
|
|
187
|
-
onFiles:
|
|
188
|
-
canAddMore:
|
|
188
|
+
/* @__PURE__ */ d(re, {
|
|
189
|
+
onFiles: I,
|
|
190
|
+
canAddMore: ke,
|
|
189
191
|
disabled: C || O,
|
|
190
192
|
showLabel: !0
|
|
191
193
|
}),
|
|
@@ -193,25 +195,25 @@ var pe = 200, p = ({ writeAccessDenied: p = !1, onSend: m, disabled: h = !1, rea
|
|
|
193
195
|
ref: w,
|
|
194
196
|
value: T,
|
|
195
197
|
onChange: (e) => E(e.target.value),
|
|
196
|
-
onKeyDown:
|
|
197
|
-
onPaste:
|
|
198
|
+
onKeyDown: Ie,
|
|
199
|
+
onPaste: Le,
|
|
198
200
|
disabled: C,
|
|
199
201
|
readOnly: O,
|
|
200
202
|
"aria-busy": O || void 0,
|
|
201
|
-
placeholder:
|
|
203
|
+
placeholder: Se ? x("composer.dropHere", "Drop files to attach") : Ae,
|
|
202
204
|
rows: 1,
|
|
203
205
|
className: "min-h-[36px] flex-1 resize-none self-center bg-transparent px-1 py-2 text-[15px] leading-relaxed text-text-primary placeholder:text-text-muted focus:outline-none disabled:opacity-50",
|
|
204
206
|
"aria-label": x("chatInput.ariaLabel", "Message input"),
|
|
205
207
|
"data-testid": "assistant-input"
|
|
206
208
|
}),
|
|
207
|
-
|
|
208
|
-
isListening:
|
|
209
|
-
isStarting:
|
|
210
|
-
onToggle:
|
|
209
|
+
G.isSupported && /* @__PURE__ */ d(oe, {
|
|
210
|
+
isListening: G.isListening,
|
|
211
|
+
isStarting: G.isStarting,
|
|
212
|
+
onToggle: G.toggle,
|
|
211
213
|
disabled: C || O
|
|
212
214
|
}),
|
|
213
|
-
|
|
214
|
-
onStart:
|
|
215
|
+
g && je.length === 0 && N.length === 0 && !G.isActive ? /* @__PURE__ */ d(ce, {
|
|
216
|
+
onStart: g,
|
|
215
217
|
disabled: C || O
|
|
216
218
|
}) : /* @__PURE__ */ d("button", {
|
|
217
219
|
type: "button",
|
|
@@ -220,18 +222,18 @@ var pe = 200, p = ({ writeAccessDenied: p = !1, onSend: m, disabled: h = !1, rea
|
|
|
220
222
|
className: `flex size-9 flex-shrink-0 items-center justify-center rounded-full shadow-sm transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${Z ? "bg-action-primary-bg text-action-primary-text hover:scale-105 hover:bg-action-primary-bg-hover" : "bg-bg-elevated text-text-muted"}`,
|
|
221
223
|
"aria-label": x("chatInput.send", "Send message"),
|
|
222
224
|
"data-testid": "assistant-send",
|
|
223
|
-
children: h ||
|
|
225
|
+
children: h || we || O ? /* @__PURE__ */ d(pe, { className: "size-4 motion-safe:animate-spin" }) : /* @__PURE__ */ d(fe, { className: "size-4" })
|
|
224
226
|
})
|
|
225
227
|
]
|
|
226
228
|
}),
|
|
227
|
-
|
|
229
|
+
ve.length > 1 && /* @__PURE__ */ d("div", {
|
|
228
230
|
className: "mt-2 px-0.5",
|
|
229
|
-
children: /* @__PURE__ */ d(
|
|
230
|
-
mode:
|
|
231
|
-
availableModes:
|
|
232
|
-
onModeChange:
|
|
231
|
+
children: /* @__PURE__ */ d(ae, {
|
|
232
|
+
mode: _e,
|
|
233
|
+
availableModes: ve,
|
|
234
|
+
onModeChange: be,
|
|
233
235
|
disabled: C || O,
|
|
234
|
-
auto:
|
|
236
|
+
auto: xe
|
|
235
237
|
})
|
|
236
238
|
})
|
|
237
239
|
]
|
|
@@ -245,49 +247,49 @@ var pe = 200, p = ({ writeAccessDenied: p = !1, onSend: m, disabled: h = !1, rea
|
|
|
245
247
|
className: "mt-1.5 px-1 text-center text-[11px]",
|
|
246
248
|
"aria-live": "polite",
|
|
247
249
|
children: O ? /* @__PURE__ */ d(t, {
|
|
248
|
-
onDismiss:
|
|
250
|
+
onDismiss: Pe,
|
|
249
251
|
children: /* @__PURE__ */ f("p", {
|
|
250
252
|
className: "flex items-center justify-center gap-2 text-text-muted",
|
|
251
253
|
"data-testid": "assistant-commit-status",
|
|
252
254
|
children: [
|
|
253
|
-
/* @__PURE__ */ d(
|
|
255
|
+
/* @__PURE__ */ d(pe, {
|
|
254
256
|
className: "size-3 motion-safe:animate-spin",
|
|
255
257
|
"aria-hidden": "true"
|
|
256
258
|
}),
|
|
257
259
|
/* @__PURE__ */ d("span", { children: x("attachments.saving", "Saving your attachments…") }),
|
|
258
260
|
/* @__PURE__ */ d("button", {
|
|
259
261
|
type: "button",
|
|
260
|
-
onClick:
|
|
262
|
+
onClick: Pe,
|
|
261
263
|
className: "rounded text-text-primary underline underline-offset-2 hover:text-action-primary-bg focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong",
|
|
262
264
|
"data-testid": "assistant-commit-cancel",
|
|
263
265
|
children: x("attachments.cancelSaving", "Cancel")
|
|
264
266
|
})
|
|
265
267
|
]
|
|
266
268
|
})
|
|
267
|
-
}) :
|
|
269
|
+
}) : A ? /* @__PURE__ */ d("p", {
|
|
268
270
|
className: "text-status-error-text",
|
|
269
271
|
role: "alert",
|
|
270
272
|
"data-testid": "assistant-commit-failed",
|
|
271
|
-
children:
|
|
272
|
-
}) :
|
|
273
|
+
children: Fe(A)
|
|
274
|
+
}) : G.isStarting && !G.isListening ? /* @__PURE__ */ d("p", {
|
|
273
275
|
className: "text-text-muted",
|
|
274
276
|
"data-testid": "assistant-voice-starting",
|
|
275
277
|
children: x("voice.starting", "Starting the microphone…")
|
|
276
|
-
}) :
|
|
278
|
+
}) : G.isListening ? /* @__PURE__ */ f("p", {
|
|
277
279
|
className: "text-status-error-text",
|
|
278
280
|
"data-testid": "assistant-voice-status",
|
|
279
|
-
children: [/* @__PURE__ */ d(
|
|
280
|
-
}) :
|
|
281
|
+
children: [/* @__PURE__ */ d(se, {}), G.interim || x("voice.listening", "Listening… speak now, tap the square to stop")]
|
|
282
|
+
}) : Ue ? /* @__PURE__ */ d("p", {
|
|
281
283
|
className: "text-status-error-text",
|
|
282
284
|
"data-testid": "assistant-voice-error",
|
|
283
|
-
children:
|
|
284
|
-
}) :
|
|
285
|
+
children: Ue
|
|
286
|
+
}) : F ? /* @__PURE__ */ d("button", {
|
|
285
287
|
type: "button",
|
|
286
|
-
onClick:
|
|
288
|
+
onClick: Oe,
|
|
287
289
|
className: "text-status-error-text underline-offset-2 hover:underline",
|
|
288
290
|
"data-testid": "assistant-attachment-rejection",
|
|
289
|
-
children:
|
|
290
|
-
}) :
|
|
291
|
+
children: He(F)
|
|
292
|
+
}) : P === "failed" ? /* @__PURE__ */ d("p", {
|
|
291
293
|
className: "text-status-error-text",
|
|
292
294
|
"data-testid": "assistant-attachment-blocked",
|
|
293
295
|
children: X.length === 1 ? x("attachments.blockedOne", "{{name}} didn't upload. Retry or remove it before sending.", { name: X[0].filename }) : x("attachments.blockedMany", "{{count}} attachments didn't upload. Retry or remove them before sending.", { count: X.length })
|
|
@@ -1,41 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { useSafePermissions as e } from "../providers/shell/PermissionProvider.js";
|
|
2
|
+
import { useAssistantStorageFolders as t } from "./product.js";
|
|
3
|
+
import { FilesPortError as n, createApolloFilesPort as r } from "../../storage/filesPort.js";
|
|
4
|
+
import { createAttachmentCommitter as i } from "./attachmentCommit.js";
|
|
5
|
+
import { getActorId as a, getWorkspaceId as o } from "./context.js";
|
|
6
|
+
import { probeAttachmentAccess as s } from "./attachmentAccess.js";
|
|
7
|
+
import { createContext as c, useCallback as l, useContext as u, useEffect as d, useMemo as f, useRef as p } from "react";
|
|
8
|
+
import { getApolloContext as m } from "@apollo/client/react";
|
|
7
9
|
//#region src/shared/assistant/useAttachmentCommitter.ts
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
let e =
|
|
11
|
-
return
|
|
10
|
+
var h = c(null);
|
|
11
|
+
function g() {
|
|
12
|
+
let e = u(h), { client: t } = u(m());
|
|
13
|
+
return f(() => e ?? (t ? r(t, { getWorkspaceId: o }) : null), [e, t]);
|
|
12
14
|
}
|
|
13
|
-
function
|
|
14
|
-
let e =
|
|
15
|
-
return
|
|
15
|
+
function _() {
|
|
16
|
+
let e = g();
|
|
17
|
+
return l(async (t) => e ? e.getDownloadUrl(t) : null, [e]);
|
|
16
18
|
}
|
|
17
|
-
var
|
|
18
|
-
ensureFolder:
|
|
19
|
-
initiate:
|
|
20
|
-
put:
|
|
21
|
-
complete:
|
|
22
|
-
getSession:
|
|
23
|
-
listSessions:
|
|
24
|
-
abort:
|
|
25
|
-
getDownloadUrl:
|
|
26
|
-
deleteFile:
|
|
19
|
+
var v = (e) => () => Promise.reject(new n(e, "File storage is not available here.", void 0)), y = {
|
|
20
|
+
ensureFolder: v("ensureFolder"),
|
|
21
|
+
initiate: v("initiate"),
|
|
22
|
+
put: v("put"),
|
|
23
|
+
complete: v("complete"),
|
|
24
|
+
getSession: v("getSession"),
|
|
25
|
+
listSessions: v("listSessions"),
|
|
26
|
+
abort: v("abort"),
|
|
27
|
+
getDownloadUrl: v("getDownloadUrl"),
|
|
28
|
+
deleteFile: v("deleteFile")
|
|
27
29
|
};
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
function b() {
|
|
31
|
+
return {
|
|
32
|
+
workspaceId: typeof window < "u" && window.location ? o() : "",
|
|
33
|
+
actorId: a()
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function x(n) {
|
|
37
|
+
let r = g(), a = e()?.isSuperAdmin ?? !1, o = p(a);
|
|
38
|
+
d(() => {
|
|
39
|
+
o.current = a;
|
|
40
|
+
}, [a]);
|
|
41
|
+
let c = t(), l = p(n);
|
|
42
|
+
l.current = n;
|
|
43
|
+
let u = p(c.attachments);
|
|
44
|
+
return u.current = c.attachments, f(() => i({
|
|
45
|
+
port: r ?? y,
|
|
46
|
+
preflightAccess: () => {
|
|
47
|
+
let { workspaceId: e, actorId: t } = b();
|
|
48
|
+
return s(e, t, o.current);
|
|
49
|
+
},
|
|
50
|
+
getScopeKey: () => JSON.stringify(b()),
|
|
34
51
|
get folderPath() {
|
|
35
|
-
return
|
|
52
|
+
return u.current;
|
|
36
53
|
},
|
|
37
|
-
onChange: (e, t) =>
|
|
38
|
-
}), [
|
|
54
|
+
onChange: (e, t) => l.current(e, t)
|
|
55
|
+
}), [r]);
|
|
39
56
|
}
|
|
40
57
|
//#endregion
|
|
41
|
-
export {
|
|
58
|
+
export { h as AttachmentFilesPortContext, x as useAttachmentCommitter, g as useAttachmentFilesPort, _ as useAttachmentUrlResolver };
|