@epam/ai-dial-chat-hooks 1.4.0-dev.95 → 1.4.0-rc.0

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 (115) hide show
  1. package/api-error/map-api-error.d.ts +10 -0
  2. package/api-error/map-api-error.d.ts.map +1 -0
  3. package/api-error/map-api-error.js +11 -0
  4. package/catalog/create-publish-api.d.ts +14 -10
  5. package/catalog/create-publish-api.d.ts.map +1 -1
  6. package/catalog/create-publish-api.js +8 -9
  7. package/catalog/map-deployment-to-catalog-item.d.ts.map +1 -1
  8. package/catalog/map-deployment-to-catalog-item.js +1 -0
  9. package/catalog/publish-target-taken.d.ts +31 -0
  10. package/catalog/publish-target-taken.d.ts.map +1 -0
  11. package/catalog/publish-target-taken.js +14 -0
  12. package/catalog/resource-name-conflict.d.ts.map +1 -1
  13. package/catalog/resource-name-conflict.js +19 -22
  14. package/catalog/resource-save.d.ts +2 -4
  15. package/catalog/resource-save.d.ts.map +1 -1
  16. package/catalog/resource-save.js +38 -32
  17. package/catalog/use-publish-target-guard.d.ts +45 -0
  18. package/catalog/use-publish-target-guard.d.ts.map +1 -0
  19. package/catalog/use-publish-target-guard.js +18 -0
  20. package/catalog/usePublishFolders/usePublishFolders.d.ts +11 -3
  21. package/catalog/usePublishFolders/usePublishFolders.d.ts.map +1 -1
  22. package/catalog/usePublishFolders/usePublishFolders.js +41 -31
  23. package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts +27 -11
  24. package/catalog/useResourceSavePanel/useResourceSavePanel.d.ts.map +1 -1
  25. package/catalog/useResourceSavePanel/useResourceSavePanel.js +163 -138
  26. package/catalog.js +51 -49
  27. package/conversation/conversation-list.d.ts +7 -1
  28. package/conversation/conversation-list.d.ts.map +1 -1
  29. package/conversation/conversation-list.js +11 -2
  30. package/conversation/conversation-transfer/zip-export.d.ts +1 -1
  31. package/conversation/conversation-transfer/zip-export.d.ts.map +1 -1
  32. package/conversation/conversation-transfer/zip-export.js +7 -8
  33. package/conversation/conversation-transfer/zip-import.d.ts.map +1 -1
  34. package/conversation/conversation-transfer/zip-import.js +8 -9
  35. package/conversation/useConversationExport/useConversationExport.d.ts.map +1 -1
  36. package/conversation/useConversationExport/useConversationExport.js +3 -1
  37. package/conversation.js +3 -3
  38. package/entry-points/catalog.d.ts +2 -0
  39. package/entry-points/catalog.d.ts.map +1 -1
  40. package/entry-points/scheduled-tasks.d.ts +1 -0
  41. package/entry-points/scheduled-tasks.d.ts.map +1 -1
  42. package/entry-points/skill-editor.d.ts +1 -0
  43. package/entry-points/skill-editor.d.ts.map +1 -1
  44. package/entry-points/utils.d.ts +1 -0
  45. package/entry-points/utils.d.ts.map +1 -1
  46. package/file-manager.js +33 -33
  47. package/files/dial-file-manager.types.d.ts +4 -2
  48. package/files/dial-file-manager.types.d.ts.map +1 -1
  49. package/files/dial-file.d.ts +6 -0
  50. package/files/dial-file.d.ts.map +1 -1
  51. package/files/dial-file.js +17 -12
  52. package/files/useDialFileListing/useDialFileListing.d.ts +9 -1
  53. package/files/useDialFileListing/useDialFileListing.d.ts.map +1 -1
  54. package/files/useDialFileListing/useDialFileListing.js +205 -183
  55. package/files/useDialFileManager/useDialFileManager.d.ts +1 -1
  56. package/files/useDialFileManager/useDialFileManager.d.ts.map +1 -1
  57. package/files/useDialFileManager/useDialFileManager.js +114 -113
  58. package/files/useDialFileMutations/useDialFileMutations.d.ts +2 -1
  59. package/files/useDialFileMutations/useDialFileMutations.d.ts.map +1 -1
  60. package/files/useDialFileMutations/useDialFileMutations.js +5 -5
  61. package/index.d.ts +5 -0
  62. package/index.d.ts.map +1 -1
  63. package/index.js +267 -262
  64. package/org-units/org-unit-guards.d.ts +95 -1
  65. package/org-units/org-unit-guards.d.ts.map +1 -1
  66. package/org-units/org-unit-guards.js +51 -16
  67. package/org-units/useOrgUnits/useOrgUnits.d.ts +12 -4
  68. package/org-units/useOrgUnits/useOrgUnits.d.ts.map +1 -1
  69. package/org-units/useOrgUnits/useOrgUnits.js +44 -35
  70. package/package.json +20 -20
  71. package/project/project-conversation-data-source.js +4 -4
  72. package/project/project-refresh.d.ts +2 -0
  73. package/project/project-refresh.d.ts.map +1 -1
  74. package/project/project-refresh.js +1 -1
  75. package/project/use-project-actions.d.ts +3 -1
  76. package/project/use-project-actions.d.ts.map +1 -1
  77. package/project/use-project-actions.js +39 -38
  78. package/project/use-project.d.ts +3 -1
  79. package/project/use-project.d.ts.map +1 -1
  80. package/project/use-project.js +57 -44
  81. package/scheduled-task/scheduled-task-display.d.ts +51 -4
  82. package/scheduled-task/scheduled-task-display.d.ts.map +1 -1
  83. package/scheduled-task/scheduled-task-display.js +53 -46
  84. package/scheduled-task/scheduled-task-next-occurrence.d.ts +2 -0
  85. package/scheduled-task/scheduled-task-next-occurrence.d.ts.map +1 -1
  86. package/scheduled-task/scheduled-task-next-occurrence.js +2 -2
  87. package/scheduled-task/scheduled-task-time-format.d.ts +36 -0
  88. package/scheduled-task/scheduled-task-time-format.d.ts.map +1 -0
  89. package/scheduled-task/scheduled-task-time-format.js +34 -0
  90. package/scheduled-task/scheduled-task-trigger.d.ts.map +1 -1
  91. package/scheduled-task/scheduled-task-trigger.js +13 -14
  92. package/scheduled-tasks.js +14 -13
  93. package/skill/skill-archive.d.ts.map +1 -1
  94. package/skill/skill-archive.js +6 -7
  95. package/skill/skill-file-batch-validation.d.ts +6 -0
  96. package/skill/skill-file-batch-validation.d.ts.map +1 -1
  97. package/skill/skill-file-batch-validation.js +39 -37
  98. package/skill/skill-types.d.ts +0 -6
  99. package/skill/skill-types.d.ts.map +1 -1
  100. package/skill/skill-types.js +7 -8
  101. package/skill/skill.d.ts +2 -9
  102. package/skill/skill.d.ts.map +1 -1
  103. package/skill/skill.js +33 -34
  104. package/skill/types/skill-editor-submit.d.ts +8 -0
  105. package/skill/types/skill-editor-submit.d.ts.map +1 -0
  106. package/skill/types/skill-editor-submit.js +6 -0
  107. package/skill/useSkillEditorLoad.js +1 -1
  108. package/skill/useSkillEditorSubmit.d.ts +2 -3
  109. package/skill/useSkillEditorSubmit.d.ts.map +1 -1
  110. package/skill/useSkillEditorSubmit.js +103 -102
  111. package/skill/useSkillFileActions.d.ts +7 -1
  112. package/skill/useSkillFileActions.d.ts.map +1 -1
  113. package/skill/useSkillFileActions.js +55 -49
  114. package/skill-editor.js +7 -6
  115. package/utils.js +28 -27
@@ -2,100 +2,122 @@ import { getApiErrorStatus as e } from "../../api-error/api-error.js";
2
2
  import { FileManagerNotificationReason as t } from "../dial-file-manager.types.js";
3
3
  import { buildSharedItemVirtualPath as n, dialCorePathToRelative as r, findFolderByVirtualPath as i, normalizeVirtualPath as a } from "../dial-file-manager-path.util.js";
4
4
  import { virtualPathToApiPath as o } from "../resolve-dial-file-api-path.js";
5
- import { buildFromCache as ee, buildSharedSearchScope as s, fetchByTab as c, fetchForSearch as te, mapCorePermissions as ne, mapSearchItem as re, mergeCreatedFolderIntoCache as ie } from "../dial-file-manager-mapping.util.js";
6
- import { ListFilesItemDtoNodeTypeEnum as l } from "@epam/ai-dial-chat-api-client";
7
- import { getParentFolderPath as ae } from "@epam/ai-dial-chat-shared";
8
- import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
9
- import { NotificationVariant as h } from "@epam/ai-dial-ui-kit";
10
- import { DialFileManagerTabs as g, DialFileNodeType as oe } from "@epam/ai-dial-react-file-manager";
5
+ import { buildFromCache as ee, buildSharedSearchScope as s, fetchByTab as c, fetchForSearch as te, mapCorePermissions as ne, mapSearchItem as l, mergeCreatedFolderIntoCache as re } from "../dial-file-manager-mapping.util.js";
6
+ import { ListFilesItemDtoNodeTypeEnum as u } from "@epam/ai-dial-chat-api-client";
7
+ import { getParentFolderPath as ie } from "@epam/ai-dial-chat-shared";
8
+ import { useCallback as d, useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
9
+ import { NotificationVariant as g } from "@epam/ai-dial-ui-kit";
10
+ import { DialFileManagerTabs as _, DialFileNodeType as v } from "@epam/ai-dial-react-file-manager";
11
11
  //#region src/files/useDialFileListing/useDialFileListing.ts
12
- var _ = ({ filesApi: _, bucket: v, rootLabel: y, activeTab: b, onNotification: x, isActive: S = !0, sessionKey: se }) => {
13
- let [C, w] = m(""), [T, E] = m(() => /* @__PURE__ */ new Map()), D = p(T);
14
- d(() => {
15
- D.current = T;
16
- }, [T]);
17
- let [O, k] = m(() => /* @__PURE__ */ new Map()), [ce, A] = m(S), [le, ue] = m(S);
18
- le !== S && (ue(S), A(S));
19
- let [de, j] = m(null), [M, N] = m(0), [P, F] = m(void 0), [fe, I] = m(() => /* @__PURE__ */ new Set()), L = p(/* @__PURE__ */ new Map()), [pe, R] = m(!1), [me, 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()), [he, K] = m(() => /* @__PURE__ */ new Set()), [q, J] = m(() => /* @__PURE__ */ new Set()), Y = `${b}|${se ?? ""}`, X = p(Y);
20
- d(() => {
21
- X.current !== Y && (X.current = Y, 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()), N((e) => e + 1));
22
- }, [Y]), d(() => () => {
23
- B.current != null && clearTimeout(B.current), V.current?.();
24
- }, []), d(() => {
25
- if (!S) {
26
- A(!1);
12
+ var ae = (e, t) => {
13
+ let n = e.replace(/^\/+|\/+$/g, "");
14
+ return n === t ? "" : n.startsWith(`${t}/`) ? n.slice(t.length + 1) : n;
15
+ }, y = (e, t) => e.reduce((e, n) => {
16
+ if (n.nodeType !== v.FOLDER) return e.push(n), e;
17
+ if (!t(n.path)) return e;
18
+ if (!n.items) return e.push(n), e;
19
+ let r = y(n.items, t);
20
+ return e.push(r.length === n.items.length && r.every((e, t) => e === n.items?.[t]) ? n : {
21
+ ...n,
22
+ items: r
23
+ }), e;
24
+ }, []), b = ({ filesApi: b, bucket: x, rootLabel: S, activeTab: C, onNotification: w, isActive: T = !0, sessionKey: oe, isPublicFolderVisible: E }) => {
25
+ let [D, O] = h(""), k = p(() => C === _.Organization && E ? (e) => E(ae(e, S)) : void 0, [
26
+ C,
27
+ E,
28
+ S
29
+ ]);
30
+ k && D !== "" && !k(`/${S}/${D}`) && O("");
31
+ let [A, j] = h(() => /* @__PURE__ */ new Map()), M = m(A);
32
+ f(() => {
33
+ M.current = A;
34
+ }, [A]);
35
+ let [N, P] = h(() => /* @__PURE__ */ new Map()), [se, F] = h(T), [ce, le] = h(T);
36
+ ce !== T && (le(T), F(T));
37
+ let [ue, de] = h(null), [fe, I] = h(0), [L, R] = h(void 0), [pe, z] = h(() => /* @__PURE__ */ new Set()), B = m(/* @__PURE__ */ new Map()), [me, V] = h(!1), [H, U] = h(null), W = m(null), G = m(null), K = m(/* @__PURE__ */ new Set()), q = m(/* @__PURE__ */ new Set()), [J, he] = h(() => /* @__PURE__ */ new Set()), [ge, Y] = h(() => /* @__PURE__ */ new Set()), [_e, ve] = h(() => /* @__PURE__ */ new Set()), X = `${C}|${oe ?? ""}`, Z = m(X);
38
+ f(() => {
39
+ Z.current !== X && (Z.current = X, j(/* @__PURE__ */ new Map()), P(/* @__PURE__ */ new Map()), O(""), R(void 0), B.current = /* @__PURE__ */ new Map(), K.current = /* @__PURE__ */ new Set(), q.current = /* @__PURE__ */ new Set(), Y(/* @__PURE__ */ new Set()), ve(/* @__PURE__ */ new Set()), W.current != null && (clearTimeout(W.current), W.current = null), G.current?.(), G.current = null, U(null), V(!1), he(/* @__PURE__ */ new Set()), I((e) => e + 1));
40
+ }, [X]), f(() => () => {
41
+ W.current != null && clearTimeout(W.current), G.current?.();
42
+ }, []), f(() => {
43
+ if (!T) {
44
+ F(!1);
27
45
  return;
28
46
  }
29
47
  let t = !1;
30
- return A(!0), j(null), c(_, b, v, C, L.current).then(({ items: e, permissions: n }) => {
31
- t || (E((t) => {
48
+ return F(!0), de(null), c(b, C, x, D, B.current).then(({ items: e, permissions: n }) => {
49
+ t || (j((t) => {
32
50
  let n = new Map(t);
33
- return n.set(C, e), n;
34
- }), k((e) => new Map(e).set(C, n)), b === g.Shared && C === "" && (F(e.map((e) => e.nodeType === l.Folder ? `/${y}/${e.name}/` : `/${y}/${e.name}`)), L.current = new Map(e.map((e) => [e.name, {
51
+ return n.set(D, e), n;
52
+ }), P((e) => new Map(e).set(D, n)), C === _.Shared && D === "" && (R(e.map((e) => e.nodeType === u.Folder ? `/${S}/${e.name}/` : `/${S}/${e.name}`)), B.current = new Map(e.map((e) => [e.name, {
35
53
  bucket: e.bucket ?? "",
36
54
  dialCorePath: e.path
37
55
  }]))));
38
56
  }).catch((n) => {
39
- t || (C !== "" && e(n) === 404 ? w(ae(C)) : j("dialFileManager.error"));
57
+ t || (D !== "" && e(n) === 404 ? O(ie(D)) : de("dialFileManager.error"));
40
58
  }).finally(() => {
41
- t || A(!1);
59
+ t || F(!1);
42
60
  }), () => {
43
61
  t = !0;
44
62
  };
45
63
  }, [
46
- b,
47
- v,
48
- _,
49
64
  C,
50
- S,
51
- M,
52
- y
53
- ]), d(() => {
54
- if (!S || b !== g.MyFiles) {
55
- I(/* @__PURE__ */ new Set());
65
+ x,
66
+ b,
67
+ D,
68
+ T,
69
+ fe,
70
+ S
71
+ ]), f(() => {
72
+ if (!T || C !== _.MyFiles) {
73
+ z(/* @__PURE__ */ new Set());
56
74
  return;
57
75
  }
58
76
  let e = !1;
59
- return _.listSharedByMe(v).then((t) => {
60
- e || I(new Set(t.items.map((e) => {
61
- let t = r(e.path, v);
62
- return n(t, y, e.nodeType === l.Folder);
77
+ return b.listSharedByMe(x).then((t) => {
78
+ e || z(new Set(t.items.map((e) => {
79
+ let t = r(e.path, x);
80
+ return n(t, S, e.nodeType === u.Folder);
63
81
  })));
64
82
  }).catch(() => {
65
- e || I(/* @__PURE__ */ new Set());
83
+ e || z(/* @__PURE__ */ new Set());
66
84
  }), () => {
67
85
  e = !0;
68
86
  };
69
87
  }, [
88
+ C,
89
+ x,
70
90
  b,
71
- v,
72
- _,
73
- S,
74
- M,
75
- y
76
- ]);
77
- let Z = f(() => [{
78
- id: v,
79
- name: y,
80
- path: `/${y}`,
81
- parentPath: "",
82
- nodeType: oe.FOLDER,
83
- folderId: v,
84
- permissions: ne(O.get("")),
85
- items: ee(T, O, "", `/${y}`, v)
86
- }], [
87
91
  T,
88
- O,
89
- y,
90
- v
91
- ]), ge = u((e) => {
92
+ fe,
93
+ S
94
+ ]);
95
+ let Q = p(() => {
96
+ let e = ee(A, N, "", `/${S}`, x);
97
+ return [{
98
+ id: x,
99
+ name: S,
100
+ path: `/${S}`,
101
+ parentPath: "",
102
+ nodeType: v.FOLDER,
103
+ folderId: x,
104
+ permissions: ne(N.get("")),
105
+ items: k ? y(e, k) : e
106
+ }];
107
+ }, [
108
+ A,
109
+ N,
110
+ S,
111
+ x,
112
+ k
113
+ ]), ye = p(() => H && k ? H.filter((e) => k(e.nodeType === v.FOLDER ? e.path : e.parentPath ?? "")) : H, [H, k]), be = d((e) => {
92
114
  if (e == null) {
93
- w("");
115
+ O("");
94
116
  return;
95
117
  }
96
- let t = `/${y}/`, n = `${y}/`;
97
- if (e === `/${y}` || e === t || e === y || e === n) {
98
- w("");
118
+ let t = `/${S}/`, n = `${S}/`;
119
+ if (e === `/${S}` || e === t || e === S || e === n) {
120
+ O("");
99
121
  return;
100
122
  }
101
123
  let r;
@@ -105,117 +127,117 @@ var _ = ({ filesApi: _, bucket: v, rootLabel: y, activeTab: b, onNotification: x
105
127
  let t = e.replace(/^\//, "");
106
128
  r = t.startsWith(n) ? t.slice(n.length) : t;
107
129
  }
108
- w(r && !r.endsWith("/") ? `${r}/` : r);
109
- }, [y]), Q = u(() => {
110
- N((e) => e + 1);
111
- }, []), _e = Q, ve = u((e) => {
130
+ O(r && !r.endsWith("/") ? `${r}/` : r);
131
+ }, [S]), xe = d(() => {
132
+ I((e) => e + 1);
133
+ }, []), Se = xe, Ce = d((e) => {
112
134
  if (e.length === 0) return;
113
- let n = new Set([...W].map((e) => o(e, y))), r = (e) => e === C || C.startsWith(e) || n.has(e), i = e.filter((e) => !r(e)), a = e.filter((e) => r(e) && e !== C);
114
- i.length > 0 && (E((e) => {
135
+ let n = new Set([...J].map((e) => o(e, S))), r = (e) => e === D || D.startsWith(e) || n.has(e), i = e.filter((e) => !r(e)), a = e.filter((e) => r(e) && e !== D);
136
+ i.length > 0 && (j((e) => {
115
137
  let t = new Map(e);
116
138
  return i.forEach((e) => t.delete(e)), t;
117
- }), k((e) => {
139
+ }), P((e) => {
118
140
  let t = new Map(e);
119
141
  return i.forEach((e) => t.delete(e)), t;
120
142
  })), a.forEach((e) => {
121
143
  (async () => {
122
144
  try {
123
- let { items: t, permissions: n } = await c(_, b, v, e, L.current);
124
- E((n) => new Map(n).set(e, t)), n != null && k((t) => new Map(t).set(e, n));
145
+ let { items: t, permissions: n } = await c(b, C, x, e, B.current);
146
+ j((n) => new Map(n).set(e, t)), n != null && P((t) => new Map(t).set(e, n));
125
147
  } catch {
126
- x?.({
127
- variant: h.Error,
148
+ w?.({
149
+ variant: g.Error,
128
150
  reason: t.FolderLoadFailed
129
151
  });
130
152
  }
131
153
  })();
132
154
  });
133
155
  }, [
134
- b,
135
- v,
136
- _,
137
156
  C,
138
- W,
139
- y,
140
- x
141
- ]), ye = u((e, t, n) => {
142
- E((r) => ie(r, e, t, n));
143
- }, []), be = u((e) => {
157
+ x,
158
+ b,
159
+ D,
160
+ J,
161
+ S,
162
+ w
163
+ ]), we = d((e, t, n) => {
164
+ j((r) => re(r, e, t, n));
165
+ }, []), Te = d((e) => {
144
166
  if (e.length === 0) return;
145
167
  let t = new Set(e);
146
- E((e) => {
168
+ j((e) => {
147
169
  let n = e.get("");
148
170
  if (n == null) return e;
149
171
  let r = new Map(e);
150
172
  return r.set("", n.filter((e) => !t.has(e.name))), r;
151
- }), F((t) => t?.filter((t) => !e.some((e) => t === `/${y}/${e}`)));
152
- }, [y]), xe = u((e) => {
153
- if (!S) return;
154
- let n = e == null ? "" : o(e, y), r = e ?? `/${y}`;
155
- J((e) => {
173
+ }), R((t) => t?.filter((t) => !e.some((e) => t === `/${S}/${e}`)));
174
+ }, [S]), Ee = d((e) => {
175
+ if (!T) return;
176
+ let n = e == null ? "" : o(e, S), r = e ?? `/${S}`;
177
+ ve((e) => {
156
178
  if (e.has(r)) return e;
157
179
  let t = new Set(e);
158
180
  return t.add(r), t;
159
- }), !D.current.has(n) && (H.current.has(n) ? K((e) => {
181
+ }), !M.current.has(n) && (K.current.has(n) ? Y((e) => {
160
182
  let t = new Set(e);
161
183
  return t.add(r), t;
162
- }) : (H.current.add(n), K((e) => {
184
+ }) : (K.current.add(n), Y((e) => {
163
185
  let t = new Set(e);
164
186
  return t.add(r), t;
165
187
  }), (async () => {
166
188
  try {
167
- let { items: e, permissions: t } = await c(_, b, v, n, L.current);
168
- E((t) => new Map(t).set(n, e)), t != null && k((e) => new Map(e).set(n, t)), U.current.delete(n);
189
+ let { items: e, permissions: t } = await c(b, C, x, n, B.current);
190
+ j((t) => new Map(t).set(n, e)), t != null && P((e) => new Map(e).set(n, t)), q.current.delete(n);
169
191
  } catch {
170
- x?.({
171
- variant: h.Error,
192
+ w?.({
193
+ variant: g.Error,
172
194
  reason: t.FolderLoadFailed
173
195
  });
174
196
  } finally {
175
- H.current.delete(n), K((e) => {
197
+ K.current.delete(n), Y((e) => {
176
198
  let t = new Set(e);
177
199
  return t.delete(r), t;
178
200
  });
179
201
  }
180
202
  })()));
181
203
  }, [
182
- b,
183
- v,
184
- _,
185
- S,
204
+ C,
186
205
  x,
187
- y
188
- ]), Se = f(() => {
189
- let e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set([...W, ...q]);
206
+ b,
207
+ T,
208
+ w,
209
+ S
210
+ ]), De = p(() => {
211
+ let e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set([...J, ..._e]);
190
212
  for (let n of t) {
191
- let t = o(n, y);
192
- T.has(t) && e.add(n);
213
+ let t = o(n, S);
214
+ A.has(t) && e.add(n);
193
215
  }
194
216
  return e;
195
217
  }, [
196
- W,
197
- q,
198
- T,
199
- y
200
- ]), Ce = u((e) => {
201
- S && (W.forEach((t) => {
202
- e.has(t) || U.current.delete(o(t, y));
203
- }), G(e), [...e].filter((e) => {
204
- let t = o(e, y);
205
- return !D.current.has(t) && !H.current.has(t) && !U.current.has(t);
218
+ J,
219
+ _e,
220
+ A,
221
+ S
222
+ ]), Oe = d((e) => {
223
+ T && (J.forEach((t) => {
224
+ e.has(t) || q.current.delete(o(t, S));
225
+ }), he(e), [...e].filter((e) => {
226
+ let t = o(e, S);
227
+ return !M.current.has(t) && !K.current.has(t) && !q.current.has(t);
206
228
  }).forEach((e) => {
207
- let n = o(e, y);
208
- H.current.add(n), (async () => {
229
+ let n = o(e, S);
230
+ K.current.add(n), (async () => {
209
231
  try {
210
- let { items: e, permissions: t } = await c(_, b, v, n, L.current);
211
- E((t) => new Map(t).set(n, e)), t != null && k((e) => new Map(e).set(n, t));
232
+ let { items: e, permissions: t } = await c(b, C, x, n, B.current);
233
+ j((t) => new Map(t).set(n, e)), t != null && P((e) => new Map(e).set(n, t));
212
234
  } catch {
213
- U.current.add(n), x?.({
214
- variant: h.Error,
235
+ q.current.add(n), w?.({
236
+ variant: g.Error,
215
237
  reason: t.FolderLoadFailed
216
238
  });
217
239
  } finally {
218
- H.current.delete(n), K((t) => {
240
+ K.current.delete(n), Y((t) => {
219
241
  let n = new Set(t);
220
242
  return n.delete(e), n;
221
243
  });
@@ -223,84 +245,84 @@ var _ = ({ filesApi: _, bucket: v, rootLabel: y, activeTab: b, onNotification: x
223
245
  })();
224
246
  }));
225
247
  }, [
226
- b,
227
- v,
228
- _,
229
- W,
230
- S,
248
+ C,
231
249
  x,
232
- y
233
- ]), we = u(() => {
234
- B.current != null && (clearTimeout(B.current), B.current = null), V.current?.(), V.current = null, z(null), R(!1);
235
- }, []), Te = u((e, t) => {
236
- S && (B.current != null && (clearTimeout(B.current), B.current = null), V.current?.(), V.current = null, t.trim() ? B.current = setTimeout(() => {
237
- if (B.current = null, b === g.Shared && C === "") {
238
- V.current?.(), V.current = null, R(!0);
239
- let e = T.get("") ?? [], t = s(y, "", /* @__PURE__ */ new Map());
240
- z(e.map((e) => re(e, e.bucket ?? v, y, t))), R(!1);
250
+ b,
251
+ J,
252
+ T,
253
+ w,
254
+ S
255
+ ]), ke = d(() => {
256
+ W.current != null && (clearTimeout(W.current), W.current = null), G.current?.(), G.current = null, U(null), V(!1);
257
+ }, []), Ae = d((e, t) => {
258
+ T && (W.current != null && (clearTimeout(W.current), W.current = null), G.current?.(), G.current = null, t.trim() ? W.current = setTimeout(() => {
259
+ if (W.current = null, C === _.Shared && D === "") {
260
+ G.current?.(), G.current = null, V(!0);
261
+ let e = A.get("") ?? [], t = s(S, "", /* @__PURE__ */ new Map());
262
+ U(e.map((e) => l(e, e.bucket ?? x, S, t))), V(!1);
241
263
  return;
242
264
  }
243
265
  let e = !1;
244
- V.current = () => {
266
+ G.current = () => {
245
267
  e = !0;
246
- }, R(!0), (async () => {
268
+ }, V(!0), (async () => {
247
269
  try {
248
- let { items: t } = await te(_, b, v, C, L.current);
270
+ let { items: t } = await te(b, C, x, D, B.current);
249
271
  if (e) return;
250
- let n = b === g.Shared ? s(y, C, L.current) : void 0;
251
- z(t.map((e) => re(e, e.bucket ?? v, y, n)));
272
+ let n = C === _.Shared ? s(S, D, B.current) : void 0;
273
+ U(t.map((e) => l(e, e.bucket ?? x, S, n)));
252
274
  } catch {
253
- e || z([]);
275
+ e || U([]);
254
276
  } finally {
255
- e || R(!1);
277
+ e || V(!1);
256
278
  }
257
279
  })();
258
- }, 300) : (z(null), R(!1)));
280
+ }, 300) : (U(null), V(!1)));
259
281
  }, [
282
+ C,
283
+ x,
284
+ A,
260
285
  b,
261
- v,
286
+ D,
262
287
  T,
263
- _,
264
- C,
265
- S,
266
- y
267
- ]), $ = C ? `/${y}/${C}` : `/${y}`, Ee = f(() => {
268
- let e = Z[0];
269
- if (e) return a($) === a(`/${y}`) ? e : i(e.items ?? [], $);
288
+ S
289
+ ]), $ = D ? `/${S}/${D}` : `/${S}`, je = p(() => {
290
+ let e = Q[0];
291
+ if (e) return a($) === a(`/${S}`) ? e : i(e.items ?? [], $);
270
292
  }, [
271
- Z,
293
+ Q,
272
294
  $,
273
- y
295
+ S
274
296
  ]);
275
297
  return {
276
- items: Z,
277
- isLoading: ce,
278
- error: de,
298
+ items: Q,
299
+ isLoading: se,
300
+ error: ue,
279
301
  path: $,
280
- folderPath: C,
281
- onPathChange: ge,
282
- retry: Q,
283
- onSearchFiles: Te,
284
- isSearching: pe,
285
- searchResults: me,
286
- clearSearchResults: we,
287
- expandedPaths: W,
288
- loadedPaths: Se,
289
- onExpandedPathsChange: Ce,
290
- onFolderPopupPathChange: xe,
291
- folderPopupLoadingPaths: he,
292
- sharedWithMeIds: f(() => b === g.Shared ? P : void 0, [b, P]),
293
- sharedByMePaths: fe,
294
- currentFolder: Ee,
295
- cache: T,
296
- listingPermissionsCache: O,
297
- sharedRootMetaRef: L,
298
- setFolderPath: w,
299
- invalidateFolders: ve,
300
- mergeCreatedFolder: ye,
301
- bumpRetry: _e,
302
- removeSharedRootItems: be
302
+ folderPath: D,
303
+ onPathChange: be,
304
+ retry: xe,
305
+ onSearchFiles: Ae,
306
+ isSearching: me,
307
+ searchResults: ye,
308
+ clearSearchResults: ke,
309
+ expandedPaths: J,
310
+ loadedPaths: De,
311
+ onExpandedPathsChange: Oe,
312
+ onFolderPopupPathChange: Ee,
313
+ folderPopupLoadingPaths: ge,
314
+ sharedWithMeIds: p(() => C === _.Shared ? L : void 0, [C, L]),
315
+ sharedByMePaths: pe,
316
+ currentFolder: je,
317
+ cache: A,
318
+ listingPermissionsCache: N,
319
+ sharedRootMetaRef: B,
320
+ setFolderPath: O,
321
+ invalidateFolders: Ce,
322
+ mergeCreatedFolder: we,
323
+ bumpRetry: Se,
324
+ removeSharedRootItems: Te
303
325
  };
304
326
  };
305
327
  //#endregion
306
- export { _ as useDialFileListing };
328
+ export { b as useDialFileListing };
@@ -12,5 +12,5 @@ export type { UseDialFileManagerOptions, UseDialFileManagerResult, } from '../di
12
12
  * every translated string reaches it through `labels`,
13
13
  * `disabledNewButtonTooltip`, and `buildValidationErrorMessage`.
14
14
  */
15
- export declare const useDialFileManager: ({ filesApi, bucket, rootLabel, activeTab, isActive, sessionKey, onNotification, onOperationSuccess, forbiddenSymbolsRegExp, variant, actionProfile, labels, locale, disabledNewButtonTooltip, downloadDestination, buildValidationErrorMessage, }: UseDialFileManagerOptions) => UseDialFileManagerResult;
15
+ export declare const useDialFileManager: ({ filesApi, bucket, rootLabel, activeTab, isActive, sessionKey, isPublicFolderVisible, onNotification, onOperationSuccess, forbiddenSymbolsRegExp, variant, actionProfile, labels, locale, disabledNewButtonTooltip, downloadDestination, buildValidationErrorMessage, }: UseDialFileManagerOptions) => UseDialFileManagerResult;
16
16
  //# sourceMappingURL=useDialFileManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDialFileManager.d.ts","sourceRoot":"","sources":["../../../src/files/useDialFileManager/useDialFileManager.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,4BAA4B,CAAC;AAQpC,YAAY,EACV,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,GAAI,mPAiBhC,yBAAyB,KAAG,wBAwN9B,CAAC"}
1
+ {"version":3,"file":"useDialFileManager.d.ts","sourceRoot":"","sources":["../../../src/files/useDialFileManager/useDialFileManager.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,4BAA4B,CAAC;AAQpC,YAAY,EACV,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,GAAI,0QAkBhC,yBAAyB,KAAG,wBAyN9B,CAAC"}