ode-explorer 1.3.2-dev.202401091605 → 1.3.2-dev.202401091744

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 (79) hide show
  1. package/dist/version.txt +1 -1
  2. package/explorer.d.ts +1 -0
  3. package/lib/ActionBarContainer.js +375 -0
  4. package/lib/AppAction.js +47 -0
  5. package/lib/DeleteModal.js +60 -0
  6. package/lib/DisableModal.js +20 -0
  7. package/lib/EmptyScreenApp.js +53 -0
  8. package/lib/EmptyScreenError.js +13 -0
  9. package/lib/EmptyScreenNoContentInFolder.js +20 -0
  10. package/lib/EmptyScreenSearch.js +20 -0
  11. package/lib/EmptyScreenTrash.js +18 -0
  12. package/lib/FolderModal.js +138 -0
  13. package/lib/FoldersList.js +77 -0
  14. package/lib/Library.js +19 -0
  15. package/lib/MoveModal.js +94 -0
  16. package/lib/ResourcesList.js +261 -0
  17. package/lib/TrashModal.js +20 -0
  18. package/lib/app/root/index.d.ts +2 -0
  19. package/lib/components/AppAction/AppAction.d.ts +1 -0
  20. package/lib/components/EmptyScreens/EmptyScreenApp.d.ts +2 -0
  21. package/lib/components/EmptyScreens/EmptyScreenError.d.ts +2 -0
  22. package/lib/components/EmptyScreens/EmptyScreenNoContentInFolder.d.ts +2 -0
  23. package/lib/components/EmptyScreens/EmptyScreenSearch.d.ts +2 -0
  24. package/lib/components/EmptyScreens/EmptyScreenTrash.d.ts +1 -0
  25. package/lib/components/Explorer.d.ts +5 -0
  26. package/lib/components/ExplorerBreadcrumb.d.ts +1 -0
  27. package/lib/components/LoadMore.d.ts +3 -0
  28. package/lib/config/getExplorerConfig.d.ts +11 -0
  29. package/lib/config/index.d.ts +3 -0
  30. package/lib/features/AccessControl/AccessControl.d.ts +12 -0
  31. package/lib/features/AccessControl/useAccessControl.d.ts +14 -0
  32. package/lib/features/ActionBar/ActionBarContainer.d.ts +1 -0
  33. package/lib/features/ActionBar/Delete/DeleteModal.d.ts +8 -0
  34. package/lib/features/ActionBar/Delete/useDeleteModal.d.ts +8 -0
  35. package/lib/features/ActionBar/Disable/DisableModal.d.ts +5 -0
  36. package/lib/features/ActionBar/Disable/useDisableModal.d.ts +4 -0
  37. package/lib/features/ActionBar/Folder/FolderModal.d.ts +9 -0
  38. package/lib/features/ActionBar/Folder/useFolderModal.d.ts +22 -0
  39. package/lib/features/ActionBar/Move/MoveModal.d.ts +8 -0
  40. package/lib/features/ActionBar/Move/useMoveModal.d.ts +12 -0
  41. package/lib/features/ActionBar/Trash/TrashModal.d.ts +5 -0
  42. package/lib/features/ActionBar/Trash/useTrashModal.d.ts +4 -0
  43. package/lib/features/ActionBar/useActionBar.d.ts +30 -0
  44. package/lib/features/List/FolderCard.d.ts +17 -0
  45. package/lib/features/List/FoldersList.d.ts +7 -0
  46. package/lib/features/List/List.d.ts +1 -0
  47. package/lib/features/List/ResourceCard.d.ts +22 -0
  48. package/lib/features/List/ResourcesList.d.ts +8 -0
  49. package/lib/features/SearchForm/SearchForm.d.ts +1 -0
  50. package/lib/features/SearchForm/useSearchForm.d.ts +8 -0
  51. package/lib/features/SearchForm/useSelectedFilters.d.ts +8 -0
  52. package/lib/features/SideBar/Library/Library.d.ts +2 -0
  53. package/lib/features/SideBar/TrashButton.d.ts +7 -0
  54. package/lib/features/SideBar/TreeViewContainer.d.ts +1 -0
  55. package/lib/i18n.d.ts +2 -0
  56. package/lib/index.d.ts +1 -0
  57. package/lib/index.js +13 -0
  58. package/lib/index2.js +1867 -0
  59. package/lib/main.d.ts +0 -0
  60. package/lib/services/api/index.d.ts +129 -0
  61. package/lib/store/index.d.ts +98 -0
  62. package/lib/style.css +410 -0
  63. package/lib/utils/TreeNodeFolderWrapper.d.ts +12 -0
  64. package/lib/utils/addNode.d.ts +6 -0
  65. package/lib/utils/arrayUnique.d.ts +1 -0
  66. package/lib/utils/capitalizeFirstLetter.d.ts +1 -0
  67. package/lib/utils/deleteNode.d.ts +4 -0
  68. package/lib/utils/findNodeById.d.ts +2 -0
  69. package/lib/utils/fullTextSearch.d.ts +1 -0
  70. package/lib/utils/getAncestors.d.ts +2 -0
  71. package/lib/utils/getAppParams.d.ts +10 -0
  72. package/lib/utils/hasChildren.d.ts +2 -0
  73. package/lib/utils/isResourceShared.d.ts +2 -0
  74. package/lib/utils/modifyNode.d.ts +2 -0
  75. package/lib/utils/moveNode.d.ts +5 -0
  76. package/lib/utils/scrollToTop.d.ts +1 -0
  77. package/lib/utils/updateNode.d.ts +6 -0
  78. package/lib/utils/wrapTreeNode.d.ts +3 -0
  79. package/package.json +33 -3
package/lib/index2.js ADDED
@@ -0,0 +1,1867 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
8
+ import { useState, useRef, useEffect, Suspense, lazy, Fragment } from "react";
9
+ import { useScrollToTop, useOdeClient, IconButton, useToast, useUser, LoadingScreen, FormControl, Input, SearchButton, Dropdown, useToggle, TreeView, Button, useXitiTrackPageLoad, isActionAvailable, AppHeader, Breadcrumb, Grid } from "@edifice-ui/react";
10
+ import { ArrowLeft, Filter, Delete, Plus } from "@edifice-ui/icons";
11
+ import { useTranslation } from "react-i18next";
12
+ import { odeServices, FOLDER, APP } from "edifice-ts-client";
13
+ import { t } from "i18next";
14
+ import { create } from "zustand";
15
+ import { useQuery, useInfiniteQuery, useQueryClient, useMutation } from "@tanstack/react-query";
16
+ const searchContext = async (searchParams) => {
17
+ const search = await odeServices.resource(searchParams.app).searchContext(searchParams);
18
+ return {
19
+ ...search,
20
+ folders: search.folders.filter((folder) => !folder.trashed)
21
+ };
22
+ };
23
+ const createFolder = async ({
24
+ searchParams,
25
+ name,
26
+ parentId
27
+ }) => {
28
+ const createFolderParameters = {
29
+ name,
30
+ parentId,
31
+ app: searchParams.app,
32
+ type: searchParams.types[0]
33
+ };
34
+ return await odeServices.resource(searchParams.app).createFolder(createFolderParameters);
35
+ };
36
+ const updateFolder = async ({
37
+ folderId,
38
+ searchParams,
39
+ parentId,
40
+ name
41
+ }) => {
42
+ const updateFolderParameters = {
43
+ folderId,
44
+ name,
45
+ parentId,
46
+ app: searchParams.app,
47
+ type: searchParams.types[0]
48
+ };
49
+ return await odeServices.resource(searchParams.app).updateFolder(updateFolderParameters);
50
+ };
51
+ const trashAll = async ({
52
+ searchParams,
53
+ resourceIds,
54
+ useAssetIds,
55
+ folderIds
56
+ }) => {
57
+ const trashParameters = {
58
+ application: searchParams.app,
59
+ resourceType: searchParams.types[0],
60
+ resourceIds,
61
+ folderIds
62
+ };
63
+ return await odeServices.resource(searchParams.app).trashAll(trashParameters, useAssetIds);
64
+ };
65
+ const deleteAll = async ({
66
+ searchParams,
67
+ resourceIds,
68
+ useAssetIds,
69
+ folderIds
70
+ }) => {
71
+ const deleteParameters = {
72
+ application: searchParams.app,
73
+ resourceType: searchParams.types[0],
74
+ resourceIds,
75
+ folderIds
76
+ };
77
+ return await odeServices.resource(searchParams.app).deleteAll(deleteParameters, useAssetIds);
78
+ };
79
+ const restoreAll = async ({
80
+ searchParams,
81
+ resourceIds,
82
+ folderIds,
83
+ useAssetIds
84
+ }) => {
85
+ const trashParameters = {
86
+ application: searchParams.app,
87
+ resourceType: searchParams.types[0],
88
+ resourceIds,
89
+ folderIds
90
+ };
91
+ return await odeServices.resource(searchParams.app).restoreAll(trashParameters, useAssetIds);
92
+ };
93
+ const moveToFolder = async ({
94
+ searchParams,
95
+ resourceIds,
96
+ folderId,
97
+ folderIds,
98
+ useAssetIds
99
+ }) => {
100
+ const moveParameters = {
101
+ application: searchParams.app,
102
+ folderId,
103
+ resourceIds,
104
+ folderIds
105
+ };
106
+ return await odeServices.resource(searchParams.app).moveToFolder(moveParameters, useAssetIds);
107
+ };
108
+ const shareResource = async ({
109
+ app,
110
+ resourceId,
111
+ rights
112
+ }) => {
113
+ return await odeServices.share().saveRights(app, resourceId, rights);
114
+ };
115
+ const updateResource = async ({
116
+ app,
117
+ params
118
+ }) => {
119
+ return await odeServices.resource(app).update(params);
120
+ };
121
+ const sessionHasWorkflowRights = async (actionRights) => {
122
+ return await odeServices.rights().sessionHasWorkflowRights(actionRights);
123
+ };
124
+ const goToResource = ({
125
+ searchParams,
126
+ assetId
127
+ }) => {
128
+ return odeServices.resource(searchParams.app).gotoView(assetId);
129
+ };
130
+ const createResource = ({
131
+ searchParams,
132
+ params
133
+ }) => {
134
+ const result = odeServices.resource(searchParams.app).create(params);
135
+ return result;
136
+ };
137
+ const printResource = ({
138
+ searchParams,
139
+ assetId
140
+ }) => {
141
+ const result = odeServices.resource(searchParams.app).gotoPrint(assetId);
142
+ return result;
143
+ };
144
+ function arrayUnique(array) {
145
+ return array.filter((item, index) => array.indexOf(item) === index);
146
+ }
147
+ function findNodeById(id, data) {
148
+ var _a, _b;
149
+ let res;
150
+ if ((data == null ? void 0 : data.id) === id) {
151
+ return data;
152
+ }
153
+ if ((_a = data == null ? void 0 : data.children) == null ? void 0 : _a.length) {
154
+ (_b = data == null ? void 0 : data.children) == null ? void 0 : _b.every((childNode) => {
155
+ res = findNodeById(id, childNode);
156
+ return res === void 0;
157
+ });
158
+ }
159
+ return res;
160
+ }
161
+ function getAncestors(folderId, treeData) {
162
+ var _a;
163
+ const findItem = findNodeById(folderId, treeData);
164
+ if ((_a = findItem == null ? void 0 : findItem.folder) == null ? void 0 : _a.ancestors) {
165
+ const nodes = (findItem == null ? void 0 : findItem.folder.ancestors) || [];
166
+ return [...nodes, folderId];
167
+ } else if (folderId === FOLDER.BIN) {
168
+ return [FOLDER.BIN];
169
+ } else {
170
+ return [FOLDER.DEFAULT];
171
+ }
172
+ }
173
+ function hasChildren(folderId, data) {
174
+ if (data.id === folderId && data.children) {
175
+ return data.children.length > 0;
176
+ }
177
+ if (data.children) {
178
+ return data.children.some((child) => hasChildren(data.id, child));
179
+ }
180
+ return false;
181
+ }
182
+ function modifyNode(data, callback) {
183
+ const root = doModify(data, callback) || data;
184
+ return root;
185
+ }
186
+ function doModify(current, callback, parent) {
187
+ var _a;
188
+ const result = callback(current, parent);
189
+ if ((_a = result == null ? void 0 : result.children) == null ? void 0 : _a.length) {
190
+ const children = [];
191
+ for (const child of (result == null ? void 0 : result.children) || []) {
192
+ const res = doModify(child, callback, result);
193
+ if (res) {
194
+ children.push(res);
195
+ }
196
+ }
197
+ return {
198
+ ...result,
199
+ children
200
+ };
201
+ }
202
+ return result;
203
+ }
204
+ class TreeNodeFolderWrapper {
205
+ constructor(folder) {
206
+ __publicField(this, "id");
207
+ __publicField(this, "name");
208
+ __publicField(this, "childNumber");
209
+ __publicField(this, "section", false);
210
+ __publicField(this, "children", []);
211
+ this.folder = folder;
212
+ this.id = folder.id;
213
+ this.name = folder.name;
214
+ this.childNumber = folder.childNumber;
215
+ }
216
+ }
217
+ const wrapTreeNode = (treeNode, folders, parentId) => {
218
+ return modifyNode(treeNode, (node) => {
219
+ if (node.id === parentId) {
220
+ node.children = folders == null ? void 0 : folders.map((e) => new TreeNodeFolderWrapper(e));
221
+ }
222
+ return node;
223
+ });
224
+ };
225
+ const useStoreContext = create()((set, get) => ({
226
+ config: null,
227
+ searchConfig: {
228
+ minLength: 1
229
+ },
230
+ searchParams: {
231
+ app: "",
232
+ types: [],
233
+ filters: {
234
+ folder: "default",
235
+ owner: void 0,
236
+ shared: void 0,
237
+ public: void 0
238
+ },
239
+ orders: {
240
+ updatedAt: "desc"
241
+ },
242
+ pagination: {
243
+ startIdx: 0,
244
+ pageSize: 48,
245
+ maxIdx: 0
246
+ },
247
+ trashed: false
248
+ },
249
+ treeData: {
250
+ id: FOLDER.DEFAULT,
251
+ name: t("explorer.filters.mine"),
252
+ section: true,
253
+ children: []
254
+ },
255
+ selectedNodesIds: ["default"],
256
+ currentFolder: {
257
+ id: "default"
258
+ },
259
+ selectedFolders: [],
260
+ selectedResources: [],
261
+ folderIds: [],
262
+ resourceIds: [],
263
+ resourceIsTrash: false,
264
+ resourceActionDisable: false,
265
+ status: void 0,
266
+ updaters: {
267
+ setConfig: (config) => set({
268
+ config
269
+ }),
270
+ setSearchConfig: (searchConfig) => set((state) => ({
271
+ searchConfig: {
272
+ ...state.searchConfig,
273
+ ...searchConfig
274
+ }
275
+ })),
276
+ setTreeData: (treeData) => set(() => ({
277
+ treeData
278
+ })),
279
+ setSearchParams: (searchParams) => {
280
+ set((state) => {
281
+ const {
282
+ searchParams: previousSearchParams
283
+ } = state;
284
+ if (previousSearchParams.search !== searchParams.search) {
285
+ if (searchParams.search) {
286
+ return {
287
+ ...state,
288
+ selectedFolders: [],
289
+ selectedNodesIds: [],
290
+ selectedResources: [],
291
+ currentFolder: void 0,
292
+ searchParams: {
293
+ ...previousSearchParams,
294
+ ...searchParams,
295
+ trashed: false,
296
+ filters: {
297
+ ...previousSearchParams.filters,
298
+ folder: void 0
299
+ }
300
+ }
301
+ };
302
+ } else {
303
+ return {
304
+ ...state,
305
+ selectedFolders: [],
306
+ selectedNodesIds: ["default"],
307
+ selectedResources: [],
308
+ currentFolder: {
309
+ id: "default"
310
+ },
311
+ searchParams: {
312
+ ...previousSearchParams,
313
+ ...searchParams,
314
+ trashed: false,
315
+ filters: {
316
+ ...previousSearchParams.filters
317
+ }
318
+ }
319
+ };
320
+ }
321
+ } else {
322
+ return {
323
+ searchParams: {
324
+ ...previousSearchParams,
325
+ ...searchParams
326
+ }
327
+ };
328
+ }
329
+ });
330
+ },
331
+ setSelectedFolders: (selectedFolders) => set(() => ({
332
+ selectedFolders
333
+ })),
334
+ setSelectedResources: (selectedResources) => set(() => ({
335
+ selectedResources
336
+ })),
337
+ setFolderIds: (folderIds) => set(() => ({
338
+ folderIds
339
+ })),
340
+ setResourceIds: (resourceIds) => set(() => ({
341
+ resourceIds
342
+ })),
343
+ setResourceIsTrash: (resourceIsTrash) => set(() => ({
344
+ resourceIsTrash
345
+ })),
346
+ setResourceActionDisable: (resourceActionDisable) => set(() => ({
347
+ resourceActionDisable
348
+ })),
349
+ setCurrentFolder: (currentFolder) => set(() => ({
350
+ currentFolder
351
+ })),
352
+ clearSelectedItems: () => set(() => ({
353
+ selectedFolders: [],
354
+ selectedResources: []
355
+ })),
356
+ clearSelectedIds: () => set(() => ({
357
+ resourceIds: [],
358
+ folderIds: []
359
+ })),
360
+ openResource: (resource) => {
361
+ try {
362
+ const {
363
+ searchParams
364
+ } = get();
365
+ goToResource({
366
+ searchParams,
367
+ assetId: resource.assetId
368
+ });
369
+ } catch (error) {
370
+ console.error("explorer open failed: ", error);
371
+ }
372
+ },
373
+ printSelectedResource: () => {
374
+ try {
375
+ const {
376
+ searchParams,
377
+ selectedResources,
378
+ resourceIds
379
+ } = get();
380
+ if (selectedResources.length !== 1) {
381
+ throw new Error("Cannot open more than 1 resource");
382
+ }
383
+ const item = selectedResources.find((resource) => resource.id === resourceIds[0]);
384
+ printResource({
385
+ searchParams,
386
+ assetId: item.assetId
387
+ });
388
+ } catch (error) {
389
+ console.error("explorer print failed: ", error);
390
+ }
391
+ },
392
+ openFolder: ({
393
+ folderId,
394
+ folder
395
+ }) => {
396
+ const {
397
+ searchParams,
398
+ treeData
399
+ } = get();
400
+ const previousId = searchParams.filters.folder;
401
+ const ancestors = getAncestors(folderId, treeData);
402
+ const selectedNodesIds = arrayUnique([...ancestors, folderId]);
403
+ if (previousId === folderId)
404
+ return;
405
+ set((state) => {
406
+ return {
407
+ ...state,
408
+ // reset selection when changing folder
409
+ folderIds: [],
410
+ resourceIds: [],
411
+ selectedNodesIds,
412
+ currentFolder: folder || {
413
+ id: folderId
414
+ },
415
+ searchParams: {
416
+ ...searchParams,
417
+ search: void 0,
418
+ filters: {
419
+ ...searchParams.filters,
420
+ folder: folderId
421
+ },
422
+ trashed: folderId === FOLDER.BIN
423
+ }
424
+ };
425
+ });
426
+ },
427
+ foldTreeItem: () => set((state) => ({
428
+ ...state,
429
+ status: "fold"
430
+ })),
431
+ unfoldTreeItem: async (folderId, queryClient) => {
432
+ const {
433
+ treeData,
434
+ searchParams
435
+ } = get();
436
+ set((state) => ({
437
+ ...state,
438
+ status: "unfold"
439
+ }));
440
+ if (!hasChildren(folderId, treeData)) {
441
+ await queryClient.prefetchInfiniteQuery({
442
+ queryKey: ["prefetchContext", {
443
+ folderId,
444
+ trashed: false
445
+ }],
446
+ queryFn: async () => await searchContext({
447
+ ...searchParams,
448
+ filters: {
449
+ ...searchParams.filters,
450
+ folder: folderId
451
+ }
452
+ })
453
+ });
454
+ const data = queryClient.getQueryData(["prefetchContext", {
455
+ folderId,
456
+ trashed: false
457
+ }]);
458
+ set((state) => {
459
+ var _a;
460
+ return {
461
+ ...state,
462
+ treeData: wrapTreeNode(treeData, (_a = data == null ? void 0 : data.pages[0]) == null ? void 0 : _a.folders, folderId || FOLDER.DEFAULT)
463
+ };
464
+ });
465
+ }
466
+ },
467
+ selectTreeItem: (folderId) => {
468
+ const {
469
+ treeData
470
+ } = get();
471
+ const {
472
+ openFolder
473
+ } = get().updaters;
474
+ const folder = findNodeById(folderId, treeData);
475
+ const goToTop = useScrollToTop();
476
+ goToTop();
477
+ set((state) => ({
478
+ ...state,
479
+ searchParams: {
480
+ ...state.searchParams,
481
+ search: void 0
482
+ },
483
+ status: "select",
484
+ selectedResources: []
485
+ }));
486
+ openFolder({
487
+ folder,
488
+ folderId
489
+ });
490
+ },
491
+ gotoPreviousFolder: () => {
492
+ const {
493
+ selectedNodesIds,
494
+ treeData
495
+ } = get();
496
+ const {
497
+ openFolder
498
+ } = get().updaters;
499
+ const selectedNodesIdsLength = selectedNodesIds.length;
500
+ if (selectedNodesIdsLength < 2) {
501
+ return void 0;
502
+ }
503
+ const previousFolder = findNodeById(selectedNodesIds[selectedNodesIdsLength - 2], treeData);
504
+ openFolder({
505
+ folder: previousFolder,
506
+ folderId: (previousFolder == null ? void 0 : previousFolder.id) || FOLDER.DEFAULT
507
+ });
508
+ },
509
+ goToTrash: () => set((state) => ({
510
+ ...state,
511
+ selectedNodesIds: [],
512
+ selectedResources: [],
513
+ resourceIds: [],
514
+ folderIds: [],
515
+ status: "select",
516
+ searchParams: {
517
+ ...state.searchParams,
518
+ search: void 0,
519
+ filters: {
520
+ folder: FOLDER.BIN
521
+ },
522
+ trashed: true
523
+ },
524
+ currentFolder: {
525
+ id: FOLDER.BIN
526
+ }
527
+ }))
528
+ }
529
+ }));
530
+ const useSearchParams = () => useStoreContext((state) => state.searchParams);
531
+ const useSelectedNodesIds = () => useStoreContext((state) => state.selectedNodesIds);
532
+ const useTreeData = () => useStoreContext((state) => state.treeData);
533
+ const useSelectedFolders = () => useStoreContext((state) => state.selectedFolders);
534
+ const useSelectedResources = () => useStoreContext((state) => state.selectedResources);
535
+ const useSearchConfig = () => useStoreContext((state) => state.searchConfig);
536
+ const useFolderIds = () => useStoreContext((state) => state.folderIds);
537
+ const useResourceIds = () => useStoreContext((state) => state.resourceIds);
538
+ const useResourceAssetIds = () => useStoreContext((state) => state.selectedResources.map((r) => r.assetId));
539
+ const useResourceWithoutIds = () => useStoreContext((state) => state.selectedResources.filter((r) => r.assetId === r.id));
540
+ const useCurrentFolder = () => useStoreContext((state) => state.currentFolder);
541
+ const useStoreActions = () => useStoreContext((state) => state.updaters);
542
+ const useIsTrash = () => {
543
+ const currentFolder = useCurrentFolder();
544
+ return (currentFolder == null ? void 0 : currentFolder.id) === FOLDER.BIN;
545
+ };
546
+ const useResourceIsTrash = () => {
547
+ return useStoreContext((state) => state.resourceIsTrash);
548
+ };
549
+ const useResourceActionDisable = () => {
550
+ return useStoreContext((state) => state.resourceActionDisable);
551
+ };
552
+ const useIsRoot = () => {
553
+ const currentFolder = useCurrentFolder();
554
+ return (currentFolder == null ? void 0 : currentFolder.id) === "default";
555
+ };
556
+ const useHasSelectedNodes = () => {
557
+ const selectedNodesIds = useSelectedNodesIds();
558
+ return selectedNodesIds.length > 1;
559
+ };
560
+ const useTreeStatus = () => useStoreContext((state) => state.status);
561
+ const useSearchForm = () => {
562
+ const searchParams = useSearchParams();
563
+ const [inputSearch, setInputSearch] = useState("");
564
+ const searchConfig = useSearchConfig();
565
+ const status = useTreeStatus();
566
+ const formRef = useRef(null);
567
+ const {
568
+ setSearchParams
569
+ } = useStoreActions();
570
+ const handleInputSearchChange = (event) => {
571
+ const newText = event.target.value;
572
+ setInputSearch(newText.toString());
573
+ };
574
+ const handleKeyPress = (event) => {
575
+ if (event.key === "Enter" || event.key === "Return") {
576
+ event.preventDefault();
577
+ setSearchParams({
578
+ search: inputSearch ? inputSearch : void 0
579
+ });
580
+ }
581
+ };
582
+ const handleSearchSubmit = (e) => {
583
+ e.preventDefault();
584
+ setSearchParams({
585
+ search: inputSearch ? inputSearch : void 0
586
+ });
587
+ };
588
+ useEffect(() => {
589
+ const shouldUpdateSearch = inputSearch.length == 0 || inputSearch.length >= searchConfig.minLength;
590
+ const searchPartial = shouldUpdateSearch ? {
591
+ search: inputSearch ? inputSearch : void 0
592
+ } : {};
593
+ setSearchParams({
594
+ ...searchParams,
595
+ ...searchPartial
596
+ });
597
+ }, [inputSearch, searchConfig.minLength]);
598
+ useEffect(() => {
599
+ if (status === "select")
600
+ setInputSearch("");
601
+ }, [status]);
602
+ useEffect(() => {
603
+ setInputSearch(() => {
604
+ var _a;
605
+ return ((_a = searchParams.search) == null ? void 0 : _a.toString()) ?? "";
606
+ });
607
+ }, [searchParams]);
608
+ return {
609
+ formRef,
610
+ inputSearch,
611
+ handleInputSearchChange,
612
+ handleKeyPress,
613
+ handleSearchSubmit
614
+ };
615
+ };
616
+ function ExplorerBreadcrumb() {
617
+ const {
618
+ appCode
619
+ } = useOdeClient();
620
+ const {
621
+ gotoPreviousFolder
622
+ } = useStoreActions();
623
+ const {
624
+ t: t2
625
+ } = useTranslation();
626
+ const {
627
+ inputSearch
628
+ } = useSearchForm();
629
+ const selectedNodesIds = useSelectedNodesIds();
630
+ const isTrashFolder = useIsTrash();
631
+ const currentFolder = useCurrentFolder();
632
+ const trashName = t2("explorer.tree.trash");
633
+ const searchName = t2("explorer.tree.search");
634
+ const rootName = t2("explorer.filters.mine", {
635
+ ns: appCode
636
+ });
637
+ const previousName = (currentFolder == null ? void 0 : currentFolder.name) || rootName;
638
+ return /* @__PURE__ */ jsx("div", { className: "py-16", children: selectedNodesIds.length > 1 && !isTrashFolder ? /* @__PURE__ */ jsxs("div", { className: "d-flex align-items-center gap-8", children: [
639
+ /* @__PURE__ */ jsx(IconButton, { icon: /* @__PURE__ */ jsx(ArrowLeft, {}), variant: "ghost", color: "tertiary", "aria-label": t2("back"), className: "ms-n16", onClick: gotoPreviousFolder }),
640
+ /* @__PURE__ */ jsx("p", { className: "body py-8 text-truncate", children: /* @__PURE__ */ jsx("strong", { children: previousName }) })
641
+ ] }) : /* @__PURE__ */ jsx("h2", { className: "body py-8 fw-bold", children: inputSearch.length !== 0 ? searchName : !isTrashFolder ? rootName : trashName }) });
642
+ }
643
+ const useDisableModal = () => {
644
+ const isActionDisableModalOpen = useResourceActionDisable();
645
+ const {
646
+ clearSelectedIds,
647
+ setResourceActionDisable,
648
+ clearSelectedItems
649
+ } = useStoreActions();
650
+ const onActionDisableCancel = () => {
651
+ clearSelectedIds();
652
+ clearSelectedItems();
653
+ setResourceActionDisable(false);
654
+ };
655
+ return {
656
+ isActionDisableModalOpen,
657
+ onActionDisableCancel
658
+ };
659
+ };
660
+ const useTrashModal = () => {
661
+ const isTrashedModalOpen = useResourceIsTrash();
662
+ const {
663
+ clearSelectedIds,
664
+ setResourceIsTrash,
665
+ clearSelectedItems
666
+ } = useStoreActions();
667
+ const onTrashedCancel = () => {
668
+ clearSelectedIds();
669
+ clearSelectedItems();
670
+ setResourceIsTrash(false);
671
+ };
672
+ return {
673
+ isTrashedModalOpen,
674
+ onTrashedCancel
675
+ };
676
+ };
677
+ function addNode(treeData, {
678
+ parentId,
679
+ newFolder
680
+ }) {
681
+ return modifyNode(treeData, (node) => {
682
+ var _a;
683
+ if (node.id === parentId) {
684
+ const parentAncestors = [...((_a = node.folder) == null ? void 0 : _a.ancestors) || []];
685
+ const ancestors = arrayUnique([...parentAncestors, node.id]);
686
+ const newNode = {
687
+ ...node,
688
+ children: [...node.children || [], new TreeNodeFolderWrapper({
689
+ ...newFolder,
690
+ ancestors
691
+ })]
692
+ };
693
+ return newNode;
694
+ } else {
695
+ return node;
696
+ }
697
+ });
698
+ }
699
+ function deleteNode(treeData, {
700
+ folders
701
+ }) {
702
+ return modifyNode(treeData, (node) => {
703
+ if (folders.includes(node.id)) {
704
+ return void 0;
705
+ } else {
706
+ return node;
707
+ }
708
+ });
709
+ }
710
+ function moveNode(treeData, {
711
+ destinationId,
712
+ folders
713
+ }) {
714
+ return modifyNode(treeData, (node, parent) => {
715
+ var _a, _b;
716
+ if (destinationId === node.id) {
717
+ const parentAncestors = [...((_a = node.folder) == null ? void 0 : _a.ancestors) || []];
718
+ const ancestors = arrayUnique([...parentAncestors, node.id]);
719
+ const newChildren = [...node.children || []];
720
+ const childrenIds = ((_b = node.children) == null ? void 0 : _b.map((child) => child.id)) || [];
721
+ for (const folder of folders) {
722
+ if (!childrenIds.includes(folder)) {
723
+ const item = findNodeById(folder, treeData);
724
+ item && newChildren.push({
725
+ ...item,
726
+ folder: {
727
+ ...item == null ? void 0 : item.folder,
728
+ ancestors
729
+ }
730
+ });
731
+ }
732
+ }
733
+ const newNode = {
734
+ ...node,
735
+ children: newChildren
736
+ };
737
+ return newNode;
738
+ } else if (folders.includes(node.id) && destinationId !== (parent == null ? void 0 : parent.id)) {
739
+ return void 0;
740
+ } else {
741
+ return node;
742
+ }
743
+ });
744
+ }
745
+ function updateNode(treeData, {
746
+ folderId,
747
+ newFolder
748
+ }) {
749
+ return modifyNode(treeData, (node) => {
750
+ if (node.id === folderId) {
751
+ return new TreeNodeFolderWrapper(newFolder);
752
+ } else {
753
+ return node;
754
+ }
755
+ });
756
+ }
757
+ const useActions = () => {
758
+ const config = useStoreContext((state) => state.config);
759
+ return useQuery({
760
+ queryKey: ["actions"],
761
+ queryFn: async () => {
762
+ const actionRights = config.actions.map((action) => action.workflow);
763
+ const availableRights = await sessionHasWorkflowRights(actionRights);
764
+ return availableRights;
765
+ },
766
+ select: (data) => {
767
+ return config.actions.map((action) => ({
768
+ ...action,
769
+ available: data[action.workflow]
770
+ }));
771
+ },
772
+ staleTime: Infinity,
773
+ enabled: !!config
774
+ });
775
+ };
776
+ const useSearchContext = () => {
777
+ const config = useStoreContext((state) => state.config);
778
+ const searchParams = useSearchParams();
779
+ const {
780
+ filters,
781
+ trashed,
782
+ search
783
+ } = searchParams;
784
+ const queryKey = ["context", {
785
+ folderId: filters.folder,
786
+ filters,
787
+ trashed,
788
+ search
789
+ }];
790
+ return useInfiniteQuery({
791
+ queryKey,
792
+ queryFn: async ({
793
+ pageParam
794
+ }) => {
795
+ return await searchContext({
796
+ ...searchParams,
797
+ app: config == null ? void 0 : config.app,
798
+ types: config == null ? void 0 : config.types,
799
+ pagination: {
800
+ ...searchParams.pagination,
801
+ startIdx: pageParam
802
+ }
803
+ });
804
+ },
805
+ initialPageParam: 0,
806
+ enabled: !!config,
807
+ retry: false,
808
+ getNextPageParam: (lastPage) => {
809
+ return lastPage.pagination.startIdx + lastPage.pagination.pageSize;
810
+ }
811
+ });
812
+ };
813
+ const useTrash = () => {
814
+ const toast = useToast();
815
+ const queryClient = useQueryClient();
816
+ const searchParams = useSearchParams();
817
+ const treeData = useTreeData();
818
+ const folderIds = useFolderIds();
819
+ const assetIds = useResourceAssetIds();
820
+ const resourceRealIds = useResourceIds();
821
+ const useAssetIds = useResourceWithoutIds().length > 0;
822
+ const resourceIds = useAssetIds ? assetIds : resourceRealIds;
823
+ const {
824
+ clearSelectedItems,
825
+ clearSelectedIds,
826
+ setTreeData,
827
+ setSearchParams
828
+ } = useStoreActions();
829
+ const {
830
+ filters,
831
+ trashed
832
+ } = searchParams;
833
+ const queryKey = ["context", {
834
+ folderId: filters.folder,
835
+ filters,
836
+ trashed
837
+ }];
838
+ return useMutation({
839
+ mutationFn: async () => await trashAll({
840
+ searchParams,
841
+ folderIds,
842
+ resourceIds,
843
+ useAssetIds
844
+ }),
845
+ onError(error) {
846
+ if (typeof error === "string")
847
+ toast.error(t(error));
848
+ },
849
+ onSuccess: async (data) => {
850
+ await queryClient.cancelQueries({
851
+ queryKey
852
+ });
853
+ const previousData = queryClient.getQueryData(queryKey);
854
+ if (previousData) {
855
+ toast.success(t("explorer.trash.title"));
856
+ return queryClient.setQueryData(queryKey, (prev) => {
857
+ var _a;
858
+ if (prev) {
859
+ const newData = {
860
+ ...prev,
861
+ pages: prev == null ? void 0 : prev.pages.map((page) => {
862
+ var _a2;
863
+ return {
864
+ ...page,
865
+ folders: page.folders.filter((folder) => !folderIds.includes(folder.id)),
866
+ pagination: {
867
+ ...page.pagination,
868
+ // @ts-ignore
869
+ maxIdx: ((_a2 = page == null ? void 0 : page.pagination) == null ? void 0 : _a2.maxIdx) - data.resources.length
870
+ },
871
+ resources: page.resources.filter((resource) => {
872
+ if (useAssetIds) {
873
+ return !assetIds.includes(resource.assetId);
874
+ } else {
875
+ return !resourceIds.includes(resource.id);
876
+ }
877
+ })
878
+ };
879
+ })
880
+ };
881
+ const update = deleteNode(treeData, {
882
+ folders: folderIds
883
+ });
884
+ setTreeData(update);
885
+ setSearchParams({
886
+ ...searchParams,
887
+ pagination: {
888
+ ...searchParams.pagination,
889
+ // @ts-ignore
890
+ maxIdx: ((_a = searchParams.pagination) == null ? void 0 : _a.maxIdx) - data.resources.length
891
+ }
892
+ });
893
+ return newData;
894
+ }
895
+ return void 0;
896
+ });
897
+ }
898
+ },
899
+ onSettled: () => {
900
+ clearSelectedItems();
901
+ clearSelectedIds();
902
+ }
903
+ });
904
+ };
905
+ const useRestore = () => {
906
+ const toast = useToast();
907
+ const queryClient = useQueryClient();
908
+ const searchParams = useSearchParams();
909
+ const folderIds = useFolderIds();
910
+ const assetIds = useResourceAssetIds();
911
+ const resourceRealIds = useResourceIds();
912
+ const useAssetIds = useResourceWithoutIds().length > 0;
913
+ const resourceIds = useAssetIds ? assetIds : resourceRealIds;
914
+ const {
915
+ setFolderIds,
916
+ setResourceIds,
917
+ setSelectedResources,
918
+ setSelectedFolders
919
+ } = useStoreActions();
920
+ const {
921
+ filters,
922
+ trashed
923
+ } = searchParams;
924
+ const queryKey = ["context", {
925
+ folderId: filters.folder,
926
+ filters,
927
+ trashed
928
+ }];
929
+ return useMutation({
930
+ mutationFn: async () => await restoreAll({
931
+ searchParams,
932
+ folderIds,
933
+ resourceIds,
934
+ useAssetIds
935
+ }),
936
+ onError(error) {
937
+ if (typeof error === "string")
938
+ toast.error(t(error));
939
+ },
940
+ onSuccess: async () => {
941
+ await queryClient.cancelQueries({
942
+ queryKey
943
+ });
944
+ const previousData = queryClient.getQueryData(queryKey);
945
+ if (previousData) {
946
+ toast.success(t("explorer.trash.toast"));
947
+ return queryClient.setQueryData(queryKey, (prev) => {
948
+ if (prev) {
949
+ return {
950
+ ...prev,
951
+ pages: prev == null ? void 0 : prev.pages.map((page) => {
952
+ return {
953
+ ...page,
954
+ folders: page.folders.filter((folder) => !folderIds.includes(folder.id)),
955
+ resources: page.resources.filter((resource) => {
956
+ if (useAssetIds) {
957
+ return !assetIds.includes(resource.assetId);
958
+ } else {
959
+ return !resourceIds.includes(resource.id);
960
+ }
961
+ })
962
+ };
963
+ })
964
+ };
965
+ }
966
+ return void 0;
967
+ });
968
+ }
969
+ },
970
+ onSettled: () => {
971
+ setResourceIds([]);
972
+ setSelectedResources([]);
973
+ setFolderIds([]);
974
+ setSelectedFolders([]);
975
+ }
976
+ });
977
+ };
978
+ const useDelete = () => {
979
+ const toast = useToast();
980
+ const queryClient = useQueryClient();
981
+ const searchParams = useSearchParams();
982
+ const folderIds = useFolderIds();
983
+ const assetIds = useResourceAssetIds();
984
+ const resourceRealIds = useResourceIds();
985
+ const useAssetIds = useResourceWithoutIds().length > 0;
986
+ const resourceIds = useAssetIds ? assetIds : resourceRealIds;
987
+ const {
988
+ clearSelectedItems,
989
+ clearSelectedIds
990
+ } = useStoreActions();
991
+ const {
992
+ filters,
993
+ trashed
994
+ } = searchParams;
995
+ const queryKey = ["context", {
996
+ folderId: filters.folder,
997
+ filters,
998
+ trashed
999
+ }];
1000
+ return useMutation({
1001
+ mutationFn: async () => await deleteAll({
1002
+ searchParams,
1003
+ folderIds,
1004
+ resourceIds,
1005
+ useAssetIds
1006
+ }),
1007
+ onError(error) {
1008
+ if (typeof error === "string")
1009
+ toast.error(t(error));
1010
+ },
1011
+ onSuccess: async () => {
1012
+ await queryClient.cancelQueries({
1013
+ queryKey
1014
+ });
1015
+ const previousData = queryClient.getQueryData(queryKey);
1016
+ if (previousData) {
1017
+ toast.success(t("explorer.removed.from.trash"));
1018
+ return queryClient.setQueryData(queryKey, (prev) => {
1019
+ if (prev) {
1020
+ const newData = {
1021
+ ...prev,
1022
+ pages: prev == null ? void 0 : prev.pages.map((page) => {
1023
+ return {
1024
+ ...page,
1025
+ folders: page.folders.filter((folder) => !folderIds.includes(folder.id)),
1026
+ resources: page.resources.filter((resource) => {
1027
+ if (useAssetIds) {
1028
+ return !assetIds.includes(resource.assetId);
1029
+ } else {
1030
+ return !resourceIds.includes(resource.id);
1031
+ }
1032
+ })
1033
+ };
1034
+ })
1035
+ };
1036
+ return newData;
1037
+ }
1038
+ return void 0;
1039
+ });
1040
+ }
1041
+ },
1042
+ onSettled: () => {
1043
+ clearSelectedItems();
1044
+ clearSelectedIds();
1045
+ }
1046
+ });
1047
+ };
1048
+ const useMoveItem = () => {
1049
+ const toast = useToast();
1050
+ const queryClient = useQueryClient();
1051
+ const searchParams = useSearchParams();
1052
+ const treeData = useTreeData();
1053
+ const folderIds = useFolderIds();
1054
+ const assetIds = useResourceAssetIds();
1055
+ const resourceRealIds = useResourceIds();
1056
+ const useAssetIds = useResourceWithoutIds().length > 0;
1057
+ const resourceIds = useAssetIds ? assetIds : resourceRealIds;
1058
+ const {
1059
+ clearSelectedIds,
1060
+ clearSelectedItems,
1061
+ setTreeData,
1062
+ setSearchParams
1063
+ } = useStoreActions();
1064
+ const {
1065
+ filters,
1066
+ trashed
1067
+ } = searchParams;
1068
+ const queryKey = ["context", {
1069
+ folderId: filters.folder,
1070
+ filters,
1071
+ trashed
1072
+ }];
1073
+ return useMutation({
1074
+ mutationFn: async (folderId) => await moveToFolder({
1075
+ searchParams,
1076
+ folderId,
1077
+ folderIds,
1078
+ resourceIds,
1079
+ useAssetIds
1080
+ }),
1081
+ onError(error) {
1082
+ if (typeof error === "string")
1083
+ toast.error(t(error));
1084
+ },
1085
+ onSuccess: async (data, variables) => {
1086
+ const previousData = queryClient.getQueryData(queryKey);
1087
+ if (previousData) {
1088
+ return queryClient.setQueryData(queryKey, (prev) => {
1089
+ var _a;
1090
+ if (prev) {
1091
+ const update = moveNode(treeData, {
1092
+ destinationId: variables,
1093
+ folders: folderIds
1094
+ });
1095
+ const newData = {
1096
+ ...prev,
1097
+ pages: prev == null ? void 0 : prev.pages.map((page) => {
1098
+ var _a2;
1099
+ return {
1100
+ ...page,
1101
+ folders: page.folders.filter((folder) => !folderIds.includes(folder.id)),
1102
+ pagination: {
1103
+ ...page.pagination,
1104
+ // @ts-ignore
1105
+ maxIdx: ((_a2 = page.pagination) == null ? void 0 : _a2.maxIdx) - data.resources.length
1106
+ },
1107
+ resources: page.resources.filter((resource) => {
1108
+ if (useAssetIds) {
1109
+ return !assetIds.includes(resource.assetId);
1110
+ } else {
1111
+ return !resourceIds.includes(resource.id);
1112
+ }
1113
+ })
1114
+ };
1115
+ })
1116
+ };
1117
+ setTreeData(update);
1118
+ setSearchParams({
1119
+ ...searchParams,
1120
+ pagination: {
1121
+ ...searchParams.pagination,
1122
+ // @ts-ignore
1123
+ maxIdx: ((_a = searchParams.pagination) == null ? void 0 : _a.maxIdx) - data.resources.length
1124
+ }
1125
+ });
1126
+ return newData;
1127
+ }
1128
+ return void 0;
1129
+ });
1130
+ }
1131
+ },
1132
+ onSettled: () => {
1133
+ clearSelectedItems();
1134
+ clearSelectedIds();
1135
+ }
1136
+ });
1137
+ };
1138
+ const useCreateFolder = () => {
1139
+ const toast = useToast();
1140
+ const queryClient = useQueryClient();
1141
+ const searchParams = useSearchParams();
1142
+ const treeData = useTreeData();
1143
+ const {
1144
+ setTreeData
1145
+ } = useStoreActions();
1146
+ const {
1147
+ filters,
1148
+ trashed
1149
+ } = searchParams;
1150
+ const queryKey = ["context", {
1151
+ folderId: filters.folder,
1152
+ filters,
1153
+ trashed
1154
+ }];
1155
+ return useMutation({
1156
+ mutationFn: async ({
1157
+ name,
1158
+ parentId
1159
+ }) => await createFolder({
1160
+ searchParams,
1161
+ name,
1162
+ parentId
1163
+ }),
1164
+ onError(error) {
1165
+ if (typeof error === "string")
1166
+ toast.error(t(error));
1167
+ },
1168
+ onSuccess: async (data, variables) => {
1169
+ await queryClient.cancelQueries({
1170
+ queryKey
1171
+ });
1172
+ const previousData = queryClient.getQueryData(queryKey);
1173
+ const newFolder = {
1174
+ ...data,
1175
+ parentId: variables.parentId,
1176
+ children: [],
1177
+ rights: [`creator:${data == null ? void 0 : data.creator_id}`]
1178
+ };
1179
+ if (previousData) {
1180
+ return queryClient.setQueryData(queryKey, (prev) => {
1181
+ if (prev) {
1182
+ const newData = {
1183
+ ...prev,
1184
+ pages: prev == null ? void 0 : prev.pages.map((page) => {
1185
+ return {
1186
+ ...page,
1187
+ folders: [...page.folders, newFolder]
1188
+ };
1189
+ })
1190
+ };
1191
+ const update = addNode(treeData, {
1192
+ parentId: variables.parentId,
1193
+ newFolder
1194
+ });
1195
+ setTreeData(update);
1196
+ return newData;
1197
+ }
1198
+ return void 0;
1199
+ });
1200
+ }
1201
+ }
1202
+ });
1203
+ };
1204
+ const useUpdatefolder = () => {
1205
+ const toast = useToast();
1206
+ const queryClient = useQueryClient();
1207
+ const searchParams = useSearchParams();
1208
+ const treeData = useTreeData();
1209
+ const {
1210
+ setFolderIds,
1211
+ setSelectedFolders,
1212
+ setTreeData
1213
+ } = useStoreActions();
1214
+ const {
1215
+ filters,
1216
+ trashed
1217
+ } = searchParams;
1218
+ const queryKey = ["context", {
1219
+ folderId: filters.folder,
1220
+ filters,
1221
+ trashed
1222
+ }];
1223
+ return useMutation({
1224
+ mutationFn: async ({
1225
+ folderId,
1226
+ name,
1227
+ parentId
1228
+ }) => await updateFolder({
1229
+ searchParams,
1230
+ folderId,
1231
+ parentId,
1232
+ name
1233
+ }),
1234
+ onError(error) {
1235
+ if (typeof error === "string")
1236
+ toast.error(t(error));
1237
+ },
1238
+ onSuccess: async (data, variables) => {
1239
+ await queryClient.cancelQueries({
1240
+ queryKey
1241
+ });
1242
+ const previousData = queryClient.getQueryData(queryKey);
1243
+ if (previousData) {
1244
+ return queryClient.setQueryData(queryKey, (prev) => {
1245
+ if (prev) {
1246
+ const newData = {
1247
+ ...prev,
1248
+ pages: prev == null ? void 0 : prev.pages.map((page) => {
1249
+ return {
1250
+ ...page,
1251
+ folders: page.folders.map((folder) => {
1252
+ if (folder.id === data.id) {
1253
+ return {
1254
+ ...data,
1255
+ parentId: variables.parentId,
1256
+ rights: folder.rights
1257
+ };
1258
+ } else {
1259
+ return folder;
1260
+ }
1261
+ })
1262
+ };
1263
+ })
1264
+ };
1265
+ const update = updateNode(treeData, {
1266
+ folderId: variables.folderId,
1267
+ newFolder: data
1268
+ });
1269
+ setTreeData(update);
1270
+ return newData;
1271
+ }
1272
+ return void 0;
1273
+ });
1274
+ }
1275
+ },
1276
+ onSettled: () => {
1277
+ setFolderIds([]);
1278
+ setSelectedFolders([]);
1279
+ }
1280
+ });
1281
+ };
1282
+ const useShareResource = () => {
1283
+ const toast = useToast();
1284
+ const queryClient = useQueryClient();
1285
+ const searchParams = useSearchParams();
1286
+ const {
1287
+ setResourceIds,
1288
+ setSelectedResources
1289
+ } = useStoreActions();
1290
+ const {
1291
+ filters,
1292
+ trashed,
1293
+ app
1294
+ } = searchParams;
1295
+ const queryKey = ["context", {
1296
+ folderId: filters.folder,
1297
+ filters,
1298
+ trashed
1299
+ }];
1300
+ return useMutation({
1301
+ mutationFn: async ({
1302
+ resourceId,
1303
+ rights
1304
+ }) => await shareResource({
1305
+ app,
1306
+ resourceId,
1307
+ rights
1308
+ }),
1309
+ onError(error) {
1310
+ if (typeof error === "string")
1311
+ toast.error(t("explorer.shared.status.error"));
1312
+ },
1313
+ onSuccess: async (_data, variables) => {
1314
+ await queryClient.cancelQueries({
1315
+ queryKey
1316
+ });
1317
+ const previousData = queryClient.getQueryData(queryKey);
1318
+ if (previousData) {
1319
+ toast.success(t("explorer.shared.status.saved"));
1320
+ return queryClient.setQueryData(queryKey, (prev) => {
1321
+ if (prev) {
1322
+ return {
1323
+ ...prev,
1324
+ pages: prev == null ? void 0 : prev.pages.map((page) => {
1325
+ return {
1326
+ ...page,
1327
+ resources: page.resources.map((resource) => {
1328
+ if (resource.assetId === (variables == null ? void 0 : variables.resourceId)) {
1329
+ let rights = [`creator:${resource.creatorId}`];
1330
+ if ((variables == null ? void 0 : variables.rights.length) >= 1) {
1331
+ rights = [...rights, ...variables.rights.flatMap((right) => {
1332
+ return right.actions.map((action) => {
1333
+ return `${right.type}:${right.id}:${action.id}`;
1334
+ });
1335
+ })];
1336
+ }
1337
+ return {
1338
+ ...resource,
1339
+ rights
1340
+ };
1341
+ } else {
1342
+ return resource;
1343
+ }
1344
+ })
1345
+ };
1346
+ })
1347
+ };
1348
+ }
1349
+ return void 0;
1350
+ });
1351
+ }
1352
+ },
1353
+ onSettled: () => {
1354
+ setResourceIds([]);
1355
+ setSelectedResources([]);
1356
+ }
1357
+ });
1358
+ };
1359
+ const useUpdateResource = () => {
1360
+ const toast = useToast();
1361
+ const queryClient = useQueryClient();
1362
+ const searchParams = useSearchParams();
1363
+ const {
1364
+ filters,
1365
+ trashed,
1366
+ app
1367
+ } = searchParams;
1368
+ const queryKey = ["context", {
1369
+ folderId: filters.folder,
1370
+ filters,
1371
+ trashed
1372
+ }];
1373
+ return useMutation({
1374
+ mutationFn: async (params) => await updateResource({
1375
+ app,
1376
+ params
1377
+ }),
1378
+ onError(error) {
1379
+ if (typeof error === "string")
1380
+ toast.error(t(error));
1381
+ },
1382
+ onSuccess: async (_data, variables) => {
1383
+ await queryClient.cancelQueries({
1384
+ queryKey
1385
+ });
1386
+ const previousData = queryClient.getQueryData(queryKey);
1387
+ if (previousData) {
1388
+ return queryClient.setQueryData(queryKey, (prev) => {
1389
+ if (prev) {
1390
+ return {
1391
+ ...prev,
1392
+ pages: prev == null ? void 0 : prev.pages.map((page) => {
1393
+ return {
1394
+ ...page,
1395
+ resources: page.resources.map((resource) => {
1396
+ if (resource.assetId === (variables == null ? void 0 : variables.entId)) {
1397
+ const {
1398
+ name,
1399
+ thumbnail,
1400
+ public: pub,
1401
+ description,
1402
+ slug,
1403
+ ...others
1404
+ } = variables;
1405
+ return {
1406
+ ...resource,
1407
+ ...others,
1408
+ // add any custom field
1409
+ name,
1410
+ thumbnail: typeof thumbnail === "string" ? thumbnail : URL.createObjectURL(thumbnail),
1411
+ public: pub,
1412
+ description,
1413
+ slug
1414
+ };
1415
+ } else {
1416
+ return resource;
1417
+ }
1418
+ })
1419
+ };
1420
+ })
1421
+ };
1422
+ }
1423
+ return void 0;
1424
+ });
1425
+ }
1426
+ }
1427
+ });
1428
+ };
1429
+ const useCreateResource = () => {
1430
+ const toast = useToast();
1431
+ const queryClient = useQueryClient();
1432
+ const searchParams = useSearchParams();
1433
+ const {
1434
+ user
1435
+ } = useUser();
1436
+ const {
1437
+ appCode: application
1438
+ } = useOdeClient();
1439
+ const queryKey = ["context", {
1440
+ folderId: searchParams.filters.folder,
1441
+ filters: searchParams.filters,
1442
+ trashed: searchParams.trashed
1443
+ }];
1444
+ return useMutation({
1445
+ mutationFn: async (params) => await createResource({
1446
+ searchParams,
1447
+ params
1448
+ }),
1449
+ onError(error) {
1450
+ if (typeof error === "string")
1451
+ toast.error(t(error));
1452
+ },
1453
+ onSuccess: async (data, variables) => {
1454
+ var _a, _b, _c;
1455
+ await queryClient.cancelQueries({
1456
+ queryKey
1457
+ });
1458
+ const previousData = queryClient.getQueryData(queryKey);
1459
+ const {
1460
+ thumbnail
1461
+ } = variables;
1462
+ const newResource = {
1463
+ ...variables,
1464
+ thumbnail: thumbnail ? URL.createObjectURL(thumbnail) : "",
1465
+ application,
1466
+ assetId: data._id || data.entId || "",
1467
+ id: data._id || data.entId || "",
1468
+ creatorId: user == null ? void 0 : user.userId,
1469
+ creatorName: user == null ? void 0 : user.username,
1470
+ createdAt: Date.now(),
1471
+ slug: variables.slug || "",
1472
+ modifiedAt: ((_a = data.modified) == null ? void 0 : _a.$date) || "",
1473
+ modifierId: ((_b = data.author) == null ? void 0 : _b.userId) || "",
1474
+ modifierName: ((_c = data.author) == null ? void 0 : _c.username) || "",
1475
+ updatedAt: Date.now(),
1476
+ trashed: false,
1477
+ rights: [`creator:${user == null ? void 0 : user.userId}`]
1478
+ };
1479
+ if (previousData) {
1480
+ return queryClient.setQueryData(queryKey, (prev) => {
1481
+ if (prev) {
1482
+ return {
1483
+ ...prev,
1484
+ pages: prev == null ? void 0 : prev.pages.map((page) => {
1485
+ return {
1486
+ ...page,
1487
+ resources: [newResource, ...page.resources]
1488
+ };
1489
+ })
1490
+ };
1491
+ }
1492
+ return void 0;
1493
+ });
1494
+ }
1495
+ }
1496
+ });
1497
+ };
1498
+ const EmptyScreenApp = /* @__PURE__ */ lazy(async () => await import("./EmptyScreenApp.js"));
1499
+ const EmptyScreenSearch = /* @__PURE__ */ lazy(async () => await import("./EmptyScreenSearch.js"));
1500
+ const EmptyScreenError = /* @__PURE__ */ lazy(async () => await import("./EmptyScreenError.js"));
1501
+ const EmptyScreenNoContentInFolder = /* @__PURE__ */ lazy(async () => await import("./EmptyScreenNoContentInFolder.js"));
1502
+ const EmptyScreenTrash = /* @__PURE__ */ lazy(async () => await import("./EmptyScreenTrash.js"));
1503
+ const FoldersList = /* @__PURE__ */ lazy(async () => await import("./FoldersList.js"));
1504
+ const ResourcesList = /* @__PURE__ */ lazy(async () => await import("./ResourcesList.js"));
1505
+ const List = () => {
1506
+ const isRoot = useIsRoot();
1507
+ const isTrashFolder = useIsTrash();
1508
+ const hasSelectedNodes = useHasSelectedNodes();
1509
+ const searchParams = useSearchParams();
1510
+ const currentFolder = useCurrentFolder();
1511
+ const treeData = useTreeData();
1512
+ const toast = useToast();
1513
+ const {
1514
+ appCode
1515
+ } = useOdeClient();
1516
+ const {
1517
+ t: t2
1518
+ } = useTranslation();
1519
+ const {
1520
+ setSearchParams,
1521
+ setSearchConfig,
1522
+ setTreeData
1523
+ } = useStoreActions();
1524
+ const {
1525
+ data,
1526
+ isError,
1527
+ error,
1528
+ isLoading,
1529
+ isFetching,
1530
+ fetchNextPage
1531
+ } = useSearchContext();
1532
+ const hasNoFolders = (data == null ? void 0 : data.pages[0].folders.length) === 0;
1533
+ const hasNoResources = (data == null ? void 0 : data.pages[0].resources.length) === 0;
1534
+ const hasNoData = hasNoFolders && hasNoResources;
1535
+ useEffect(() => {
1536
+ var _a, _b, _c;
1537
+ if (data) {
1538
+ const folders = [...((_a = data == null ? void 0 : data.pages[0]) == null ? void 0 : _a.folders) ?? []];
1539
+ if ((_b = data == null ? void 0 : data.pages[0]) == null ? void 0 : _b.searchConfig) {
1540
+ setSearchConfig(data.pages[0].searchConfig);
1541
+ }
1542
+ if (!searchParams.search) {
1543
+ if ((currentFolder == null ? void 0 : currentFolder.id) === "default") {
1544
+ setTreeData({
1545
+ id: FOLDER.DEFAULT,
1546
+ section: true,
1547
+ children: folders.map((folder) => new TreeNodeFolderWrapper(folder)),
1548
+ name: t2("explorer.filters.mine", {
1549
+ ns: appCode
1550
+ })
1551
+ });
1552
+ } else {
1553
+ setTreeData(wrapTreeNode(treeData, folders, searchParams.filters.folder || FOLDER.DEFAULT));
1554
+ }
1555
+ }
1556
+ setSearchParams({
1557
+ ...searchParams,
1558
+ pagination: (_c = data == null ? void 0 : data.pages[(data == null ? void 0 : data.pages.length) - 1]) == null ? void 0 : _c.pagination
1559
+ });
1560
+ }
1561
+ }, [data]);
1562
+ useEffect(() => {
1563
+ if (error && typeof error === "string") {
1564
+ toast.error(t2(error));
1565
+ }
1566
+ }, [error]);
1567
+ if (isLoading)
1568
+ return /* @__PURE__ */ jsx(LoadingScreen, {});
1569
+ if (isError) {
1570
+ return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingScreen, {}), children: /* @__PURE__ */ jsx(EmptyScreenError, {}) });
1571
+ }
1572
+ if (searchParams.search && hasNoData) {
1573
+ return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingScreen, {}), children: /* @__PURE__ */ jsx(EmptyScreenSearch, {}) });
1574
+ }
1575
+ if (isRoot && hasNoData) {
1576
+ return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingScreen, {}), children: /* @__PURE__ */ jsx(EmptyScreenApp, {}) });
1577
+ }
1578
+ if (hasSelectedNodes && hasNoData && !isTrashFolder) {
1579
+ return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingScreen, {}), children: /* @__PURE__ */ jsx(EmptyScreenNoContentInFolder, {}) });
1580
+ }
1581
+ if (isTrashFolder && (data == null ? void 0 : data.pages[0].resources.length) === 0) {
1582
+ return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingScreen, {}), children: /* @__PURE__ */ jsx(EmptyScreenTrash, {}) });
1583
+ }
1584
+ return /* @__PURE__ */ jsxs(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingScreen, {}), children: [
1585
+ /* @__PURE__ */ jsx(FoldersList, { data, isFetching }),
1586
+ /* @__PURE__ */ jsx(ResourcesList, { data, isFetching, fetchNextPage })
1587
+ ] });
1588
+ };
1589
+ const useSelectedFilters = () => {
1590
+ const {
1591
+ appCode,
1592
+ currentApp
1593
+ } = useOdeClient();
1594
+ const {
1595
+ t: t2
1596
+ } = useTranslation();
1597
+ const [selectedFilters, setSelectedFilters] = useState("");
1598
+ const handleOnSelectFilter = (value) => {
1599
+ if (value === "0") {
1600
+ setSelectedFilters("");
1601
+ return;
1602
+ }
1603
+ setSelectedFilters(value);
1604
+ };
1605
+ const currentFolder = useCurrentFolder();
1606
+ const searchParams = useSearchParams();
1607
+ const {
1608
+ setSearchParams
1609
+ } = useStoreActions();
1610
+ useEffect(() => {
1611
+ const isOwnerSelected = () => {
1612
+ return selectedFilters.includes("1") ? true : void 0;
1613
+ };
1614
+ const isSharedSelected = () => {
1615
+ return selectedFilters.includes("2") ? true : void 0;
1616
+ };
1617
+ const isPublicSelected = () => {
1618
+ return selectedFilters.includes("7") ? true : void 0;
1619
+ };
1620
+ setSearchParams({
1621
+ ...searchParams,
1622
+ filters: {
1623
+ owner: isOwnerSelected(),
1624
+ public: isPublicSelected(),
1625
+ shared: isSharedSelected(),
1626
+ folder: currentFolder ? currentFolder.id : "default"
1627
+ }
1628
+ });
1629
+ }, [currentFolder, setSearchParams, selectedFilters]);
1630
+ const options = [{
1631
+ label: t2("explorer.filter.all", {
1632
+ ns: appCode
1633
+ }),
1634
+ value: "0"
1635
+ }, {
1636
+ label: t2("explorer.filter.owner", {
1637
+ ns: appCode
1638
+ }),
1639
+ value: "1"
1640
+ }, {
1641
+ label: t2("explorer.filter.shared", {
1642
+ ns: appCode
1643
+ }),
1644
+ value: "2"
1645
+ }, ...(currentApp == null ? void 0 : currentApp.displayName) == APP.EXERCIZER ? [{
1646
+ label: "Exercices interactifs",
1647
+ value: "3"
1648
+ }] : [], ...(currentApp == null ? void 0 : currentApp.displayName) == APP.EXERCIZER ? [{
1649
+ label: "Exercices à rendre",
1650
+ value: "4"
1651
+ }] : [], ...(currentApp == null ? void 0 : currentApp.displayName) == "pages" ? [{
1652
+ label: "Projets publics",
1653
+ value: "5"
1654
+ }] : [], ...(currentApp == null ? void 0 : currentApp.displayName) == "pages" ? [{
1655
+ label: "Projets internes",
1656
+ value: "6"
1657
+ }] : [], ...(currentApp == null ? void 0 : currentApp.displayName) == APP.BLOG ? [{
1658
+ label: t2("explorer.filter.public", {
1659
+ ns: appCode
1660
+ }),
1661
+ value: "7"
1662
+ }] : []];
1663
+ return {
1664
+ selectedFilters,
1665
+ options,
1666
+ handleOnSelectFilter
1667
+ };
1668
+ };
1669
+ const SearchForm = () => {
1670
+ const {
1671
+ appCode
1672
+ } = useOdeClient();
1673
+ const {
1674
+ t: t2
1675
+ } = useTranslation();
1676
+ const {
1677
+ selectedFilters,
1678
+ options,
1679
+ handleOnSelectFilter
1680
+ } = useSelectedFilters();
1681
+ const {
1682
+ formRef,
1683
+ inputSearch,
1684
+ handleInputSearchChange,
1685
+ handleKeyPress,
1686
+ handleSearchSubmit
1687
+ } = useSearchForm();
1688
+ const count = selectedFilters.length > 0 ? selectedFilters.length : void 0;
1689
+ return /* @__PURE__ */ jsxs("form", { noValidate: true, className: "bg-light p-16 ps-24 ms-n16 ms-lg-n24 me-n16 position-relative z-3 d-flex gap-8", ref: formRef, children: [
1690
+ /* @__PURE__ */ jsxs(FormControl, { id: "search", className: "input-group", children: [
1691
+ /* @__PURE__ */ jsx(Input, { type: "search", placeholder: t2("explorer.label.search", {
1692
+ ns: appCode
1693
+ }), size: "lg", noValidationIcon: true, value: inputSearch, onChange: handleInputSearchChange, onKeyDown: handleKeyPress }),
1694
+ /* @__PURE__ */ jsx(SearchButton, { type: "submit", "aria-label": t2("explorer.label.search", {
1695
+ ns: appCode
1696
+ }), onClick: handleSearchSubmit })
1697
+ ] }),
1698
+ /* @__PURE__ */ jsxs(Dropdown, { placement: "bottom-end", children: [
1699
+ /* @__PURE__ */ jsx(Dropdown.Trigger, { label: t2("explorer.filters"), icon: /* @__PURE__ */ jsx(Filter, { width: 20 }), variant: "ghost", badgeContent: count }),
1700
+ /* @__PURE__ */ jsx(Dropdown.Menu, { children: options.map((option) => {
1701
+ if (option.value === "0") {
1702
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1703
+ /* @__PURE__ */ jsx(Dropdown.RadioItem, { value: option.value, model: selectedFilters, onChange: () => handleOnSelectFilter(option.value), children: option.label }),
1704
+ /* @__PURE__ */ jsx(Dropdown.Separator, {})
1705
+ ] }, "0");
1706
+ }
1707
+ return /* @__PURE__ */ jsx(Dropdown.RadioItem, { value: option.value, model: selectedFilters, onChange: () => handleOnSelectFilter(option.value), children: option.label }, option.value);
1708
+ }) })
1709
+ ] })
1710
+ ] });
1711
+ };
1712
+ const TrashButton = ({
1713
+ id,
1714
+ selected,
1715
+ onSelect
1716
+ }) => {
1717
+ const {
1718
+ t: t2
1719
+ } = useTranslation();
1720
+ return /* @__PURE__ */ jsx("div", { className: "treeview", children: /* @__PURE__ */ jsx("ul", { role: "tree", className: "m-0 p-0", children: /* @__PURE__ */ jsx("li", { id, role: "treeitem", "aria-selected": selected, children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("div", { className: "action-container", children: /* @__PURE__ */ jsx("div", { onClick: onSelect, role: "button", tabIndex: 0, children: /* @__PURE__ */ jsxs("div", { className: "d-flex align-items-center gap-8 py-8 ps-24", children: [
1721
+ /* @__PURE__ */ jsx(Delete, { width: "20", height: "20" }),
1722
+ /* @__PURE__ */ jsx("span", { children: t2("explorer.tree.trash") })
1723
+ ] }) }) }) }) }) }) });
1724
+ };
1725
+ const CreateFolderModal = /* @__PURE__ */ lazy(async () => await import("./FolderModal.js"));
1726
+ const TreeViewContainer = () => {
1727
+ const queryclient = useQueryClient();
1728
+ const [isModalOpen, toggle] = useToggle();
1729
+ const treeData = useTreeData();
1730
+ const isTrashFolder = useIsTrash();
1731
+ const selectedNodesIds = useSelectedNodesIds();
1732
+ const {
1733
+ appCode
1734
+ } = useOdeClient();
1735
+ const {
1736
+ t: t2
1737
+ } = useTranslation(["common", appCode]);
1738
+ const {
1739
+ goToTrash,
1740
+ selectTreeItem,
1741
+ unfoldTreeItem,
1742
+ foldTreeItem,
1743
+ clearSelectedItems,
1744
+ clearSelectedIds
1745
+ } = useStoreActions();
1746
+ const handleTreeItemUnfold = async (folderId) => {
1747
+ await unfoldTreeItem(folderId, queryclient);
1748
+ };
1749
+ const handleOnFolderCreate = () => {
1750
+ clearSelectedItems();
1751
+ clearSelectedIds();
1752
+ toggle();
1753
+ };
1754
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
1755
+ /* @__PURE__ */ jsx(TreeView, { data: treeData, selectedNodesIds, onTreeItemSelect: selectTreeItem, onTreeItemFold: foldTreeItem, onTreeItemUnfold: handleTreeItemUnfold }),
1756
+ /* @__PURE__ */ jsx(TrashButton, { id: FOLDER.BIN, selected: isTrashFolder, onSelect: goToTrash }),
1757
+ /* @__PURE__ */ jsx("div", { className: "d-grid my-16", children: /* @__PURE__ */ jsx(Button, { disabled: isTrashFolder, type: "button", color: "primary", variant: "outline", leftIcon: /* @__PURE__ */ jsx(Plus, {}), onClick: handleOnFolderCreate, children: t2("explorer.folder.new") }) }),
1758
+ /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingScreen, {}), children: isModalOpen && /* @__PURE__ */ jsx(CreateFolderModal, { edit: false, isOpen: isModalOpen, onSuccess: toggle, onCancel: toggle }) })
1759
+ ] });
1760
+ };
1761
+ const style = "";
1762
+ const OnboardingModal = /* @__PURE__ */ lazy(async () => {
1763
+ const module = await import("@edifice-ui/react");
1764
+ return {
1765
+ default: module.OnboardingModal
1766
+ };
1767
+ });
1768
+ const AppAction = /* @__PURE__ */ lazy(async () => await import("./AppAction.js"));
1769
+ const Library = /* @__PURE__ */ lazy(async () => await import("./Library.js"));
1770
+ const ActionBar = /* @__PURE__ */ lazy(async () => await import("./ActionBarContainer.js"));
1771
+ const ActionResourceDisableModal = /* @__PURE__ */ lazy(async () => await import("./DisableModal.js"));
1772
+ const TrashedResourceModal = /* @__PURE__ */ lazy(async () => await import("./TrashModal.js"));
1773
+ const Explorer = ({
1774
+ config
1775
+ }) => {
1776
+ const searchParams = useSearchParams();
1777
+ const {
1778
+ setConfig,
1779
+ setSearchParams
1780
+ } = useStoreActions();
1781
+ useEffect(() => {
1782
+ setConfig(config || {});
1783
+ setSearchParams({
1784
+ ...searchParams,
1785
+ app: config.app,
1786
+ types: config.types
1787
+ });
1788
+ }, [config]);
1789
+ const {
1790
+ currentApp
1791
+ } = useOdeClient();
1792
+ const {
1793
+ data: actions
1794
+ } = useActions();
1795
+ const {
1796
+ isTrashedModalOpen,
1797
+ onTrashedCancel
1798
+ } = useTrashModal();
1799
+ const {
1800
+ isActionDisableModalOpen,
1801
+ onActionDisableCancel
1802
+ } = useDisableModal();
1803
+ useXitiTrackPageLoad();
1804
+ const canPublish = isActionAvailable("publish", actions);
1805
+ const canCreate = isActionAvailable("create", actions);
1806
+ return config && /* @__PURE__ */ jsxs(Fragment$1, { children: [
1807
+ /* @__PURE__ */ jsx(AppHeader, { render: () => canCreate ? /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingScreen, {}), children: /* @__PURE__ */ jsx(AppAction, {}) }) : null, children: /* @__PURE__ */ jsx(Breadcrumb, { app: currentApp }) }),
1808
+ /* @__PURE__ */ jsxs(Grid, { className: "flex-grow-1", children: [
1809
+ /* @__PURE__ */ jsx(Grid.Col, { sm: "3", lg: "2", xl: "3", className: "border-end pt-16 pe-16 d-none d-lg-block", as: "aside", children: /* @__PURE__ */ jsxs(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingScreen, {}), children: [
1810
+ /* @__PURE__ */ jsx(TreeViewContainer, {}),
1811
+ canPublish && /* @__PURE__ */ jsx(Library, {})
1812
+ ] }) }),
1813
+ /* @__PURE__ */ jsxs(Grid.Col, { sm: "4", md: "8", lg: "6", xl: "9", children: [
1814
+ /* @__PURE__ */ jsx(SearchForm, {}),
1815
+ /* @__PURE__ */ jsx(ExplorerBreadcrumb, {}),
1816
+ /* @__PURE__ */ jsx(List, {})
1817
+ ] }),
1818
+ /* @__PURE__ */ jsxs(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingScreen, {}), children: [
1819
+ /* @__PURE__ */ jsx(ActionBar, {}),
1820
+ /* @__PURE__ */ jsx(OnboardingModal, { id: "showOnboardingTrash", items: [{
1821
+ src: "onboarding/illu-trash-menu.svg",
1822
+ alt: "explorer.modal.onboarding.trash.screen1.alt",
1823
+ text: "explorer.modal.onboarding.trash.screen1.title"
1824
+ }, {
1825
+ src: "onboarding/illu-trash-notif.svg",
1826
+ alt: "explorer.modal.onboarding.trash.screen2.alt",
1827
+ text: "explorer.modal.onboarding.trash.screen2.alt"
1828
+ }, {
1829
+ src: "onboarding/illu-trash-delete.svg",
1830
+ alt: "explorer.modal.onboarding.trash.screen3.alt",
1831
+ text: "explorer.modal.onboarding.trash.screen3.title"
1832
+ }], modalOptions: {
1833
+ title: "explorer.modal.onboarding.trash.title",
1834
+ prevText: "explorer.modal.onboarding.trash.prev",
1835
+ nextText: "explorer.modal.onboarding.trash.next",
1836
+ closeText: "explorer.modal.onboarding.trash.close"
1837
+ } }),
1838
+ isTrashedModalOpen && /* @__PURE__ */ jsx(TrashedResourceModal, { isOpen: isTrashedModalOpen, onCancel: onTrashedCancel }),
1839
+ isActionDisableModalOpen && /* @__PURE__ */ jsx(ActionResourceDisableModal, { isOpen: isActionDisableModalOpen, onCancel: onActionDisableCancel })
1840
+ ] })
1841
+ ] })
1842
+ ] });
1843
+ };
1844
+ export {
1845
+ Explorer as E,
1846
+ useActions as a,
1847
+ useCurrentFolder as b,
1848
+ useCreateResource as c,
1849
+ useIsTrash as d,
1850
+ useStoreContext as e,
1851
+ useResourceIds as f,
1852
+ useSelectedResources as g,
1853
+ useSelectedFolders as h,
1854
+ useFolderIds as i,
1855
+ useRestore as j,
1856
+ useResourceIsTrash as k,
1857
+ useShareResource as l,
1858
+ useUpdateResource as m,
1859
+ useSearchParams as n,
1860
+ useCreateFolder as o,
1861
+ useUpdatefolder as p,
1862
+ useDelete as q,
1863
+ useTrash as r,
1864
+ useMoveItem as s,
1865
+ useTreeData as t,
1866
+ useStoreActions as u
1867
+ };