@epam/ai-dial-chat-hooks 1.4.0-dev.6 → 1.4.0-dev.66
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/catalog/create-publish-api.d.ts +7 -1
- package/catalog/create-publish-api.d.ts.map +1 -1
- package/catalog/create-publish-api.js +4 -0
- package/catalog/entity-details.d.ts +5 -2
- package/catalog/entity-details.d.ts.map +1 -1
- package/catalog/map-entity-details-to-catalog.d.ts +4 -0
- package/catalog/map-entity-details-to-catalog.d.ts.map +1 -1
- package/catalog/map-entity-details-to-catalog.js +15 -13
- package/catalog/publish-dependency-icons.d.ts +22 -0
- package/catalog/publish-dependency-icons.d.ts.map +1 -0
- package/catalog/publish-dependency-icons.js +11 -0
- package/catalog/publish.d.ts +13 -2
- package/catalog/publish.d.ts.map +1 -1
- package/catalog/publish.js +13 -2
- package/catalog/use-publish-dependencies.d.ts +19 -0
- package/catalog/use-publish-dependencies.d.ts.map +1 -0
- package/catalog/use-publish-dependencies.js +25 -0
- package/catalog/usePublishFolders/usePublishFolders.d.ts.map +1 -1
- package/catalog/usePublishFolders/usePublishFolders.js +1 -1
- package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts.map +1 -1
- package/catalog/useResourceSavePanel/useResourceSavePanel.js +83 -84
- package/catalog.js +33 -31
- package/conversation/announcement-message.d.ts +12 -0
- package/conversation/announcement-message.d.ts.map +1 -1
- package/conversation/announcement-message.js +16 -10
- package/conversation.js +44 -44
- package/entry-points/catalog.d.ts +2 -0
- package/entry-points/catalog.d.ts.map +1 -1
- package/entry-points/project.d.ts +5 -0
- package/entry-points/project.d.ts.map +1 -1
- package/entry-points/utils.d.ts +3 -0
- package/entry-points/utils.d.ts.map +1 -1
- package/index.d.ts +10 -0
- package/index.d.ts.map +1 -1
- package/index.js +223 -214
- package/org-units/models.d.ts +9 -0
- package/org-units/models.d.ts.map +1 -0
- package/org-units/types.d.ts +14 -0
- package/org-units/types.d.ts.map +1 -0
- package/org-units/types.js +6 -0
- package/org-units/useOrgUnits/useOrgUnits.d.ts +19 -0
- package/org-units/useOrgUnits/useOrgUnits.d.ts.map +1 -0
- package/org-units/useOrgUnits/useOrgUnits.js +34 -0
- package/package.json +18 -18
- package/project/project-sharing-client.d.ts +8 -0
- package/project/project-sharing-client.d.ts.map +1 -0
- package/project/project-sharing-client.js +11 -0
- package/project/project-sharing.d.ts +28 -0
- package/project/project-sharing.d.ts.map +1 -0
- package/project/project-sharing.js +22 -0
- package/project/use-pinned-project-chats.d.ts +4 -2
- package/project/use-pinned-project-chats.d.ts.map +1 -1
- package/project/use-pinned-project-chats.js +152 -96
- package/project/use-project-conversations.d.ts.map +1 -1
- package/project/use-project-conversations.js +2 -2
- package/project/use-project-remove-from-list.d.ts +30 -0
- package/project/use-project-remove-from-list.d.ts.map +1 -0
- package/project/use-project-remove-from-list.js +39 -0
- package/project/use-project-revoke-access.d.ts +15 -0
- package/project/use-project-revoke-access.d.ts.map +1 -0
- package/project/use-project-revoke-access.js +32 -0
- package/project/use-project-share-recipients.d.ts +7 -0
- package/project/use-project-share-recipients.d.ts.map +1 -0
- package/project/use-project-share-recipients.js +36 -0
- package/project/use-projects.d.ts +1 -0
- package/project/use-projects.d.ts.map +1 -1
- package/project/use-projects.js +2 -1
- package/project.js +7 -2
- package/utils.js +3 -1
|
@@ -14,10 +14,26 @@ var l = 10, u = 1e3, d = [
|
|
|
14
14
|
snapshots: /* @__PURE__ */ new Map(),
|
|
15
15
|
settled: /* @__PURE__ */ new Set(),
|
|
16
16
|
watchKey: ""
|
|
17
|
-
}, m = [], h = (e,
|
|
17
|
+
}, m = [], h = ({ overflow: e, chats: t, ...n }, r) => {
|
|
18
|
+
if (r == null || t.some((e) => e.id === r)) return {
|
|
19
|
+
...n,
|
|
20
|
+
chats: t
|
|
21
|
+
};
|
|
22
|
+
let i = e.find((e) => e.id === r);
|
|
23
|
+
return i == null ? {
|
|
24
|
+
...n,
|
|
25
|
+
chats: t
|
|
26
|
+
} : {
|
|
27
|
+
...n,
|
|
28
|
+
chats: [...t.slice(0, 9), {
|
|
29
|
+
id: i.id,
|
|
30
|
+
title: i.title
|
|
31
|
+
}]
|
|
32
|
+
};
|
|
33
|
+
}, g = (e, { settled: t, snapshots: n }, r) => {
|
|
18
34
|
let i = [...e].sort();
|
|
19
35
|
return i.every((e) => t.has(e)) ? i.filter((e) => n.has(e)).slice(0, u).join(f) : r;
|
|
20
|
-
},
|
|
36
|
+
}, _ = (e, t) => {
|
|
21
37
|
if (!e.snapshots.has(t) && !e.settled.has(t)) return e;
|
|
22
38
|
let n = new Map(e.snapshots);
|
|
23
39
|
n.delete(t);
|
|
@@ -27,7 +43,7 @@ var l = 10, u = 1e3, d = [
|
|
|
27
43
|
snapshots: n,
|
|
28
44
|
settled: r
|
|
29
45
|
};
|
|
30
|
-
},
|
|
46
|
+
}, v = (e, t) => {
|
|
31
47
|
if (t.length === 0) return e;
|
|
32
48
|
let n = new Map(t.map((e) => [e.id, e]));
|
|
33
49
|
return e.map((e) => {
|
|
@@ -38,73 +54,75 @@ var l = 10, u = 1e3, d = [
|
|
|
38
54
|
isTitlePending: !1
|
|
39
55
|
} : e;
|
|
40
56
|
});
|
|
41
|
-
},
|
|
42
|
-
let [
|
|
57
|
+
}, y = (l, u, { enabled: y, onProjectDeleted: b, activeConversationId: x }) => {
|
|
58
|
+
let [S, C] = c(p), w = s(S);
|
|
43
59
|
a(() => {
|
|
44
|
-
|
|
60
|
+
w.current = S;
|
|
45
61
|
});
|
|
46
|
-
let
|
|
62
|
+
let T = s(b);
|
|
47
63
|
a(() => {
|
|
48
|
-
|
|
64
|
+
T.current = b;
|
|
49
65
|
});
|
|
50
|
-
let
|
|
66
|
+
let E = s(/* @__PURE__ */ new Set()), D = s(/* @__PURE__ */ new Map()), O = s(/* @__PURE__ */ new Map()), k = s(/* @__PURE__ */ new Set()), A = s(/* @__PURE__ */ new Map()), j = s(/* @__PURE__ */ new Map()), M = s(null), N = o(() => [...new Set(u)].sort().join(f), [u]), P = i(async (e, t) => {
|
|
51
67
|
let [n, r] = await Promise.allSettled([l.getProject(e, t), l.listProjectConversations(e, t)]);
|
|
52
68
|
if (n.status === "rejected") throw n.reason;
|
|
53
69
|
let i = r.status === "fulfilled" ? r.value.items : [], a = i.slice(0, 10), o = a.filter((e) => e.isTitlePending).map((e) => e.name);
|
|
54
70
|
if (o.length > 0) try {
|
|
55
71
|
let { items: n } = await l.getProjectConversationTitles(e, o, t);
|
|
56
|
-
a =
|
|
72
|
+
a = v(a, n);
|
|
57
73
|
} catch {}
|
|
58
74
|
return {
|
|
59
75
|
project: n.value,
|
|
60
76
|
items: a,
|
|
77
|
+
overflow: i.slice(10),
|
|
61
78
|
hasMore: i.length > 10
|
|
62
79
|
};
|
|
63
|
-
}, [l]),
|
|
64
|
-
for (let { id: e, updatedAt: n } of t)
|
|
80
|
+
}, [l]), F = i(({ project: e, items: t, overflow: r, hasMore: i }) => {
|
|
81
|
+
for (let { id: e, updatedAt: n } of [...t, ...r]) j.current.set(e, n);
|
|
65
82
|
return {
|
|
66
83
|
project: e,
|
|
67
|
-
hasMore:
|
|
84
|
+
hasMore: i,
|
|
85
|
+
overflow: r,
|
|
68
86
|
chats: t.map((e) => ({
|
|
69
87
|
id: e.id,
|
|
70
88
|
title: e.title,
|
|
71
|
-
...n(
|
|
89
|
+
...n(A.current, e) ? { isUnread: !0 } : {}
|
|
72
90
|
}))
|
|
73
91
|
};
|
|
74
|
-
}, []), P = i((e) => {
|
|
75
|
-
D.current.has(e) || (D.current.add(e), C.current(e));
|
|
76
|
-
}, []), F = i((e) => {
|
|
77
|
-
E.current.get(e)?.controller?.abort(), E.current.delete(e);
|
|
78
92
|
}, []), I = i((e) => {
|
|
79
|
-
|
|
93
|
+
k.current.has(e) || (k.current.add(e), T.current(e));
|
|
94
|
+
}, []), L = i((e) => {
|
|
95
|
+
O.current.get(e)?.controller?.abort(), O.current.delete(e);
|
|
96
|
+
}, []), R = i((e) => {
|
|
97
|
+
L(e), C((t) => {
|
|
80
98
|
if (!t.snapshots.has(e)) return t;
|
|
81
99
|
let n = new Map(t.snapshots);
|
|
82
100
|
return n.delete(e), {
|
|
83
101
|
...t,
|
|
84
102
|
snapshots: n,
|
|
85
|
-
watchKey:
|
|
103
|
+
watchKey: g(E.current, {
|
|
86
104
|
settled: t.settled,
|
|
87
105
|
snapshots: n
|
|
88
106
|
}, t.watchKey)
|
|
89
107
|
};
|
|
90
108
|
});
|
|
91
|
-
}, [
|
|
92
|
-
if (!
|
|
93
|
-
let n =
|
|
109
|
+
}, [L]), z = i((t) => {
|
|
110
|
+
if (!w.current.snapshots.has(t)) return;
|
|
111
|
+
let n = O.current.get(t);
|
|
94
112
|
if (n ?? (n = {
|
|
95
113
|
isRefreshing: !1,
|
|
96
114
|
isPending: !1
|
|
97
|
-
},
|
|
115
|
+
}, O.current.set(t, n)), n.isRefreshing) {
|
|
98
116
|
n.isPending = !0;
|
|
99
117
|
return;
|
|
100
118
|
}
|
|
101
119
|
let r = n, i = new AbortController();
|
|
102
120
|
r.isRefreshing = !0, r.controller = i, (async () => {
|
|
103
121
|
try {
|
|
104
|
-
let e = await
|
|
122
|
+
let e = await P(t, i.signal);
|
|
105
123
|
if (i.signal.aborted) return;
|
|
106
|
-
let n =
|
|
107
|
-
|
|
124
|
+
let n = F(e);
|
|
125
|
+
C((e) => {
|
|
108
126
|
if (!e.snapshots.has(t)) return e;
|
|
109
127
|
let r = new Map(e.snapshots);
|
|
110
128
|
return r.set(t, n), {
|
|
@@ -114,33 +132,33 @@ var l = 10, u = 1e3, d = [
|
|
|
114
132
|
});
|
|
115
133
|
} catch (n) {
|
|
116
134
|
if (i.signal.aborted) return;
|
|
117
|
-
e(n) === 404 && (
|
|
135
|
+
e(n) === 404 && (R(t), I(t));
|
|
118
136
|
} finally {
|
|
119
|
-
r.isRefreshing = !1, r.isPending && !i.signal.aborted &&
|
|
137
|
+
r.isRefreshing = !1, r.isPending && !i.signal.aborted && O.current.get(t) === r && (r.isPending = !1, z(t));
|
|
120
138
|
}
|
|
121
139
|
})();
|
|
122
140
|
}, [
|
|
123
|
-
|
|
124
|
-
M,
|
|
141
|
+
R,
|
|
125
142
|
P,
|
|
126
|
-
|
|
127
|
-
|
|
143
|
+
I,
|
|
144
|
+
F
|
|
145
|
+
]), B = i((t, n, r = 0) => {
|
|
128
146
|
let i = () => {
|
|
129
|
-
|
|
147
|
+
D.current.get(t) === n && D.current.delete(t);
|
|
130
148
|
};
|
|
131
149
|
(async () => {
|
|
132
150
|
try {
|
|
133
|
-
let e = await
|
|
151
|
+
let e = await P(t, n.signal);
|
|
134
152
|
if (n.signal.aborted) return;
|
|
135
|
-
let r =
|
|
136
|
-
|
|
153
|
+
let r = F(e);
|
|
154
|
+
C((e) => {
|
|
137
155
|
let n = new Map(e.snapshots);
|
|
138
156
|
n.set(t, r);
|
|
139
157
|
let i = new Set(e.settled).add(t);
|
|
140
158
|
return {
|
|
141
159
|
snapshots: n,
|
|
142
160
|
settled: i,
|
|
143
|
-
watchKey:
|
|
161
|
+
watchKey: g(E.current, {
|
|
144
162
|
settled: i,
|
|
145
163
|
snapshots: n
|
|
146
164
|
}, e.watchKey)
|
|
@@ -148,13 +166,13 @@ var l = 10, u = 1e3, d = [
|
|
|
148
166
|
}), i();
|
|
149
167
|
} catch (a) {
|
|
150
168
|
if (n.signal.aborted) return;
|
|
151
|
-
|
|
169
|
+
C((e) => {
|
|
152
170
|
if (e.settled.has(t)) return e;
|
|
153
171
|
let n = new Set(e.settled).add(t);
|
|
154
172
|
return {
|
|
155
173
|
...e,
|
|
156
174
|
settled: n,
|
|
157
|
-
watchKey:
|
|
175
|
+
watchKey: g(E.current, {
|
|
158
176
|
settled: n,
|
|
159
177
|
snapshots: e.snapshots
|
|
160
178
|
}, e.watchKey)
|
|
@@ -162,74 +180,74 @@ var l = 10, u = 1e3, d = [
|
|
|
162
180
|
});
|
|
163
181
|
let o = e(a) === 404, s = o ? void 0 : d[r];
|
|
164
182
|
if (s == null) {
|
|
165
|
-
i(), o &&
|
|
183
|
+
i(), o && I(t);
|
|
166
184
|
return;
|
|
167
185
|
}
|
|
168
|
-
let c = setTimeout(() =>
|
|
186
|
+
let c = setTimeout(() => B(t, n, r + 1), s);
|
|
169
187
|
n.signal.addEventListener("abort", () => clearTimeout(c), { once: !0 });
|
|
170
188
|
}
|
|
171
189
|
})();
|
|
172
190
|
}, [
|
|
173
|
-
M,
|
|
174
191
|
P,
|
|
175
|
-
|
|
192
|
+
I,
|
|
193
|
+
F
|
|
176
194
|
]);
|
|
177
195
|
a(() => () => {
|
|
178
|
-
for (let e of
|
|
179
|
-
|
|
180
|
-
for (let e of
|
|
181
|
-
|
|
182
|
-
}, [l,
|
|
183
|
-
if (!
|
|
184
|
-
let e = new Set(
|
|
185
|
-
for (let t of [...
|
|
186
|
-
let n =
|
|
196
|
+
for (let e of D.current.values()) e.abort();
|
|
197
|
+
D.current.clear();
|
|
198
|
+
for (let e of O.current.values()) e.controller?.abort();
|
|
199
|
+
O.current.clear(), E.current.clear(), k.current.clear(), A.current.clear(), j.current.clear(), C(p);
|
|
200
|
+
}, [l, y]), a(() => {
|
|
201
|
+
if (!y) return;
|
|
202
|
+
let e = new Set(N === "" ? [] : N.split(f));
|
|
203
|
+
for (let t of [...E.current]) e.has(t) || (E.current.delete(t), k.current.delete(t), D.current.get(t)?.abort(), D.current.delete(t), L(t), C((e) => {
|
|
204
|
+
let n = _(e, t);
|
|
187
205
|
return {
|
|
188
206
|
...n,
|
|
189
|
-
watchKey:
|
|
207
|
+
watchKey: g(E.current, n, e.watchKey)
|
|
190
208
|
};
|
|
191
209
|
}));
|
|
192
210
|
for (let t of e) {
|
|
193
|
-
if (
|
|
194
|
-
|
|
211
|
+
if (E.current.has(t)) continue;
|
|
212
|
+
E.current.add(t);
|
|
195
213
|
let e = new AbortController();
|
|
196
|
-
|
|
214
|
+
D.current.set(t, e), B(t, e);
|
|
197
215
|
}
|
|
198
216
|
}, [
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
217
|
+
y,
|
|
218
|
+
N,
|
|
219
|
+
L,
|
|
220
|
+
B
|
|
203
221
|
]);
|
|
204
|
-
let
|
|
222
|
+
let V = y && N !== "" && N.split(f).some((e) => !S.settled.has(e)), H = y ? S.watchKey : "", { watchProjects: U } = l;
|
|
205
223
|
a(() => {
|
|
206
|
-
if (
|
|
224
|
+
if (U == null || H === "" || H === M.current) return;
|
|
207
225
|
let e = new AbortController();
|
|
208
226
|
return t({
|
|
209
|
-
watchProjects:
|
|
210
|
-
ids:
|
|
227
|
+
watchProjects: U,
|
|
228
|
+
ids: H.split(f),
|
|
211
229
|
signal: e.signal,
|
|
212
230
|
onEvent: (t) => {
|
|
213
231
|
if (e.signal.aborted) return;
|
|
214
|
-
let n =
|
|
215
|
-
n != null && (t.action === r.Delete ? (
|
|
232
|
+
let n = w.current.snapshots.get(t.id);
|
|
233
|
+
n != null && (t.action === r.Delete ? (R(t.id), I(t.id)) : (t.etag == null || t.etag !== n.project.etag) && z(t.id));
|
|
216
234
|
},
|
|
217
235
|
onReconnected: () => {
|
|
218
|
-
for (let e of
|
|
236
|
+
for (let e of w.current.snapshots.keys()) z(e);
|
|
219
237
|
},
|
|
220
238
|
onUnavailable: () => {
|
|
221
|
-
|
|
239
|
+
M.current = H;
|
|
222
240
|
}
|
|
223
241
|
}), () => e.abort();
|
|
224
242
|
}, [
|
|
225
|
-
|
|
226
|
-
|
|
243
|
+
U,
|
|
244
|
+
H,
|
|
245
|
+
R,
|
|
227
246
|
I,
|
|
228
|
-
|
|
229
|
-
L
|
|
247
|
+
z
|
|
230
248
|
]);
|
|
231
|
-
let
|
|
232
|
-
|
|
249
|
+
let W = i((e) => {
|
|
250
|
+
j.current.has(e) && (A.current.set(e, j.current.get(e)), C((t) => {
|
|
233
251
|
let n;
|
|
234
252
|
for (let [r, i] of t.snapshots) i.chats.some((t) => t.id === e && t.isUnread) && (n ??= new Map(t.snapshots), n.set(r, {
|
|
235
253
|
...i,
|
|
@@ -243,27 +261,65 @@ var l = 10, u = 1e3, d = [
|
|
|
243
261
|
snapshots: n
|
|
244
262
|
} : t;
|
|
245
263
|
}));
|
|
246
|
-
}, [])
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
])
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
}, []), G = o(() => {
|
|
265
|
+
if (!y) return m;
|
|
266
|
+
let e = /* @__PURE__ */ new Set(), t = [];
|
|
267
|
+
for (let n of u) {
|
|
268
|
+
if (e.has(n)) continue;
|
|
269
|
+
e.add(n);
|
|
270
|
+
let r = S.snapshots.get(n);
|
|
271
|
+
r && t.push(h(r, x));
|
|
272
|
+
}
|
|
273
|
+
return t;
|
|
274
|
+
}, [
|
|
275
|
+
y,
|
|
276
|
+
u,
|
|
277
|
+
S.snapshots,
|
|
278
|
+
x
|
|
279
|
+
]), K = o(() => {
|
|
280
|
+
if (y && x != null) for (let [e, t] of S.snapshots) {
|
|
281
|
+
let n = t.overflow.find((e) => e.id === x && e.isTitlePending);
|
|
282
|
+
if (n != null) return {
|
|
283
|
+
projectId: e,
|
|
284
|
+
name: n.name
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
}, [
|
|
288
|
+
y,
|
|
289
|
+
x,
|
|
290
|
+
S.snapshots
|
|
291
|
+
]), q = K?.projectId, J = K?.name;
|
|
292
|
+
return a(() => {
|
|
293
|
+
if (q == null || J == null) return;
|
|
294
|
+
let e = new AbortController();
|
|
295
|
+
return (async () => {
|
|
296
|
+
try {
|
|
297
|
+
let { items: t } = await l.getProjectConversationTitles(q, [J], e.signal);
|
|
298
|
+
if (e.signal.aborted) return;
|
|
299
|
+
C((e) => {
|
|
300
|
+
let n = e.snapshots.get(q);
|
|
301
|
+
if (n == null) return e;
|
|
302
|
+
let r = new Map(e.snapshots);
|
|
303
|
+
return r.set(q, {
|
|
304
|
+
...n,
|
|
305
|
+
overflow: v(n.overflow, t)
|
|
306
|
+
}), {
|
|
307
|
+
...e,
|
|
308
|
+
snapshots: r
|
|
309
|
+
};
|
|
310
|
+
});
|
|
311
|
+
} catch {}
|
|
312
|
+
})(), () => e.abort();
|
|
313
|
+
}, [
|
|
314
|
+
l,
|
|
315
|
+
q,
|
|
316
|
+
J
|
|
317
|
+
]), {
|
|
318
|
+
projects: G,
|
|
319
|
+
isLoading: V,
|
|
320
|
+
markViewed: W,
|
|
321
|
+
refresh: z
|
|
266
322
|
};
|
|
267
323
|
};
|
|
268
324
|
//#endregion
|
|
269
|
-
export { l as PINNED_PROJECT_CHATS_LIMIT,
|
|
325
|
+
export { l as PINNED_PROJECT_CHATS_LIMIT, y as usePinnedProjectChats };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-project-conversations.d.ts","sourceRoot":"","sources":["../../src/project/use-project-conversations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAG1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AA8E/D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,GAClC,QAAQ,IAAI,CACV,iBAAiB,EACf,0BAA0B,GAC1B,8BAA8B,GAC9B,2BAA2B,GAC3B,kCAAkC,GAClC,2BAA2B,GAC3B,+BAA+B,CAClC,EACD,WAAW,MAAM,GAAG,IAAI;;;;
|
|
1
|
+
{"version":3,"file":"use-project-conversations.d.ts","sourceRoot":"","sources":["../../src/project/use-project-conversations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAG1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AA8E/D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,GAClC,QAAQ,IAAI,CACV,iBAAiB,EACf,0BAA0B,GAC1B,8BAA8B,GAC9B,2BAA2B,GAC3B,kCAAkC,GAClC,2BAA2B,GAC3B,+BAA+B,CAClC,EACD,WAAW,MAAM,GAAG,IAAI;;;;IA4OtB,8CAA8C;;IAE9C,2DAA2D;;;;iBAzDhD,MAAM,YAAY,MAAM;wBAoBxB,MAAM;iBAQN,MAAM;;qBAjDZ,MAAM;CAwFd,CAAC"}
|
|
@@ -167,8 +167,8 @@ var o = 20, s = 100, c = {
|
|
|
167
167
|
title: r,
|
|
168
168
|
isTitlePending: !1
|
|
169
169
|
} : e)
|
|
170
|
-
}));
|
|
171
|
-
}, [e]), M = t(async (t) => {
|
|
170
|
+
})), k();
|
|
171
|
+
}, [e, k]), M = t(async (t) => {
|
|
172
172
|
let { name: n } = await e.generateProjectConversationTitle(t);
|
|
173
173
|
return n;
|
|
174
174
|
}, [e]), N = t(async (t) => {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ProjectDetailsDto } from '@epam/ai-dial-chat-api-client';
|
|
2
|
+
/** Host behaviour the removal delegates to. */
|
|
3
|
+
export interface ProjectRemoveFromListHandlers {
|
|
4
|
+
/** Discards the caller's own access to the project; rejects on failure. */
|
|
5
|
+
discardShared: (projectId: string) => Promise<unknown>;
|
|
6
|
+
/** Persists the pin state; rejects on failure. */
|
|
7
|
+
setPinned: (projectId: string, isPinned: boolean) => Promise<void>;
|
|
8
|
+
/** Called when the unpin could not be saved, so the host can mirror it locally and the entry still leaves the sidebar. */
|
|
9
|
+
onUnpinFailed?: (project: ProjectDetailsDto) => void;
|
|
10
|
+
/** Called after the project left the caller's list; the host notifies and navigates away. */
|
|
11
|
+
onRemoved: (project: ProjectDetailsDto) => void;
|
|
12
|
+
/** Called when the discard failed, with the request's trace id; the host shows the message. */
|
|
13
|
+
onError: (project: ProjectDetailsDto, requestId?: string) => void;
|
|
14
|
+
/** Called once the request settles, whether it succeeded or failed, so the host can close its confirmation. */
|
|
15
|
+
onSettled?: () => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Drops a project shared with the caller from their own list: discards only
|
|
19
|
+
* the caller's access, then unpins it. The owner's project and the other
|
|
20
|
+
* recipients' access are untouched. Messages, notifications and navigation
|
|
21
|
+
* stay with the host through `handlers`.
|
|
22
|
+
*
|
|
23
|
+
* @param project - The project to remove, or `null` while none is chosen.
|
|
24
|
+
* @param handlers - Host behaviour the removal delegates to.
|
|
25
|
+
*/
|
|
26
|
+
export declare const useProjectRemoveFromList: (project: ProjectDetailsDto | null, { discardShared, setPinned, onUnpinFailed, onRemoved, onError, onSettled, }: ProjectRemoveFromListHandlers) => {
|
|
27
|
+
isRemoving: boolean;
|
|
28
|
+
confirmRemove: () => Promise<void>;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=use-project-remove-from-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-project-remove-from-list.d.ts","sourceRoot":"","sources":["../../src/project/use-project-remove-from-list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAIvE,+CAA+C;AAC/C,MAAM,WAAW,6BAA6B;IAC5C,2EAA2E;IAC3E,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACvD,kDAAkD;IAClD,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,0HAA0H;IAC1H,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACrD,6FAA6F;IAC7F,SAAS,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAChD,+FAA+F;IAC/F,OAAO,EAAE,CAAC,OAAO,EAAE,iBAAiB,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAClE,+GAA+G;IAC/G,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,iBAAiB,GAAG,IAAI,EACjC,6EAOG,6BAA6B;;;CA0CjC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { getApiErrorDetails as e } from "../api-error/api-error.js";
|
|
2
|
+
import { useCallback as t, useRef as n, useState as r } from "react";
|
|
3
|
+
//#region src/project/use-project-remove-from-list.ts
|
|
4
|
+
var i = (i, { discardShared: a, setPinned: o, onUnpinFailed: s, onRemoved: c, onError: l, onSettled: u }) => {
|
|
5
|
+
let [d, f] = r(!1), p = n(!1);
|
|
6
|
+
return {
|
|
7
|
+
isRemoving: d,
|
|
8
|
+
confirmRemove: t(async () => {
|
|
9
|
+
if (i == null || p.current) return;
|
|
10
|
+
p.current = !0, f(!0);
|
|
11
|
+
let t = () => {
|
|
12
|
+
p.current = !1, f(!1), u?.();
|
|
13
|
+
};
|
|
14
|
+
try {
|
|
15
|
+
await a(i.id);
|
|
16
|
+
} catch (n) {
|
|
17
|
+
let { traceId: r } = await e(n);
|
|
18
|
+
l(i, r), t();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
await o(i.id, !1);
|
|
23
|
+
} catch {
|
|
24
|
+
s?.(i);
|
|
25
|
+
}
|
|
26
|
+
t(), c(i);
|
|
27
|
+
}, [
|
|
28
|
+
i,
|
|
29
|
+
a,
|
|
30
|
+
o,
|
|
31
|
+
s,
|
|
32
|
+
c,
|
|
33
|
+
l,
|
|
34
|
+
u
|
|
35
|
+
])
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
//#endregion
|
|
39
|
+
export { i as useProjectRemoveFromList };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ProjectDetailsDto } from '@epam/ai-dial-chat-api-client';
|
|
2
|
+
import { ProjectSharingClient } from './project-sharing-client';
|
|
3
|
+
/** Host notifications and dialog lifecycle for a project revoke. */
|
|
4
|
+
export interface ProjectRevokeAccessHandlers {
|
|
5
|
+
/** Called after successful revoke; the host may notify and close the dialog. */
|
|
6
|
+
onRevoked: (project: ProjectDetailsDto) => void;
|
|
7
|
+
/** Called on failure with the request trace id when available. */
|
|
8
|
+
onError: (project: ProjectDetailsDto, requestId?: string) => void;
|
|
9
|
+
}
|
|
10
|
+
/** Revokes recipients' access while keeping the owner's project, pins and route. */
|
|
11
|
+
export declare const useProjectRevokeAccess: (client: ProjectSharingClient, project: ProjectDetailsDto | null, { onRevoked, onError }: ProjectRevokeAccessHandlers) => {
|
|
12
|
+
isRevoking: boolean;
|
|
13
|
+
confirmRevoke: () => Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=use-project-revoke-access.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-project-revoke-access.d.ts","sourceRoot":"","sources":["../../src/project/use-project-revoke-access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGvE,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,0BAA0B,CAAC;AAElC,oEAAoE;AACpE,MAAM,WAAW,2BAA2B;IAC1C,gFAAgF;IAChF,SAAS,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAChD,kEAAkE;IAClE,OAAO,EAAE,CAAC,OAAO,EAAE,iBAAiB,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACnE;AAED,oFAAoF;AACpF,eAAO,MAAM,sBAAsB,GACjC,QAAQ,oBAAoB,EAC5B,SAAS,iBAAiB,GAAG,IAAI,EACjC,wBAAwB,2BAA2B;;;CAwBpD,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { getApiErrorDetails as e } from "../api-error/api-error.js";
|
|
2
|
+
import { notifyProjectAccessRevoked as t } from "./project-sharing-client.js";
|
|
3
|
+
import { useCallback as n, useRef as r, useState as i } from "react";
|
|
4
|
+
//#region src/project/use-project-revoke-access.ts
|
|
5
|
+
var a = (a, o, { onRevoked: s, onError: c }) => {
|
|
6
|
+
let [l, u] = i(!1), d = r(!1);
|
|
7
|
+
return {
|
|
8
|
+
isRevoking: l,
|
|
9
|
+
confirmRevoke: n(async () => {
|
|
10
|
+
if (o?.canManage && !d.current) {
|
|
11
|
+
d.current = !0, u(!0);
|
|
12
|
+
try {
|
|
13
|
+
await a.revokeSharedAccess({ revokeSharedAccessDto: { itemId: o.id } });
|
|
14
|
+
} catch (t) {
|
|
15
|
+
let { traceId: n } = await e(t);
|
|
16
|
+
c(o, n);
|
|
17
|
+
return;
|
|
18
|
+
} finally {
|
|
19
|
+
d.current = !1, u(!1);
|
|
20
|
+
}
|
|
21
|
+
t(a, o.id), s(o);
|
|
22
|
+
}
|
|
23
|
+
}, [
|
|
24
|
+
a,
|
|
25
|
+
o,
|
|
26
|
+
s,
|
|
27
|
+
c
|
|
28
|
+
])
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { a as useProjectRevokeAccess };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ProjectSharingClient } from './project-sharing-client';
|
|
2
|
+
/** Reads current recipient counts on menu open; a successful revoke immediately clears both surfaces. */
|
|
3
|
+
export declare const useProjectShareRecipients: (client: ProjectSharingClient) => {
|
|
4
|
+
requestRecipients: (projectId: string) => void;
|
|
5
|
+
canRevokeAccess: (projectId: string) => boolean;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=use-project-share-recipients.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-project-share-recipients.d.ts","sourceRoot":"","sources":["../../src/project/use-project-share-recipients.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGrE,yGAAyG;AACzG,eAAO,MAAM,yBAAyB,GAAI,QAAQ,oBAAoB;mCAoBtD,MAAM;iCAwBN,MAAM;CAKrB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { subscribeProjectAccessRevoked as e } from "./project-sharing-client.js";
|
|
2
|
+
import { useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
|
|
3
|
+
//#region src/project/use-project-share-recipients.ts
|
|
4
|
+
var a = (a) => {
|
|
5
|
+
let [o, s] = i({}), c = r(/* @__PURE__ */ new Map());
|
|
6
|
+
return n(() => {
|
|
7
|
+
s({});
|
|
8
|
+
let t = c.current, n = e(a, (e) => {
|
|
9
|
+
t.delete(e), s((t) => ({
|
|
10
|
+
...t,
|
|
11
|
+
[e]: 0
|
|
12
|
+
}));
|
|
13
|
+
});
|
|
14
|
+
return () => {
|
|
15
|
+
n(), t.clear();
|
|
16
|
+
};
|
|
17
|
+
}, [a]), {
|
|
18
|
+
requestRecipients: t((e) => {
|
|
19
|
+
if (c.current.has(e)) return;
|
|
20
|
+
let t = {};
|
|
21
|
+
c.current.set(e, t), (async () => {
|
|
22
|
+
let n;
|
|
23
|
+
try {
|
|
24
|
+
n = (await a.getShareRecipientsCount({ itemId: e })).recipientsCount;
|
|
25
|
+
} catch {}
|
|
26
|
+
c.current.get(e) === t && (c.current.delete(e), s((t) => ({
|
|
27
|
+
...t,
|
|
28
|
+
[e]: n
|
|
29
|
+
})));
|
|
30
|
+
})();
|
|
31
|
+
}, [a]),
|
|
32
|
+
canRevokeAccess: t((e) => (o[e] ?? 0) > 0, [o])
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
export { a as useProjectShareRecipients };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-projects.d.ts","sourceRoot":"","sources":["../../src/project/use-projects.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAKzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAoC/D;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,WAAW,GACtB,QAAQ,IAAI,CAAC,iBAAiB,EAAE,cAAc,GAAG,eAAe,CAAC,EACjE,SAAS,OAAO
|
|
1
|
+
{"version":3,"file":"use-projects.d.ts","sourceRoot":"","sources":["../../src/project/use-projects.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAKzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAoC/D;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,WAAW,GACtB,QAAQ,IAAI,CAAC,iBAAiB,EAAE,cAAc,GAAG,eAAe,CAAC,EACjE,SAAS,OAAO;;;;;;;CAoGjB,CAAC"}
|
package/project/use-projects.js
CHANGED
package/project.js
CHANGED
|
@@ -16,5 +16,10 @@ import { useProjectConversations as z } from "./project/use-project-conversation
|
|
|
16
16
|
import { PINNED_PROJECT_CHATS_LIMIT as B, usePinnedProjectChats as V } from "./project/use-pinned-project-chats.js";
|
|
17
17
|
import { useProjectArtifacts as H } from "./project/use-project-artifacts.js";
|
|
18
18
|
import { ProjectActionError as U, useProjectActions as W } from "./project/use-project-actions.js";
|
|
19
|
-
import {
|
|
20
|
-
|
|
19
|
+
import { PinnedProjectMenuAction as G, getPinnedProjectMenuActions as K, isProjectSharedWithMe as q } from "./project/project-sharing.js";
|
|
20
|
+
import { useProjectRemoveFromList as J } from "./project/use-project-remove-from-list.js";
|
|
21
|
+
import { createSerializedKeyedWriter as Y } from "./shared/serialized-writer.js";
|
|
22
|
+
import { notifyProjectAccessRevoked as X } from "./project/project-sharing-client.js";
|
|
23
|
+
import { useProjectShareRecipients as Z } from "./project/use-project-share-recipients.js";
|
|
24
|
+
import { useProjectRevokeAccess as Q } from "./project/use-project-revoke-access.js";
|
|
25
|
+
export { l as DEFAULT_PROJECT_CONTEXT_ALLOWED_EXTENSIONS, u as DEFAULT_PROJECT_CONTEXT_FILE_MAX_BYTES, d as DEFAULT_PROJECT_CONTEXT_TOTAL_MAX_BYTES, B as PINNED_PROJECT_CHATS_LIMIT, G as PinnedProjectMenuAction, U as ProjectActionError, k as ProjectChatCreateFailure, D as ProjectDraftMode, h as ProjectFormErrorField, g as ProjectFormErrorReason, P as ProjectRefreshOutcome, e as buildCreateConversationDto, A as classifyProjectChatCreateError, j as createProjectChat, M as createProjectConversationDataSource, t as createProjectsApiClient, Y as createSerializedKeyedWriter, v as downloadProjectFileAttachment, y as fromProjectOutputCardId, b as fromProjectPreviewKey, f as getMimeTypesForExtensions, K as getPinnedProjectMenuActions, _ as getProjectFormError, q as isProjectSharedWithMe, r as mapProjectArtifactsToOutputs, i as mapProjectDetailsToViewModel, a as mapProjectDtoToItem, o as mapProjectSource, s as mapProjectSourceToFilterTab, c as mapStoredContextFiles, X as notifyProjectAccessRevoked, p as resolveByteLimit, m as resolveExtensionList, n as splitProjectConversationId, x as toProjectContextFileAttachment, S as toProjectOutputAttachment, C as toProjectOutputCardId, w as toProjectPreviewKey, T as toStoredProjectFileAttachment, L as useCreateProject, V as usePinnedProjectChats, F as useProject, W as useProjectActions, H as useProjectArtifacts, z as useProjectConversations, O as useProjectDraft, E as useProjectFilePreview, J as useProjectRemoveFromList, Q as useProjectRevokeAccess, Z as useProjectShareRecipients, I as useProjectWatch, N as useProjects, R as useSaveProject };
|
package/utils.js
CHANGED
|
@@ -20,4 +20,6 @@ import { triggerBrowserDownload as ne } from "./files/browser-download.js";
|
|
|
20
20
|
import { usePersistedState as re } from "./shared/usePersistedState/usePersistedState.js";
|
|
21
21
|
import { useAppVersionCheck as ie } from "./shared/useAppVersionCheck/useAppVersionCheck.js";
|
|
22
22
|
import { getCleanedLocationTarget as ae } from "./shared/url-cleanup.js";
|
|
23
|
-
|
|
23
|
+
import { OrgUnitsStatus as oe } from "./org-units/types.js";
|
|
24
|
+
import { useOrgUnits as se } from "./org-units/useOrgUnits/useOrgUnits.js";
|
|
25
|
+
export { Q as ColorScheme, Y as EXTERNAL_SERVICE_SIGNIN_METHOD, oe as OrgUnitsStatus, j as PROMPT_CONTENT_MAX_LENGTH, M as PROMPT_COUNTER_ANNOUNCE_THRESHOLD, N as PROMPT_DESCRIPTION_MAX_LENGTH, P as PROMPT_FIELD_VALIDATORS, F as PROMPT_NAME_MAX_LENGTH, X as PendingSigninEventKind, I as PromptFieldError, b as PromptSource, Z as TOOLSET_SIGNIN_METHOD, U as apSchedulerDayToJsDay, f as appendLocaleCode, $ as applyThemeColors, p as buildAdditionalLocaleOptions, T as buildExternalServiceScopeId, O as buildPromptExportEnvelope, k as buildPromptExportFileName, L as buildPromptPath, m as composeLocalePayload, a as createCsrfMiddleware, o as createUnauthorizedMiddleware, h as decomposeLocalizedFields, v as formatCalendarDate, e as getAcceptInvitationErrorItemName, t as getApiErrorDetails, n as getApiErrorMessage, r as getApiErrorStatus, G as getBrowserTimezone, ae as getCleanedLocationTarget, E as getExternalServiceFallbackName, ee as getOsPreferredTheme, R as getRemainingCharacters, S as getRunnerSchemas, s as includesIgnoreCase, i as isConversationNotFoundError, C as isCustomAppSchema, w as isQuickAppSchema, K as isValidAbsoluteUrl, q as isValidFeaturesData, W as jsDayToApSchedulerDay, y as padTwoDigits, D as parseExternalServiceUrl, J as parseFeaturesData, x as parsePromptResourceUrl, g as resolveLocalizedText, c as safeDecodeURI, l as safeDecodeURIComponent, A as serializePromptExport, u as stripSurroundingSlashes, d as stripTrailingSlashes, _ as toBaseLocale, ne as triggerBrowserDownload, ie as useAppVersionCheck, se as useOrgUnits, re as usePersistedState, H as usePromptsState, te as useUsageData, z as validatePromptContent, B as validatePromptDescription, V as validatePromptName };
|