@epam/ai-dial-chat-hooks 1.1.0-dev.423 → 1.1.0-dev.426
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/{api-error-DuLNy43N.js → api-error/api-error.js} +1 -1
- package/api-transport/create-csrf-middleware.js +21 -0
- package/api-transport/create-unauthorized-middleware.js +41 -0
- package/attachment/useAttachmentAction/useAttachmentAction.js +74 -0
- package/attachment/useAttachmentValidation/useAttachmentValidation.js +35 -0
- package/attachments.js +3 -2
- package/catalog/catalog-derivations.js +10 -0
- package/catalog/catalog-primary-action.js +21 -0
- package/catalog/create-publish-api.js +27 -0
- package/catalog/deployment-endpoint-url.js +34 -0
- package/{deployment-id-CxWgJTs9.js → catalog/deployment-id.js} +1 -1
- package/catalog/entity-details.js +6 -0
- package/catalog/map-deployment-limits-to-catalog.js +73 -0
- package/catalog/map-deployment-limits-to-input.js +14 -0
- package/catalog/map-deployment-to-catalog-item.js +92 -0
- package/catalog/map-entity-details-to-catalog.js +350 -0
- package/catalog/map-prompt-to-catalog-item.js +49 -0
- package/catalog/map-skill-to-catalog-item.js +123 -0
- package/catalog/mcp-endpoint-url.js +26 -0
- package/catalog/publish.js +18 -0
- package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.js +109 -0
- package/catalog/useCatalogItemDetails.js +101 -0
- package/catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.js +146 -0
- package/catalog/useFavoriteEntitiesState/useFavoriteEntitiesState.js +50 -0
- package/catalog/usePublishFolders/usePublishFolders.js +72 -0
- package/catalog.js +22 -3
- package/conversation/announcement-message.js +42 -0
- package/conversation/conversation-transfer/async.js +18 -0
- package/conversation/conversation-transfer/attachment-refs.js +11 -0
- package/conversation/conversation-transfer/build-upload-path.js +27 -0
- package/{date-BeuD8G79.js → conversation/conversation-transfer/date.js} +1 -1
- package/conversation/conversation-transfer/dial-file-resolve.js +18 -0
- package/conversation/conversation-transfer/export-conversation.js +32 -0
- package/conversation/conversation-transfer/import-conversation.js +93 -0
- package/conversation/conversation-transfer/progress.js +39 -0
- package/conversation/conversation-transfer/queue.js +84 -0
- package/conversation/conversation-transfer/types.js +9 -0
- package/conversation/conversation-transfer/zip-export.js +19 -0
- package/conversation/conversation-transfer/zip-import.js +29 -0
- package/conversation/create-chat-stream-api.js +96 -0
- package/conversation/deriveConversationRowActionState/deriveConversationRowActionState.js +14 -0
- package/conversation/display-name-watch.js +5 -0
- package/conversation/footer-message.js +23 -0
- package/conversation/get-model-id-from-conversation-id.js +14 -0
- package/conversation/greeting.js +7 -0
- package/conversation/message-factory.js +19 -0
- package/conversation/message-utils.js +13 -0
- package/conversation/overlay-messages.js +8 -0
- package/conversation/quick-app-conversation-starters.js +29 -0
- package/conversation/starter-option.js +27 -0
- package/conversation/useActiveConversationSync/useActiveConversationSync.js +19 -0
- package/conversation/useAsyncConfirmDialog/useAsyncConfirmDialog.js +39 -0
- package/conversation/useAttachmentUpload/useAttachmentUpload.js +33 -0
- package/conversation/useConversationExport/useConversationExport.js +285 -0
- package/conversation/useConversationHandlers/attachment-to-dto.js +13 -0
- package/conversation/useConversationHandlers/message-factory.js +21 -0
- package/conversation/useConversationHandlers/message-utils.js +8 -0
- package/conversation/useConversationHandlers/starter-option.js +11 -0
- package/conversation/useConversationHandlers/useConversationHandlers.js +263 -0
- package/conversation/useConversationImport/useConversationImport.js +239 -0
- package/conversation/useConversationLookupMaps/useConversationLookupMaps.js +11 -0
- package/conversation/useConversationPanelItems/useConversationPanelItems.js +35 -0
- package/{useConversationScroll-CliIMnjP.js → conversation/useConversationScroll/useConversationScroll.js} +1 -1
- package/conversation/useConversationStream/apply-chunk.js +78 -0
- package/conversation/useConversationStream/buffered-generation.js +18 -0
- package/conversation/useConversationStream/conversation-path.js +8 -0
- package/conversation/useConversationStream/generation-resume.js +126 -0
- package/conversation/useConversationStream/useConversationStream.js +148 -0
- package/conversation/useImportFilePicker/useImportFilePicker.js +20 -0
- package/conversation/useTranscribeAudio/audio-transcription-error.js +12 -0
- package/conversation/useTranscribeAudio/transcription-retry.js +38 -0
- package/conversation/useTranscribeAudio/useTranscribeAudio.js +41 -0
- package/{useConversationSources-DKaKvjXZ.js → conversation-sources/useConversationSources/useConversationSources.js} +1 -1
- package/conversation-sources.js +1 -1
- package/conversation-transfer.js +7 -3
- package/conversation.d.ts +66 -0
- package/conversation.js +31 -2
- package/file-manager.d.ts +3 -4
- package/file-manager.js +28 -3
- package/files/annotation.js +15 -0
- package/files/attachment-canvas.js +218 -0
- package/files/attachment-dto-to-display.js +15 -0
- package/files/attachment-types.js +16 -0
- package/files/create-files-api.js +40 -0
- package/files/create-upload-file-with-progress.js +42 -0
- package/files/dial-file-manager-copy-move.util.js +55 -0
- package/files/dial-file-manager-mapping.util.js +140 -0
- package/files/dial-file-manager-path.util.js +72 -0
- package/files/dial-file-manager.model.js +25 -0
- package/files/dial-file-manager.types.js +10 -0
- package/files/dial-file-to-attachment.js +37 -0
- package/files/dial-file.js +30 -0
- package/files/dial-files-api.js +6 -0
- package/files/download-destination.js +6 -0
- package/files/file-manager-variant.js +11 -0
- package/files/file-name.js +19 -0
- package/files/prepare-download-destination.js +24 -0
- package/files/resolve-dial-file-api-path.js +33 -0
- package/files/source-content.js +37 -0
- package/files/useDialFileListing/useDialFileListing.js +295 -0
- package/files/useDialFileManager/useDialFileManager.js +146 -0
- package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +23 -0
- package/files/useDialFileMetadata/useDialFileMetadata.js +42 -0
- package/files/useDialFileMutations/useDialFileMutations.js +359 -0
- package/files/useDialFileSharing/useDialFileSharing.js +70 -0
- package/files/useDialFileUploadBatch/useDialFileUploadBatch.js +156 -0
- package/index.d.ts +69 -4
- package/index.js +134 -28
- package/mcp-apps/mcp-apps-api-client.js +48 -0
- package/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js +26 -0
- package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +26 -0
- package/mcp-apps/useMcpAppTools/useMcpAppTools.js +71 -0
- package/mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js +58 -0
- package/mcp-apps.js +6 -2
- package/oauth/authorize-url.js +12 -0
- package/oauth/handshake.js +65 -0
- package/oauth/popup.js +29 -0
- package/oauth/toolset-id.js +10 -0
- package/oauth/types.js +24 -0
- package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.js +94 -0
- package/oauth/useToolsetLogin/useToolsetLogin.js +73 -0
- package/oauth.js +9 -3
- package/package.json +35 -23
- package/prompt/export-prompt.js +28 -0
- package/prompt/prompt-resource.js +15 -0
- package/prompt/prompt.js +12 -0
- package/prompt/usePromptsState/usePromptsState.js +42 -0
- package/scheduled-task/scheduled-task-mapping.js +6 -0
- package/{scheduled-task-trigger-D9RZCk52.js → scheduled-task/scheduled-task-trigger.js} +39 -40
- package/scheduled-tasks.js +3 -2
- package/scroll-anchoring.js +1 -1
- package/shared/application-schema.js +4 -0
- package/shared/browser-timezone.js +10 -0
- package/{cron-weekday-B4w29eAC.js → shared/cron-weekday.js} +1 -1
- package/shared/custom-apps.js +30 -0
- package/shared/external-services.js +18 -0
- package/{formatting-CZyyxBG3.js → shared/formatting.js} +1 -1
- package/{prompt-resource-Bt1I-8ri.js → shared/locale.js} +2 -13
- package/{string-utils-iBi2Y55C.js → shared/string-utils.js} +1 -1
- package/shared/toolset-login-events.js +13 -0
- package/sharing.js +3 -3
- package/skill/skill-file-batch-validation.js +48 -0
- package/skill/skill-file-preview.js +15 -0
- package/skill/skill-manifest.js +70 -0
- package/skill/skill-types.js +15 -0
- package/skill/skill.js +48 -0
- package/skill/useSkillEditorLoad.js +103 -0
- package/skill/useSkillEditorSubmit.js +135 -0
- package/skill/useSkillFileActions.js +99 -0
- package/skill/useSkillFilePreview.js +29 -0
- package/{useSkillsState-BoLlwmzb.js → skill/useSkillsState/useSkillsState.js} +1 -1
- package/skill-editor.js +8 -3
- package/skills-state.js +1 -1
- package/source-content.d.ts +29 -0
- package/source-content.js +2 -0
- package/usage/useUsageData/useUsageData.js +32 -0
- package/useChatSettingsFormConfig/useChatSettingsFormConfig.js +74 -0
- package/{usePanelMaxWidth-BEZYuqF9.js → usePageFileDrag/usePageFileDrag.js} +1 -11
- package/usePanelMaxWidth/usePanelMaxWidth.js +8 -0
- package/{useShareLink-xkiaxATt.js → useShareLink/useShareLink.js} +1 -1
- package/{useShareRecipientsCount-BgwCLKY0.js → useShareRecipientsCount/useShareRecipientsCount.js} +1 -1
- package/useToolsMenu/useToolsMenu.js +50 -0
- package/useViewportWidth/useViewportWidth.js +12 -0
- package/utils.js +17 -7
- package/viewport-layout.js +4 -2
- package/attachment-types-AAoN9E95.js +0 -7760
- package/browser-Btsa0Lmr.js +0 -607
- package/skill-manifest-CeG6-WSK.js +0 -4056
- package/useAttachmentValidation-CkMTd5lA.js +0 -102
- package/useConversationImport-CDRs7JF1.js +0 -826
- package/useDialFileManagerTabConfig-CjI46lMo.js +0 -2291
- package/useOAuthCallbackCompletion-CvyTKLER.js +0 -93
- package/useOpenMcpAppCanvas-C7-AMseH.js +0 -207
- package/useSkillFileActions-B-VaGD20.js +0 -373
- package/useSkillFilePreview-B5o1n_0F.js +0 -1244
- package/useToolsMenu-zURpMEn1.js +0 -1882
- package/useToolsetLogin-B05m134e.js +0 -195
- package/useUsageData-D7BxloKZ.js +0 -201
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { getApiErrorStatus as e } from "../../api-error/api-error.js";
|
|
2
|
+
import { FileManagerNotificationReason as t } from "../dial-file-manager.types.js";
|
|
3
|
+
import { buildSharedItemVirtualPath as n, dialCorePathToRelative as r, findFolderByVirtualPath as i, normalizeVirtualPath as a } from "../dial-file-manager-path.util.js";
|
|
4
|
+
import { getParentFolderPath as ee, virtualPathToApiPath as o } from "../resolve-dial-file-api-path.js";
|
|
5
|
+
import { buildFromCache as te, fetchByTab as s, fetchForSearch as c, mapCorePermissions as ne, mapSearchItem as l, mergeCreatedFolderIntoCache as re } from "../dial-file-manager-mapping.util.js";
|
|
6
|
+
import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
7
|
+
import { ListFilesItemDtoNodeTypeEnum as h } from "@epam/ai-dial-chat-api-client";
|
|
8
|
+
import { NotificationVariant as g } from "@epam/ai-dial-ui-kit";
|
|
9
|
+
import { DialFileManagerTabs as _, DialFileNodeType as ie } from "@epam/ai-dial-react-file-manager";
|
|
10
|
+
//#region src/files/useDialFileListing/useDialFileListing.ts
|
|
11
|
+
var v = ({ filesApi: v, bucket: y, rootLabel: b, activeTab: x, onNotification: S }) => {
|
|
12
|
+
let [C, w] = m(""), [T, E] = m(() => /* @__PURE__ */ new Map()), D = p(T);
|
|
13
|
+
d(() => {
|
|
14
|
+
D.current = T;
|
|
15
|
+
}, [T]);
|
|
16
|
+
let [O, k] = m(() => /* @__PURE__ */ new Map()), [ae, A] = m(!0), [oe, j] = m(null), [M, N] = m(0), [P, F] = m(void 0), [se, I] = m(() => /* @__PURE__ */ new Set()), L = p(/* @__PURE__ */ new Map()), [ce, R] = m(!1), [le, 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()), [ue, K] = m(() => /* @__PURE__ */ new Set()), [q, J] = m(() => /* @__PURE__ */ new Set()), Y = p(x);
|
|
17
|
+
d(() => {
|
|
18
|
+
Y.current !== x && (Y.current = x, E(/* @__PURE__ */ new Map()), k(/* @__PURE__ */ new Map()), w(""), 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()));
|
|
19
|
+
}, [x]), d(() => () => {
|
|
20
|
+
B.current != null && clearTimeout(B.current), V.current?.();
|
|
21
|
+
}, []), d(() => {
|
|
22
|
+
let t = !1;
|
|
23
|
+
return A(!0), j(null), s(v, x, y, C, L.current).then(({ items: e, permissions: i }) => {
|
|
24
|
+
t || (E((t) => {
|
|
25
|
+
let n = new Map(t);
|
|
26
|
+
return n.set(C, e), n;
|
|
27
|
+
}), k((e) => new Map(e).set(C, i)), x === _.Shared && C === "" && (F(e.map((e) => n(r(e.path, e.bucket ?? ""), b, e.nodeType === h.Folder))), L.current = new Map(e.map((e) => [e.name, {
|
|
28
|
+
bucket: e.bucket ?? "",
|
|
29
|
+
dialCorePath: e.path
|
|
30
|
+
}]))));
|
|
31
|
+
}).catch((n) => {
|
|
32
|
+
if (!t) {
|
|
33
|
+
if (C !== "" && e(n) === 404) {
|
|
34
|
+
w(ee(C));
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
j("dialFileManager.error");
|
|
38
|
+
}
|
|
39
|
+
}).finally(() => {
|
|
40
|
+
t || A(!1);
|
|
41
|
+
}), () => {
|
|
42
|
+
t = !0;
|
|
43
|
+
};
|
|
44
|
+
}, [
|
|
45
|
+
x,
|
|
46
|
+
y,
|
|
47
|
+
v,
|
|
48
|
+
C,
|
|
49
|
+
M,
|
|
50
|
+
b
|
|
51
|
+
]), d(() => {
|
|
52
|
+
if (x !== _.MyFiles) {
|
|
53
|
+
I(/* @__PURE__ */ new Set());
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
let e = !1;
|
|
57
|
+
return v.listSharedByMe(y).then((t) => {
|
|
58
|
+
e || I(new Set(t.items.map((e) => n(r(e.path, y), b, e.nodeType === h.Folder))));
|
|
59
|
+
}).catch(() => {
|
|
60
|
+
e || I(/* @__PURE__ */ new Set());
|
|
61
|
+
}), () => {
|
|
62
|
+
e = !0;
|
|
63
|
+
};
|
|
64
|
+
}, [
|
|
65
|
+
x,
|
|
66
|
+
y,
|
|
67
|
+
v,
|
|
68
|
+
M,
|
|
69
|
+
b
|
|
70
|
+
]);
|
|
71
|
+
let X = f(() => [{
|
|
72
|
+
id: y,
|
|
73
|
+
name: b,
|
|
74
|
+
path: `/${b}`,
|
|
75
|
+
parentPath: "",
|
|
76
|
+
nodeType: ie.FOLDER,
|
|
77
|
+
folderId: y,
|
|
78
|
+
permissions: ne(O.get("")),
|
|
79
|
+
items: te(T, O, "", `/${b}`, y)
|
|
80
|
+
}], [
|
|
81
|
+
T,
|
|
82
|
+
O,
|
|
83
|
+
b,
|
|
84
|
+
y
|
|
85
|
+
]), de = u((e) => {
|
|
86
|
+
if (e == null) {
|
|
87
|
+
w("");
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
let t = `/${b}/`, n = `${b}/`;
|
|
91
|
+
if (e === `/${b}` || e === t || e === b || e === n) {
|
|
92
|
+
w("");
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
let r;
|
|
96
|
+
if (e.startsWith(t)) r = e.slice(t.length);
|
|
97
|
+
else if (e.startsWith(n)) r = e.slice(n.length);
|
|
98
|
+
else {
|
|
99
|
+
let t = e.replace(/^\//, "");
|
|
100
|
+
r = t.startsWith(n) ? t.slice(n.length) : t;
|
|
101
|
+
}
|
|
102
|
+
w(r && !r.endsWith("/") ? `${r}/` : r);
|
|
103
|
+
}, [b]), Z = u(() => {
|
|
104
|
+
N((e) => e + 1);
|
|
105
|
+
}, []), fe = Z, pe = u((e) => {
|
|
106
|
+
if (e.length === 0) return;
|
|
107
|
+
let n = new Set([...W].map((e) => o(e, b))), r = (e) => e === C || C.startsWith(e) || n.has(e), i = e.filter((e) => !r(e)), a = e.filter((e) => r(e) && e !== C);
|
|
108
|
+
i.length > 0 && (E((e) => {
|
|
109
|
+
let t = new Map(e);
|
|
110
|
+
return i.forEach((e) => t.delete(e)), t;
|
|
111
|
+
}), k((e) => {
|
|
112
|
+
let t = new Map(e);
|
|
113
|
+
return i.forEach((e) => t.delete(e)), t;
|
|
114
|
+
})), a.forEach((e) => {
|
|
115
|
+
(async () => {
|
|
116
|
+
try {
|
|
117
|
+
let { items: t, permissions: n } = await s(v, x, y, e, L.current);
|
|
118
|
+
E((n) => new Map(n).set(e, t)), n != null && k((t) => new Map(t).set(e, n));
|
|
119
|
+
} catch {
|
|
120
|
+
S?.({
|
|
121
|
+
variant: g.Error,
|
|
122
|
+
reason: t.FolderLoadFailed
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
})();
|
|
126
|
+
});
|
|
127
|
+
}, [
|
|
128
|
+
x,
|
|
129
|
+
y,
|
|
130
|
+
v,
|
|
131
|
+
C,
|
|
132
|
+
W,
|
|
133
|
+
b,
|
|
134
|
+
S
|
|
135
|
+
]), me = u((e, t, n) => {
|
|
136
|
+
E((r) => re(r, e, t, n));
|
|
137
|
+
}, []), he = u((e) => {
|
|
138
|
+
let n = e == null ? "" : o(e, b), r = e ?? `/${b}`;
|
|
139
|
+
if (J((e) => {
|
|
140
|
+
if (e.has(r)) return e;
|
|
141
|
+
let t = new Set(e);
|
|
142
|
+
return t.add(r), t;
|
|
143
|
+
}), !D.current.has(n)) {
|
|
144
|
+
if (H.current.has(n)) {
|
|
145
|
+
K((e) => {
|
|
146
|
+
let t = new Set(e);
|
|
147
|
+
return t.add(r), t;
|
|
148
|
+
});
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
H.current.add(n), K((e) => {
|
|
152
|
+
let t = new Set(e);
|
|
153
|
+
return t.add(r), t;
|
|
154
|
+
}), (async () => {
|
|
155
|
+
try {
|
|
156
|
+
let { items: e, permissions: t } = await s(v, x, y, n, L.current);
|
|
157
|
+
E((t) => new Map(t).set(n, e)), t != null && k((e) => new Map(e).set(n, t)), U.current.delete(n);
|
|
158
|
+
} catch {
|
|
159
|
+
S?.({
|
|
160
|
+
variant: g.Error,
|
|
161
|
+
reason: t.FolderLoadFailed
|
|
162
|
+
});
|
|
163
|
+
} finally {
|
|
164
|
+
H.current.delete(n), K((e) => {
|
|
165
|
+
let t = new Set(e);
|
|
166
|
+
return t.delete(r), t;
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
})();
|
|
170
|
+
}
|
|
171
|
+
}, [
|
|
172
|
+
x,
|
|
173
|
+
y,
|
|
174
|
+
v,
|
|
175
|
+
S,
|
|
176
|
+
b
|
|
177
|
+
]), ge = f(() => {
|
|
178
|
+
let e = /* @__PURE__ */ new Set(), t = new Set([...W, ...q]);
|
|
179
|
+
for (let n of t) {
|
|
180
|
+
let t = o(n, b);
|
|
181
|
+
T.has(t) && e.add(n);
|
|
182
|
+
}
|
|
183
|
+
return e;
|
|
184
|
+
}, [
|
|
185
|
+
W,
|
|
186
|
+
q,
|
|
187
|
+
T,
|
|
188
|
+
b
|
|
189
|
+
]), _e = u((e) => {
|
|
190
|
+
W.forEach((t) => {
|
|
191
|
+
e.has(t) || U.current.delete(o(t, b));
|
|
192
|
+
}), G(e), [...e].filter((e) => {
|
|
193
|
+
let t = o(e, b);
|
|
194
|
+
return !D.current.has(t) && !H.current.has(t) && !U.current.has(t);
|
|
195
|
+
}).forEach((e) => {
|
|
196
|
+
let n = o(e, b);
|
|
197
|
+
H.current.add(n), (async () => {
|
|
198
|
+
try {
|
|
199
|
+
let { items: e, permissions: t } = await s(v, x, y, n, L.current);
|
|
200
|
+
E((t) => new Map(t).set(n, e)), t != null && k((e) => new Map(e).set(n, t));
|
|
201
|
+
} catch {
|
|
202
|
+
U.current.add(n), S?.({
|
|
203
|
+
variant: g.Error,
|
|
204
|
+
reason: t.FolderLoadFailed
|
|
205
|
+
});
|
|
206
|
+
} finally {
|
|
207
|
+
H.current.delete(n), K((t) => {
|
|
208
|
+
let n = new Set(t);
|
|
209
|
+
return n.delete(e), n;
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
})();
|
|
213
|
+
});
|
|
214
|
+
}, [
|
|
215
|
+
x,
|
|
216
|
+
y,
|
|
217
|
+
v,
|
|
218
|
+
W,
|
|
219
|
+
S,
|
|
220
|
+
b
|
|
221
|
+
]), Q = u(() => {
|
|
222
|
+
B.current != null && (clearTimeout(B.current), B.current = null), V.current?.(), V.current = null, z(null), R(!1);
|
|
223
|
+
}, []), ve = u((e, t) => {
|
|
224
|
+
if (B.current != null && (clearTimeout(B.current), B.current = null), V.current?.(), V.current = null, !t.trim()) {
|
|
225
|
+
z(null), R(!1);
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
B.current = setTimeout(() => {
|
|
229
|
+
B.current = null;
|
|
230
|
+
let e = t.toLowerCase();
|
|
231
|
+
if (x === _.Shared && C === "") {
|
|
232
|
+
V.current?.(), V.current = null, R(!0), z((T.get("") ?? []).filter((t) => t.name.toLowerCase().includes(e)).map((e) => l(e, e.bucket ?? y, b))), R(!1);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
let n = !1;
|
|
236
|
+
V.current = () => {
|
|
237
|
+
n = !0;
|
|
238
|
+
}, R(!0), (async () => {
|
|
239
|
+
try {
|
|
240
|
+
let { items: t } = await c(v, x, y, C, L.current);
|
|
241
|
+
if (n) return;
|
|
242
|
+
z(t.filter((t) => t.name.toLowerCase().includes(e)).map((e) => l(e, e.bucket ?? y, b)));
|
|
243
|
+
} catch {
|
|
244
|
+
n || z([]);
|
|
245
|
+
} finally {
|
|
246
|
+
n || R(!1);
|
|
247
|
+
}
|
|
248
|
+
})();
|
|
249
|
+
}, 300);
|
|
250
|
+
}, [
|
|
251
|
+
x,
|
|
252
|
+
y,
|
|
253
|
+
T,
|
|
254
|
+
v,
|
|
255
|
+
C,
|
|
256
|
+
b
|
|
257
|
+
]), $ = C ? `/${b}/${C}` : `/${b}`, ye = f(() => {
|
|
258
|
+
let e = X[0];
|
|
259
|
+
if (e) return a($) === a(`/${b}`) ? e : i(e.items ?? [], $);
|
|
260
|
+
}, [
|
|
261
|
+
X,
|
|
262
|
+
$,
|
|
263
|
+
b
|
|
264
|
+
]);
|
|
265
|
+
return {
|
|
266
|
+
items: X,
|
|
267
|
+
isLoading: ae,
|
|
268
|
+
error: oe,
|
|
269
|
+
path: $,
|
|
270
|
+
folderPath: C,
|
|
271
|
+
onPathChange: de,
|
|
272
|
+
retry: Z,
|
|
273
|
+
onSearchFiles: ve,
|
|
274
|
+
isSearching: ce,
|
|
275
|
+
searchResults: le,
|
|
276
|
+
clearSearchResults: Q,
|
|
277
|
+
expandedPaths: W,
|
|
278
|
+
loadedPaths: ge,
|
|
279
|
+
onExpandedPathsChange: _e,
|
|
280
|
+
onFolderPopupPathChange: he,
|
|
281
|
+
folderPopupLoadingPaths: ue,
|
|
282
|
+
sharedWithMeIds: f(() => x === _.Shared ? P : void 0, [x, P]),
|
|
283
|
+
sharedByMePaths: se,
|
|
284
|
+
currentFolder: ye,
|
|
285
|
+
cache: T,
|
|
286
|
+
listingPermissionsCache: O,
|
|
287
|
+
sharedRootMetaRef: L,
|
|
288
|
+
setFolderPath: w,
|
|
289
|
+
invalidateFolders: pe,
|
|
290
|
+
mergeCreatedFolder: me,
|
|
291
|
+
bumpRetry: fe
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
//#endregion
|
|
295
|
+
export { v as useDialFileListing };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { COLUMNS_WITHOUT_AUTHOR as e, COLUMNS_WITH_AUTHOR as t, DATE_OPTIONS as n } from "../dial-file-manager.model.js";
|
|
2
|
+
import { DialFileManagerActionProfile as r, DialFileManagerVariant as i, deriveActionProfile as a } from "../file-manager-variant.js";
|
|
3
|
+
import { hasDialFileWritePermission as o, isCopyMoveDuplicateAllowed as s, isShareActionsAllowed as c } from "../dial-file-manager-path.util.js";
|
|
4
|
+
import { useDialFileListing as l } from "../useDialFileListing/useDialFileListing.js";
|
|
5
|
+
import { useDialFileMetadata as u } from "../useDialFileMetadata/useDialFileMetadata.js";
|
|
6
|
+
import { useDialFileMutations as d } from "../useDialFileMutations/useDialFileMutations.js";
|
|
7
|
+
import { useDialFileSharing as f } from "../useDialFileSharing/useDialFileSharing.js";
|
|
8
|
+
import { useDialFileUploadBatch as p } from "../useDialFileUploadBatch/useDialFileUploadBatch.js";
|
|
9
|
+
import { useCallback as m, useMemo as h } from "react";
|
|
10
|
+
import { DialFileManagerActions as g, DialFileManagerTabs as _ } from "@epam/ai-dial-react-file-manager";
|
|
11
|
+
//#region src/files/useDialFileManager/useDialFileManager.ts
|
|
12
|
+
var v = ({ filesApi: v, bucket: y, rootLabel: b = "My files", activeTab: x = _.MyFiles, onNotification: S, onOperationSuccess: C, forbiddenSymbolsRegExp: w, variant: T = i.Attach, actionProfile: E, labels: D, locale: O, disabledNewButtonTooltip: k, downloadDestination: A, buildValidationErrorMessage: j }) => {
|
|
13
|
+
let M = E ?? a(T), N = l({
|
|
14
|
+
filesApi: v,
|
|
15
|
+
bucket: y,
|
|
16
|
+
rootLabel: b,
|
|
17
|
+
activeTab: x,
|
|
18
|
+
onNotification: S
|
|
19
|
+
}), P = p({
|
|
20
|
+
filesApi: v,
|
|
21
|
+
bucket: y,
|
|
22
|
+
rootLabel: b,
|
|
23
|
+
activeTab: x,
|
|
24
|
+
cache: N.cache,
|
|
25
|
+
sharedRootMetaRef: N.sharedRootMetaRef,
|
|
26
|
+
invalidateFolders: N.invalidateFolders,
|
|
27
|
+
bumpRetry: N.bumpRetry,
|
|
28
|
+
onNotification: S
|
|
29
|
+
}), F = d({
|
|
30
|
+
filesApi: v,
|
|
31
|
+
bucket: y,
|
|
32
|
+
rootLabel: b,
|
|
33
|
+
activeTab: x,
|
|
34
|
+
folderPath: N.folderPath,
|
|
35
|
+
currentFolder: N.currentFolder,
|
|
36
|
+
sharedRootMetaRef: N.sharedRootMetaRef,
|
|
37
|
+
listingPermissionsCache: N.listingPermissionsCache,
|
|
38
|
+
invalidateFolders: N.invalidateFolders,
|
|
39
|
+
bumpRetry: N.bumpRetry,
|
|
40
|
+
mergeCreatedFolder: N.mergeCreatedFolder,
|
|
41
|
+
setFolderPath: N.setFolderPath,
|
|
42
|
+
onNotification: S,
|
|
43
|
+
onOperationSuccess: C,
|
|
44
|
+
downloadDestination: A,
|
|
45
|
+
forbiddenSymbolsRegExp: w
|
|
46
|
+
}), I = f({
|
|
47
|
+
filesApi: v,
|
|
48
|
+
bucket: y,
|
|
49
|
+
rootLabel: b,
|
|
50
|
+
bumpRetry: N.bumpRetry,
|
|
51
|
+
onNotification: S
|
|
52
|
+
}), L = u({
|
|
53
|
+
filesApi: v,
|
|
54
|
+
bucket: y,
|
|
55
|
+
rootLabel: b,
|
|
56
|
+
onNotification: S
|
|
57
|
+
}), R = o(N.currentFolder), z = h(() => x === _.Organization || x === _.Shared && N.folderPath === "" ? !1 : R, [
|
|
58
|
+
x,
|
|
59
|
+
N.folderPath,
|
|
60
|
+
R
|
|
61
|
+
]), B = h(() => x === _.Shared ? t : e, [x]), V = h(() => {
|
|
62
|
+
let e = {}, t = (t) => {
|
|
63
|
+
let n = D[t];
|
|
64
|
+
n != null && (e[t] = n);
|
|
65
|
+
};
|
|
66
|
+
return t(g.Download), x === _.MyFiles ? (t(g.Delete), z && (t(g.Rename), s(M) && (t(g.Copy), t(g.Move), t(g.Duplicate))), c(M) && t(g.RemoveAccess)) : x === _.Shared && c(M) && t(g.Unshare), M === r.Full && t(g.Info), e;
|
|
67
|
+
}, [
|
|
68
|
+
x,
|
|
69
|
+
z,
|
|
70
|
+
M,
|
|
71
|
+
D
|
|
72
|
+
]), H = h(() => F.isCreatingFolder || F.isDownloading || F.isDeleting || F.isRenaming || F.isCopying || F.isMoving || I.isUnsharing || I.isRemovingAccess || P.uploadBatchState != null, [
|
|
73
|
+
F.isCreatingFolder,
|
|
74
|
+
F.isDownloading,
|
|
75
|
+
F.isDeleting,
|
|
76
|
+
F.isRenaming,
|
|
77
|
+
F.isCopying,
|
|
78
|
+
F.isMoving,
|
|
79
|
+
I.isUnsharing,
|
|
80
|
+
I.isRemovingAccess,
|
|
81
|
+
P.uploadBatchState
|
|
82
|
+
]), U = m((e, t) => {
|
|
83
|
+
let n = F.onCreateFolderValidate(e, t);
|
|
84
|
+
return n ? j(n) : null;
|
|
85
|
+
}, [F, j]), W = m((e, t) => {
|
|
86
|
+
let n = F.onRenameValidate(e, t);
|
|
87
|
+
return n ? j(n, t) : null;
|
|
88
|
+
}, [F, j]);
|
|
89
|
+
return {
|
|
90
|
+
items: N.items,
|
|
91
|
+
isLoading: N.isLoading,
|
|
92
|
+
error: N.error,
|
|
93
|
+
path: N.path,
|
|
94
|
+
onPathChange: N.onPathChange,
|
|
95
|
+
retry: N.retry,
|
|
96
|
+
onSearchFiles: N.onSearchFiles,
|
|
97
|
+
isSearching: N.isSearching,
|
|
98
|
+
searchResults: N.searchResults,
|
|
99
|
+
clearSearchResults: N.clearSearchResults,
|
|
100
|
+
expandedPaths: N.expandedPaths,
|
|
101
|
+
loadedPaths: N.loadedPaths,
|
|
102
|
+
onExpandedPathsChange: N.onExpandedPathsChange,
|
|
103
|
+
onFolderPopupPathChange: N.onFolderPopupPathChange,
|
|
104
|
+
folderPopupLoadingPaths: N.folderPopupLoadingPaths,
|
|
105
|
+
onUploadFiles: P.onUploadFiles,
|
|
106
|
+
onUploadArchive: P.onUploadArchive,
|
|
107
|
+
onValidateUpload: P.onValidateUpload,
|
|
108
|
+
uploadBatchState: P.uploadBatchState,
|
|
109
|
+
cancelUpload: P.cancelUpload,
|
|
110
|
+
clearUploadBatch: P.clearUploadBatch,
|
|
111
|
+
onCreateFolder: F.onCreateFolder,
|
|
112
|
+
onCreateFolderValidate: U,
|
|
113
|
+
isCreatingFolder: F.isCreatingFolder,
|
|
114
|
+
onDownloadFiles: F.onDownloadFiles,
|
|
115
|
+
isDownloading: F.isDownloading,
|
|
116
|
+
onDeleteFiles: F.onDeleteFiles,
|
|
117
|
+
isDeleting: F.isDeleting,
|
|
118
|
+
onRenameValidate: W,
|
|
119
|
+
onMoveToFiles: F.onMoveToFiles,
|
|
120
|
+
isRenaming: F.isRenaming,
|
|
121
|
+
onCopyFiles: F.onCopyFiles,
|
|
122
|
+
isCopying: F.isCopying,
|
|
123
|
+
isMoving: F.isMoving,
|
|
124
|
+
cancelCopyMove: F.cancelCopyMove,
|
|
125
|
+
uploadEnabled: z,
|
|
126
|
+
isNewButtonDisabled: !z,
|
|
127
|
+
disabledNewButtonTooltip: k,
|
|
128
|
+
visibleColumns: B,
|
|
129
|
+
dateLocale: O,
|
|
130
|
+
dateOptions: n,
|
|
131
|
+
actionLabels: V,
|
|
132
|
+
sharedWithMeIds: N.sharedWithMeIds,
|
|
133
|
+
sharedByMePaths: N.sharedByMePaths,
|
|
134
|
+
onUnshareFiles: I.onUnshareFiles,
|
|
135
|
+
isUnsharing: I.isUnsharing,
|
|
136
|
+
onRemoveFilesAccess: I.onRemoveFilesAccess,
|
|
137
|
+
isRemovingAccess: I.isRemovingAccess,
|
|
138
|
+
fileMetadata: L.fileMetadata,
|
|
139
|
+
isFileMetadataLoading: L.isFileMetadataLoading,
|
|
140
|
+
onGetInfo: L.onGetInfo,
|
|
141
|
+
clearMetadata: L.clearMetadata,
|
|
142
|
+
isAnyOperationInProgress: H
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
//#endregion
|
|
146
|
+
export { v as useDialFileManager };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useCallback as e, useEffect as t, useMemo as n } from "react";
|
|
2
|
+
import { DialFileManagerTabs as r } from "@epam/ai-dial-react-file-manager";
|
|
3
|
+
//#region src/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.ts
|
|
4
|
+
var i = [
|
|
5
|
+
r.MyFiles,
|
|
6
|
+
r.Shared,
|
|
7
|
+
r.Organization
|
|
8
|
+
], a = (a, o, s, c) => {
|
|
9
|
+
let l = e((e) => c == null || c.includes(e), [c]), u = n(() => s?.filter((e) => l(e.id)).flatMap(({ id: e, label: t, disabled: n }) => typeof t == "string" ? [{
|
|
10
|
+
id: e,
|
|
11
|
+
label: t,
|
|
12
|
+
disabled: n
|
|
13
|
+
}] : []), [s, l]);
|
|
14
|
+
return t(() => {
|
|
15
|
+
l(a) || o(i.find((e) => l(e)) ?? r.MyFiles);
|
|
16
|
+
}, [
|
|
17
|
+
l,
|
|
18
|
+
a,
|
|
19
|
+
o
|
|
20
|
+
]), { tabs: u };
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { a as useDialFileManagerTabConfig };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { FileManagerNotificationReason as e } from "../dial-file-manager.types.js";
|
|
2
|
+
import { resolveDialFileApiPath as t } from "../resolve-dial-file-api-path.js";
|
|
3
|
+
import { mapFileMetadataToDialFile as n } from "../dial-file-manager-mapping.util.js";
|
|
4
|
+
import { useCallback as r, useState as i } from "react";
|
|
5
|
+
import { NotificationVariant as a } from "@epam/ai-dial-ui-kit";
|
|
6
|
+
//#region src/files/useDialFileMetadata/useDialFileMetadata.ts
|
|
7
|
+
var o = ({ filesApi: o, bucket: s, rootLabel: c, onNotification: l }) => {
|
|
8
|
+
let [u, d] = i(void 0), [f, p] = i(!1);
|
|
9
|
+
return {
|
|
10
|
+
fileMetadata: u,
|
|
11
|
+
isFileMetadataLoading: f,
|
|
12
|
+
onGetInfo: r((r) => {
|
|
13
|
+
(async () => {
|
|
14
|
+
p(!0);
|
|
15
|
+
try {
|
|
16
|
+
let e = r.bucket ?? s, i = t(r, e, c);
|
|
17
|
+
d(n(await o.getFileMetadata({
|
|
18
|
+
bucket: e,
|
|
19
|
+
path: i
|
|
20
|
+
}), r));
|
|
21
|
+
} catch {
|
|
22
|
+
l?.({
|
|
23
|
+
variant: a.Error,
|
|
24
|
+
reason: e.MetadataLoadFailed
|
|
25
|
+
});
|
|
26
|
+
} finally {
|
|
27
|
+
p(!1);
|
|
28
|
+
}
|
|
29
|
+
})();
|
|
30
|
+
}, [
|
|
31
|
+
s,
|
|
32
|
+
o,
|
|
33
|
+
c,
|
|
34
|
+
l
|
|
35
|
+
]),
|
|
36
|
+
clearMetadata: r(() => {
|
|
37
|
+
d(void 0), p(!1);
|
|
38
|
+
}, [])
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { o as useDialFileMetadata };
|