@edifice.io/react 2.6.9-develop-integration.20261012100537 → 2.6.9-develop-orga.20261013105203

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 (34) hide show
  1. package/dist/components/Tree/utilities/tree.js +1 -21
  2. package/dist/hooks/index.d.ts +0 -2
  3. package/dist/index.js +182 -194
  4. package/dist/modules/multimedia/FileCard/index.d.ts +0 -4
  5. package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.d.ts +1 -7
  6. package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +0 -2
  7. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +2 -2
  8. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +12 -48
  9. package/dist/modules/multimedia/MediaLibrary/innertabs/index.d.ts +0 -2
  10. package/dist/modules/multimedia/MediaLibrary/innertabs/index.js +0 -4
  11. package/dist/modules/multimedia/Workspace/Workspace.js +5 -8
  12. package/dist/modules/multimedia/index.d.ts +0 -2
  13. package/dist/multimedia.js +18 -26
  14. package/package.json +6 -6
  15. package/dist/hooks/useGoogleDriveSearch/index.d.ts +0 -1
  16. package/dist/hooks/useGoogleDriveSearch/useGoogleDriveSearch.d.ts +0 -14
  17. package/dist/hooks/useGoogleDriveSearch/useGoogleDriveSearch.js +0 -60
  18. package/dist/hooks/useNextcloudSearch/index.d.ts +0 -1
  19. package/dist/hooks/useNextcloudSearch/useNextcloudSearch.d.ts +0 -14
  20. package/dist/hooks/useNextcloudSearch/useNextcloudSearch.js +0 -64
  21. package/dist/modules/multimedia/FileCard/GoogleDriveFileCard.d.ts +0 -25
  22. package/dist/modules/multimedia/FileCard/GoogleDriveFileCard.js +0 -102
  23. package/dist/modules/multimedia/FileCard/NextcloudFileCard.d.ts +0 -25
  24. package/dist/modules/multimedia/FileCard/NextcloudFileCard.js +0 -102
  25. package/dist/modules/multimedia/GoogleDrive/GoogleDrive.d.ts +0 -24
  26. package/dist/modules/multimedia/GoogleDrive/GoogleDrive.js +0 -100
  27. package/dist/modules/multimedia/GoogleDrive/index.d.ts +0 -2
  28. package/dist/modules/multimedia/MediaLibrary/innertabs/GoogleDrive.d.ts +0 -1
  29. package/dist/modules/multimedia/MediaLibrary/innertabs/GoogleDrive.js +0 -61
  30. package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.d.ts +0 -1
  31. package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.js +0 -48
  32. package/dist/modules/multimedia/Nextcloud/Nextcloud.d.ts +0 -24
  33. package/dist/modules/multimedia/Nextcloud/Nextcloud.js +0 -124
  34. package/dist/modules/multimedia/Nextcloud/index.d.ts +0 -2
@@ -5,7 +5,6 @@ import { useTranslation } from "react-i18next";
5
5
  import SvgIconApplications from "../../icons/components/IconApplications.js";
6
6
  import SvgIconCode from "../../icons/components/IconCode.js";
7
7
  import SvgIconFolder from "../../icons/components/IconFolder.js";
8
- import SvgIconGlobe2 from "../../icons/components/IconGlobe2.js";
9
8
  import SvgIconGlobe from "../../icons/components/IconGlobe.js";
10
9
  import SvgIconMic from "../../icons/components/IconMic.js";
11
10
  import SvgIconRecordVideo from "../../icons/components/IconRecordVideo.js";
@@ -13,7 +12,6 @@ import SvgIconSmartphone from "../../icons/components/IconSmartphone.js";
13
12
  import { InnerTabs } from "./innertabs/index.js";
14
13
  import { MediaLibraryContext } from "./MediaLibraryContext.js";
15
14
  import useHasWorkflow from "../../../hooks/useHasWorkflow/useHasWorkflow.js";
16
- import usePublicConf from "../../../hooks/usePublicConf/usePublicConf.js";
17
15
  import useHttpErrorToast from "../../../hooks/useHttpErrorToast/useHttpErrorToast.js";
18
16
  import Modal from "../../../components/Modal/Modal.js";
19
17
  import { Tabs } from "../../../components/Tabs/components/Tabs.js";
@@ -31,13 +29,9 @@ const orderedTabs = [
31
29
  // Filesystem browser + drag'n'drop of files
32
30
  "workspace",
33
31
  // Media browser
34
- "nextcloud",
35
- // Nextcloud media browser
36
- "google-drive",
37
- // Google Drive media browser
38
32
  "video-embedder"
39
33
  // Link to a hosted video
40
- ], GOOGLE_DRIVE_VIEW_WORKFLOW = "io.edifice.google.drive.controller.GoogleDriveController|view", mediaLibraryTypes = {
34
+ ], mediaLibraryTypes = {
41
35
  none: null,
42
36
  audio: {
43
37
  title: "bbm.audio.modal.title",
@@ -76,7 +70,7 @@ const orderedTabs = [
76
70
  onCancel,
77
71
  onTabChange
78
72
  }, ref) => {
79
- var _a, _b, _c;
73
+ var _a;
80
74
  const linkTabProps = useRef(), refModal = useRef(null);
81
75
  useImperativeHandle(ref, () => ({
82
76
  show,
@@ -87,9 +81,7 @@ const orderedTabs = [
87
81
  }));
88
82
  const {
89
83
  t
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), {
91
- data: workspacePublicConf
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);
84
+ } = useTranslation(), workspaceCreateWorkflow = useHasWorkflow("org.entcore.workspace.controllers.WorkspaceController|addDocument"), videoCaptureWorkflow = useHasWorkflow("com.opendigitaleducation.video.controllers.VideoController|capture"), [type, setType] = useState(null);
93
85
  useHttpErrorToast({
94
86
  active: !!type,
95
87
  isDismissible: !0,
@@ -104,23 +96,6 @@ const orderedTabs = [
104
96
  availableFor: ["audio", "video", "image", "attachment"],
105
97
  isEnable: null
106
98
  },
107
- nextcloud: {
108
- id: "nextcloud",
109
- icon: /* @__PURE__ */ jsx(SvgIconGlobe2, {}),
110
- label: t("bbm.nextcloud"),
111
- content: /* @__PURE__ */ jsx(InnerTabs.Nextcloud, {}),
112
- availableFor: ["audio", "video", "image", "attachment"],
113
- isEnable: () => !!enableNextcloudTab
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
- },
124
99
  upload: {
125
100
  id: "upload",
126
101
  icon: /* @__PURE__ */ jsx(SvgIconSmartphone, {}),
@@ -187,7 +162,7 @@ const orderedTabs = [
187
162
  ), [defaultTabId, setDefaultTabId] = useState(), defaultTabIdx = useMemo(() => {
188
163
  const index = tabs.findIndex((t2) => t2.id === defaultTabId);
189
164
  return 0 > index || index >= tabs.length ? 0 : index;
190
- }, [tabs, defaultTabId]), [resultCounter, setResultCounter] = useState(), [result, setResult] = useState(), [deletionsOnCancel, setDeletionsOnCancel] = useState([]), [onSuccessAction, setPreSuccess] = useState(), [isSubmitting, setIsSubmitting] = useState(!1);
165
+ }, [tabs, defaultTabId]), [resultCounter, setResultCounter] = useState(), [result, setResult] = useState(), [deletionsOnCancel, setDeletionsOnCancel] = useState([]), [onSuccessAction, setPreSuccess] = useState();
191
166
  function setVisibleTab(tab) {
192
167
  throw tabs.findIndex((t2) => t2.id === tab) < 0 ? "tab.not.visible" : "not.implemented.yet";
193
168
  }
@@ -202,33 +177,22 @@ const orderedTabs = [
202
177
  linkTabProps.current = props, "resourceId" in props || "appPrefix" in props || setDefaultTabId("external-link"), setType("hyperlink");
203
178
  };
204
179
  useEffect(() => {
205
- var _a2, _b2;
180
+ var _a2, _b;
206
181
  const typeKey = type || "none";
207
- !defaultTabId && typeof ((_a2 = mediaLibraryTypes[typeKey]) == null ? void 0 : _a2.defaultTab) == "string" && setDefaultTabId((_b2 = mediaLibraryTypes[typeKey]) == null ? void 0 : _b2.defaultTab);
182
+ !defaultTabId && typeof ((_a2 = mediaLibraryTypes[typeKey]) == null ? void 0 : _a2.defaultTab) == "string" && setDefaultTabId((_b = mediaLibraryTypes[typeKey]) == null ? void 0 : _b.defaultTab);
208
183
  }, [defaultTabId, type]);
209
- const modalHeader = t(((_c = mediaLibraryTypes[type ?? "none"]) == null ? void 0 : _c.title) ?? "bbm"), resetState = () => {
184
+ const modalHeader = t(((_a = mediaLibraryTypes[type ?? "none"]) == null ? void 0 : _a.title) ?? "bbm"), resetState = () => {
210
185
  linkTabProps.current = void 0, setResult(void 0), setResultCounter(void 0), setDefaultTabId(void 0), setPreSuccess(void 0), setDeletionsOnCancel([]);
211
186
  }, handleTabChange = (tab) => {
212
187
  onTabChange == null || onTabChange(tab, deletionsOnCancel), resetState();
213
188
  }, handleOnSuccess = useCallback(() => {
214
- if (isSubmitting) return;
215
189
  const triggerSuccess = async (result2) => {
216
190
  result2 instanceof Array && ["protected", "public"].findIndex((v) => v === visibility) >= 0 && (result2 = await odeServices.workspace().transferDocuments(result2, appCode ?? "media-library", visibility)), onSuccess(result2);
217
191
  };
218
- (async () => {
219
- setIsSubmitting(!0);
220
- try {
221
- if (onSuccessAction) {
222
- const asyncResult = await onSuccessAction();
223
- await triggerSuccess(asyncResult);
224
- } else result && await triggerSuccess(result);
225
- resetState();
226
- } catch {
227
- } finally {
228
- setIsSubmitting(!1);
229
- }
230
- })();
231
- }, [isSubmitting, onSuccessAction, result, onSuccess, visibility, appCode]), handleOnCancel = () => {
192
+ onSuccessAction ? onSuccessAction().then((result2) => {
193
+ triggerSuccess(result2);
194
+ }) : result && triggerSuccess(result), resetState();
195
+ }, [onSuccessAction, result, onSuccess, visibility, appCode]), handleOnCancel = () => {
232
196
  onCancel(deletionsOnCancel), resetState();
233
197
  };
234
198
  return type && /* @__PURE__ */ jsx(MediaLibraryContext.Provider, { value: {
@@ -250,7 +214,7 @@ const orderedTabs = [
250
214
  ] }) }),
251
215
  /* @__PURE__ */ jsxs(Modal.Footer, { children: [
252
216
  /* @__PURE__ */ jsx(Button, { type: "button", color: "tertiary", variant: "ghost", onClick: handleOnCancel, children: t("cancel") }),
253
- /* @__PURE__ */ jsx(Button, { type: "button", color: "primary", variant: "filled", disabled: typeof result > "u" || isSubmitting, onClick: handleOnSuccess, children: resultCounter && resultCounter > 1 ? t("addMultiple", {
217
+ /* @__PURE__ */ jsx(Button, { type: "button", color: "primary", variant: "filled", disabled: typeof result > "u", onClick: handleOnSuccess, children: resultCounter && resultCounter > 1 ? t("addMultiple", {
254
218
  number: resultCounter
255
219
  }) : t("add") })
256
220
  ] })
@@ -4,8 +4,6 @@ export declare const InnerTabs: {
4
4
  Upload: () => import("react/jsx-runtime").JSX.Element;
5
5
  ExternalLink: ({ link, multiNodeSelected, }: import('./ExternalLink').ExternalLinkTabProps) => import("react/jsx-runtime").JSX.Element;
6
6
  Workspace: () => import("react/jsx-runtime").JSX.Element;
7
- Nextcloud: () => import("react/jsx-runtime").JSX.Element;
8
- GoogleDrive: () => import("react/jsx-runtime").JSX.Element;
9
7
  InternalLink: ({ target, resourceId, appPrefix, }: import('./InternalLink').InternalLinkTabProps) => import("react/jsx-runtime").JSX.Element;
10
8
  Iframe: () => import("react/jsx-runtime").JSX.Element;
11
9
  VideoEmbedder: () => import("react/jsx-runtime").JSX.Element;
@@ -1,9 +1,7 @@
1
1
  import { Audio } from "./Audio.js";
2
2
  import { ExternalLink } from "./ExternalLink.js";
3
- import { GoogleDrive } from "./GoogleDrive.js";
4
3
  import { Iframe } from "./Iframe.js";
5
4
  import { InternalLink } from "./InternalLink.js";
6
- import { Nextcloud } from "./Nextcloud.js";
7
5
  import { Upload } from "./Upload.js";
8
6
  import { Video } from "./Video.js";
9
7
  import { VideoEmbedder } from "./VideoEmbedder.js";
@@ -14,8 +12,6 @@ const InnerTabs = {
14
12
  Upload,
15
13
  ExternalLink,
16
14
  Workspace,
17
- Nextcloud,
18
- GoogleDrive,
19
15
  InternalLink,
20
16
  Iframe,
21
17
  VideoEmbedder
@@ -6,7 +6,6 @@ import SvgIconSortAscendingLetters from "../../icons/components/IconSortAscendin
6
6
  import SvgIconSortDescendingLetters from "../../icons/components/IconSortDescendingLetters.js";
7
7
  import SvgIconSortTime from "../../icons/components/IconSortTime.js";
8
8
  import illuTrash from "@edifice.io/bootstrap/dist/images/emptyscreen/illu-trash.svg";
9
- import useHasWorkflow from "../../../hooks/useHasWorkflow/useHasWorkflow.js";
10
9
  import useWorkspaceSearch from "../../../hooks/useWorkspaceSearch/useWorkspaceSearch.js";
11
10
  import { Grid } from "../../../components/Grid/Grid.js";
12
11
  import TreeView from "../../../components/TreeView/TreeView.js";
@@ -16,7 +15,7 @@ import LoadingScreen from "../../../components/LoadingScreen/LoadingScreen.js";
16
15
  import FileCard from "../FileCard/FileCard.js";
17
16
  import EmptyScreen from "../../../components/EmptyScreen/EmptyScreen.js";
18
17
  import { findTreeNode } from "../../../components/TreeView/utilities/treeview.js";
19
- const WORKSPACE_VIEW_WORKFLOW = "org.entcore.workspace.controllers.WorkspaceController|view", Workspace = ({
18
+ const Workspace = ({
20
19
  roles,
21
20
  onSelect,
22
21
  multiple = !0,
@@ -26,7 +25,7 @@ const WORKSPACE_VIEW_WORKFLOW = "org.entcore.workspace.controllers.WorkspaceCont
26
25
  }) => {
27
26
  const {
28
27
  t
29
- } = useTranslation(), hasWorkspaceViewRight = useHasWorkflow(WORKSPACE_VIEW_WORKFLOW), canViewPersonalFolders = !!hasWorkspaceViewRight, {
28
+ } = useTranslation(), {
30
29
  root: ownerRoot,
31
30
  loadContent: loadOwnerDocs
32
31
  } = useWorkspaceSearch("root", t("workspace.tree.owner"), "owner", roles), {
@@ -112,9 +111,7 @@ const WORKSPACE_VIEW_WORKFLOW = "org.entcore.workspace.controllers.WorkspaceCont
112
111
  return;
113
112
  }
114
113
  (_a = ref == null ? void 0 : ref.current) == null || _a.select("root");
115
- }, [currentFilter]), useEffect(() => {
116
- hasWorkspaceViewRight === !1 && (currentFilter === "owner" || currentFilter === "shared") && selectAndLoadContent("protected", "root");
117
- }, [hasWorkspaceViewRight]), useEffect(loadContent, [loadContent]), useEffect(() => {
114
+ }, [currentFilter]), useEffect(loadContent, [loadContent]), useEffect(() => {
118
115
  if (currentNode.files) {
119
116
  let list = [].concat(currentNode.files);
120
117
  searchTerm && (list = list.filter((f) => f.name.indexOf(searchTerm) >= 0));
@@ -143,8 +140,8 @@ const WORKSPACE_VIEW_WORKFLOW = "org.entcore.workspace.controllers.WorkspaceCont
143
140
  top: 0,
144
141
  paddingTop: "1.2rem"
145
142
  }, children: [
146
- canViewPersonalFolders && /* @__PURE__ */ jsx(TreeView, { ref: ownerRef, data: ownerRoot, onTreeItemClick: (nodeId) => selectAndLoadContent("owner", nodeId), onTreeItemUnfold: (nodeId) => selectAndLoadContent("owner", nodeId) }),
147
- canViewPersonalFolders && /* @__PURE__ */ jsx(TreeView, { ref: sharedRef, data: sharedRoot, onTreeItemClick: (nodeId) => selectAndLoadContent("shared", nodeId), onTreeItemUnfold: (nodeId) => selectAndLoadContent("shared", nodeId) }),
143
+ /* @__PURE__ */ jsx(TreeView, { ref: ownerRef, data: ownerRoot, onTreeItemClick: (nodeId) => selectAndLoadContent("owner", nodeId), onTreeItemUnfold: (nodeId) => selectAndLoadContent("owner", nodeId) }),
144
+ /* @__PURE__ */ jsx(TreeView, { ref: sharedRef, data: sharedRoot, onTreeItemClick: (nodeId) => selectAndLoadContent("shared", nodeId), onTreeItemUnfold: (nodeId) => selectAndLoadContent("shared", nodeId) }),
148
145
  /* @__PURE__ */ jsx(TreeView, { ref: protectRef, data: protectRoot, onTreeItemClick: (nodeId) => selectAndLoadContent("protected", nodeId), onTreeItemUnfold: (nodeId) => selectAndLoadContent("protected", nodeId) }),
149
146
  showPublicFolder && /* @__PURE__ */ jsx(TreeView, { ref: publicRef, data: publicRoot, onTreeItemClick: (nodeId) => selectAndLoadContent("public", nodeId), onTreeItemUnfold: (nodeId) => selectAndLoadContent("public", nodeId) })
150
147
  ] }) }),
@@ -5,8 +5,6 @@ export * from './ImagePicker';
5
5
  export * from './FileCard';
6
6
  export * from './Linker';
7
7
  export * from './MediaLibrary';
8
- export * from './GoogleDrive';
9
- export * from './Nextcloud';
10
8
  export * from './UploadCard';
11
9
  export * from './VideoEmbed';
12
10
  export * from './VideoRecorder';
@@ -1,19 +1,15 @@
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/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";
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/UploadCard/UploadCard.js";
8
+ import { default as default9 } from "./modules/multimedia/UploadFiles/UploadFiles.js";
9
+ import { default as default10 } from "./modules/multimedia/VideoEmbed/VideoEmbed.js";
10
+ import { default as default11 } from "./modules/multimedia/VideoRecorder/VideoRecorder.js";
11
+ import { default as default12 } from "./modules/multimedia/Workspace/Workspace.js";
12
+ import { default as default13 } from "./modules/multimedia/WorkspaceFolders/WorkspaceFolders.js";
17
13
  import { ExternalLinker } from "./modules/multimedia/Linker/ExternalLinker/ExternalLinker.js";
18
14
  import { InternalLinker } from "./modules/multimedia/Linker/InternalLinker/InternalLinker.js";
19
15
  import { Upload } from "./modules/multimedia/MediaLibrary/innertabs/Upload.js";
@@ -22,19 +18,15 @@ export {
22
18
  default3 as Embed,
23
19
  ExternalLinker,
24
20
  default4 as FileCard,
25
- default5 as GoogleDrive,
26
- default6 as GoogleDriveFileCard,
27
- default7 as ImageEditor,
28
- default8 as ImagePicker,
21
+ default5 as ImageEditor,
22
+ default6 as ImagePicker,
29
23
  InternalLinker,
30
- default9 as MediaLibrary,
31
- default10 as Nextcloud,
32
- default11 as NextcloudFileCard,
24
+ default7 as MediaLibrary,
33
25
  Upload,
34
- default12 as UploadCard,
35
- default13 as UploadFiles,
36
- default14 as VideoEmbed,
37
- default15 as VideoRecorder,
38
- default16 as Workspace,
39
- default17 as WorkspaceFolders
26
+ default8 as UploadCard,
27
+ default9 as UploadFiles,
28
+ default10 as VideoEmbed,
29
+ default11 as VideoRecorder,
30
+ default12 as Workspace,
31
+ default13 as WorkspaceFolders
40
32
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.6.9-develop-integration.20261012100537",
3
+ "version": "2.6.9-develop-orga.20261013105203",
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/tiptap-extensions": "2.6.9-develop-integration.20261012100537",
144
- "@edifice.io/utilities": "2.6.9-develop-integration.20261012100537",
145
- "@edifice.io/bootstrap": "2.6.9-develop-integration.20261012100537"
143
+ "@edifice.io/tiptap-extensions": "2.6.9-develop-orga.20261013105203",
144
+ "@edifice.io/utilities": "2.6.9-develop-orga.20261013105203",
145
+ "@edifice.io/bootstrap": "2.6.9-develop-orga.20261013105203"
146
146
  },
147
147
  "devDependencies": {
148
148
  "@babel/plugin-transform-react-pure-annotations": "7.27.1",
@@ -173,8 +173,8 @@
173
173
  "vite": "5.4.14",
174
174
  "vite-plugin-dts": "4.5.4",
175
175
  "vite-tsconfig-paths": "5.1.4",
176
- "@edifice.io/config": "2.6.9-develop-integration.20261012100537",
177
- "@edifice.io/client": "2.6.9-develop-integration.20261012100537"
176
+ "@edifice.io/config": "2.6.9-develop-orga.20261013105203",
177
+ "@edifice.io/client": "2.6.9-develop-orga.20261013105203"
178
178
  },
179
179
  "peerDependencies": {
180
180
  "@react-spring/web": "9.7.5",
@@ -1 +0,0 @@
1
- export { default as useGoogleDriveSearch } from './useGoogleDriveSearch';
@@ -1,14 +0,0 @@
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
- };
@@ -1,60 +0,0 @@
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
- };
@@ -1 +0,0 @@
1
- export { default as useNextcloudSearch } from './useNextcloudSearch';
@@ -1,14 +0,0 @@
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
- };
@@ -1,64 +0,0 @@
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
- };
@@ -1,25 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { GoogleDriveDocument } from '@edifice.io/client';
3
- import { CardProps } from '../../../components/Card';
4
- export interface GoogleDriveFileCardProps extends CardProps {
5
- doc: GoogleDriveDocument;
6
- /**
7
- * Id of the user who owns the Google Drive document, used to build the preview URL.
8
- */
9
- userId: string;
10
- /**
11
- * Custom icon to override the default based on file type
12
- * Can be a string or a React node
13
- */
14
- customIcon?: ReactNode;
15
- /**
16
- * Custom color class to override the default based on file type
17
- * Example: "bg-purple-300" or any valid CSS class
18
- */
19
- customColor?: string;
20
- }
21
- declare const GoogleDriveFileCard: {
22
- ({ doc, userId, isClickable, isSelectable, isSelected, onClick, className, onSelect, isFocused, app, customIcon, customColor, }: GoogleDriveFileCardProps): import("react/jsx-runtime").JSX.Element;
23
- displayName: string;
24
- };
25
- export default GoogleDriveFileCard;
@@ -1,102 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useRef } from "react";
3
- import { DocumentHelper, odeServices } from "@edifice.io/client";
4
- import clsx from "clsx";
5
- import SvgIconLandscape from "../../icons/components/IconLandscape.js";
6
- import SvgIconMic from "../../icons/components/IconMic.js";
7
- import SvgIconTextPage from "../../icons/components/IconTextPage.js";
8
- import SvgIconVideo from "../../icons/components/IconVideo.js";
9
- import FileIcon from "./FileIcon.js";
10
- import useThumbnail from "../../../hooks/useThumbnail/useThumbnail.js";
11
- import Card from "../../../components/Card/Card.js";
12
- const roleMappings = {
13
- csv: {
14
- icon: ".CSV",
15
- color: "bg-orange-200"
16
- },
17
- xls: {
18
- icon: ".XLS",
19
- color: "bg-green-200"
20
- },
21
- doc: {
22
- icon: ".DOC",
23
- color: "bg-blue-200"
24
- },
25
- txt: {
26
- icon: ".TXT",
27
- color: "bg-blue-200"
28
- },
29
- pdf: {
30
- icon: ".PDF",
31
- color: "bg-red-200"
32
- },
33
- audio: {
34
- icon: /* @__PURE__ */ jsx(SvgIconMic, { width: 22, height: 22 }),
35
- color: "bg-red-200"
36
- },
37
- ppt: {
38
- icon: ".PPT",
39
- color: "bg-red-200"
40
- },
41
- img: {
42
- icon: /* @__PURE__ */ jsx(SvgIconLandscape, { width: 22, height: 22 }),
43
- color: "bg-green-200"
44
- },
45
- video: {
46
- icon: /* @__PURE__ */ jsx(SvgIconVideo, { width: 22, height: 22 }),
47
- color: "bg-purple-200"
48
- },
49
- zip: {
50
- icon: ".ZIP",
51
- color: "bg-gray-300"
52
- },
53
- md: {
54
- icon: ".MD",
55
- color: "bg-blue-200"
56
- },
57
- unknown: {
58
- icon: /* @__PURE__ */ jsx(SvgIconTextPage, { width: 22, height: 22 }),
59
- color: "bg-gray-300"
60
- }
61
- };
62
- function getRoleMap(type, customIcon, customColor) {
63
- return customIcon !== void 0 || customColor !== void 0 ? {
64
- icon: customIcon || /* @__PURE__ */ jsx(SvgIconTextPage, { width: 22, height: 22 }),
65
- color: customColor || "bg-gray-300",
66
- hasShadow: !1
67
- } : roleMappings[type] ?? roleMappings.unknown;
68
- }
69
- const GoogleDriveFileCard = ({
70
- doc,
71
- userId,
72
- isClickable = !0,
73
- isSelectable = !1,
74
- isSelected = !1,
75
- onClick,
76
- className,
77
- onSelect,
78
- isFocused,
79
- app,
80
- customIcon,
81
- customColor
82
- }) => {
83
- const ref = useRef(null), type = DocumentHelper.role(doc.contentType, !1), roleMap = getRoleMap(type ?? "unknown", customIcon, customColor), file = clsx("file position-relative rounded", (roleMap == null ? void 0 : roleMap.color) ?? "bg-yellow-200"), mediaSrc = type === "img" ? odeServices.googledrive().getFileUrl(userId, doc) : null, hasThumbnail = useThumbnail(mediaSrc, {
84
- ref
85
- }), imageStyles = hasThumbnail && {
86
- backgroundImage: `url(${mediaSrc})`,
87
- backgroundSize: "cover"
88
- };
89
- return /* @__PURE__ */ jsx(Card, { className: clsx("card-file", className), isClickable, isSelectable, isSelected, onClick, app, isFocused, onSelect, children: /* @__PURE__ */ jsxs(Card.Body, { space: "8", children: [
90
- /* @__PURE__ */ jsx("div", { ref, className: file, style: {
91
- aspectRatio: "16/10",
92
- ...imageStyles
93
- }, children: type !== "img" || !hasThumbnail ? /* @__PURE__ */ jsx(FileIcon, { type, roleMap }) : null }),
94
- /* @__PURE__ */ jsxs("div", { className: "mt-4", children: [
95
- /* @__PURE__ */ jsx(Card.Text, { children: doc.name }),
96
- /* @__PURE__ */ jsx(Card.Text, { className: "text-black-50", children: doc == null ? void 0 : doc.ownerDisplayName })
97
- ] })
98
- ] }) });
99
- };
100
- export {
101
- GoogleDriveFileCard as default
102
- };
@@ -1,25 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { NextcloudDocument } from '@edifice.io/client';
3
- import { CardProps } from '../../../components/Card';
4
- export interface NextcloudFileCardProps extends CardProps {
5
- doc: NextcloudDocument;
6
- /**
7
- * Id of the user who owns the Nextcloud document, used to build the preview URL.
8
- */
9
- userId: string;
10
- /**
11
- * Custom icon to override the default based on file type
12
- * Can be a string or a React node
13
- */
14
- customIcon?: ReactNode;
15
- /**
16
- * Custom color class to override the default based on file type
17
- * Example: "bg-purple-300" or any valid CSS class
18
- */
19
- customColor?: string;
20
- }
21
- declare const NextcloudFileCard: {
22
- ({ doc, userId, isClickable, isSelectable, isSelected, onClick, className, onSelect, isFocused, app, customIcon, customColor, }: NextcloudFileCardProps): import("react/jsx-runtime").JSX.Element;
23
- displayName: string;
24
- };
25
- export default NextcloudFileCard;