@epam/ai-dial-chat-hooks 1.2.0-dev.21 → 1.2.0-dev.213
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/api-error.js +5 -4
- package/attachment/useAttachmentValidation/useAttachmentValidation.js +26 -19
- package/attachments.d.ts +10 -4
- package/catalog/catalog-derivations.js +1 -1
- package/catalog/deployment-id.js +8 -2
- package/catalog/map-deployment-limits-to-input.js +81 -9
- package/catalog/map-deployment-to-catalog-item.js +34 -34
- package/catalog/map-entity-details-to-catalog.js +7 -0
- package/catalog/map-skill-to-catalog-item.js +30 -27
- package/catalog/publish.js +6 -5
- package/catalog/useApplicationCredentials/useApplicationCredentials.js +39 -0
- package/catalog/useSkillDetailsPanelData/useSkillDetailsPanelData.js +39 -39
- package/catalog/useSkillItemDetails.js +17 -13
- package/catalog.d.ts +116 -20
- package/catalog.js +23 -22
- package/conversation/conversation-transfer/export-conversation.js +24 -16
- package/conversation/conversation-transfer/import-conversation.js +80 -31
- package/conversation/conversation-transfer/queue.js +8 -5
- package/conversation/create-chat-stream-api.js +85 -49
- package/conversation/message-utils.js +44 -2
- package/conversation/stage.js +23 -0
- package/conversation/useConversationExport/useConversationExport.js +9 -9
- package/conversation/useConversationHandlers/useConversationHandlers.js +16 -5
- package/conversation/useConversationImport/useConversationImport.js +123 -121
- package/conversation/useConversationPanelItems/useConversationPanelItems.js +2 -3
- package/conversation/useConversationScroll/useConversationScroll.js +68 -64
- package/conversation/useConversationStream/apply-chunk.js +1 -1
- package/conversation/useConversationStream/generation-resume.js +104 -63
- package/conversation/useConversationStream/useConversationStream.js +181 -110
- package/conversation/useMessageSelectionReply/useMessageSelectionReply.js +189 -0
- package/conversation-overlay.d.ts +7 -0
- package/conversation-overlay.js +2 -0
- package/conversation-sources/useConversationSources/useConversationSources.js +31 -24
- package/conversation-sources.d.ts +1 -1
- package/conversation-transfer.d.ts +2 -1
- package/conversation.d.ts +241 -13
- package/conversation.js +32 -30
- package/file-manager-canvas.d.ts +398 -0
- package/file-manager-canvas.js +2 -0
- package/file-manager.d.ts +153 -350
- package/file-manager.js +25 -24
- package/files/attachment-canvas.js +40 -1
- package/files/attachment-types.js +14 -13
- package/files/dial-file-manager-mapping.util.js +2 -1
- package/files/dial-file-manager-path.util.js +23 -1
- package/files/dial-file-manager.model.js +23 -19
- package/files/dial-file-manager.types.js +3 -3
- package/files/useDialFileListing/useDialFileListing.js +157 -145
- package/files/useDialFileManager/useDialFileManager.js +132 -128
- package/files/useDialFileManagerSections/useDialFileManagerSections.js +155 -0
- package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +20 -19
- package/files/useDialFileMutations/useDialFileMutations.js +33 -32
- package/files/useDialFileUploadBatch/useDialFileUploadBatch.js +117 -110
- package/files/useFileAttachmentPicker/useFileAttachmentPicker.js +43 -0
- package/index.d.ts +1068 -81
- package/index.js +136 -122
- package/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js +7 -5
- package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +1 -1
- package/mcp-apps/useMcpAppTools/useMcpAppTools.js +1 -1
- package/mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js +25 -23
- package/mcp-apps.d.ts +8 -6
- package/oauth/toolset-id.js +5 -3
- package/oauth/useToolsetLogin/useToolsetLogin.js +8 -8
- package/oauth.d.ts +32 -0
- package/oauth.js +9 -9
- package/package.json +36 -21
- package/scheduled-task/scheduled-task-description.js +77 -0
- package/scheduled-task/scheduled-task-preparation.js +24 -0
- package/scheduled-task/scheduled-task-trigger.js +7 -2
- package/scheduled-task/scheduled-tasks-api-client.js +19 -0
- package/scheduled-task/use-scheduled-task-runs.js +194 -0
- package/scheduled-task/use-scheduled-tasks.js +93 -0
- package/scheduled-tasks.d.ts +195 -3
- package/scheduled-tasks.js +7 -2
- package/skill/skill-archive.js +19 -0
- package/skill/skill-types.js +8 -7
- package/skill/skill.js +42 -27
- package/skill/useSkillArchiveImport/useSkillArchiveImport.js +79 -0
- package/skill/useSkillEditorLoad.js +29 -28
- package/skill/useSkillEditorSubmit.js +108 -84
- package/skill/useSkillFileActions.js +70 -58
- package/skill-editor.d.ts +133 -3
- package/skill-editor.js +9 -8
- package/usage/map-usage-data-to-dashboard.js +66 -0
- package/usage/map-user-usage-to-model-limits.js +202 -0
- package/usage.d.ts +125 -0
- package/usage.js +3 -0
- package/usePageFileDrag/usePageFileDrag.js +3 -3
- package/utils.d.ts +8 -6
|
@@ -6,141 +6,145 @@ import { useDialFileMetadata as u } from "../useDialFileMetadata/useDialFileMeta
|
|
|
6
6
|
import { useDialFileMutations as d } from "../useDialFileMutations/useDialFileMutations.js";
|
|
7
7
|
import { useDialFileSharing as f } from "../useDialFileSharing/useDialFileSharing.js";
|
|
8
8
|
import { useDialFileUploadBatch as p } from "../useDialFileUploadBatch/useDialFileUploadBatch.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { isUploadInProgress as m } from "@epam/ai-dial-chat-shared";
|
|
10
|
+
import { useCallback as h, useMemo as g } from "react";
|
|
11
|
+
import { DialFileManagerActions as _, DialFileManagerTabs as v } from "@epam/ai-dial-react-file-manager";
|
|
11
12
|
//#region src/files/useDialFileManager/useDialFileManager.ts
|
|
12
|
-
var
|
|
13
|
-
let
|
|
14
|
-
filesApi:
|
|
15
|
-
bucket:
|
|
16
|
-
rootLabel:
|
|
17
|
-
activeTab:
|
|
18
|
-
onNotification:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
13
|
+
var y = ({ filesApi: y, bucket: b, rootLabel: x = "My files", activeTab: S = v.MyFiles, isActive: C, sessionKey: w, onNotification: T, onOperationSuccess: E, forbiddenSymbolsRegExp: D, variant: O = i.Attach, actionProfile: k, labels: A, locale: j, disabledNewButtonTooltip: M, downloadDestination: N, buildValidationErrorMessage: P }) => {
|
|
14
|
+
let F = k ?? a(O), I = l({
|
|
15
|
+
filesApi: y,
|
|
16
|
+
bucket: b,
|
|
17
|
+
rootLabel: x,
|
|
18
|
+
activeTab: S,
|
|
19
|
+
onNotification: T,
|
|
20
|
+
isActive: C,
|
|
21
|
+
sessionKey: w
|
|
22
|
+
}), L = p({
|
|
23
|
+
filesApi: y,
|
|
24
|
+
bucket: b,
|
|
25
|
+
rootLabel: x,
|
|
26
|
+
activeTab: S,
|
|
27
|
+
cache: I.cache,
|
|
28
|
+
sharedRootMetaRef: I.sharedRootMetaRef,
|
|
29
|
+
invalidateFolders: I.invalidateFolders,
|
|
30
|
+
bumpRetry: I.bumpRetry,
|
|
31
|
+
onNotification: T
|
|
32
|
+
}), R = d({
|
|
33
|
+
filesApi: y,
|
|
34
|
+
bucket: b,
|
|
35
|
+
rootLabel: x,
|
|
36
|
+
activeTab: S,
|
|
37
|
+
folderPath: I.folderPath,
|
|
38
|
+
currentFolder: I.currentFolder,
|
|
39
|
+
sharedRootMetaRef: I.sharedRootMetaRef,
|
|
40
|
+
listingPermissionsCache: I.listingPermissionsCache,
|
|
41
|
+
invalidateFolders: I.invalidateFolders,
|
|
42
|
+
bumpRetry: I.bumpRetry,
|
|
43
|
+
mergeCreatedFolder: I.mergeCreatedFolder,
|
|
44
|
+
setFolderPath: I.setFolderPath,
|
|
45
|
+
onNotification: T,
|
|
46
|
+
onOperationSuccess: E,
|
|
47
|
+
downloadDestination: N,
|
|
48
|
+
forbiddenSymbolsRegExp: D
|
|
49
|
+
}), z = f({
|
|
50
|
+
filesApi: y,
|
|
51
|
+
bucket: b,
|
|
52
|
+
rootLabel: x,
|
|
53
|
+
bumpRetry: I.bumpRetry,
|
|
54
|
+
onNotification: T
|
|
55
|
+
}), B = u({
|
|
56
|
+
filesApi: y,
|
|
57
|
+
bucket: b,
|
|
58
|
+
rootLabel: x,
|
|
59
|
+
onNotification: T
|
|
60
|
+
}), V = o(I.currentFolder), H = g(() => S === v.Organization || S === v.Shared && I.folderPath === "" ? !1 : V, [
|
|
61
|
+
S,
|
|
62
|
+
I.folderPath,
|
|
63
|
+
V
|
|
64
|
+
]), U = g(() => S === v.Shared ? t : e, [S]), W = g(() => {
|
|
62
65
|
let e = {}, t = (t) => {
|
|
63
|
-
let n =
|
|
66
|
+
let n = A[t];
|
|
64
67
|
n != null && (e[t] = n);
|
|
65
68
|
};
|
|
66
|
-
return t(
|
|
69
|
+
return t(_.Download), S === v.MyFiles ? (t(_.Delete), H && (t(_.Rename), s(F) && (t(_.Copy), t(_.Move), t(_.Duplicate))), c(F) && t(_.RemoveAccess)) : S === v.Shared && c(F) && t(_.Unshare), F === r.Full && t(_.Info), e;
|
|
67
70
|
}, [
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
]),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
]),
|
|
83
|
-
let n =
|
|
84
|
-
return n ?
|
|
85
|
-
}, [
|
|
86
|
-
let n =
|
|
87
|
-
return n ?
|
|
88
|
-
}, [
|
|
71
|
+
S,
|
|
72
|
+
H,
|
|
73
|
+
F,
|
|
74
|
+
A
|
|
75
|
+
]), G = g(() => R.isCreatingFolder || R.isDownloading || R.isDeleting || R.isRenaming || R.isCopying || R.isMoving || z.isUnsharing || z.isRemovingAccess || m(L.uploadBatchState), [
|
|
76
|
+
R.isCreatingFolder,
|
|
77
|
+
R.isDownloading,
|
|
78
|
+
R.isDeleting,
|
|
79
|
+
R.isRenaming,
|
|
80
|
+
R.isCopying,
|
|
81
|
+
R.isMoving,
|
|
82
|
+
z.isUnsharing,
|
|
83
|
+
z.isRemovingAccess,
|
|
84
|
+
L.uploadBatchState
|
|
85
|
+
]), K = h((e, t) => {
|
|
86
|
+
let n = R.onCreateFolderValidate(e, t);
|
|
87
|
+
return n ? P(n) : null;
|
|
88
|
+
}, [R, P]), q = h((e, t) => {
|
|
89
|
+
let n = R.onRenameValidate(e, t);
|
|
90
|
+
return n ? P(n, t) : null;
|
|
91
|
+
}, [R, P]);
|
|
89
92
|
return {
|
|
90
|
-
items:
|
|
91
|
-
isLoading:
|
|
92
|
-
error:
|
|
93
|
-
path:
|
|
94
|
-
onPathChange:
|
|
95
|
-
retry:
|
|
96
|
-
onSearchFiles:
|
|
97
|
-
isSearching:
|
|
98
|
-
searchResults:
|
|
99
|
-
clearSearchResults:
|
|
100
|
-
expandedPaths:
|
|
101
|
-
loadedPaths:
|
|
102
|
-
onExpandedPathsChange:
|
|
103
|
-
onFolderPopupPathChange:
|
|
104
|
-
folderPopupLoadingPaths:
|
|
105
|
-
onUploadFiles:
|
|
106
|
-
onUploadArchive:
|
|
107
|
-
onValidateUpload:
|
|
108
|
-
uploadBatchState:
|
|
109
|
-
cancelUpload:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
93
|
+
items: I.items,
|
|
94
|
+
isLoading: I.isLoading,
|
|
95
|
+
error: I.error,
|
|
96
|
+
path: I.path,
|
|
97
|
+
onPathChange: I.onPathChange,
|
|
98
|
+
retry: I.retry,
|
|
99
|
+
onSearchFiles: I.onSearchFiles,
|
|
100
|
+
isSearching: I.isSearching,
|
|
101
|
+
searchResults: I.searchResults,
|
|
102
|
+
clearSearchResults: I.clearSearchResults,
|
|
103
|
+
expandedPaths: I.expandedPaths,
|
|
104
|
+
loadedPaths: I.loadedPaths,
|
|
105
|
+
onExpandedPathsChange: I.onExpandedPathsChange,
|
|
106
|
+
onFolderPopupPathChange: I.onFolderPopupPathChange,
|
|
107
|
+
folderPopupLoadingPaths: I.folderPopupLoadingPaths,
|
|
108
|
+
onUploadFiles: L.onUploadFiles,
|
|
109
|
+
onUploadArchive: L.onUploadArchive,
|
|
110
|
+
onValidateUpload: L.onValidateUpload,
|
|
111
|
+
uploadBatchState: L.uploadBatchState,
|
|
112
|
+
cancelUpload: L.cancelUpload,
|
|
113
|
+
cancelUploadFile: L.cancelUploadFile,
|
|
114
|
+
clearUploadBatch: L.clearUploadBatch,
|
|
115
|
+
onCreateFolder: R.onCreateFolder,
|
|
116
|
+
onCreateFolderValidate: K,
|
|
117
|
+
isCreatingFolder: R.isCreatingFolder,
|
|
118
|
+
onDownloadFiles: R.onDownloadFiles,
|
|
119
|
+
isDownloading: R.isDownloading,
|
|
120
|
+
onDeleteFiles: R.onDeleteFiles,
|
|
121
|
+
isDeleting: R.isDeleting,
|
|
122
|
+
onRenameValidate: q,
|
|
123
|
+
onMoveToFiles: R.onMoveToFiles,
|
|
124
|
+
isRenaming: R.isRenaming,
|
|
125
|
+
onCopyFiles: R.onCopyFiles,
|
|
126
|
+
isCopying: R.isCopying,
|
|
127
|
+
isMoving: R.isMoving,
|
|
128
|
+
cancelCopyMove: R.cancelCopyMove,
|
|
129
|
+
uploadEnabled: H,
|
|
130
|
+
isNewButtonDisabled: !H,
|
|
131
|
+
disabledNewButtonTooltip: M,
|
|
132
|
+
visibleColumns: U,
|
|
133
|
+
dateLocale: j,
|
|
130
134
|
dateOptions: n,
|
|
131
|
-
actionLabels:
|
|
132
|
-
sharedWithMeIds:
|
|
133
|
-
sharedByMePaths:
|
|
134
|
-
onUnshareFiles:
|
|
135
|
-
isUnsharing:
|
|
136
|
-
onRemoveFilesAccess:
|
|
137
|
-
isRemovingAccess:
|
|
138
|
-
fileMetadata:
|
|
139
|
-
isFileMetadataLoading:
|
|
140
|
-
onGetInfo:
|
|
141
|
-
clearMetadata:
|
|
142
|
-
isAnyOperationInProgress:
|
|
135
|
+
actionLabels: W,
|
|
136
|
+
sharedWithMeIds: I.sharedWithMeIds,
|
|
137
|
+
sharedByMePaths: I.sharedByMePaths,
|
|
138
|
+
onUnshareFiles: z.onUnshareFiles,
|
|
139
|
+
isUnsharing: z.isUnsharing,
|
|
140
|
+
onRemoveFilesAccess: z.onRemoveFilesAccess,
|
|
141
|
+
isRemovingAccess: z.isRemovingAccess,
|
|
142
|
+
fileMetadata: B.fileMetadata,
|
|
143
|
+
isFileMetadataLoading: B.isFileMetadataLoading,
|
|
144
|
+
onGetInfo: B.onGetInfo,
|
|
145
|
+
clearMetadata: B.clearMetadata,
|
|
146
|
+
isAnyOperationInProgress: G
|
|
143
147
|
};
|
|
144
148
|
};
|
|
145
149
|
//#endregion
|
|
146
|
-
export {
|
|
150
|
+
export { y as useDialFileManager };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { FileManagerNotificationReason as e } from "../dial-file-manager.types.js";
|
|
2
|
+
import { DIAL_FILE_MANAGER_SECTION_TABS as t } from "../dial-file-manager.model.js";
|
|
3
|
+
import { hasSamePaths as n, resolveSectionByPath as r, unionPathSets as i, withRoutableRootLabels as ee } from "../dial-file-manager-path.util.js";
|
|
4
|
+
import { useDialFileManager as a } from "../useDialFileManager/useDialFileManager.js";
|
|
5
|
+
import { useEffect as te, useMemo as ne, useRef as re, useState as o } from "react";
|
|
6
|
+
import { NotificationVariant as s } from "@epam/ai-dial-ui-kit";
|
|
7
|
+
import { DialFileManagerTabs as c } from "@epam/ai-dial-react-file-manager";
|
|
8
|
+
//#region src/files/useDialFileManagerSections/useDialFileManagerSections.ts
|
|
9
|
+
var l = ({ activeTab: l, sections: u, ...d }) => {
|
|
10
|
+
let f = ne(() => ee(u.filter((e) => t.includes(e.tab))), [u]), p = l === c.All, m = (e) => {
|
|
11
|
+
let t = f.find((t) => t.tab === e);
|
|
12
|
+
return {
|
|
13
|
+
...d,
|
|
14
|
+
activeTab: e,
|
|
15
|
+
rootLabel: t?.rootLabel ?? e,
|
|
16
|
+
isActive: t != null && (p || l === e),
|
|
17
|
+
sessionKey: l
|
|
18
|
+
};
|
|
19
|
+
}, h = a(m(c.MyFiles)), g = a(m(c.Shared)), ie = a(m(c.Organization)), _ = (e) => {
|
|
20
|
+
switch (e) {
|
|
21
|
+
case c.MyFiles: return h;
|
|
22
|
+
case c.Shared: return g;
|
|
23
|
+
case c.Organization: return ie;
|
|
24
|
+
default: throw Error(`Not a file-manager section tab: ${e}`);
|
|
25
|
+
}
|
|
26
|
+
}, [v, y] = o(null), [b, x] = o(null), [S, C] = o(l);
|
|
27
|
+
S !== l && (C(l), y(null), x(null));
|
|
28
|
+
let w = (e) => f.some((t) => t.tab === e), ae = f[0]?.tab ?? c.MyFiles, T = v != null && w(v) ? v : ae, oe = b != null && w(b) ? b : T, E = (e) => e == null ? void 0 : r(e, f)?.tab, D = (e) => _(E(e) ?? T), O = (e, t) => {
|
|
29
|
+
let n = /* @__PURE__ */ new Map();
|
|
30
|
+
return e.forEach((e) => {
|
|
31
|
+
let r = E(t(e)) ?? T;
|
|
32
|
+
n.set(r, [...n.get(r) ?? [], e]);
|
|
33
|
+
}), [...n];
|
|
34
|
+
}, { onNotification: k } = d, A = re(/* @__PURE__ */ new Set());
|
|
35
|
+
te(() => {
|
|
36
|
+
let t = A.current;
|
|
37
|
+
if (!p) {
|
|
38
|
+
t.clear();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
f.forEach(({ tab: n }) => {
|
|
42
|
+
if (_(n).error == null) {
|
|
43
|
+
t.delete(n);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
t.has(n) || (t.add(n), n !== T && k?.({
|
|
47
|
+
variant: s.Error,
|
|
48
|
+
reason: e.FolderLoadFailed
|
|
49
|
+
}));
|
|
50
|
+
});
|
|
51
|
+
}, [
|
|
52
|
+
f.map(({ tab: e }) => `${e}:${_(e).error ?? ""}`).join("|"),
|
|
53
|
+
p,
|
|
54
|
+
T,
|
|
55
|
+
k
|
|
56
|
+
]);
|
|
57
|
+
let j = () => {
|
|
58
|
+
k?.({
|
|
59
|
+
variant: s.Warning,
|
|
60
|
+
reason: e.CrossSectionTransferUnsupported
|
|
61
|
+
});
|
|
62
|
+
}, M = (e, t) => {
|
|
63
|
+
let n = new Set(e.map(E));
|
|
64
|
+
if (n.size !== 1) return;
|
|
65
|
+
let [r] = n;
|
|
66
|
+
if (r != null) return (t ? E(t) : r) === r ? r : void 0;
|
|
67
|
+
}, N = (e) => {
|
|
68
|
+
if (e == null) {
|
|
69
|
+
_(T).onPathChange();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
let t = E(e);
|
|
73
|
+
t != null && (y(t), _(t).onPathChange(e));
|
|
74
|
+
}, P = (e) => {
|
|
75
|
+
f.forEach(({ tab: t }) => {
|
|
76
|
+
let r = _(t), i = new Set([...e].filter((e) => E(e) === t));
|
|
77
|
+
n(i, r.expandedPaths) || r.onExpandedPathsChange(i);
|
|
78
|
+
});
|
|
79
|
+
}, F = (e) => D(e).onFolderPopupPathChange(e), I = (e, t) => D(t).onUploadFiles(e, t), L = (e, t, n) => D(n).onUploadArchive(e, t, n), R = (e, t, n) => D(n).onValidateUpload(e, t, n), z = (e, t, n) => D(t).onCreateFolder(e, t, n), B = (e, t) => D(t.path).onCreateFolderValidate(e, t), V = (e) => O(e, (e) => e.path).forEach(([e, t]) => _(e).onDownloadFiles(t)), H = (e, t) => {
|
|
80
|
+
let n = E(t);
|
|
81
|
+
O(e, (e) => e.sourceUrl ?? t).forEach(([e, r]) => _(e).onDeleteFiles(r, e === n ? t : ""));
|
|
82
|
+
}, U = (e, t) => D(t.path).onRenameValidate(e, t), W = (e) => O(e, (e) => e.path).forEach(([e, t]) => _(e).onUnshareFiles(t)), G = (e) => O(e, (e) => e.path).forEach(([e, t]) => _(e).onRemoveFilesAccess(t)), K = (e) => {
|
|
83
|
+
let t = E(e.path) ?? T;
|
|
84
|
+
x(t), _(t).onGetInfo(e);
|
|
85
|
+
}, q = (e, t) => {
|
|
86
|
+
if (e.length === 0) return;
|
|
87
|
+
let n = M(e.map((e) => e.sourceUrl), t);
|
|
88
|
+
if (n == null) {
|
|
89
|
+
j();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
_(n).onCopyFiles(e, t);
|
|
93
|
+
}, se = (e, t, n) => {
|
|
94
|
+
if (e.length === 0) return;
|
|
95
|
+
let r = M(e.map((e) => e.sourceUrl ?? t), n);
|
|
96
|
+
if (r == null) {
|
|
97
|
+
j();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
_(r).onMoveToFiles(e, t, n);
|
|
101
|
+
}, ce = () => f.forEach(({ tab: e }) => _(e).cancelCopyMove());
|
|
102
|
+
if (!p) {
|
|
103
|
+
let e = t.includes(l) ? l : c.MyFiles;
|
|
104
|
+
return {
|
|
105
|
+
..._(e),
|
|
106
|
+
sectionTab: e
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
let J = f.map(({ tab: e }) => _(e)), Y = _(T), X = _(oe), Z = [Y, ...J].find((e) => e.uploadBatchState != null) ?? Y, Q = (e) => J.some(e), $ = J.map((e) => e.sharedWithMeIds).filter((e) => e != null), le = new Set(f.filter(({ tab: e }) => e !== T && _(e).isLoading).map(({ tab: e }) => _(e).path));
|
|
110
|
+
return {
|
|
111
|
+
...Y,
|
|
112
|
+
items: J.map((e) => e.items[0]).filter((e) => e != null),
|
|
113
|
+
onPathChange: N,
|
|
114
|
+
expandedPaths: i(J.map((e) => e.expandedPaths)),
|
|
115
|
+
loadedPaths: i(J.map((e) => e.loadedPaths)),
|
|
116
|
+
onExpandedPathsChange: P,
|
|
117
|
+
onFolderPopupPathChange: F,
|
|
118
|
+
folderPopupLoadingPaths: i([...J.map((e) => e.folderPopupLoadingPaths), le]),
|
|
119
|
+
onUploadFiles: I,
|
|
120
|
+
onUploadArchive: L,
|
|
121
|
+
onValidateUpload: R,
|
|
122
|
+
uploadBatchState: Z.uploadBatchState,
|
|
123
|
+
cancelUpload: Z.cancelUpload,
|
|
124
|
+
cancelUploadFile: Z.cancelUploadFile,
|
|
125
|
+
clearUploadBatch: Z.clearUploadBatch,
|
|
126
|
+
onCreateFolder: z,
|
|
127
|
+
onCreateFolderValidate: B,
|
|
128
|
+
isCreatingFolder: Q((e) => e.isCreatingFolder),
|
|
129
|
+
onDownloadFiles: V,
|
|
130
|
+
isDownloading: Q((e) => e.isDownloading),
|
|
131
|
+
onDeleteFiles: H,
|
|
132
|
+
isDeleting: Q((e) => e.isDeleting),
|
|
133
|
+
onRenameValidate: U,
|
|
134
|
+
onMoveToFiles: se,
|
|
135
|
+
isRenaming: Q((e) => e.isRenaming),
|
|
136
|
+
onCopyFiles: q,
|
|
137
|
+
isCopying: Q((e) => e.isCopying),
|
|
138
|
+
isMoving: Q((e) => e.isMoving),
|
|
139
|
+
cancelCopyMove: ce,
|
|
140
|
+
sharedWithMeIds: $.length > 0 ? $.flat() : void 0,
|
|
141
|
+
sharedByMePaths: i(J.map((e) => e.sharedByMePaths)),
|
|
142
|
+
onUnshareFiles: W,
|
|
143
|
+
isUnsharing: Q((e) => e.isUnsharing),
|
|
144
|
+
onRemoveFilesAccess: G,
|
|
145
|
+
isRemovingAccess: Q((e) => e.isRemovingAccess),
|
|
146
|
+
fileMetadata: X.fileMetadata,
|
|
147
|
+
isFileMetadataLoading: X.isFileMetadataLoading,
|
|
148
|
+
onGetInfo: K,
|
|
149
|
+
clearMetadata: X.clearMetadata,
|
|
150
|
+
isAnyOperationInProgress: Q((e) => e.isAnyOperationInProgress),
|
|
151
|
+
sectionTab: T
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
//#endregion
|
|
155
|
+
export { l as useDialFileManagerSections };
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { DIAL_FILE_MANAGER_SECTION_TABS as e } from "../dial-file-manager.model.js";
|
|
2
|
+
import { useCallback as t, useEffect as n, useMemo as r } from "react";
|
|
3
|
+
import { DialFileManagerTabs as i } from "@epam/ai-dial-react-file-manager";
|
|
3
4
|
//#region src/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.ts
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
return
|
|
15
|
-
|
|
5
|
+
var a = [
|
|
6
|
+
i.All,
|
|
7
|
+
i.MyFiles,
|
|
8
|
+
i.Shared,
|
|
9
|
+
i.Organization
|
|
10
|
+
], o = 2, s = (s, c, l, u) => {
|
|
11
|
+
let d = t((t) => {
|
|
12
|
+
let n = (e) => u == null || u.includes(e);
|
|
13
|
+
return n(t) ? t === i.All ? e.filter((e) => n(e)).length >= o : !0 : !1;
|
|
14
|
+
}, [u]), f = r(() => l?.filter((e) => d(e.value)), [l, d]);
|
|
15
|
+
return n(() => {
|
|
16
|
+
d(s) || c(a.find((e) => d(e)) ?? i.MyFiles);
|
|
16
17
|
}, [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
]), { tabs:
|
|
18
|
+
d,
|
|
19
|
+
s,
|
|
20
|
+
c
|
|
21
|
+
]), { tabs: f };
|
|
21
22
|
};
|
|
22
23
|
//#endregion
|
|
23
|
-
export {
|
|
24
|
+
export { s as useDialFileManagerTabConfig };
|
|
@@ -6,19 +6,18 @@ import { prepareCopyItems as f, prepareMoveRenameItems as p } from "../dial-file
|
|
|
6
6
|
import { findFirstSuccessfulCopyMoveItem as m } from "../dial-file-manager-mapping.util.js";
|
|
7
7
|
import { DownloadDestinationType as h } from "../download-destination.js";
|
|
8
8
|
import { useCallback as g, useRef as _, useState as v } from "react";
|
|
9
|
-
import { ArchiveItemDtoNodeTypeEnum as y,
|
|
9
|
+
import { ArchiveItemDtoNodeTypeEnum as y, CopyItemDtoNodeTypeEnum as b, DeleteItemDtoNodeTypeEnum as x, MoveItemDtoNodeTypeEnum as ee, RenameItemDtoNodeTypeEnum as te } from "@epam/ai-dial-chat-api-client";
|
|
10
10
|
import { NOT_ALLOWED_SYMBOLS as S, NotificationVariant as C } from "@epam/ai-dial-ui-kit";
|
|
11
11
|
import { DialFileManagerTabs as w, DialFileNodeType as T } from "@epam/ai-dial-react-file-manager";
|
|
12
12
|
//#region src/files/useDialFileMutations/useDialFileMutations.ts
|
|
13
13
|
var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, currentFolder: j, sharedRootMetaRef: M, listingPermissionsCache: N, invalidateFolders: P, bumpRetry: F, mergeCreatedFolder: I, setFolderPath: L, onNotification: R, onOperationSuccess: z, downloadDestination: B, forbiddenSymbolsRegExp: V }) => {
|
|
14
|
-
let [
|
|
14
|
+
let [ne, H] = v(!1), [re, U] = v(!1), [ie, W] = v(!1), [G, K] = v(!1), [q, J] = v(!1), [Y, X] = v(!1), Z = _(null), Q = _(null), $ = g((e, n) => {
|
|
15
15
|
let i = null;
|
|
16
16
|
if (!e || e.trim() === "") i = { reason: t.Empty };
|
|
17
17
|
else if (o(e, V)) i = {
|
|
18
18
|
reason: t.ForbiddenSymbols,
|
|
19
19
|
symbols: S
|
|
20
20
|
};
|
|
21
|
-
else if (e.startsWith(".")) i = { reason: t.LeadingDot };
|
|
22
21
|
else if (e === r) i = { reason: t.ReservedName };
|
|
23
22
|
else if (e.length > 255) i = {
|
|
24
23
|
reason: t.TooLong,
|
|
@@ -32,7 +31,7 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
32
31
|
});
|
|
33
32
|
}
|
|
34
33
|
return Q.current = i, i;
|
|
35
|
-
}, [V]),
|
|
34
|
+
}, [V]), ae = g(async (t, r, i) => {
|
|
36
35
|
let { parentVirtualPath: a, name: o } = s(r, O), l = d(a, O), u = j && A === l ? j : {
|
|
37
36
|
id: l,
|
|
38
37
|
path: l,
|
|
@@ -78,7 +77,7 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
78
77
|
z,
|
|
79
78
|
M,
|
|
80
79
|
R
|
|
81
|
-
]),
|
|
80
|
+
]), oe = g((t) => {
|
|
82
81
|
(async () => {
|
|
83
82
|
U(!0);
|
|
84
83
|
try {
|
|
@@ -128,7 +127,7 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
128
127
|
R,
|
|
129
128
|
E,
|
|
130
129
|
B
|
|
131
|
-
]),
|
|
130
|
+
]), se = g((t, n) => {
|
|
132
131
|
t.length !== 0 && (async () => {
|
|
133
132
|
W(!0);
|
|
134
133
|
let r = t.map((e) => {
|
|
@@ -140,7 +139,7 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
140
139
|
bucket: o,
|
|
141
140
|
path: s,
|
|
142
141
|
name: i,
|
|
143
|
-
nodeType: t ?
|
|
142
|
+
nodeType: t ? x.Folder : x.Item
|
|
144
143
|
};
|
|
145
144
|
});
|
|
146
145
|
try {
|
|
@@ -166,9 +165,9 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
166
165
|
reason: e.DeleteFailed
|
|
167
166
|
});
|
|
168
167
|
}
|
|
169
|
-
let i = r.filter((e) => e.nodeType ===
|
|
168
|
+
let i = r.filter((e) => e.nodeType === x.Folder).map((e) => e.path.endsWith("/") ? e.path : `${e.path}/`);
|
|
170
169
|
P([...new Set(r.map((e) => {
|
|
171
|
-
if (e.nodeType ===
|
|
170
|
+
if (e.nodeType === x.Folder) return e.path.endsWith("/") ? e.path : `${e.path}/`;
|
|
172
171
|
let t = e.path.lastIndexOf("/");
|
|
173
172
|
return t > 0 ? e.path.slice(0, t + 1) : "";
|
|
174
173
|
}))]), i.some((e) => A === e || A.startsWith(e)) && L((e) => e.replace(/[^/]+\/$/, "")), F(), W(!1);
|
|
@@ -184,7 +183,7 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
184
183
|
P,
|
|
185
184
|
F,
|
|
186
185
|
L
|
|
187
|
-
]),
|
|
186
|
+
]), ce = g((e, n) => {
|
|
188
187
|
if (!e || e.trim() === "") return { reason: t.Empty };
|
|
189
188
|
if (e === r) return { reason: t.ReservedName };
|
|
190
189
|
if (o(e, V)) return {
|
|
@@ -200,20 +199,21 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
200
199
|
reason: t.DuplicateName,
|
|
201
200
|
existingName: s.name
|
|
202
201
|
} : null;
|
|
203
|
-
}, [V, j]),
|
|
202
|
+
}, [V, j]), le = g((t, r) => {
|
|
204
203
|
if (t.length === 0 || q || Y) return;
|
|
205
204
|
let a = new AbortController();
|
|
206
205
|
Z.current = a, (async () => {
|
|
207
206
|
J(!0);
|
|
208
207
|
let o = f(t, D, O), s = o.map(({ dto: e }) => e);
|
|
209
208
|
try {
|
|
210
|
-
let { results: t } = await E.copyFiles(s, a.signal), c = t.filter((e) => !e.success).length,
|
|
211
|
-
if (
|
|
212
|
-
let e = m(o, t);
|
|
213
|
-
z?.({
|
|
214
|
-
kind:
|
|
209
|
+
let { results: t } = await E.copyFiles(s, a.signal), c = t.filter((e) => !e.success).length, u = t.length - c;
|
|
210
|
+
if (u > 0) {
|
|
211
|
+
let e = m(o, t), a = s.every((e) => l(e.sourcePath) === l(e.destinationPath)), c;
|
|
212
|
+
c = a ? u === 1 ? n.FileDuplicated : n.FilesDuplicated : u === 1 ? n.FileCopied : n.FilesCopied, z?.({
|
|
213
|
+
kind: c,
|
|
215
214
|
name: e?.destinationName,
|
|
216
|
-
count:
|
|
215
|
+
count: u,
|
|
216
|
+
isFolder: e?.dto.nodeType === b.Folder,
|
|
217
217
|
destinationFolderName: i(r, O)
|
|
218
218
|
});
|
|
219
219
|
}
|
|
@@ -244,21 +244,21 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
244
244
|
Y,
|
|
245
245
|
P,
|
|
246
246
|
F
|
|
247
|
-
]),
|
|
247
|
+
]), ue = g(() => {
|
|
248
248
|
Z.current?.abort();
|
|
249
249
|
}, []);
|
|
250
250
|
return {
|
|
251
|
-
isCreatingFolder:
|
|
252
|
-
isDownloading:
|
|
253
|
-
isDeleting:
|
|
251
|
+
isCreatingFolder: ne,
|
|
252
|
+
isDownloading: re,
|
|
253
|
+
isDeleting: ie,
|
|
254
254
|
isRenaming: G,
|
|
255
255
|
isCopying: q,
|
|
256
256
|
isMoving: Y,
|
|
257
|
-
onCreateFolder:
|
|
257
|
+
onCreateFolder: ae,
|
|
258
258
|
onCreateFolderValidate: $,
|
|
259
|
-
onDownloadFiles:
|
|
260
|
-
onDeleteFiles:
|
|
261
|
-
onRenameValidate:
|
|
259
|
+
onDownloadFiles: oe,
|
|
260
|
+
onDeleteFiles: se,
|
|
261
|
+
onRenameValidate: ce,
|
|
262
262
|
onMoveToFiles: g((t, r, o) => {
|
|
263
263
|
if (t.length === 0 || q || Y || G) return;
|
|
264
264
|
let { renameDtos: s, preparedMoveItems: c } = p(t, D, O), u = c.map(({ dto: e }) => e), d = new AbortController();
|
|
@@ -308,6 +308,7 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
308
308
|
kind: _ === 1 ? n.FileMoved : n.FilesMoved,
|
|
309
309
|
name: e?.destinationName,
|
|
310
310
|
count: _,
|
|
311
|
+
isFolder: e?.dto.nodeType === ee.Folder,
|
|
311
312
|
destinationFolderName: i(o, O)
|
|
312
313
|
});
|
|
313
314
|
}
|
|
@@ -316,7 +317,7 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
316
317
|
z?.({
|
|
317
318
|
kind: n.FileRenamed,
|
|
318
319
|
name: a(e.destinationPath, e.destinationPath),
|
|
319
|
-
isFolder: e.nodeType ===
|
|
320
|
+
isFolder: e.nodeType === te.Folder
|
|
320
321
|
});
|
|
321
322
|
}
|
|
322
323
|
y > 0 && (y === v ? R?.({
|
|
@@ -327,11 +328,11 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
327
328
|
reason: b ? e.MovePartiallyFailed : e.RenamePartiallyFailed,
|
|
328
329
|
count: y
|
|
329
330
|
}));
|
|
330
|
-
let
|
|
331
|
-
if (
|
|
332
|
-
let e =
|
|
331
|
+
let x = s.find((e) => e.nodeType === te.Folder && t.results.some((t) => t.success && t.sourcePath === e.sourcePath));
|
|
332
|
+
if (x != null) {
|
|
333
|
+
let e = x.sourcePath.endsWith("/") ? x.sourcePath : `${x.sourcePath}/`;
|
|
333
334
|
if (A === e || A.startsWith(e)) {
|
|
334
|
-
let t =
|
|
335
|
+
let t = x.destinationPath.endsWith("/") ? x.destinationPath : `${x.destinationPath}/`;
|
|
335
336
|
L(A.replace(e, t));
|
|
336
337
|
}
|
|
337
338
|
}
|
|
@@ -351,8 +352,8 @@ var E = ({ filesApi: E, bucket: D, rootLabel: O, activeTab: k, folderPath: A, cu
|
|
|
351
352
|
F,
|
|
352
353
|
L
|
|
353
354
|
]),
|
|
354
|
-
onCopyFiles:
|
|
355
|
-
cancelCopyMove:
|
|
355
|
+
onCopyFiles: le,
|
|
356
|
+
cancelCopyMove: ue
|
|
356
357
|
};
|
|
357
358
|
};
|
|
358
359
|
//#endregion
|