@epam/ai-dial-chat-hooks 1.3.0-dev.276 → 1.3.0-dev.282
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/attachment/attach-constraints.d.ts +31 -0
- package/attachment/attach-constraints.d.ts.map +1 -0
- package/attachment/attach-constraints.js +18 -0
- package/attachments.js +2 -1
- package/catalog/catalog-derivations.d.ts +2 -0
- package/catalog/catalog-derivations.d.ts.map +1 -1
- package/catalog/catalog-derivations.js +12 -6
- package/catalog/usage-limit-rows.d.ts +14 -0
- package/catalog/usage-limit-rows.d.ts.map +1 -0
- package/catalog/usage-limit-rows.js +19 -0
- package/catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.js +24 -24
- package/catalog.js +17 -16
- package/conversation/conversation-list.d.ts +6 -0
- package/conversation/conversation-list.d.ts.map +1 -0
- package/conversation/conversation-list.js +5 -0
- package/conversation/message-utils.d.ts +6 -0
- package/conversation/message-utils.d.ts.map +1 -1
- package/conversation/message-utils.js +14 -10
- package/conversation/useActiveConversationSync/useActiveConversationSync.d.ts +4 -2
- package/conversation/useActiveConversationSync/useActiveConversationSync.d.ts.map +1 -1
- package/conversation/useActiveConversationSync/useActiveConversationSync.js +19 -12
- package/conversation/useVisibleConversationIdsReporter/useVisibleConversationIdsReporter.d.ts +16 -0
- package/conversation/useVisibleConversationIdsReporter/useVisibleConversationIdsReporter.d.ts.map +1 -0
- package/conversation/useVisibleConversationIdsReporter/useVisibleConversationIdsReporter.js +17 -0
- package/conversation.js +35 -33
- package/entry-points/attachments.d.ts +1 -0
- package/entry-points/attachments.d.ts.map +1 -1
- package/entry-points/catalog.d.ts +1 -0
- package/entry-points/catalog.d.ts.map +1 -1
- package/entry-points/conversation.d.ts +2 -0
- package/entry-points/conversation.d.ts.map +1 -1
- package/entry-points/file-manager.d.ts +1 -0
- package/entry-points/file-manager.d.ts.map +1 -1
- package/entry-points/offline-credentials.d.ts +1 -0
- package/entry-points/offline-credentials.d.ts.map +1 -1
- package/file-manager-canvas.js +3 -3
- package/file-manager.js +32 -31
- package/files/attachment-canvas.d.ts +12 -0
- package/files/attachment-canvas.d.ts.map +1 -1
- package/files/attachment-canvas.js +18 -10
- package/files/dial-file.d.ts +17 -0
- package/files/dial-file.d.ts.map +1 -1
- package/files/dial-file.js +20 -12
- package/files/useDialFileListing/useDialFileListing.js +111 -111
- package/files/useDialFileMutations/useDialFileMutations.js +22 -22
- package/files/useUnshareConfirmationState/useUnshareConfirmationState.d.ts +23 -0
- package/files/useUnshareConfirmationState/useUnshareConfirmationState.d.ts.map +1 -0
- package/files/useUnshareConfirmationState/useUnshareConfirmationState.js +18 -0
- package/index.d.ts +6 -0
- package/index.d.ts.map +1 -1
- package/index.js +204 -197
- package/oauth/toolset-id.d.ts +7 -0
- package/oauth/toolset-id.d.ts.map +1 -1
- package/oauth/toolset-id.js +9 -2
- package/oauth.js +8 -8
- package/offline-credentials/scheduled-tasks-login-banner.d.ts +31 -0
- package/offline-credentials/scheduled-tasks-login-banner.d.ts.map +1 -0
- package/offline-credentials/scheduled-tasks-login-banner.js +17 -0
- package/offline-credentials.js +3 -2
- package/package.json +18 -18
- package/project/use-project-actions.d.ts +1 -2
- package/project/use-project-actions.d.ts.map +1 -1
- package/project/use-project-actions.js +7 -20
- package/scheduled-task/scheduled-task-trigger.d.ts.map +1 -1
- package/scheduled-task/scheduled-task-trigger.js +7 -8
- package/shared/external-services.d.ts +1 -1
- package/shared/usage-stat.d.ts +3 -0
- package/shared/usage-stat.d.ts.map +1 -0
- package/shared/usage-stat.js +4 -0
- package/usage/usage-banner-source.d.ts +2 -2
- package/usage/usage-banner-source.d.ts.map +1 -1
- package/usage/usage-banner-source.js +19 -18
- package/usage-limits.js +4 -3
- package/useChatSettingsFormConfig/useChatSettingsFormConfig.d.ts +2 -0
- package/useChatSettingsFormConfig/useChatSettingsFormConfig.d.ts.map +1 -1
- package/useChatSettingsFormConfig/useChatSettingsFormConfig.js +25 -21
|
@@ -5,61 +5,61 @@ import { virtualPathToApiPath as o } from "../resolve-dial-file-api-path.js";
|
|
|
5
5
|
import { buildFromCache as ee, buildSharedSearchScope as s, fetchByTab as c, fetchForSearch as te, mapCorePermissions as ne, mapSearchItem as l, mergeCreatedFolderIntoCache as re } from "../dial-file-manager-mapping.util.js";
|
|
6
6
|
import { getParentFolderPath as ie } from "@epam/ai-dial-chat-shared";
|
|
7
7
|
import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
8
|
-
import { ListFilesItemDtoNodeTypeEnum as ae } from "@epam/ai-dial-chat-api-client";
|
|
9
8
|
import { NotificationVariant as h } from "@epam/ai-dial-ui-kit";
|
|
10
|
-
import {
|
|
9
|
+
import { ListFilesItemDtoNodeTypeEnum as g } from "@epam/ai-dial-chat-api-client";
|
|
10
|
+
import { DialFileManagerTabs as _, DialFileNodeType as ae } from "@epam/ai-dial-react-file-manager";
|
|
11
11
|
//#region src/files/useDialFileListing/useDialFileListing.ts
|
|
12
|
-
var
|
|
13
|
-
let [
|
|
12
|
+
var v = ({ filesApi: v, bucket: y, rootLabel: b, activeTab: x, onNotification: S, isActive: C = !0, sessionKey: oe }) => {
|
|
13
|
+
let [w, T] = m(""), [E, D] = m(() => /* @__PURE__ */ new Map()), O = p(E);
|
|
14
14
|
d(() => {
|
|
15
|
-
|
|
16
|
-
}, [
|
|
17
|
-
let [
|
|
18
|
-
|
|
19
|
-
let [
|
|
15
|
+
O.current = E;
|
|
16
|
+
}, [E]);
|
|
17
|
+
let [k, A] = m(() => /* @__PURE__ */ new Map()), [se, j] = m(C), [ce, le] = m(C);
|
|
18
|
+
ce !== C && (le(C), j(C));
|
|
19
|
+
let [ue, de] = m(null), [M, N] = m(0), [P, F] = m(void 0), [fe, I] = m(() => /* @__PURE__ */ new Set()), L = p(/* @__PURE__ */ new Map()), [pe, R] = m(!1), [me, z] = m(null), B = p(null), V = p(null), H = p(/* @__PURE__ */ new Set()), U = p(/* @__PURE__ */ new Set()), [W, G] = m(() => /* @__PURE__ */ new Set()), [he, K] = m(() => /* @__PURE__ */ new Set()), [q, J] = m(() => /* @__PURE__ */ new Set()), Y = `${x}|${oe ?? ""}`, X = p(Y);
|
|
20
20
|
d(() => {
|
|
21
|
-
X.current !== Y && (X.current = Y,
|
|
21
|
+
X.current !== Y && (X.current = Y, D(/* @__PURE__ */ new Map()), A(/* @__PURE__ */ new Map()), T(""), F(void 0), L.current = /* @__PURE__ */ new Map(), H.current = /* @__PURE__ */ new Set(), U.current = /* @__PURE__ */ new Set(), K(/* @__PURE__ */ new Set()), J(/* @__PURE__ */ new Set()), B.current != null && (clearTimeout(B.current), B.current = null), V.current?.(), V.current = null, z(null), R(!1), G(/* @__PURE__ */ new Set()), N((e) => e + 1));
|
|
22
22
|
}, [Y]), d(() => () => {
|
|
23
23
|
B.current != null && clearTimeout(B.current), V.current?.();
|
|
24
24
|
}, []), d(() => {
|
|
25
|
-
if (!
|
|
26
|
-
|
|
25
|
+
if (!C) {
|
|
26
|
+
j(!1);
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
let t = !1;
|
|
30
|
-
return
|
|
31
|
-
t || (
|
|
30
|
+
return j(!0), de(null), c(v, x, y, w, L.current).then(({ items: e, permissions: n }) => {
|
|
31
|
+
t || (D((t) => {
|
|
32
32
|
let n = new Map(t);
|
|
33
|
-
return n.set(
|
|
34
|
-
}),
|
|
33
|
+
return n.set(w, e), n;
|
|
34
|
+
}), A((e) => new Map(e).set(w, n)), x === _.Shared && w === "" && (F(e.map((e) => e.nodeType === g.Folder ? `/${b}/${e.name}/` : `/${b}/${e.name}`)), L.current = new Map(e.map((e) => [e.name, {
|
|
35
35
|
bucket: e.bucket ?? "",
|
|
36
36
|
dialCorePath: e.path
|
|
37
37
|
}]))));
|
|
38
38
|
}).catch((n) => {
|
|
39
|
-
t || (
|
|
39
|
+
t || (w !== "" && e(n) === 404 ? T(ie(w)) : de("dialFileManager.error"));
|
|
40
40
|
}).finally(() => {
|
|
41
|
-
t ||
|
|
41
|
+
t || j(!1);
|
|
42
42
|
}), () => {
|
|
43
43
|
t = !0;
|
|
44
44
|
};
|
|
45
45
|
}, [
|
|
46
|
-
|
|
46
|
+
x,
|
|
47
|
+
y,
|
|
47
48
|
v,
|
|
48
|
-
|
|
49
|
+
w,
|
|
49
50
|
C,
|
|
50
|
-
S,
|
|
51
51
|
M,
|
|
52
|
-
|
|
52
|
+
b
|
|
53
53
|
]), d(() => {
|
|
54
|
-
if (!
|
|
54
|
+
if (!C || x !== _.MyFiles) {
|
|
55
55
|
I(/* @__PURE__ */ new Set());
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
58
|
let e = !1;
|
|
59
|
-
return
|
|
59
|
+
return v.listSharedByMe(y).then((t) => {
|
|
60
60
|
e || I(new Set(t.items.map((e) => {
|
|
61
|
-
let t = r(e.path,
|
|
62
|
-
return n(t,
|
|
61
|
+
let t = r(e.path, y);
|
|
62
|
+
return n(t, b, e.nodeType === g.Folder);
|
|
63
63
|
})));
|
|
64
64
|
}).catch(() => {
|
|
65
65
|
e || I(/* @__PURE__ */ new Set());
|
|
@@ -67,35 +67,35 @@ var _ = ({ filesApi: _, bucket: v, rootLabel: y, activeTab: b, onNotification: x
|
|
|
67
67
|
e = !0;
|
|
68
68
|
};
|
|
69
69
|
}, [
|
|
70
|
-
|
|
70
|
+
x,
|
|
71
|
+
y,
|
|
71
72
|
v,
|
|
72
|
-
|
|
73
|
-
S,
|
|
73
|
+
C,
|
|
74
74
|
M,
|
|
75
|
-
|
|
75
|
+
b
|
|
76
76
|
]);
|
|
77
77
|
let Z = f(() => [{
|
|
78
|
-
id:
|
|
79
|
-
name:
|
|
80
|
-
path: `/${
|
|
78
|
+
id: y,
|
|
79
|
+
name: b,
|
|
80
|
+
path: `/${b}`,
|
|
81
81
|
parentPath: "",
|
|
82
|
-
nodeType:
|
|
83
|
-
folderId:
|
|
84
|
-
permissions: ne(
|
|
85
|
-
items: ee(
|
|
82
|
+
nodeType: ae.FOLDER,
|
|
83
|
+
folderId: y,
|
|
84
|
+
permissions: ne(k.get("")),
|
|
85
|
+
items: ee(E, k, "", `/${b}`, y)
|
|
86
86
|
}], [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
E,
|
|
88
|
+
k,
|
|
89
|
+
b,
|
|
90
|
+
y
|
|
91
91
|
]), ge = u((e) => {
|
|
92
92
|
if (e == null) {
|
|
93
|
-
|
|
93
|
+
T("");
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
|
-
let t = `/${
|
|
97
|
-
if (e === `/${
|
|
98
|
-
|
|
96
|
+
let t = `/${b}/`, n = `${b}/`;
|
|
97
|
+
if (e === `/${b}` || e === t || e === b || e === n) {
|
|
98
|
+
T("");
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
101
|
let r;
|
|
@@ -105,25 +105,25 @@ var _ = ({ filesApi: _, bucket: v, rootLabel: y, activeTab: b, onNotification: x
|
|
|
105
105
|
let t = e.replace(/^\//, "");
|
|
106
106
|
r = t.startsWith(n) ? t.slice(n.length) : t;
|
|
107
107
|
}
|
|
108
|
-
|
|
109
|
-
}, [
|
|
108
|
+
T(r && !r.endsWith("/") ? `${r}/` : r);
|
|
109
|
+
}, [b]), Q = u(() => {
|
|
110
110
|
N((e) => e + 1);
|
|
111
111
|
}, []), _e = Q, ve = u((e) => {
|
|
112
112
|
if (e.length === 0) return;
|
|
113
|
-
let n = new Set([...W].map((e) => o(e,
|
|
114
|
-
i.length > 0 && (
|
|
113
|
+
let n = new Set([...W].map((e) => o(e, b))), r = (e) => e === w || w.startsWith(e) || n.has(e), i = e.filter((e) => !r(e)), a = e.filter((e) => r(e) && e !== w);
|
|
114
|
+
i.length > 0 && (D((e) => {
|
|
115
115
|
let t = new Map(e);
|
|
116
116
|
return i.forEach((e) => t.delete(e)), t;
|
|
117
|
-
}),
|
|
117
|
+
}), A((e) => {
|
|
118
118
|
let t = new Map(e);
|
|
119
119
|
return i.forEach((e) => t.delete(e)), t;
|
|
120
120
|
})), a.forEach((e) => {
|
|
121
121
|
(async () => {
|
|
122
122
|
try {
|
|
123
|
-
let { items: t, permissions: n } = await c(
|
|
124
|
-
|
|
123
|
+
let { items: t, permissions: n } = await c(v, x, y, e, L.current);
|
|
124
|
+
D((n) => new Map(n).set(e, t)), n != null && A((t) => new Map(t).set(e, n));
|
|
125
125
|
} catch {
|
|
126
|
-
|
|
126
|
+
S?.({
|
|
127
127
|
variant: h.Error,
|
|
128
128
|
reason: t.FolderLoadFailed
|
|
129
129
|
});
|
|
@@ -131,32 +131,32 @@ var _ = ({ filesApi: _, bucket: v, rootLabel: y, activeTab: b, onNotification: x
|
|
|
131
131
|
})();
|
|
132
132
|
});
|
|
133
133
|
}, [
|
|
134
|
-
|
|
134
|
+
x,
|
|
135
|
+
y,
|
|
135
136
|
v,
|
|
136
|
-
|
|
137
|
-
C,
|
|
137
|
+
w,
|
|
138
138
|
W,
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
b,
|
|
140
|
+
S
|
|
141
141
|
]), ye = u((e, t, n) => {
|
|
142
|
-
|
|
142
|
+
D((r) => re(r, e, t, n));
|
|
143
143
|
}, []), be = u((e) => {
|
|
144
144
|
if (e.length === 0) return;
|
|
145
145
|
let t = new Set(e);
|
|
146
|
-
|
|
146
|
+
D((e) => {
|
|
147
147
|
let n = e.get("");
|
|
148
148
|
if (n == null) return e;
|
|
149
149
|
let r = new Map(e);
|
|
150
150
|
return r.set("", n.filter((e) => !t.has(e.name))), r;
|
|
151
|
-
}), F((t) => t?.filter((t) => !e.some((e) => t === `/${
|
|
152
|
-
}, [
|
|
153
|
-
if (!
|
|
154
|
-
let n = e == null ? "" : o(e,
|
|
151
|
+
}), F((t) => t?.filter((t) => !e.some((e) => t === `/${b}/${e}`)));
|
|
152
|
+
}, [b]), xe = u((e) => {
|
|
153
|
+
if (!C) return;
|
|
154
|
+
let n = e == null ? "" : o(e, b), r = e ?? `/${b}`;
|
|
155
155
|
J((e) => {
|
|
156
156
|
if (e.has(r)) return e;
|
|
157
157
|
let t = new Set(e);
|
|
158
158
|
return t.add(r), t;
|
|
159
|
-
}), !
|
|
159
|
+
}), !O.current.has(n) && (H.current.has(n) ? K((e) => {
|
|
160
160
|
let t = new Set(e);
|
|
161
161
|
return t.add(r), t;
|
|
162
162
|
}) : (H.current.add(n), K((e) => {
|
|
@@ -164,10 +164,10 @@ var _ = ({ filesApi: _, bucket: v, rootLabel: y, activeTab: b, onNotification: x
|
|
|
164
164
|
return t.add(r), t;
|
|
165
165
|
}), (async () => {
|
|
166
166
|
try {
|
|
167
|
-
let { items: e, permissions: t } = await c(
|
|
168
|
-
|
|
167
|
+
let { items: e, permissions: t } = await c(v, x, y, n, L.current);
|
|
168
|
+
D((t) => new Map(t).set(n, e)), t != null && A((e) => new Map(e).set(n, t)), U.current.delete(n);
|
|
169
169
|
} catch {
|
|
170
|
-
|
|
170
|
+
S?.({
|
|
171
171
|
variant: h.Error,
|
|
172
172
|
reason: t.FolderLoadFailed
|
|
173
173
|
});
|
|
@@ -179,38 +179,38 @@ var _ = ({ filesApi: _, bucket: v, rootLabel: y, activeTab: b, onNotification: x
|
|
|
179
179
|
}
|
|
180
180
|
})()));
|
|
181
181
|
}, [
|
|
182
|
-
|
|
182
|
+
x,
|
|
183
|
+
y,
|
|
183
184
|
v,
|
|
184
|
-
|
|
185
|
+
C,
|
|
185
186
|
S,
|
|
186
|
-
|
|
187
|
-
y
|
|
187
|
+
b
|
|
188
188
|
]), Se = f(() => {
|
|
189
189
|
let e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set([...W, ...q]);
|
|
190
190
|
for (let n of t) {
|
|
191
|
-
let t = o(n,
|
|
192
|
-
|
|
191
|
+
let t = o(n, b);
|
|
192
|
+
E.has(t) && e.add(n);
|
|
193
193
|
}
|
|
194
194
|
return e;
|
|
195
195
|
}, [
|
|
196
196
|
W,
|
|
197
197
|
q,
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
E,
|
|
199
|
+
b
|
|
200
200
|
]), Ce = u((e) => {
|
|
201
|
-
|
|
202
|
-
e.has(t) || U.current.delete(o(t,
|
|
201
|
+
C && (W.forEach((t) => {
|
|
202
|
+
e.has(t) || U.current.delete(o(t, b));
|
|
203
203
|
}), G(e), [...e].filter((e) => {
|
|
204
|
-
let t = o(e,
|
|
205
|
-
return !
|
|
204
|
+
let t = o(e, b);
|
|
205
|
+
return !O.current.has(t) && !H.current.has(t) && !U.current.has(t);
|
|
206
206
|
}).forEach((e) => {
|
|
207
|
-
let n = o(e,
|
|
207
|
+
let n = o(e, b);
|
|
208
208
|
H.current.add(n), (async () => {
|
|
209
209
|
try {
|
|
210
|
-
let { items: e, permissions: t } = await c(
|
|
211
|
-
|
|
210
|
+
let { items: e, permissions: t } = await c(v, x, y, n, L.current);
|
|
211
|
+
D((t) => new Map(t).set(n, e)), t != null && A((e) => new Map(e).set(n, t));
|
|
212
212
|
} catch {
|
|
213
|
-
U.current.add(n),
|
|
213
|
+
U.current.add(n), S?.({
|
|
214
214
|
variant: h.Error,
|
|
215
215
|
reason: t.FolderLoadFailed
|
|
216
216
|
});
|
|
@@ -223,21 +223,21 @@ var _ = ({ filesApi: _, bucket: v, rootLabel: y, activeTab: b, onNotification: x
|
|
|
223
223
|
})();
|
|
224
224
|
}));
|
|
225
225
|
}, [
|
|
226
|
-
|
|
226
|
+
x,
|
|
227
|
+
y,
|
|
227
228
|
v,
|
|
228
|
-
_,
|
|
229
229
|
W,
|
|
230
|
+
C,
|
|
230
231
|
S,
|
|
231
|
-
|
|
232
|
-
y
|
|
232
|
+
b
|
|
233
233
|
]), we = u(() => {
|
|
234
234
|
B.current != null && (clearTimeout(B.current), B.current = null), V.current?.(), V.current = null, z(null), R(!1);
|
|
235
235
|
}, []), Te = u((e, t) => {
|
|
236
|
-
|
|
237
|
-
if (B.current = null,
|
|
236
|
+
C && (B.current != null && (clearTimeout(B.current), B.current = null), V.current?.(), V.current = null, t.trim() ? B.current = setTimeout(() => {
|
|
237
|
+
if (B.current = null, x === _.Shared && w === "") {
|
|
238
238
|
V.current?.(), V.current = null, R(!0);
|
|
239
|
-
let e =
|
|
240
|
-
z(e.map((e) => l(e, e.bucket ??
|
|
239
|
+
let e = E.get("") ?? [], t = s(b, "", /* @__PURE__ */ new Map());
|
|
240
|
+
z(e.map((e) => l(e, e.bucket ?? y, b, t))), R(!1);
|
|
241
241
|
return;
|
|
242
242
|
}
|
|
243
243
|
let e = !1;
|
|
@@ -245,10 +245,10 @@ var _ = ({ filesApi: _, bucket: v, rootLabel: y, activeTab: b, onNotification: x
|
|
|
245
245
|
e = !0;
|
|
246
246
|
}, R(!0), (async () => {
|
|
247
247
|
try {
|
|
248
|
-
let { items: t } = await te(
|
|
248
|
+
let { items: t } = await te(v, x, y, w, L.current);
|
|
249
249
|
if (e) return;
|
|
250
|
-
let n =
|
|
251
|
-
z(t.map((e) => l(e, e.bucket ??
|
|
250
|
+
let n = x === _.Shared ? s(b, w, L.current) : void 0;
|
|
251
|
+
z(t.map((e) => l(e, e.bucket ?? y, b, n)));
|
|
252
252
|
} catch {
|
|
253
253
|
e || z([]);
|
|
254
254
|
} finally {
|
|
@@ -257,27 +257,27 @@ var _ = ({ filesApi: _, bucket: v, rootLabel: y, activeTab: b, onNotification: x
|
|
|
257
257
|
})();
|
|
258
258
|
}, 300) : (z(null), R(!1)));
|
|
259
259
|
}, [
|
|
260
|
-
|
|
260
|
+
x,
|
|
261
|
+
y,
|
|
262
|
+
E,
|
|
261
263
|
v,
|
|
262
|
-
|
|
263
|
-
_,
|
|
264
|
+
w,
|
|
264
265
|
C,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
]), $ = C ? `/${y}/${C}` : `/${y}`, Ee = f(() => {
|
|
266
|
+
b
|
|
267
|
+
]), $ = w ? `/${b}/${w}` : `/${b}`, Ee = f(() => {
|
|
268
268
|
let e = Z[0];
|
|
269
|
-
if (e) return a($) === a(`/${
|
|
269
|
+
if (e) return a($) === a(`/${b}`) ? e : i(e.items ?? [], $);
|
|
270
270
|
}, [
|
|
271
271
|
Z,
|
|
272
272
|
$,
|
|
273
|
-
|
|
273
|
+
b
|
|
274
274
|
]);
|
|
275
275
|
return {
|
|
276
276
|
items: Z,
|
|
277
|
-
isLoading:
|
|
278
|
-
error:
|
|
277
|
+
isLoading: se,
|
|
278
|
+
error: ue,
|
|
279
279
|
path: $,
|
|
280
|
-
folderPath:
|
|
280
|
+
folderPath: w,
|
|
281
281
|
onPathChange: ge,
|
|
282
282
|
retry: Q,
|
|
283
283
|
onSearchFiles: Te,
|
|
@@ -289,13 +289,13 @@ var _ = ({ filesApi: _, bucket: v, rootLabel: y, activeTab: b, onNotification: x
|
|
|
289
289
|
onExpandedPathsChange: Ce,
|
|
290
290
|
onFolderPopupPathChange: xe,
|
|
291
291
|
folderPopupLoadingPaths: he,
|
|
292
|
-
sharedWithMeIds: f(() =>
|
|
292
|
+
sharedWithMeIds: f(() => x === _.Shared ? P : void 0, [x, P]),
|
|
293
293
|
sharedByMePaths: fe,
|
|
294
294
|
currentFolder: Ee,
|
|
295
|
-
cache:
|
|
296
|
-
listingPermissionsCache:
|
|
295
|
+
cache: E,
|
|
296
|
+
listingPermissionsCache: k,
|
|
297
297
|
sharedRootMetaRef: L,
|
|
298
|
-
setFolderPath:
|
|
298
|
+
setFolderPath: T,
|
|
299
299
|
invalidateFolders: ve,
|
|
300
300
|
mergeCreatedFolder: ye,
|
|
301
301
|
bumpRetry: _e,
|
|
@@ -303,4 +303,4 @@ var _ = ({ filesApi: _, bucket: v, rootLabel: y, activeTab: b, onNotification: x
|
|
|
303
303
|
};
|
|
304
304
|
};
|
|
305
305
|
//#endregion
|
|
306
|
-
export {
|
|
306
|
+
export { v as useDialFileListing };
|
|
@@ -9,8 +9,8 @@ import { DownloadDestinationType as g } from "../download-destination.js";
|
|
|
9
9
|
import { createDownloadResponseError as _, estimateArchiveSize as v, getContentLength as y, getDownloadPercent as b, withDownloadProgress as ee } from "../download-progress.js";
|
|
10
10
|
import { FileDownloadStatus as x, getParentFolderPath as S, isDownloadInProgress as te } from "@epam/ai-dial-chat-shared";
|
|
11
11
|
import { useCallback as C, useEffect as ne, useRef as w, useState as T } from "react";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import { NOT_ALLOWED_SYMBOLS as re, NotificationVariant as E } from "@epam/ai-dial-ui-kit";
|
|
13
|
+
import { ArchiveItemDtoNodeTypeEnum as ie, CopyItemDtoNodeTypeEnum as ae, DeleteItemDtoNodeTypeEnum as D, MoveItemDtoNodeTypeEnum as oe, RenameItemDtoNodeTypeEnum as se } from "@epam/ai-dial-chat-api-client";
|
|
14
14
|
import { DialFileManagerTabs as ce, DialFileNodeType as O } from "@epam/ai-dial-react-file-manager";
|
|
15
15
|
//#region src/files/useDialFileMutations/useDialFileMutations.ts
|
|
16
16
|
var k = 0, le = () => (k += 1, `download-${Date.now()}-${k}`), A = ({ filesApi: k, bucket: A, rootLabel: j, activeTab: M, folderPath: N, currentFolder: P, sharedRootMetaRef: F, listingPermissionsCache: ue, invalidateFolders: I, bumpRetry: L, mergeCreatedFolder: de, setFolderPath: R, onNotification: z, onOperationSuccess: B, downloadDestination: V, forbiddenSymbolsRegExp: H }) => {
|
|
@@ -19,7 +19,7 @@ var k = 0, le = () => (k += 1, `download-${Date.now()}-${k}`), A = ({ filesApi:
|
|
|
19
19
|
if (!e || e.trim() === "") r = { reason: n.Empty };
|
|
20
20
|
else if (s(e, H)) r = {
|
|
21
21
|
reason: n.ForbiddenSymbols,
|
|
22
|
-
symbols:
|
|
22
|
+
symbols: re
|
|
23
23
|
};
|
|
24
24
|
else if (e === i) r = { reason: n.ReservedName };
|
|
25
25
|
else if (e.length > 255) r = {
|
|
@@ -60,7 +60,7 @@ var k = 0, le = () => (k += 1, `download-${Date.now()}-${k}`), A = ({ filesApi:
|
|
|
60
60
|
});
|
|
61
61
|
} catch {
|
|
62
62
|
z?.({
|
|
63
|
-
variant:
|
|
63
|
+
variant: E.Error,
|
|
64
64
|
reason: t.FolderCreateFailed
|
|
65
65
|
});
|
|
66
66
|
} finally {
|
|
@@ -113,7 +113,7 @@ var k = 0, le = () => (k += 1, `download-${Date.now()}-${k}`), A = ({ filesApi:
|
|
|
113
113
|
o = await V.resolveDestination(i, n ? e[0].contentType ?? "application/octet-stream" : "application/zip");
|
|
114
114
|
} catch {
|
|
115
115
|
z?.({
|
|
116
|
-
variant:
|
|
116
|
+
variant: E.Error,
|
|
117
117
|
reason: a
|
|
118
118
|
});
|
|
119
119
|
return;
|
|
@@ -141,7 +141,7 @@ var k = 0, le = () => (k += 1, `download-${Date.now()}-${k}`), A = ({ filesApi:
|
|
|
141
141
|
bucket: e.bucket ?? A,
|
|
142
142
|
path: u(e, e.bucket ?? A, j),
|
|
143
143
|
name: e.name,
|
|
144
|
-
nodeType: e.nodeType === O.FOLDER ?
|
|
144
|
+
nodeType: e.nodeType === O.FOLDER ? ie.Folder : ie.Item
|
|
145
145
|
}));
|
|
146
146
|
if (t = await k.downloadArchive(n, c.signal), !t.ok) throw _(t);
|
|
147
147
|
a = v(e.map((e) => ({
|
|
@@ -174,7 +174,7 @@ var k = 0, le = () => (k += 1, `download-${Date.now()}-${k}`), A = ({ filesApi:
|
|
|
174
174
|
status: x.Failed,
|
|
175
175
|
failureReason: t
|
|
176
176
|
}), z?.({
|
|
177
|
-
variant:
|
|
177
|
+
variant: E.Error,
|
|
178
178
|
reason: a
|
|
179
179
|
});
|
|
180
180
|
} finally {
|
|
@@ -210,13 +210,13 @@ var k = 0, le = () => (k += 1, `download-${Date.now()}-${k}`), A = ({ filesApi:
|
|
|
210
210
|
bucket: s,
|
|
211
211
|
path: c,
|
|
212
212
|
name: a,
|
|
213
|
-
nodeType: t ?
|
|
213
|
+
nodeType: t ? D.Folder : D.Item
|
|
214
214
|
};
|
|
215
215
|
});
|
|
216
216
|
try {
|
|
217
217
|
let { results: e } = await k.deleteFiles(i), r = e.filter((e) => !e.success), a = r.length, o = e.length - a, s = e.find((e) => e.success), c = i.find((e) => e.path === s?.path) ?? i[0];
|
|
218
218
|
if (o > 0 && z?.({
|
|
219
|
-
variant:
|
|
219
|
+
variant: E.Success,
|
|
220
220
|
reason: t.FilesDeleted,
|
|
221
221
|
count: o,
|
|
222
222
|
name: c?.name,
|
|
@@ -224,7 +224,7 @@ var k = 0, le = () => (k += 1, `download-${Date.now()}-${k}`), A = ({ filesApi:
|
|
|
224
224
|
}), a > 0) {
|
|
225
225
|
let e = r.slice(0, 3).map((e) => i.find((t) => t.path === e.path)?.name ?? e.path), n = a - e.length;
|
|
226
226
|
z?.({
|
|
227
|
-
variant:
|
|
227
|
+
variant: E.Error,
|
|
228
228
|
reason: t.FilesDeletePartiallyFailed,
|
|
229
229
|
names: e,
|
|
230
230
|
restCount: n
|
|
@@ -232,12 +232,12 @@ var k = 0, le = () => (k += 1, `download-${Date.now()}-${k}`), A = ({ filesApi:
|
|
|
232
232
|
}
|
|
233
233
|
} catch {
|
|
234
234
|
z?.({
|
|
235
|
-
variant:
|
|
235
|
+
variant: E.Error,
|
|
236
236
|
reason: t.DeleteFailed
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
I([...new Set(i.map((e) => {
|
|
240
|
-
if (e.nodeType ===
|
|
240
|
+
if (e.nodeType === D.Folder) return e.path.endsWith("/") ? e.path : `${e.path}/`;
|
|
241
241
|
let t = e.path.lastIndexOf("/");
|
|
242
242
|
return t > 0 ? e.path.slice(0, t + 1) : "";
|
|
243
243
|
}))]);
|
|
@@ -261,7 +261,7 @@ var k = 0, le = () => (k += 1, `download-${Date.now()}-${k}`), A = ({ filesApi:
|
|
|
261
261
|
if (t === i || a !== "" && t === `${i}${a}`) return { reason: n.ReservedName };
|
|
262
262
|
if (s(t, H)) return {
|
|
263
263
|
reason: n.ForbiddenSymbols,
|
|
264
|
-
symbols:
|
|
264
|
+
symbols: re
|
|
265
265
|
};
|
|
266
266
|
if (t.length > 255) return {
|
|
267
267
|
reason: n.TooLong,
|
|
@@ -286,21 +286,21 @@ var k = 0, le = () => (k += 1, `download-${Date.now()}-${k}`), A = ({ filesApi:
|
|
|
286
286
|
kind: c,
|
|
287
287
|
name: t?.destinationName,
|
|
288
288
|
count: l,
|
|
289
|
-
isFolder: t?.dto.nodeType ===
|
|
289
|
+
isFolder: t?.dto.nodeType === ae.Folder,
|
|
290
290
|
destinationFolderName: a(n, j)
|
|
291
291
|
});
|
|
292
292
|
}
|
|
293
293
|
c > 0 && c < e.length ? z?.({
|
|
294
|
-
variant:
|
|
294
|
+
variant: E.Error,
|
|
295
295
|
reason: t.CopyPartiallyFailed,
|
|
296
296
|
count: c
|
|
297
297
|
}) : c === e.length && z?.({
|
|
298
|
-
variant:
|
|
298
|
+
variant: E.Error,
|
|
299
299
|
reason: t.CopyFailed
|
|
300
300
|
});
|
|
301
301
|
} catch {
|
|
302
302
|
i.signal.aborted || z?.({
|
|
303
|
-
variant:
|
|
303
|
+
variant: E.Error,
|
|
304
304
|
reason: t.CopyFailed
|
|
305
305
|
});
|
|
306
306
|
} finally {
|
|
@@ -385,7 +385,7 @@ var k = 0, le = () => (k += 1, `download-${Date.now()}-${k}`), A = ({ filesApi:
|
|
|
385
385
|
kind: g === 1 ? r.FileMoved : r.FilesMoved,
|
|
386
386
|
name: e?.destinationName,
|
|
387
387
|
count: g,
|
|
388
|
-
isFolder: e?.dto.nodeType ===
|
|
388
|
+
isFolder: e?.dto.nodeType === oe.Folder,
|
|
389
389
|
destinationFolderName: a(i, j)
|
|
390
390
|
});
|
|
391
391
|
}
|
|
@@ -394,18 +394,18 @@ var k = 0, le = () => (k += 1, `download-${Date.now()}-${k}`), A = ({ filesApi:
|
|
|
394
394
|
B?.({
|
|
395
395
|
kind: r.FileRenamed,
|
|
396
396
|
name: o(e.destinationPath, e.destinationPath),
|
|
397
|
-
isFolder: e.nodeType ===
|
|
397
|
+
isFolder: e.nodeType === se.Folder
|
|
398
398
|
});
|
|
399
399
|
}
|
|
400
400
|
v > 0 && (v === _ ? z?.({
|
|
401
|
-
variant:
|
|
401
|
+
variant: E.Error,
|
|
402
402
|
reason: y ? t.MoveFailed : t.RenameFailed
|
|
403
403
|
}) : z?.({
|
|
404
|
-
variant:
|
|
404
|
+
variant: E.Error,
|
|
405
405
|
reason: y ? t.MovePartiallyFailed : t.RenamePartiallyFailed,
|
|
406
406
|
count: v
|
|
407
407
|
}));
|
|
408
|
-
let b = s.find((t) => t.nodeType ===
|
|
408
|
+
let b = s.find((t) => t.nodeType === se.Folder && e.results.some((e) => e.success && e.sourcePath === t.sourcePath));
|
|
409
409
|
if (b != null) {
|
|
410
410
|
let e = b.sourcePath.endsWith("/") ? b.sourcePath : `${b.sourcePath}/`;
|
|
411
411
|
if (N === e || N.startsWith(e)) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DialFile } from '@epam/ai-dial-react-file-manager';
|
|
2
|
+
/** The part of a file-manager controller whose unshare action is held back. */
|
|
3
|
+
export interface UnshareConfirmationController {
|
|
4
|
+
/** Unshares shared-with-me items at once. */
|
|
5
|
+
onUnshareFiles: (files: DialFile[]) => void;
|
|
6
|
+
}
|
|
7
|
+
/** Return value of `useUnshareConfirmationState`. */
|
|
8
|
+
export interface UnshareConfirmationState<T extends UnshareConfirmationController> {
|
|
9
|
+
/** The controller with `onUnshareFiles` replaced by a request that waits for `confirm`. */
|
|
10
|
+
controller: T;
|
|
11
|
+
/** Items waiting for confirmation, or `null` when no confirmation is open. */
|
|
12
|
+
pendingItems: DialFile[] | null;
|
|
13
|
+
/** Unshares the pending items with the original `onUnshareFiles` and closes the confirmation. */
|
|
14
|
+
confirm: () => void;
|
|
15
|
+
/** Closes the confirmation without unsharing. */
|
|
16
|
+
cancel: () => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Holds back a file-manager controller's unshare action until the user
|
|
20
|
+
* confirms; the host renders a confirmation while `pendingItems` is set.
|
|
21
|
+
*/
|
|
22
|
+
export declare const useUnshareConfirmationState: <T extends UnshareConfirmationController>(controller: T) => UnshareConfirmationState<T>;
|
|
23
|
+
//# sourceMappingURL=useUnshareConfirmationState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUnshareConfirmationState.d.ts","sourceRoot":"","sources":["../../../src/files/useUnshareConfirmationState/useUnshareConfirmationState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAGjE,+EAA+E;AAC/E,MAAM,WAAW,6BAA6B;IAC5C,6CAA6C;IAC7C,cAAc,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;CAC7C;AAED,qDAAqD;AACrD,MAAM,WAAW,wBAAwB,CACvC,CAAC,SAAS,6BAA6B;IAEvC,2FAA2F;IAC3F,UAAU,EAAE,CAAC,CAAC;IACd,8EAA8E;IAC9E,YAAY,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAChC,iGAAiG;IACjG,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,iDAAiD;IACjD,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B,GACtC,CAAC,SAAS,6BAA6B,EAEvC,YAAY,CAAC,KACZ,wBAAwB,CAAC,CAAC,CAsB5B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useCallback as e, useMemo as t, useState as n } from "react";
|
|
2
|
+
//#region src/files/useUnshareConfirmationState/useUnshareConfirmationState.ts
|
|
3
|
+
var r = (r) => {
|
|
4
|
+
let [i, a] = n(null), { onUnshareFiles: o } = r, s = e((e) => a(e), []), c = e(() => {
|
|
5
|
+
i != null && o(i), a(null);
|
|
6
|
+
}, [i, o]), l = e(() => a(null), []);
|
|
7
|
+
return {
|
|
8
|
+
controller: t(() => ({
|
|
9
|
+
...r,
|
|
10
|
+
onUnshareFiles: s
|
|
11
|
+
}), [r, s]),
|
|
12
|
+
pendingItems: i,
|
|
13
|
+
confirm: c,
|
|
14
|
+
cancel: l
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { r as useUnshareConfirmationState };
|
package/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './api-transport/create-csrf-middleware';
|
|
|
3
3
|
export * from './api-transport/create-unauthorized-middleware';
|
|
4
4
|
export * from './attachment/useAttachmentAction/useAttachmentAction';
|
|
5
5
|
export * from './attachment/useAttachmentValidation/useAttachmentValidation';
|
|
6
|
+
export * from './attachment/attach-constraints';
|
|
6
7
|
export { EXPORT_APP_NAME } from './conversation/conversation-transfer/export-conversation';
|
|
7
8
|
export { formatDateYM, formatDateYMD, } from './conversation/conversation-transfer/date';
|
|
8
9
|
export { formatQuotedNameList } from './conversation/conversation-transfer/import-conversation';
|
|
@@ -22,6 +23,7 @@ export * from './catalog/catalog-derivations';
|
|
|
22
23
|
export * from './catalog/catalog-entity-kind';
|
|
23
24
|
export * from './catalog/favorite-entity-type';
|
|
24
25
|
export * from './catalog/catalog-preferences';
|
|
26
|
+
export * from './catalog/usage-limit-rows';
|
|
25
27
|
export * from './catalog/catalog-primary-action';
|
|
26
28
|
export * from './catalog/useCatalogEditNavigation/useCatalogEditNavigation';
|
|
27
29
|
export * from './catalog/useCatalogItemDetails';
|
|
@@ -81,6 +83,7 @@ export * from './offline-credentials/useOfflineCredentialsGate/useOfflineCredent
|
|
|
81
83
|
export * from './offline-credentials/useOfflineCredentialsLogin/useOfflineCredentialsLogin';
|
|
82
84
|
export * from './offline-credentials/useOfflineCredentialsAuth/useOfflineCredentialsAuth';
|
|
83
85
|
export * from './offline-credentials/map-offline-credentials-response';
|
|
86
|
+
export * from './offline-credentials/scheduled-tasks-login-banner';
|
|
84
87
|
export * from './scheduled-task/check-scheduled-task-auth-session-error';
|
|
85
88
|
export * from './skill/skill';
|
|
86
89
|
export * from './skill/skill-file-batch-validation';
|
|
@@ -134,6 +137,7 @@ export * from './files/attachment-canvas';
|
|
|
134
137
|
export * from './files/source-content';
|
|
135
138
|
export * from './files/attachment-dto-to-display';
|
|
136
139
|
export * from './files/dial-file';
|
|
140
|
+
export * from './files/useUnshareConfirmationState/useUnshareConfirmationState';
|
|
137
141
|
export * from './files/dial-file-to-attachment';
|
|
138
142
|
export * from './files/download-destination';
|
|
139
143
|
export * from './files/prepare-download-destination';
|
|
@@ -198,6 +202,8 @@ export * from './conversation/generation-registry';
|
|
|
198
202
|
export * from './scheduled-task/active-scheduled-task';
|
|
199
203
|
export * from './scheduled-task/useActiveScheduledTaskDetails';
|
|
200
204
|
export * from './conversation/useConversationTitleEnrichmentController';
|
|
205
|
+
export * from './conversation/useVisibleConversationIdsReporter/useVisibleConversationIdsReporter';
|
|
206
|
+
export * from './conversation/conversation-list';
|
|
201
207
|
export * from './skill-editor/useSkillFilePreviewSyncController';
|
|
202
208
|
export * from './external-services/useExternalServiceLogin';
|
|
203
209
|
export * from './conversation/useDeploymentChangeTracking';
|