@epam/ai-dial-chat-hooks 1.2.0-rc.0 → 1.3.0-dev.10

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.
@@ -1,150 +1,156 @@
1
- import { COLUMNS_WITHOUT_AUTHOR as e, COLUMNS_WITH_AUTHOR as t, DATE_OPTIONS as n } from "../dial-file-manager.model.js";
2
- import { hasDialFileWritePermission as r, isCopyMoveDuplicateAllowed as i, isShareActionsAllowed as a } from "../dial-file-manager-path.util.js";
3
- import { deriveActionProfile as o } from "../file-manager-variant.js";
4
- import { useDialFileListing as s } from "../useDialFileListing/useDialFileListing.js";
5
- import { useDialFileMetadata as c } from "../useDialFileMetadata/useDialFileMetadata.js";
6
- import { useDialFileMutations as l } from "../useDialFileMutations/useDialFileMutations.js";
7
- import { useDialFileSharing as u } from "../useDialFileSharing/useDialFileSharing.js";
8
- import { useDialFileUploadBatch as d } from "../useDialFileUploadBatch/useDialFileUploadBatch.js";
9
- import { DialFileManagerActionProfile as f, DialFileManagerVariant as p, 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";
1
+ import { COLUMNS_MY_FILES as e, COLUMNS_ORGANIZATION as t, COLUMNS_SHARED as n, DATE_OPTIONS as r } from "../dial-file-manager.model.js";
2
+ import { hasDialFileWritePermission as i, isCopyMoveDuplicateAllowed as a, isShareActionsAllowed as o } from "../dial-file-manager-path.util.js";
3
+ import { deriveActionProfile as s } from "../file-manager-variant.js";
4
+ import { useDialFileListing as c } from "../useDialFileListing/useDialFileListing.js";
5
+ import { useDialFileMetadata as l } from "../useDialFileMetadata/useDialFileMetadata.js";
6
+ import { useDialFileMutations as u } from "../useDialFileMutations/useDialFileMutations.js";
7
+ import { useDialFileSharing as d } from "../useDialFileSharing/useDialFileSharing.js";
8
+ import { useDialFileUploadBatch as f } from "../useDialFileUploadBatch/useDialFileUploadBatch.js";
9
+ import { DialFileManagerActionProfile as p, DialFileManagerVariant as m, isUploadInProgress as h } from "@epam/ai-dial-chat-shared";
10
+ import { useCallback as g, useMemo as _ } from "react";
11
+ import { DialFileManagerActions as v, DialFileManagerTabs as y } from "@epam/ai-dial-react-file-manager";
12
12
  //#region src/files/useDialFileManager/useDialFileManager.ts
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 = p.Attach, actionProfile: k, labels: A, locale: j, disabledNewButtonTooltip: M, downloadDestination: N, buildValidationErrorMessage: P }) => {
14
- let F = k ?? o(O), I = s({
15
- filesApi: y,
16
- bucket: b,
17
- rootLabel: x,
18
- activeTab: S,
19
- onNotification: T,
20
- isActive: C,
21
- sessionKey: w
22
- }), L = d({
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 = l({
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
13
+ var b = ({ filesApi: b, bucket: x, rootLabel: S = "My files", activeTab: C = y.MyFiles, isActive: w, sessionKey: T, onNotification: E, onOperationSuccess: D, forbiddenSymbolsRegExp: O, variant: k = m.Attach, actionProfile: A, labels: j, locale: M, disabledNewButtonTooltip: N, downloadDestination: P, buildValidationErrorMessage: F }) => {
14
+ let I = A ?? s(k), L = c({
15
+ filesApi: b,
16
+ bucket: x,
17
+ rootLabel: S,
18
+ activeTab: C,
19
+ onNotification: E,
20
+ isActive: w,
21
+ sessionKey: T
22
+ }), R = f({
23
+ filesApi: b,
24
+ bucket: x,
25
+ rootLabel: S,
26
+ activeTab: C,
27
+ cache: L.cache,
28
+ sharedRootMetaRef: L.sharedRootMetaRef,
29
+ invalidateFolders: L.invalidateFolders,
30
+ bumpRetry: L.bumpRetry,
31
+ onNotification: E
49
32
  }), z = u({
50
- filesApi: y,
51
- bucket: b,
52
- rootLabel: x,
53
- bumpRetry: I.bumpRetry,
54
- onNotification: T
55
- }), B = c({
56
- filesApi: y,
57
- bucket: b,
58
- rootLabel: x,
59
- onNotification: T
60
- }), V = r(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(() => {
33
+ filesApi: b,
34
+ bucket: x,
35
+ rootLabel: S,
36
+ activeTab: C,
37
+ folderPath: L.folderPath,
38
+ currentFolder: L.currentFolder,
39
+ sharedRootMetaRef: L.sharedRootMetaRef,
40
+ listingPermissionsCache: L.listingPermissionsCache,
41
+ invalidateFolders: L.invalidateFolders,
42
+ bumpRetry: L.bumpRetry,
43
+ mergeCreatedFolder: L.mergeCreatedFolder,
44
+ setFolderPath: L.setFolderPath,
45
+ onNotification: E,
46
+ onOperationSuccess: D,
47
+ downloadDestination: P,
48
+ forbiddenSymbolsRegExp: O
49
+ }), B = d({
50
+ filesApi: b,
51
+ bucket: x,
52
+ rootLabel: S,
53
+ bumpRetry: L.bumpRetry,
54
+ onNotification: E
55
+ }), V = l({
56
+ filesApi: b,
57
+ bucket: x,
58
+ rootLabel: S,
59
+ onNotification: E
60
+ }), H = i(L.currentFolder), U = _(() => C === y.Organization || C === y.Shared && L.folderPath === "" ? !1 : H, [
61
+ C,
62
+ L.folderPath,
63
+ H
64
+ ]), W = _(() => {
65
+ switch (C) {
66
+ case y.Shared: return n;
67
+ case y.Organization: return t;
68
+ default: return e;
69
+ }
70
+ }, [C]), G = _(() => {
65
71
  let e = {}, t = (t) => {
66
- let n = A[t];
72
+ let n = j[t];
67
73
  n != null && (e[t] = n);
68
74
  };
69
- return t(_.Download), S === v.MyFiles ? (t(_.Delete), H && (t(_.Rename), i(F) && (t(_.Copy), t(_.Move), t(_.Duplicate))), a(F) && t(_.RemoveAccess)) : S === v.Shared && a(F) && t(_.Unshare), F === f.Full && t(_.Info), e;
75
+ return t(v.Download), C === y.MyFiles ? (t(v.Delete), U && (t(v.Rename), a(I) && (t(v.Copy), t(v.Move), t(v.Duplicate))), o(I) && t(v.RemoveAccess)) : C === y.Shared && o(I) && t(v.Unshare), I === p.Full && t(v.Info), e;
70
76
  }, [
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]);
77
+ C,
78
+ U,
79
+ I,
80
+ j
81
+ ]), K = _(() => z.isCreatingFolder || z.isDownloading || z.isDeleting || z.isRenaming || z.isCopying || z.isMoving || B.isUnsharing || B.isRemovingAccess || h(R.uploadBatchState), [
82
+ z.isCreatingFolder,
83
+ z.isDownloading,
84
+ z.isDeleting,
85
+ z.isRenaming,
86
+ z.isCopying,
87
+ z.isMoving,
88
+ B.isUnsharing,
89
+ B.isRemovingAccess,
90
+ R.uploadBatchState
91
+ ]), q = g((e, t) => {
92
+ let n = z.onCreateFolderValidate(e, t);
93
+ return n ? F(n) : null;
94
+ }, [z, F]), J = g((e, t) => {
95
+ let n = z.onRenameValidate(e, t);
96
+ return n ? F(n, t) : null;
97
+ }, [z, F]);
92
98
  return {
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,
134
- dateOptions: n,
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
99
+ items: L.items,
100
+ isLoading: L.isLoading,
101
+ error: L.error,
102
+ path: L.path,
103
+ onPathChange: L.onPathChange,
104
+ retry: L.retry,
105
+ onSearchFiles: L.onSearchFiles,
106
+ isSearching: L.isSearching,
107
+ searchResults: L.searchResults,
108
+ clearSearchResults: L.clearSearchResults,
109
+ expandedPaths: L.expandedPaths,
110
+ loadedPaths: L.loadedPaths,
111
+ onExpandedPathsChange: L.onExpandedPathsChange,
112
+ onFolderPopupPathChange: L.onFolderPopupPathChange,
113
+ folderPopupLoadingPaths: L.folderPopupLoadingPaths,
114
+ onUploadFiles: R.onUploadFiles,
115
+ onUploadArchive: R.onUploadArchive,
116
+ onValidateUpload: R.onValidateUpload,
117
+ uploadBatchState: R.uploadBatchState,
118
+ cancelUpload: R.cancelUpload,
119
+ cancelUploadFile: R.cancelUploadFile,
120
+ clearUploadBatch: R.clearUploadBatch,
121
+ onCreateFolder: z.onCreateFolder,
122
+ onCreateFolderValidate: q,
123
+ isCreatingFolder: z.isCreatingFolder,
124
+ onDownloadFiles: z.onDownloadFiles,
125
+ isDownloading: z.isDownloading,
126
+ onDeleteFiles: z.onDeleteFiles,
127
+ isDeleting: z.isDeleting,
128
+ onRenameValidate: J,
129
+ onMoveToFiles: z.onMoveToFiles,
130
+ isRenaming: z.isRenaming,
131
+ onCopyFiles: z.onCopyFiles,
132
+ isCopying: z.isCopying,
133
+ isMoving: z.isMoving,
134
+ cancelCopyMove: z.cancelCopyMove,
135
+ uploadEnabled: U,
136
+ isNewButtonDisabled: !U,
137
+ disabledNewButtonTooltip: N,
138
+ visibleColumns: W,
139
+ dateLocale: M,
140
+ dateOptions: r,
141
+ actionLabels: G,
142
+ sharedWithMeIds: L.sharedWithMeIds,
143
+ sharedByMePaths: L.sharedByMePaths,
144
+ onUnshareFiles: B.onUnshareFiles,
145
+ isUnsharing: B.isUnsharing,
146
+ onRemoveFilesAccess: B.onRemoveFilesAccess,
147
+ isRemovingAccess: B.isRemovingAccess,
148
+ fileMetadata: V.fileMetadata,
149
+ isFileMetadataLoading: V.isFileMetadataLoading,
150
+ onGetInfo: V.onGetInfo,
151
+ clearMetadata: V.clearMetadata,
152
+ isAnyOperationInProgress: K
147
153
  };
148
154
  };
149
155
  //#endregion
150
- export { y as useDialFileManager };
156
+ export { b as useDialFileManager };