@epam/ai-dial-chat-hooks 1.2.0-dev.99 → 1.3.0-dev.5

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.
Files changed (84) hide show
  1. package/api-error/api-error.js +7 -4
  2. package/catalog/catalog-derivations.js +1 -1
  3. package/catalog/deployment-id.js +8 -2
  4. package/catalog/map-deployment-limits-to-catalog.js +16 -24
  5. package/catalog/map-deployment-limits-to-input.js +81 -9
  6. package/catalog/map-deployment-to-catalog-item.js +34 -34
  7. package/catalog/map-entity-details-to-catalog.js +237 -192
  8. package/catalog/map-skill-to-catalog-item.js +61 -54
  9. package/catalog/publish.js +4 -4
  10. package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.js +122 -101
  11. package/catalog/useCatalogItemDetails.js +9 -8
  12. package/catalog/usePublishFolders/usePublishFolders.js +1 -1
  13. package/catalog.d.ts +171 -34
  14. package/catalog.js +23 -23
  15. package/conversation/conversation-transfer/export-conversation.js +24 -16
  16. package/conversation/conversation-transfer/import-conversation.js +80 -31
  17. package/conversation/create-chat-stream-api.js +89 -49
  18. package/conversation/get-model-id-from-conversation-id.js +15 -9
  19. package/conversation/message-utils.js +44 -2
  20. package/conversation/stage.js +6 -2
  21. package/conversation/useActiveConversationSync/useActiveConversationSync.js +7 -8
  22. package/conversation/useConversationExport/useConversationExport.js +9 -9
  23. package/conversation/useConversationHandlers/message-utils.js +8 -5
  24. package/conversation/useConversationHandlers/useConversationHandlers.js +181 -167
  25. package/conversation/useConversationImport/useConversationImport.js +123 -121
  26. package/conversation/useConversationPanelItems/useConversationPanelItems.js +49 -31
  27. package/conversation/useConversationStream/frame-scheduler.js +39 -0
  28. package/conversation/useConversationStream/generation-resume.js +122 -64
  29. package/conversation/useConversationStream/useConversationStream.js +298 -118
  30. package/conversation/useMessageSelectionReply/useMessageSelectionReply.js +189 -0
  31. package/conversation-sources/useConversationSources/useConversationSources.js +31 -24
  32. package/conversation-sources.d.ts +1 -1
  33. package/conversation-transfer.d.ts +2 -1
  34. package/conversation.d.ts +218 -22
  35. package/conversation.js +32 -31
  36. package/file-manager-canvas.d.ts +27 -7
  37. package/file-manager.d.ts +87 -32
  38. package/file-manager.js +25 -24
  39. package/files/attachment-canvas.js +67 -44
  40. package/files/dial-file-manager-copy-move.util.js +9 -8
  41. package/files/dial-file-manager-mapping.util.js +2 -1
  42. package/files/dial-file-manager-path.util.js +24 -2
  43. package/files/dial-file-manager.model.js +23 -19
  44. package/files/dial-file-manager.types.js +3 -3
  45. package/files/file-manager-variant.js +1 -1
  46. package/files/resolve-dial-file-api-path.js +11 -12
  47. package/files/useDialFileListing/useDialFileListing.js +140 -127
  48. package/files/useDialFileManager/useDialFileManager.js +139 -135
  49. package/files/useDialFileManagerSections/useDialFileManagerSections.js +155 -0
  50. package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +20 -15
  51. package/files/useDialFileMutations/useDialFileMutations.js +65 -60
  52. package/files/useDialFileUploadBatch/useDialFileUploadBatch.js +117 -110
  53. package/files/useFileAttachmentPicker/useFileAttachmentPicker.js +28 -23
  54. package/index.d.ts +643 -128
  55. package/index.js +136 -134
  56. package/mcp-apps/useMcpAppTools/useMcpAppTools.js +1 -1
  57. package/oauth/authorize-url.js +3 -3
  58. package/oauth/toolset-id.js +5 -3
  59. package/oauth/useToolsetLogin/useToolsetLogin.js +8 -8
  60. package/oauth.d.ts +34 -2
  61. package/oauth.js +9 -9
  62. package/package.json +19 -23
  63. package/scheduled-task/scheduled-task-description.js +43 -39
  64. package/scheduled-task/scheduled-task-trigger.js +74 -71
  65. package/scheduled-task/use-scheduled-task-runs.js +162 -50
  66. package/scheduled-task/use-scheduled-tasks.js +52 -48
  67. package/scheduled-tasks.d.ts +27 -6
  68. package/scheduled-tasks.js +2 -2
  69. package/shared/application-schema.js +5 -2
  70. package/shared/cron-day-of-month.js +13 -0
  71. package/skill/skill-archive.js +19 -0
  72. package/skill/skill-types.js +8 -7
  73. package/skill/skill.js +52 -29
  74. package/skill/useSkillArchiveImport/useSkillArchiveImport.js +38 -34
  75. package/skill/useSkillEditorLoad.js +65 -59
  76. package/skill/useSkillEditorSubmit.js +105 -93
  77. package/skill/useSkillFileActions.js +70 -58
  78. package/skill-editor.d.ts +62 -13
  79. package/skill-editor.js +9 -9
  80. package/usage/map-user-usage-to-model-limits.js +137 -95
  81. package/usage.d.ts +8 -3
  82. package/usePageFileDrag/usePageFileDrag.js +3 -3
  83. package/utils.d.ts +26 -6
  84. package/utils.js +10 -10
@@ -1,146 +1,150 @@
1
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";
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";
11
12
  //#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(() => {
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
49
+ }), 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(() => {
62
65
  let e = {}, t = (t) => {
63
- let n = D[t];
66
+ let n = A[t];
64
67
  n != null && (e[t] = n);
65
68
  };
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;
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;
67
70
  }, [
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]);
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: 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,
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: 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
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 { v as useDialFileManager };
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,19 +1,24 @@
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";
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 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.value)), [s, l]);
10
- return t(() => {
11
- l(a) || o(i.find((e) => l(e)) ?? r.MyFiles);
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);
12
17
  }, [
13
- l,
14
- a,
15
- o
16
- ]), { tabs: u };
18
+ d,
19
+ s,
20
+ c
21
+ ]), { tabs: f };
17
22
  };
18
23
  //#endregion
19
- export { a as useDialFileManagerTabConfig };
24
+ export { s as useDialFileManagerTabConfig };