@edifice.io/react 2.6.7-develop-pedago.20260930173910 → 2.6.7-develop-integration.20261001112826

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 (44) hide show
  1. package/dist/components/Tree/utilities/tree.js +21 -1
  2. package/dist/homepage.js +1 -2
  3. package/dist/hooks/index.d.ts +2 -0
  4. package/dist/hooks/useGoogleDriveSearch/index.d.ts +1 -0
  5. package/dist/hooks/useGoogleDriveSearch/useGoogleDriveSearch.d.ts +14 -0
  6. package/dist/hooks/useGoogleDriveSearch/useGoogleDriveSearch.js +60 -0
  7. package/dist/hooks/useNextcloudSearch/index.d.ts +1 -0
  8. package/dist/hooks/useNextcloudSearch/useNextcloudSearch.d.ts +14 -0
  9. package/dist/hooks/useNextcloudSearch/useNextcloudSearch.js +64 -0
  10. package/dist/index.js +186 -174
  11. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.Typography.js +3 -3
  12. package/dist/modules/homepage/components/Communities/Communities.d.ts +1 -2
  13. package/dist/modules/homepage/components/Communities/Communities.js +13 -14
  14. package/dist/modules/homepage/components/Communities/CommunitiesContainer.d.ts +1 -1
  15. package/dist/modules/homepage/components/Communities/CommunitiesContainer.js +5 -9
  16. package/dist/modules/homepage/components/Communities/CommunitiesSkeleton.js +7 -4
  17. package/dist/modules/homepage/components/Communities/useCommunities.d.ts +1 -4
  18. package/dist/modules/homepage/components/Communities/useCommunities.js +3 -8
  19. package/dist/modules/homepage/components/HomeCard/HomeCardHeader.js +2 -2
  20. package/dist/modules/multimedia/FileCard/GoogleDriveFileCard.d.ts +25 -0
  21. package/dist/modules/multimedia/FileCard/GoogleDriveFileCard.js +102 -0
  22. package/dist/modules/multimedia/FileCard/NextcloudFileCard.d.ts +25 -0
  23. package/dist/modules/multimedia/FileCard/NextcloudFileCard.js +102 -0
  24. package/dist/modules/multimedia/FileCard/index.d.ts +4 -0
  25. package/dist/modules/multimedia/GoogleDrive/GoogleDrive.d.ts +24 -0
  26. package/dist/modules/multimedia/GoogleDrive/GoogleDrive.js +100 -0
  27. package/dist/modules/multimedia/GoogleDrive/index.d.ts +2 -0
  28. package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.d.ts +7 -1
  29. package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +2 -0
  30. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +2 -2
  31. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +48 -12
  32. package/dist/modules/multimedia/MediaLibrary/innertabs/GoogleDrive.d.ts +1 -0
  33. package/dist/modules/multimedia/MediaLibrary/innertabs/GoogleDrive.js +61 -0
  34. package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.d.ts +1 -0
  35. package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.js +48 -0
  36. package/dist/modules/multimedia/MediaLibrary/innertabs/index.d.ts +2 -0
  37. package/dist/modules/multimedia/MediaLibrary/innertabs/index.js +4 -0
  38. package/dist/modules/multimedia/Nextcloud/Nextcloud.d.ts +24 -0
  39. package/dist/modules/multimedia/Nextcloud/Nextcloud.js +124 -0
  40. package/dist/modules/multimedia/Nextcloud/index.d.ts +2 -0
  41. package/dist/modules/multimedia/Workspace/Workspace.js +8 -5
  42. package/dist/modules/multimedia/index.d.ts +2 -0
  43. package/dist/multimedia.js +26 -18
  44. package/package.json +6 -6
@@ -16,6 +16,25 @@ function findNodeById(data, id) {
16
16
  }
17
17
  }
18
18
  }
19
+ function modifyNode(data, callback) {
20
+ return doModify(data, callback) || data;
21
+ }
22
+ function doModify(current, callback, parent) {
23
+ var _a;
24
+ const result = callback(current, parent);
25
+ if ((_a = result == null ? void 0 : result.children) != null && _a.length) {
26
+ const children = [];
27
+ for (const child of (result == null ? void 0 : result.children) || []) {
28
+ const res = doModify(child, callback, result);
29
+ res && children.push(res);
30
+ }
31
+ return {
32
+ ...result,
33
+ children
34
+ };
35
+ }
36
+ return result;
37
+ }
19
38
  function findPathById(tree, nodeId) {
20
39
  let path = [];
21
40
  function traverse(node, currentPath) {
@@ -40,5 +59,6 @@ function findPathById(tree, nodeId) {
40
59
  }
41
60
  export {
42
61
  findNodeById,
43
- findPathById
62
+ findPathById,
63
+ modifyNode
44
64
  };
package/dist/homepage.js CHANGED
@@ -11,7 +11,6 @@ import { default as default11 } from "./modules/homepage/components/Notification
11
11
  import { NotificationListContainer } from "./modules/homepage/components/Notifications/NotificationListContainer.js";
12
12
  import { default as default12 } from "./modules/homepage/components/SchoolSpace/SchoolSpace.js";
13
13
  import { default as default13 } from "./modules/homepage/components/UserSpace/UserSpace.js";
14
- import { COMMUNITIES_PREVIEW_SIZE, useCommunities } from "./modules/homepage/components/Communities/useCommunities.js";
15
14
  import { CommunitiesContainer } from "./modules/homepage/components/Communities/CommunitiesContainer.js";
16
15
  import { Favorites } from "./modules/homepage/components/Favorites/Favorites.js";
17
16
  import { FavoritesContainer } from "./modules/homepage/components/Favorites/FavoritesContainer.js";
@@ -20,8 +19,8 @@ import { LastInfosList } from "./modules/homepage/components/LastInfos/LastInfos
20
19
  import { MessageFlashListContainer } from "./modules/homepage/components/MessageFlashList/MessageFlashListContainer.js";
21
20
  import { SchoolSpaceContainer } from "./modules/homepage/components/SchoolSpace/SchoolSpaceContainer.js";
22
21
  import { UserSpaceContainer } from "./modules/homepage/components/UserSpace/UserSpaceContainer.js";
22
+ import { useCommunities } from "./modules/homepage/components/Communities/useCommunities.js";
23
23
  export {
24
- COMMUNITIES_PREVIEW_SIZE,
25
24
  default2 as Communities,
26
25
  CommunitiesContainer,
27
26
  default3 as CommunitiesItem,
@@ -11,6 +11,7 @@ export * from './useDirectory';
11
11
  export * from './useDropdown';
12
12
  export * from './useDropzone';
13
13
  export * from './useEdificeIcons';
14
+ export * from './useGoogleDriveSearch';
14
15
  export * from './useHasWorkflow';
15
16
  export * from './useHover';
16
17
  export * from './useHttpErrorToast';
@@ -22,6 +23,7 @@ export * from './useIsAdmlcOrAdmc';
22
23
  export * from './useKeyPress';
23
24
  export * from './useLibraryUrl';
24
25
  export * from './useMediaLibrary';
26
+ export * from './useNextcloudSearch';
25
27
  export * from './usePublicConf';
26
28
  export * from './useScreeb';
27
29
  export * from './useScrollToTop';
@@ -0,0 +1 @@
1
+ export { default as useGoogleDriveSearch } from './useGoogleDriveSearch';
@@ -0,0 +1,14 @@
1
+ import { GoogleDriveDocument, ID } from '@edifice.io/client';
2
+ import { TreeItem } from '../../components/Tree/types';
3
+ export type GoogleDriveFolderNode = TreeItem & {
4
+ files?: GoogleDriveDocument[];
5
+ };
6
+ export default function useGoogleDriveSearch(rootId: string, rootName: string, userId?: string): {
7
+ root: GoogleDriveFolderNode;
8
+ needsAuth: boolean;
9
+ isCheckingAuth: boolean;
10
+ isAuthError: boolean;
11
+ refetchAuthStatus: () => void;
12
+ loadContent: (folderId?: ID) => void;
13
+ loadError: unknown;
14
+ };
@@ -0,0 +1,60 @@
1
+ import { useState, useCallback } from "react";
2
+ import { odeServices } from "@edifice.io/client";
3
+ import { useQueryClient } from "@tanstack/react-query";
4
+ import { findNodeById, modifyNode } from "../../components/Tree/utilities/tree.js";
5
+ function useGoogleDriveSearch(rootId, rootName, userId) {
6
+ const [root, setRoot] = useState({
7
+ id: rootId,
8
+ name: rootName,
9
+ section: !0
10
+ }), updateFolder = useCallback((folderId, subfolders, files) => {
11
+ setRoot((prev) => {
12
+ const node = findNodeById(prev, folderId);
13
+ if (!node) return prev;
14
+ const children = subfolders.map((f) => {
15
+ var _a;
16
+ const existing = (_a = node.children) == null ? void 0 : _a.find((c) => c.id === f.id);
17
+ return existing ? {
18
+ ...existing,
19
+ name: f.name
20
+ } : {
21
+ id: f.id,
22
+ name: f.name
23
+ };
24
+ });
25
+ return modifyNode(prev, (n) => n.id === node.id ? {
26
+ ...n,
27
+ children,
28
+ files
29
+ } : n);
30
+ });
31
+ }, []), queryClient = useQueryClient(), [loadError, setLoadError] = useState(null), loadContent = useCallback(async (folderId) => {
32
+ if (!userId) return;
33
+ const parentId = folderId === rootId ? void 0 : folderId;
34
+ try {
35
+ const payload = await queryClient.fetchQuery({
36
+ queryKey: ["googledrive", "documents", userId, parentId ?? "root"],
37
+ queryFn: () => odeServices.googledrive().listDocuments(userId, parentId),
38
+ staleTime: 6e4
39
+ }), subfolders = [], files = [];
40
+ payload.filter((doc) => doc.id !== parentId).forEach((doc) => {
41
+ doc.isFolder ? subfolders.push(doc) : files.push(doc);
42
+ }), setLoadError(null), updateFolder(folderId, subfolders, files);
43
+ } catch (error) {
44
+ setLoadError(error);
45
+ }
46
+ }, [rootId, userId, queryClient, updateFolder]);
47
+ return {
48
+ root,
49
+ needsAuth: !1,
50
+ isCheckingAuth: !1,
51
+ isAuthError: !1,
52
+ refetchAuthStatus: () => {
53
+ },
54
+ loadContent,
55
+ loadError
56
+ };
57
+ }
58
+ export {
59
+ useGoogleDriveSearch as default
60
+ };
@@ -0,0 +1 @@
1
+ export { default as useNextcloudSearch } from './useNextcloudSearch';
@@ -0,0 +1,14 @@
1
+ import { ID, NextcloudDocument } from '@edifice.io/client';
2
+ import { TreeItem } from '../../components/Tree/types';
3
+ export type NextcloudFolderNode = TreeItem & {
4
+ files?: NextcloudDocument[];
5
+ };
6
+ export default function useNextcloudSearch(rootId: string, rootName: string, userId?: string): {
7
+ root: NextcloudFolderNode;
8
+ needsAuth: boolean;
9
+ isCheckingAuth: boolean;
10
+ isAuthError: boolean;
11
+ refetchAuthStatus: () => void;
12
+ loadContent: (folderId?: ID) => void;
13
+ loadError: unknown;
14
+ };
@@ -0,0 +1,64 @@
1
+ import { useState, useCallback } from "react";
2
+ import { odeServices } from "@edifice.io/client";
3
+ import { useQueryClient, useQuery } from "@tanstack/react-query";
4
+ import { findNodeById, modifyNode } from "../../components/Tree/utilities/tree.js";
5
+ function useNextcloudSearch(rootId, rootName, userId) {
6
+ var _a;
7
+ const [root, setRoot] = useState({
8
+ id: rootId,
9
+ name: rootName,
10
+ section: !0
11
+ }), updateFolder = useCallback((folderId, subfolders, files) => {
12
+ setRoot((prev) => {
13
+ const node = findNodeById(prev, folderId);
14
+ if (!node) return prev;
15
+ const children = subfolders.map((f) => {
16
+ var _a2;
17
+ const existing = (_a2 = node.children) == null ? void 0 : _a2.find((c) => c.id === f.path);
18
+ return existing ? {
19
+ ...existing,
20
+ name: f.name
21
+ } : {
22
+ id: f.path,
23
+ name: f.name
24
+ };
25
+ });
26
+ return modifyNode(prev, (n) => n.id === node.id ? {
27
+ ...n,
28
+ children,
29
+ files
30
+ } : n);
31
+ });
32
+ }, []), queryClient = useQueryClient(), oauth2StatusQuery = useQuery({
33
+ queryKey: ["nextcloud", "oauth2-status", userId],
34
+ queryFn: () => odeServices.nextcloud().getOauth2Status(userId),
35
+ enabled: !!userId
36
+ }), needsAuth = !((_a = oauth2StatusQuery.data) != null && _a.connected), [loadError, setLoadError] = useState(null), loadContent = useCallback(async (folderId) => {
37
+ if (!userId) return;
38
+ const path = folderId === rootId ? void 0 : folderId;
39
+ try {
40
+ const payload = await queryClient.fetchQuery({
41
+ queryKey: ["nextcloud", "documents", userId, path ?? "/"],
42
+ queryFn: () => odeServices.nextcloud().listDocuments(userId, path),
43
+ staleTime: 6e4
44
+ }), subfolders = [], files = [], currentPath = path ?? "/";
45
+ payload.filter((doc) => doc.path !== currentPath).forEach((doc) => {
46
+ doc.isFolder ? subfolders.push(doc) : files.push(doc);
47
+ }), setLoadError(null), updateFolder(folderId, subfolders, files);
48
+ } catch (error) {
49
+ setLoadError(error);
50
+ }
51
+ }, [rootId, userId, queryClient, updateFolder]);
52
+ return {
53
+ root,
54
+ needsAuth,
55
+ isCheckingAuth: oauth2StatusQuery.isLoading,
56
+ isAuthError: oauth2StatusQuery.isError,
57
+ refetchAuthStatus: oauth2StatusQuery.refetch,
58
+ loadContent,
59
+ loadError
60
+ };
61
+ }
62
+ export {
63
+ useNextcloudSearch as default
64
+ };