@edifice.io/react 2.6.12-develop-integration-crna.20261101211105 → 2.6.12-develop-integration.20261103121816

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 (68) hide show
  1. package/dist/components/Dropdown/Dropdown.js +14 -20
  2. package/dist/components/Dropdown/DropdownContext.d.ts +0 -5
  3. package/dist/components/Dropdown/DropdownMenuGroup.js +6 -23
  4. package/dist/components/Dropdown/DropdownSearchInput.js +8 -16
  5. package/dist/components/Dropdown/DropdownTrigger.js +8 -24
  6. package/dist/components/Dropdown/useDropdownItemFilter.js +2 -2
  7. package/dist/components/Select/Select.d.ts +1 -14
  8. package/dist/components/Select/Select.js +5 -11
  9. package/dist/homepage.js +28 -24
  10. package/dist/hooks/index.d.ts +1 -0
  11. package/dist/hooks/useDropdown/useDropdown.d.ts +0 -5
  12. package/dist/hooks/useDropdown/useDropdown.js +6 -16
  13. package/dist/hooks/useGoogleDriveSearch/index.d.ts +1 -0
  14. package/dist/hooks/useGoogleDriveSearch/useGoogleDriveSearch.d.ts +19 -0
  15. package/dist/hooks/useGoogleDriveSearch/useGoogleDriveSearch.js +60 -0
  16. package/dist/hooks/useNextcloudSearch/useNextcloudSearch.d.ts +1 -1
  17. package/dist/hooks/useNextcloudSearch/useNextcloudSearch.js +2 -2
  18. package/dist/icons-apps.js +184 -182
  19. package/dist/index.js +198 -194
  20. package/dist/modules/editor/components/Editor/Editor.d.ts +7 -0
  21. package/dist/modules/editor/components/Editor/Editor.js +3 -2
  22. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.d.ts +3 -1
  23. package/dist/modules/editor/components/EditorToolbar/EditorToolbar.js +14 -8
  24. package/dist/modules/editor/components/NodeView/ImageNodeView.d.ts +1 -1
  25. package/dist/modules/editor/components/NodeView/ImageNodeView.js +14 -7
  26. package/dist/modules/editor/hooks/useActionOptions.d.ts +1 -1
  27. package/dist/modules/editor/hooks/useActionOptions.js +12 -12
  28. package/dist/modules/editor/hooks/useTipTapEditor.d.ts +2 -1
  29. package/dist/modules/editor/hooks/useTipTapEditor.js +2 -2
  30. package/dist/modules/homepage/components/AlloLycee/AlloLycee.d.ts +11 -0
  31. package/dist/modules/homepage/components/AlloLycee/AlloLycee.js +32 -0
  32. package/dist/modules/homepage/components/AlloLycee/AlloLyceeContainer.d.ts +4 -0
  33. package/dist/modules/homepage/components/AlloLycee/AlloLyceeContainer.js +10 -0
  34. package/dist/modules/homepage/components/AlloLycee/index.d.ts +3 -0
  35. package/dist/modules/homepage/components/Favorites/Favorites.js +4 -1
  36. package/dist/modules/homepage/components/Notifications/components/CommonNotificationItem.js +9 -9
  37. package/dist/modules/homepage/components/Notifications/components/notificationAdapter.d.ts +2 -1
  38. package/dist/modules/homepage/components/Notifications/components/notificationAdapter.js +2 -2
  39. package/dist/modules/homepage/components/index.d.ts +1 -0
  40. package/dist/modules/icons/components/apps/IconElea.d.ts +7 -0
  41. package/dist/modules/icons/components/apps/IconElea.js +23 -0
  42. package/dist/modules/icons/components/apps/index.d.ts +1 -0
  43. package/dist/modules/multimedia/FileCard/GoogleDriveFileCard.d.ts +25 -0
  44. package/dist/modules/multimedia/FileCard/GoogleDriveFileCard.js +102 -0
  45. package/dist/modules/multimedia/FileCard/index.d.ts +2 -0
  46. package/dist/modules/multimedia/GoogleDrive/GoogleDrive.d.ts +24 -0
  47. package/dist/modules/multimedia/GoogleDrive/GoogleDrive.js +103 -0
  48. package/dist/modules/multimedia/GoogleDrive/index.d.ts +2 -0
  49. package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.d.ts +7 -1
  50. package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +2 -0
  51. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +16 -5
  52. package/dist/modules/multimedia/MediaLibrary/innertabs/GoogleDrive.d.ts +1 -0
  53. package/dist/modules/multimedia/MediaLibrary/innertabs/GoogleDrive.js +61 -0
  54. package/dist/modules/multimedia/MediaLibrary/innertabs/index.d.ts +1 -0
  55. package/dist/modules/multimedia/MediaLibrary/innertabs/index.js +2 -0
  56. package/dist/modules/multimedia/Nextcloud/Nextcloud.js +19 -7
  57. package/dist/modules/multimedia/index.d.ts +1 -1
  58. package/dist/multimedia.js +26 -24
  59. package/package.json +6 -6
  60. package/dist/components/Dropdown/useMatchRegistry.d.ts +0 -13
  61. package/dist/components/Dropdown/useMatchRegistry.js +0 -20
  62. package/dist/modules/multimedia/Nextcloud/NextcloudLogin.d.ts +0 -12
  63. package/dist/modules/multimedia/Nextcloud/NextcloudLogin.js +0 -33
  64. package/dist/modules/multimedia/NextcloudFolders/NextcloudFolders.d.ts +0 -12
  65. package/dist/modules/multimedia/NextcloudFolders/NextcloudFolders.js +0 -51
  66. package/dist/modules/multimedia/NextcloudFolders/components/NewFolderForm.d.ts +0 -16
  67. package/dist/modules/multimedia/NextcloudFolders/components/NewFolderForm.js +0 -51
  68. package/dist/modules/multimedia/NextcloudFolders/index.d.ts +0 -1
@@ -33,9 +33,11 @@ const orderedTabs = [
33
33
  // Media browser
34
34
  "nextcloud",
35
35
  // Nextcloud media browser
36
+ "google-drive",
37
+ // Google Drive media browser
36
38
  "video-embedder"
37
39
  // Link to a hosted video
38
- ], mediaLibraryTypes = {
40
+ ], GOOGLE_DRIVE_VIEW_WORKFLOW = "io.edifice.google.drive.controller.GoogleDriveController|view", mediaLibraryTypes = {
39
41
  none: null,
40
42
  audio: {
41
43
  title: "bbm.audio.modal.title",
@@ -74,7 +76,7 @@ const orderedTabs = [
74
76
  onCancel,
75
77
  onTabChange
76
78
  }, ref) => {
77
- var _a, _b;
79
+ var _a, _b, _c;
78
80
  const linkTabProps = useRef(), refModal = useRef(null);
79
81
  useImperativeHandle(ref, () => ({
80
82
  show,
@@ -85,9 +87,9 @@ const orderedTabs = [
85
87
  }));
86
88
  const {
87
89
  t
88
- } = useTranslation(), workspaceCreateWorkflow = useHasWorkflow("org.entcore.workspace.controllers.WorkspaceController|addDocument"), videoCaptureWorkflow = useHasWorkflow("com.opendigitaleducation.video.controllers.VideoController|capture"), nextcloudViewWorkflow = useHasWorkflow("fr.openent.nextcloud.controller.NextcloudController|view"), {
90
+ } = useTranslation(), workspaceCreateWorkflow = useHasWorkflow("org.entcore.workspace.controllers.WorkspaceController|addDocument"), videoCaptureWorkflow = useHasWorkflow("com.opendigitaleducation.video.controllers.VideoController|capture"), nextcloudViewWorkflow = useHasWorkflow("fr.openent.nextcloud.controller.NextcloudController|view"), googleDriveViewWorkflow = useHasWorkflow(GOOGLE_DRIVE_VIEW_WORKFLOW), {
89
91
  data: workspacePublicConf
90
- } = usePublicConf("workspace"), enableNextcloudTab = ((_a = workspacePublicConf == null ? void 0 : workspacePublicConf["folder-service"]) == null ? void 0 : _a.includes("nextcloud")) && nextcloudViewWorkflow, [type, setType] = useState(null);
92
+ } = usePublicConf("workspace"), enableNextcloudTab = ((_a = workspacePublicConf == null ? void 0 : workspacePublicConf["folder-service"]) == null ? void 0 : _a.includes("nextcloud")) && nextcloudViewWorkflow, enableGoogleDriveTab = ((_b = workspacePublicConf == null ? void 0 : workspacePublicConf["folder-service"]) == null ? void 0 : _b.includes("google-drive")) && googleDriveViewWorkflow, [type, setType] = useState(null);
91
93
  useHttpErrorToast({
92
94
  active: !!type,
93
95
  isDismissible: !0,
@@ -110,6 +112,15 @@ const orderedTabs = [
110
112
  availableFor: ["audio", "video", "image", "attachment"],
111
113
  isEnable: () => !!enableNextcloudTab
112
114
  },
115
+ "google-drive": {
116
+ id: "google-drive",
117
+ // FIXME No Google Drive icon in the pack yet; reusing the generic one.
118
+ icon: /* @__PURE__ */ jsx(SvgIconGlobe2, {}),
119
+ label: t("bbm.google-drive"),
120
+ content: /* @__PURE__ */ jsx(InnerTabs.GoogleDrive, {}),
121
+ availableFor: ["audio", "video", "image", "attachment"],
122
+ isEnable: () => !!enableGoogleDriveTab
123
+ },
113
124
  upload: {
114
125
  id: "upload",
115
126
  icon: /* @__PURE__ */ jsx(SvgIconSmartphone, {}),
@@ -195,7 +206,7 @@ const orderedTabs = [
195
206
  const typeKey = type || "none";
196
207
  !defaultTabId && typeof ((_a2 = mediaLibraryTypes[typeKey]) == null ? void 0 : _a2.defaultTab) == "string" && setDefaultTabId((_b2 = mediaLibraryTypes[typeKey]) == null ? void 0 : _b2.defaultTab);
197
208
  }, [defaultTabId, type]);
198
- const modalHeader = t(((_b = mediaLibraryTypes[type ?? "none"]) == null ? void 0 : _b.title) ?? "bbm"), resetState = () => {
209
+ const modalHeader = t(((_c = mediaLibraryTypes[type ?? "none"]) == null ? void 0 : _c.title) ?? "bbm"), resetState = () => {
199
210
  linkTabProps.current = void 0, setResult(void 0), setResultCounter(void 0), setDefaultTabId(void 0), setPreSuccess(void 0), setDeletionsOnCancel([]);
200
211
  }, handleTabChange = (tab) => {
201
212
  onTabChange == null || onTabChange(tab, deletionsOnCancel), resetState();
@@ -0,0 +1 @@
1
+ export declare const GoogleDrive: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,61 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { odeServices, GoogleDriveCopyError } from "@edifice.io/client";
3
+ import { useTranslation } from "react-i18next";
4
+ import { useMediaLibraryContext } from "../MediaLibraryContext.js";
5
+ import useUser from "../../../../hooks/useUser/useUser.js";
6
+ import useToast from "../../../../hooks/useToast/useToast.js";
7
+ import GoogleDrive$1 from "../../GoogleDrive/GoogleDrive.js";
8
+ const GoogleDrive = () => {
9
+ const {
10
+ appCode,
11
+ visibility,
12
+ type,
13
+ setResultCounter,
14
+ setResult,
15
+ setPreSuccess,
16
+ multiple
17
+ } = useMediaLibraryContext(), {
18
+ user
19
+ } = useUser(), {
20
+ t
21
+ } = useTranslation(), toast = useToast();
22
+ function getDocumentRoleFilter() {
23
+ switch (type) {
24
+ case "image":
25
+ return "img";
26
+ case "audio":
27
+ return "audio";
28
+ case "video":
29
+ return "video";
30
+ default:
31
+ return null;
32
+ }
33
+ }
34
+ async function copyToWorkspace(userId, ids) {
35
+ try {
36
+ return await odeServices.googledrive().copyDocumentToWorkspace(
37
+ userId,
38
+ ids,
39
+ void 0,
40
+ // Copy the documents straight to their final place, the way an upload
41
+ // does, instead of leaving a copy in the user's own documents for the
42
+ // modal to transfer afterwards.
43
+ {
44
+ application: appCode,
45
+ visibility
46
+ }
47
+ );
48
+ } catch (error) {
49
+ if (error instanceof GoogleDriveCopyError && error.copied.length > 0)
50
+ return toast.warning(t("google-drive.transfer.error")), error.copied;
51
+ throw error;
52
+ }
53
+ }
54
+ function handleSelect(result) {
55
+ setResultCounter(result.length), result.length ? (setResult(result), setPreSuccess(() => () => user != null && user.userId ? copyToWorkspace(user.userId, result.map((doc) => doc.id)) : Promise.resolve([]))) : (setResult(), setPreSuccess(void 0));
56
+ }
57
+ return /* @__PURE__ */ jsx(GoogleDrive$1, { roles: getDocumentRoleFilter(), onSelect: handleSelect, multiple, className: "border rounded overflow-y-auto" });
58
+ };
59
+ export {
60
+ GoogleDrive
61
+ };
@@ -5,6 +5,7 @@ export declare const InnerTabs: {
5
5
  ExternalLink: ({ link, multiNodeSelected, }: import('./ExternalLink').ExternalLinkTabProps) => import("react/jsx-runtime").JSX.Element;
6
6
  Workspace: () => import("react/jsx-runtime").JSX.Element;
7
7
  Nextcloud: () => import("react/jsx-runtime").JSX.Element;
8
+ GoogleDrive: () => import("react/jsx-runtime").JSX.Element;
8
9
  InternalLink: ({ target, resourceId, appPrefix, }: import('./InternalLink').InternalLinkTabProps) => import("react/jsx-runtime").JSX.Element;
9
10
  Iframe: () => import("react/jsx-runtime").JSX.Element;
10
11
  VideoEmbedder: () => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { Audio } from "./Audio.js";
2
2
  import { ExternalLink } from "./ExternalLink.js";
3
+ import { GoogleDrive } from "./GoogleDrive.js";
3
4
  import { Iframe } from "./Iframe.js";
4
5
  import { InternalLink } from "./InternalLink.js";
5
6
  import { Nextcloud } from "./Nextcloud.js";
@@ -14,6 +15,7 @@ const InnerTabs = {
14
15
  ExternalLink,
15
16
  Workspace,
16
17
  Nextcloud,
18
+ GoogleDrive,
17
19
  InternalLink,
18
20
  Iframe,
19
21
  VideoEmbedder
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useState, useCallback, useEffect, useMemo } from "react";
2
+ import { useRef, useState, useCallback, useEffect, useMemo } from "react";
3
3
  import { DocumentHelper } from "@edifice.io/client";
4
4
  import clsx from "clsx";
5
5
  import { useTranslation } from "react-i18next";
@@ -7,10 +7,11 @@ import { findNodeById } from "../../../components/Tree/utilities/tree.js";
7
7
  import SvgIconSortAscendingLetters from "../../icons/components/IconSortAscendingLetters.js";
8
8
  import SvgIconSortDescendingLetters from "../../icons/components/IconSortDescendingLetters.js";
9
9
  import SvgIconSortTime from "../../icons/components/IconSortTime.js";
10
- import NextcloudLogin from "./NextcloudLogin.js";
11
10
  import illuError from "@edifice.io/bootstrap/dist/images/emptyscreen/illu-error.svg";
11
+ import illuConnectionLost from "@edifice.io/bootstrap/dist/images/emptyscreen/illu-connection-lost.svg";
12
12
  import illuTrash from "@edifice.io/bootstrap/dist/images/emptyscreen/illu-trash.svg";
13
13
  import useUser from "../../../hooks/useUser/useUser.js";
14
+ import useToast from "../../../hooks/useToast/useToast.js";
14
15
  import useNextcloudSearch from "../../../hooks/useNextcloudSearch/useNextcloudSearch.js";
15
16
  import LoadingScreen from "../../../components/LoadingScreen/LoadingScreen.js";
16
17
  import Flex from "../../../components/Flex/Flex.js";
@@ -35,7 +36,7 @@ const Nextcloud = ({
35
36
  t
36
37
  } = useTranslation(), {
37
38
  user
38
- } = useUser(), {
39
+ } = useUser(), toast = useToast(), {
39
40
  root,
40
41
  needsAuth,
41
42
  isCheckingAuth,
@@ -43,7 +44,7 @@ const Nextcloud = ({
43
44
  refetchAuthStatus,
44
45
  loadContent,
45
46
  loadError
46
- } = useNextcloudSearch(ROOT_ID, t("nextcloud"), user == null ? void 0 : user.userId), [currentNodeId, setCurrentNodeId] = useState(ROOT_ID), currentNode = findNodeById(root, currentNodeId) ?? root, [searchTerm, setSearchTerm] = useState(void 0), [sortOrder, setSortOrder] = useState(["modified", "desc"]), [selectedDocuments, setSelectedDocuments] = useState([]), handleTreeItemChange = useCallback((nodeId) => {
47
+ } = useNextcloudSearch(ROOT_ID, t("nextcloud"), user == null ? void 0 : user.userId), popupRef = useRef(null), [currentNodeId, setCurrentNodeId] = useState(ROOT_ID), currentNode = findNodeById(root, currentNodeId) ?? root, [searchTerm, setSearchTerm] = useState(void 0), [sortOrder, setSortOrder] = useState(["modified", "desc"]), [selectedDocuments, setSelectedDocuments] = useState([]), handleTreeItemChange = useCallback((nodeId) => {
47
48
  setCurrentNodeId(nodeId), loadContent(nodeId);
48
49
  }, [loadContent]);
49
50
  useEffect(() => {
@@ -68,11 +69,22 @@ const Nextcloud = ({
68
69
  let currentDocuments = [...selectedDocuments];
69
70
  multiple ? currentDocuments.some((selectedDocument) => selectedDocument.path === doc.path) ? currentDocuments = currentDocuments.filter((selectedDocument) => selectedDocument.path !== doc.path) : currentDocuments = [...currentDocuments, doc] : currentDocuments = [doc], setSelectedDocuments(currentDocuments), onSelect(currentDocuments);
70
71
  }
71
- const nextcloud = clsx("workspace flex-grow-1 gap-0", className);
72
- return isCheckingAuth ? /* @__PURE__ */ jsx(LoadingScreen, {}) : isAuthError ? /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "12", className: "h-full w-100", justify: "center", align: "center", children: [
72
+ const nextcloud = clsx("workspace flex-grow-1 gap-0", className), openLoginPopup = () => {
73
+ popupRef.current = window.open(`${window.location.origin}/nextcloud/user/oauth2/init`, "", "popup, height=600, width=400"), popupRef.current || toast.error(t("nextcloud.auth.popupBlocked"));
74
+ };
75
+ return useEffect(() => {
76
+ function handleMessage(event) {
77
+ var _a;
78
+ event.origin !== window.location.origin || ((_a = event.data) == null ? void 0 : _a.type) !== "nextcloud-connected" || (popupRef.current && !popupRef.current.closed && popupRef.current.close(), refetchAuthStatus());
79
+ }
80
+ return window.addEventListener("message", handleMessage), () => window.removeEventListener("message", handleMessage);
81
+ }, [refetchAuthStatus]), isCheckingAuth ? /* @__PURE__ */ jsx(LoadingScreen, {}) : isAuthError ? /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "12", className: "h-full w-100", justify: "center", align: "center", children: [
73
82
  /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: illuError, title: t("nextcloud.error.title"), text: t("nextcloud.error.description") }),
74
83
  /* @__PURE__ */ jsx(Button, { onClick: () => refetchAuthStatus(), children: t("retry") })
75
- ] }) : needsAuth ? /* @__PURE__ */ jsx(NextcloudLogin, { onConnected: refetchAuthStatus }) : /* @__PURE__ */ jsxs(Grid, { className: nextcloud, children: [
84
+ ] }) : needsAuth ? /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "12", className: "h-full w-100", justify: "center", align: "center", children: [
85
+ /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: illuConnectionLost, title: t("nextcloud.auth.title"), text: t("nextcloud.auth.description") }),
86
+ /* @__PURE__ */ jsx(Button, { onClick: openLoginPopup, children: t("nextcloud.auth.connect") })
87
+ ] }) : /* @__PURE__ */ jsxs(Grid, { className: nextcloud, children: [
76
88
  /* @__PURE__ */ jsx(Grid.Col, { sm: "12", md: "3", xl: "4", className: "workspace-folders p-12 pt-0 gap-12", children: /* @__PURE__ */ jsx("div", { style: {
77
89
  position: "sticky",
78
90
  top: 0,
@@ -5,8 +5,8 @@ export * from './ImagePicker';
5
5
  export * from './FileCard';
6
6
  export * from './Linker';
7
7
  export * from './MediaLibrary';
8
+ export * from './GoogleDrive';
8
9
  export * from './Nextcloud';
9
- export * from './NextcloudFolders';
10
10
  export * from './UploadCard';
11
11
  export * from './VideoEmbed';
12
12
  export * from './VideoRecorder';
@@ -1,18 +1,19 @@
1
1
  import { default as default2 } from "./modules/multimedia/AudioRecorder/AudioRecorder.js";
2
2
  import { default as default3 } from "./modules/multimedia/Embed/Embed.js";
3
3
  import { default as default4 } from "./modules/multimedia/FileCard/FileCard.js";
4
- import { default as default5 } from "./modules/multimedia/ImageEditor/components/ImageEditor.js";
5
- import { default as default6 } from "./modules/multimedia/ImagePicker/ImagePicker.js";
6
- import { default as default7 } from "./modules/multimedia/MediaLibrary/MediaLibrary.js";
7
- import { default as default8 } from "./modules/multimedia/Nextcloud/Nextcloud.js";
8
- import { default as default9 } from "./modules/multimedia/FileCard/NextcloudFileCard.js";
9
- import { default as default10 } from "./modules/multimedia/NextcloudFolders/NextcloudFolders.js";
10
- import { default as default11 } from "./modules/multimedia/UploadCard/UploadCard.js";
11
- import { default as default12 } from "./modules/multimedia/UploadFiles/UploadFiles.js";
12
- import { default as default13 } from "./modules/multimedia/VideoEmbed/VideoEmbed.js";
13
- import { default as default14 } from "./modules/multimedia/VideoRecorder/VideoRecorder.js";
14
- import { default as default15 } from "./modules/multimedia/Workspace/Workspace.js";
15
- import { default as default16 } from "./modules/multimedia/WorkspaceFolders/WorkspaceFolders.js";
4
+ import { default as default5 } from "./modules/multimedia/GoogleDrive/GoogleDrive.js";
5
+ import { default as default6 } from "./modules/multimedia/FileCard/GoogleDriveFileCard.js";
6
+ import { default as default7 } from "./modules/multimedia/ImageEditor/components/ImageEditor.js";
7
+ import { default as default8 } from "./modules/multimedia/ImagePicker/ImagePicker.js";
8
+ import { default as default9 } from "./modules/multimedia/MediaLibrary/MediaLibrary.js";
9
+ import { default as default10 } from "./modules/multimedia/Nextcloud/Nextcloud.js";
10
+ import { default as default11 } from "./modules/multimedia/FileCard/NextcloudFileCard.js";
11
+ import { default as default12 } from "./modules/multimedia/UploadCard/UploadCard.js";
12
+ import { default as default13 } from "./modules/multimedia/UploadFiles/UploadFiles.js";
13
+ import { default as default14 } from "./modules/multimedia/VideoEmbed/VideoEmbed.js";
14
+ import { default as default15 } from "./modules/multimedia/VideoRecorder/VideoRecorder.js";
15
+ import { default as default16 } from "./modules/multimedia/Workspace/Workspace.js";
16
+ import { default as default17 } from "./modules/multimedia/WorkspaceFolders/WorkspaceFolders.js";
16
17
  import { ExternalLinker } from "./modules/multimedia/Linker/ExternalLinker/ExternalLinker.js";
17
18
  import { InternalLinker } from "./modules/multimedia/Linker/InternalLinker/InternalLinker.js";
18
19
  import { Upload } from "./modules/multimedia/MediaLibrary/innertabs/Upload.js";
@@ -21,18 +22,19 @@ export {
21
22
  default3 as Embed,
22
23
  ExternalLinker,
23
24
  default4 as FileCard,
24
- default5 as ImageEditor,
25
- default6 as ImagePicker,
25
+ default5 as GoogleDrive,
26
+ default6 as GoogleDriveFileCard,
27
+ default7 as ImageEditor,
28
+ default8 as ImagePicker,
26
29
  InternalLinker,
27
- default7 as MediaLibrary,
28
- default8 as Nextcloud,
29
- default9 as NextcloudFileCard,
30
- default10 as NextcloudFolders,
30
+ default9 as MediaLibrary,
31
+ default10 as Nextcloud,
32
+ default11 as NextcloudFileCard,
31
33
  Upload,
32
- default11 as UploadCard,
33
- default12 as UploadFiles,
34
- default13 as VideoEmbed,
35
- default14 as VideoRecorder,
36
- default15 as Workspace,
37
- default16 as WorkspaceFolders
34
+ default12 as UploadCard,
35
+ default13 as UploadFiles,
36
+ default14 as VideoEmbed,
37
+ default15 as VideoRecorder,
38
+ default16 as Workspace,
39
+ default17 as WorkspaceFolders
38
40
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.6.12-develop-integration-crna.20261101211105",
3
+ "version": "2.6.12-develop-integration.20261103121816",
4
4
  "description": "Edifice React Library",
5
5
  "keywords": [
6
6
  "react",
@@ -140,9 +140,9 @@
140
140
  "swiper": "10.1.0",
141
141
  "ua-parser-js": "1.0.36",
142
142
  "zustand": "4.5.7",
143
- "@edifice.io/bootstrap": "2.6.12-develop-integration-crna.20261101211105",
144
- "@edifice.io/tiptap-extensions": "2.6.12-develop-integration-crna.20261101211105",
145
- "@edifice.io/utilities": "2.6.12-develop-integration-crna.20261101211105"
143
+ "@edifice.io/tiptap-extensions": "2.6.12-develop-integration.20261103121816",
144
+ "@edifice.io/utilities": "2.6.12-develop-integration.20261103121816",
145
+ "@edifice.io/bootstrap": "2.6.12-develop-integration.20261103121816"
146
146
  },
147
147
  "devDependencies": {
148
148
  "@babel/plugin-transform-react-pure-annotations": "7.27.1",
@@ -174,8 +174,8 @@
174
174
  "vite": "5.4.14",
175
175
  "vite-plugin-dts": "4.5.4",
176
176
  "vite-tsconfig-paths": "5.1.4",
177
- "@edifice.io/config": "2.6.12-develop-integration-crna.20261101211105",
178
- "@edifice.io/client": "2.6.12-develop-integration-crna.20261101211105"
177
+ "@edifice.io/config": "2.6.12-develop-integration.20261103121816",
178
+ "@edifice.io/client": "2.6.12-develop-integration.20261103121816"
179
179
  },
180
180
  "peerDependencies": {
181
181
  "@react-spring/web": "9.7.5",
@@ -1,13 +0,0 @@
1
- /**
2
- * Tracks which searchable items match the current search query.
3
- * Used by the Dropdown root (empty state) and by menu groups (hide empty groups).
4
- *
5
- * @returns `hasMatches` – true when at least one item matches, or when no item is searchable
6
- * @returns `reportMatch` – registers or updates the match state of an item
7
- * @returns `unregisterMatch` – removes an item from the registry
8
- */
9
- export declare const useMatchRegistry: () => {
10
- hasMatches: boolean;
11
- reportMatch: (id: string, isMatch: boolean) => void;
12
- unregisterMatch: (id: string) => void;
13
- };
@@ -1,20 +0,0 @@
1
- import { useState, useRef, useCallback } from "react";
2
- const useMatchRegistry = () => {
3
- const [hasMatches, setHasMatches] = useState(!0), matchMapRef = useRef(/* @__PURE__ */ new Map()), reportMatch = useCallback((id, isMatch) => {
4
- matchMapRef.current.set(id, isMatch);
5
- const next = [...matchMapRef.current.values()].some(Boolean);
6
- setHasMatches((prev) => prev !== next ? next : prev);
7
- }, []), unregisterMatch = useCallback((id) => {
8
- matchMapRef.current.delete(id);
9
- const next = matchMapRef.current.size === 0 || [...matchMapRef.current.values()].some(Boolean);
10
- setHasMatches((prev) => prev !== next ? next : prev);
11
- }, []);
12
- return {
13
- hasMatches,
14
- reportMatch,
15
- unregisterMatch
16
- };
17
- };
18
- export {
19
- useMatchRegistry
20
- };
@@ -1,12 +0,0 @@
1
- export interface NextcloudLoginProps {
2
- /**
3
- * Called once the user is connected through the OAuth2 popup.
4
- */
5
- onConnected: () => void;
6
- /**
7
- * Replaces the default description, which is about inserting Nextcloud files.
8
- */
9
- description?: string;
10
- }
11
- declare const NextcloudLogin: ({ onConnected, description }: NextcloudLoginProps) => import("react/jsx-runtime").JSX.Element;
12
- export default NextcloudLogin;
@@ -1,33 +0,0 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { useRef, useEffect } from "react";
3
- import { useTranslation } from "react-i18next";
4
- import illuConnectionLost from "@edifice.io/bootstrap/dist/images/emptyscreen/illu-connection-lost.svg";
5
- import useToast from "../../../hooks/useToast/useToast.js";
6
- import Flex from "../../../components/Flex/Flex.js";
7
- import EmptyScreen from "../../../components/EmptyScreen/EmptyScreen.js";
8
- import Button from "../../../components/Button/Button.js";
9
- const NextcloudLogin = ({
10
- onConnected,
11
- description
12
- }) => {
13
- const {
14
- t
15
- } = useTranslation(), toast = useToast(), popupRef = useRef(null);
16
- useEffect(() => {
17
- function handleMessage(event) {
18
- var _a;
19
- event.origin !== window.location.origin || ((_a = event.data) == null ? void 0 : _a.type) !== "nextcloud-connected" || (popupRef.current && !popupRef.current.closed && popupRef.current.close(), onConnected());
20
- }
21
- return window.addEventListener("message", handleMessage), () => window.removeEventListener("message", handleMessage);
22
- }, [onConnected]);
23
- const openLoginPopup = () => {
24
- popupRef.current = window.open(`${window.location.origin}/nextcloud/user/oauth2/init`, "", "popup, height=600, width=400"), popupRef.current || toast.error(t("nextcloud.auth.popupBlocked"));
25
- };
26
- return /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "12", className: "h-full w-100", justify: "center", align: "center", children: [
27
- /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: illuConnectionLost, title: t("nextcloud.auth.title"), text: description ?? t("nextcloud.auth.description") }),
28
- /* @__PURE__ */ jsx(Button, { onClick: openLoginPopup, children: t("nextcloud.auth.connect") })
29
- ] });
30
- };
31
- export {
32
- NextcloudLogin as default
33
- };
@@ -1,12 +0,0 @@
1
- interface NextcloudFoldersProps {
2
- /**
3
- * Function called with the path of the selected folder, relative to the user's Nextcloud root
4
- */
5
- onFolderSelected: (path: string) => void;
6
- /**
7
- * Description of the login screen shown when the user is not connected to Nextcloud
8
- */
9
- loginDescription?: string;
10
- }
11
- export default function NextcloudFolders({ onFolderSelected, loginDescription, }: NextcloudFoldersProps): import("react/jsx-runtime").JSX.Element;
12
- export {};
@@ -1,51 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useState, useEffect } from "react";
3
- import { useTranslation } from "react-i18next";
4
- import SvgIconFolderAdd from "../../icons/components/IconFolderAdd.js";
5
- import NextcloudLogin from "../Nextcloud/NextcloudLogin.js";
6
- import NewFolderForm from "./components/NewFolderForm.js";
7
- import illuError from "@edifice.io/bootstrap/dist/images/emptyscreen/illu-error.svg";
8
- import useUser from "../../../hooks/useUser/useUser.js";
9
- import useNextcloudSearch from "../../../hooks/useNextcloudSearch/useNextcloudSearch.js";
10
- import Loading from "../../../components/Loading/Loading.js";
11
- import Flex from "../../../components/Flex/Flex.js";
12
- import EmptyScreen from "../../../components/EmptyScreen/EmptyScreen.js";
13
- import Button from "../../../components/Button/Button.js";
14
- import Tree from "../../../components/Tree/components/Tree.js";
15
- const ROOT_ID = "root", ROOT_PATH = "/";
16
- function NextcloudFolders({
17
- onFolderSelected,
18
- loginDescription
19
- }) {
20
- const {
21
- t
22
- } = useTranslation(), {
23
- user
24
- } = useUser(), {
25
- root,
26
- needsAuth,
27
- isCheckingAuth,
28
- isAuthError,
29
- refetchAuthStatus,
30
- loadContent,
31
- loadError
32
- } = useNextcloudSearch(ROOT_ID, t("nextcloud"), user == null ? void 0 : user.userId), [selectedFolderId, setSelectedFolderId] = useState(), [showNewFolderForm, setShowNewFolderForm] = useState(!1), selectedPath = selectedFolderId === ROOT_ID ? ROOT_PATH : selectedFolderId;
33
- useEffect(() => {
34
- needsAuth || loadContent(ROOT_ID);
35
- }, [loadContent, needsAuth]);
36
- const handleFolderSelected = (folderId) => {
37
- setShowNewFolderForm(!1), setSelectedFolderId(folderId), loadContent(folderId), onFolderSelected(folderId === ROOT_ID ? ROOT_PATH : folderId);
38
- }, handleFolderCreated = (path) => {
39
- loadContent(selectedFolderId, !0), setSelectedFolderId(path), onFolderSelected(path);
40
- }, handleRetry = () => isAuthError ? refetchAuthStatus() : loadContent(selectedFolderId ?? ROOT_ID, !0);
41
- return isCheckingAuth ? /* @__PURE__ */ jsx(Loading, { isLoading: !0, className: "justify-content-center" }) : isAuthError || loadError ? /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "12", align: "center", children: [
42
- /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: illuError, title: t("nextcloud.error.title"), text: t("nextcloud.error.description") }),
43
- /* @__PURE__ */ jsx(Button, { onClick: handleRetry, children: t("retry") })
44
- ] }) : needsAuth ? /* @__PURE__ */ jsx(NextcloudLogin, { onConnected: refetchAuthStatus, description: loginDescription }) : /* @__PURE__ */ jsxs("div", { className: "border border-gray-400 rounded", children: [
45
- /* @__PURE__ */ jsx("div", { className: "p-12", children: /* @__PURE__ */ jsx(Tree, { nodes: root, selectedNodeId: selectedFolderId, showIcon: !0, onTreeItemClick: handleFolderSelected, onTreeItemUnfold: (nodeId) => loadContent(nodeId) }) }),
46
- /* @__PURE__ */ jsx("div", { className: "d-flex justify-content-end border-top border-gray-400 px-8 py-4", children: showNewFolderForm && selectedPath ? /* @__PURE__ */ jsx(NewFolderForm, { parentPath: selectedPath, onClose: () => setShowNewFolderForm(!1), onFolderCreated: handleFolderCreated }) : /* @__PURE__ */ jsx(Button, { color: "primary", variant: "ghost", leftIcon: /* @__PURE__ */ jsx(SvgIconFolderAdd, {}), onClick: () => setShowNewFolderForm(!0), disabled: !selectedPath, children: t("workspace.folder.create") }) })
47
- ] });
48
- }
49
- export {
50
- NextcloudFolders as default
51
- };
@@ -1,16 +0,0 @@
1
- type Props = {
2
- /**
3
- * Path of the folder in which the new folder is created
4
- */
5
- parentPath: string;
6
- /**
7
- * Function called when the form is closed
8
- */
9
- onClose: () => void;
10
- /**
11
- * Function called with the path of the created folder
12
- */
13
- onFolderCreated: (path: string) => void;
14
- };
15
- export default function NewFolderForm({ parentPath, onClose, onFolderCreated, }: Props): import("react/jsx-runtime").JSX.Element;
16
- export {};
@@ -1,51 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useRef, useEffect } from "react";
3
- import { odeServices } from "@edifice.io/client";
4
- import { useMutation } from "@tanstack/react-query";
5
- import { useTranslation } from "react-i18next";
6
- import SvgIconSave from "../../../icons/components/IconSave.js";
7
- import useUser from "../../../../hooks/useUser/useUser.js";
8
- import useToast from "../../../../hooks/useToast/useToast.js";
9
- import FormControl from "../../../../components/Form/FormControl.js";
10
- import IconButton from "../../../../components/Button/IconButton.js";
11
- function NewFolderForm({
12
- parentPath,
13
- onClose,
14
- onFolderCreated
15
- }) {
16
- const {
17
- t
18
- } = useTranslation(), {
19
- user
20
- } = useUser(), toast = useToast(), refInputName = useRef(null), createFolderMutation = useMutation({
21
- mutationFn: ({
22
- userId,
23
- path
24
- }) => odeServices.nextcloud().createFolder(userId, path)
25
- });
26
- return useEffect(() => {
27
- var _a;
28
- (_a = refInputName.current) == null || _a.focus();
29
- }, []), /* @__PURE__ */ jsx("form", { id: "modalNextcloudNewFolderForm", onSubmit: (event) => {
30
- var _a;
31
- event.preventDefault();
32
- const folderName = (_a = refInputName.current) == null ? void 0 : _a.value.trim().replace(/\//g, "-");
33
- if (!folderName || !user) return;
34
- const path = `${parentPath.replace(/\/?$/, "/")}${folderName}/`;
35
- createFolderMutation.mutate({
36
- userId: user.userId,
37
- path
38
- }, {
39
- onSuccess: () => {
40
- onFolderCreated(path), onClose();
41
- },
42
- onError: () => toast.error(t("e400"))
43
- });
44
- }, children: /* @__PURE__ */ jsxs("div", { className: "d-flex gap-4 flex-row", children: [
45
- /* @__PURE__ */ jsx(FormControl, { id: "modalNextcloudNewFolderForm", isRequired: !0, children: /* @__PURE__ */ jsx(FormControl.Input, { ref: refInputName, size: "md", type: "text", placeholder: t("workspace.folder.new.placeholder") }) }),
46
- /* @__PURE__ */ jsx(IconButton, { type: "submit", color: "primary", variant: "ghost", title: t("workspace.folder.new.create"), disabled: createFolderMutation.isPending, isLoading: createFolderMutation.isPending, icon: /* @__PURE__ */ jsx(SvgIconSave, {}) })
47
- ] }) });
48
- }
49
- export {
50
- NewFolderForm as default
51
- };
@@ -1 +0,0 @@
1
- export { default as NextcloudFolders } from './NextcloudFolders';