@edifice.io/react 2.6.7-develop-b2school.20261002174012 → 2.6.7-develop-integration.20261003123008

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 (54) hide show
  1. package/dist/components/Layout/Layout.js +8 -21
  2. package/dist/components/Tree/utilities/tree.js +21 -1
  3. package/dist/homepage.js +0 -4
  4. package/dist/hooks/index.d.ts +2 -0
  5. package/dist/hooks/useBackground/useBackground.d.ts +0 -1
  6. package/dist/hooks/useBackground/useBackground.js +0 -2
  7. package/dist/hooks/useGoogleDriveSearch/index.d.ts +1 -0
  8. package/dist/hooks/useGoogleDriveSearch/useGoogleDriveSearch.d.ts +14 -0
  9. package/dist/hooks/useGoogleDriveSearch/useGoogleDriveSearch.js +60 -0
  10. package/dist/hooks/useNextcloudSearch/index.d.ts +1 -0
  11. package/dist/hooks/useNextcloudSearch/useNextcloudSearch.d.ts +14 -0
  12. package/dist/hooks/useNextcloudSearch/useNextcloudSearch.js +64 -0
  13. package/dist/hooks/useZendeskGuide/useZendeskGuide.d.ts +1 -3
  14. package/dist/hooks/useZendeskGuide/useZendeskGuide.js +3 -10
  15. package/dist/icons.js +402 -404
  16. package/dist/index.js +194 -182
  17. package/dist/modules/homepage/components/UserSpace/UserSpace.d.ts +1 -3
  18. package/dist/modules/homepage/components/UserSpace/UserSpace.js +7 -13
  19. package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.d.ts +2 -4
  20. package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.js +2 -3
  21. package/dist/modules/homepage/components/index.d.ts +1 -2
  22. package/dist/modules/icons/components/index.d.ts +0 -1
  23. package/dist/modules/multimedia/FileCard/GoogleDriveFileCard.d.ts +25 -0
  24. package/dist/modules/multimedia/FileCard/GoogleDriveFileCard.js +102 -0
  25. package/dist/modules/multimedia/FileCard/NextcloudFileCard.d.ts +25 -0
  26. package/dist/modules/multimedia/FileCard/NextcloudFileCard.js +102 -0
  27. package/dist/modules/multimedia/FileCard/index.d.ts +4 -0
  28. package/dist/modules/multimedia/GoogleDrive/GoogleDrive.d.ts +24 -0
  29. package/dist/modules/multimedia/GoogleDrive/GoogleDrive.js +100 -0
  30. package/dist/modules/multimedia/GoogleDrive/index.d.ts +2 -0
  31. package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.d.ts +7 -1
  32. package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +2 -0
  33. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +2 -2
  34. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +48 -12
  35. package/dist/modules/multimedia/MediaLibrary/innertabs/GoogleDrive.d.ts +1 -0
  36. package/dist/modules/multimedia/MediaLibrary/innertabs/GoogleDrive.js +61 -0
  37. package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.d.ts +1 -0
  38. package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.js +48 -0
  39. package/dist/modules/multimedia/MediaLibrary/innertabs/index.d.ts +2 -0
  40. package/dist/modules/multimedia/MediaLibrary/innertabs/index.js +4 -0
  41. package/dist/modules/multimedia/Nextcloud/Nextcloud.d.ts +24 -0
  42. package/dist/modules/multimedia/Nextcloud/Nextcloud.js +124 -0
  43. package/dist/modules/multimedia/Nextcloud/index.d.ts +2 -0
  44. package/dist/modules/multimedia/Workspace/Workspace.js +8 -5
  45. package/dist/modules/multimedia/index.d.ts +2 -0
  46. package/dist/multimedia.js +26 -18
  47. package/package.json +6 -6
  48. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.d.ts +0 -16
  49. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.js +0 -15
  50. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.d.ts +0 -21
  51. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.js +0 -47
  52. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/index.d.ts +0 -2
  53. package/dist/modules/icons/components/IconAddWidget.d.ts +0 -7
  54. package/dist/modules/icons/components/IconAddWidget.js +0 -12
@@ -14,26 +14,19 @@ import useZendeskGuide from "../../hooks/useZendeskGuide/useZendeskGuide.js";
14
14
  import useCantoo from "../../hooks/useCantoo/useCantoo.js";
15
15
  import Alert from "../Alert/Alert.js";
16
16
  import ButtonBeta from "../ButtonBeta/ButtonBeta.js";
17
- import HelpZone from "../../modules/HelpZone/HelpZone.js";
18
- const HeaderV2 = /* @__PURE__ */ lazy(() => import("../../modules/homepage/components/Header/Header.js"));
19
- function getHeaderColor() {
20
- return getComputedStyle(document.documentElement).getPropertyValue("--primitive-blue-400").trim();
21
- }
22
- const Layout = ({
17
+ const HeaderV2 = /* @__PURE__ */ lazy(() => import("../../modules/homepage/components/Header/Header.js")), Layout = ({
23
18
  children,
24
19
  headless = !1,
25
20
  whiteBg = !0,
26
21
  className,
27
22
  ...restProps
28
23
  }) => {
29
- var _a;
30
24
  const {
31
25
  theme
32
- } = useEdificeTheme(), override = useUiOverride("layout.header"), isHeaderV2 = (override == null ? void 0 : override.variant) === "v2", isEdificeInProductHelp = ((_a = useUiOverride("layout.helpzone")) == null ? void 0 : _a.variant) === "edifice-in-product", {
26
+ } = useEdificeTheme(), override = useUiOverride("layout.header"), isHeaderV2 = (override == null ? void 0 : override.variant) === "v2", {
33
27
  productOverride,
34
28
  background,
35
- isBackgroundImageOverridden,
36
- betaEnabled
29
+ isBackgroundImageOverridden
37
30
  } = useBackground(), {
38
31
  toggleOverlay
39
32
  } = useOverlay(), toast = useToast(), {
@@ -42,28 +35,22 @@ const Layout = ({
42
35
  showCookiesConsent,
43
36
  handleConsultCookies,
44
37
  handleCloseCookiesConsent
45
- } = useCookiesConsent(), {
46
- isReady: isHelpZoneReady,
47
- isOpen: isHelpZoneOpen,
48
- open: openHelpZone,
49
- close: closeHelpZone
50
- } = useZendeskGuide(isEdificeInProductHelp ? getHeaderColor() : void 0);
51
- useCantoo();
38
+ } = useCookiesConsent();
39
+ useZendeskGuide(), useCantoo();
52
40
  const classes = clsx("d-flex flex-column", {
53
41
  "bg-white": whiteBg,
54
42
  "container-fluid": !headless,
55
43
  "rounded-4 border": (theme == null ? void 0 : theme.is1d) && !headless,
56
44
  "mt-24": (theme == null ? void 0 : theme.is1d) && !headless
57
- }, className), renderHeader = headless ? null : isHeaderV2 ? /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(HeaderV2, { src: theme == null ? void 0 : theme.basePath, dataProduct: override == null ? void 0 : override.theme, onNotificationsClick: toggleOverlay }) }) : /* @__PURE__ */ jsx(Header, { is1d: theme == null ? void 0 : theme.is1d, src: theme == null ? void 0 : theme.basePath }), renderNotificationsOverlay = !headless && isHeaderV2 && /* @__PURE__ */ jsx(HeaderNotificationsOverlay, {}), renderCookies = showCookiesConsent && /* @__PURE__ */ jsx(Alert, { type: "info", className: "m-12 rgpd", isConfirm: !0, position: "bottom-right", button: /* @__PURE__ */ jsx(ButtonBeta, { variant: "outline", onClick: handleConsultCookies, children: t("rgpd.cookies.banner.button.consult") }), onClose: handleCloseCookiesConsent, children: t("rgpd.cookies.banner.text1") }), renderToaster = toast.renderToaster(), isBackgroundHidden = !!(theme != null && theme.is1d || !betaEnabled);
58
- return /* @__PURE__ */ jsxs("div", { "data-product": productOverride, "data-background": isBackgroundHidden ? void 0 : background, className: clsx("layout", {
45
+ }, className), renderHeader = headless ? null : isHeaderV2 ? /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(HeaderV2, { src: theme == null ? void 0 : theme.basePath, dataProduct: override == null ? void 0 : override.theme, onNotificationsClick: toggleOverlay }) }) : /* @__PURE__ */ jsx(Header, { is1d: theme == null ? void 0 : theme.is1d, src: theme == null ? void 0 : theme.basePath }), renderNotificationsOverlay = !headless && isHeaderV2 && /* @__PURE__ */ jsx(HeaderNotificationsOverlay, {}), renderCookies = showCookiesConsent && /* @__PURE__ */ jsx(Alert, { type: "info", className: "m-12 rgpd", isConfirm: !0, position: "bottom-right", button: /* @__PURE__ */ jsx(ButtonBeta, { variant: "outline", onClick: handleConsultCookies, children: t("rgpd.cookies.banner.button.consult") }), onClose: handleCloseCookiesConsent, children: t("rgpd.cookies.banner.text1") }), renderToaster = toast.renderToaster();
46
+ return /* @__PURE__ */ jsxs("div", { "data-product": productOverride, "data-background": theme != null && theme.is1d ? void 0 : background, className: clsx("layout", {
59
47
  "layout-has-background-image": isBackgroundImageOverridden
60
48
  }), children: [
61
49
  renderHeader,
62
50
  renderNotificationsOverlay,
63
51
  /* @__PURE__ */ jsx("main", { className: classes, ...restProps, children }),
64
52
  renderToaster,
65
- renderCookies,
66
- isEdificeInProductHelp && /* @__PURE__ */ jsx(HelpZone, { isReady: isHelpZoneReady, isOpen: isHelpZoneOpen, onOpen: openHelpZone, onClose: closeHelpZone })
53
+ renderCookies
67
54
  ] });
68
55
  };
69
56
  export {
@@ -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
@@ -24,8 +24,6 @@ import { UsefulLinks } from "./modules/homepage/components/UsefulLinks/UsefulLin
24
24
  import { UsefulLinksContainer } from "./modules/homepage/components/UsefulLinks/UsefulLinksContainer.js";
25
25
  import { UsefulLinksModal } from "./modules/homepage/components/UsefulLinks/UsefulLinksModal.js";
26
26
  import { UserSpaceContainer } from "./modules/homepage/components/UserSpace/UserSpaceContainer.js";
27
- import { WidgetToggle } from "./modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.js";
28
- import { WidgetsPersonalizationPanel } from "./modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.js";
29
27
  import { useCommunities } from "./modules/homepage/components/Communities/useCommunities.js";
30
28
  export {
31
29
  default2 as Communities,
@@ -54,8 +52,6 @@ export {
54
52
  UsefulLinksModal,
55
53
  default13 as UserSpace,
56
54
  UserSpaceContainer,
57
- WidgetToggle,
58
- WidgetsPersonalizationPanel,
59
55
  useCommunities,
60
56
  useUsefulLinksContainer
61
57
  };
@@ -12,6 +12,7 @@ export * from './useDirectory';
12
12
  export * from './useDropdown';
13
13
  export * from './useDropzone';
14
14
  export * from './useEdificeIcons';
15
+ export * from './useGoogleDriveSearch';
15
16
  export * from './useHasWorkflow';
16
17
  export * from './useHover';
17
18
  export * from './useHttpErrorToast';
@@ -23,6 +24,7 @@ export * from './useIsAdmlcOrAdmc';
23
24
  export * from './useKeyPress';
24
25
  export * from './useLibraryUrl';
25
26
  export * from './useMediaLibrary';
27
+ export * from './useNextcloudSearch';
26
28
  export * from './usePublicConf';
27
29
  export * from './useScreeb';
28
30
  export * from './useScrollToTop';
@@ -1,6 +1,5 @@
1
1
  export type Background = 'default' | 'pink-200' | 'yellow-200' | 'orange-200' | 'blue-200' | 'green-200';
2
2
  declare const _default: () => {
3
- betaEnabled: boolean | undefined;
4
3
  background: Background;
5
4
  isBackgroundImageOverridden: boolean;
6
5
  productOverride: string | undefined;
@@ -1,12 +1,10 @@
1
1
  import useUiOverride from "../useUiOverride/useUiOverride.js";
2
2
  import useUserPreferences from "../useUserPreferences/useUserPreferences.js";
3
3
  const useBackground = () => {
4
- var _a;
5
4
  const backgroundOverride = useUiOverride("layout.background"), backgroundDefault = useUiOverride("background.default"), {
6
5
  preferences
7
6
  } = useUserPreferences(), isBackgroundImageOverridden = (backgroundOverride == null ? void 0 : backgroundOverride.variant) === "image";
8
7
  return {
9
- betaEnabled: (_a = preferences == null ? void 0 : preferences.homePage) == null ? void 0 : _a.betaEnabled,
10
8
  /* Actual background is either : user's prefered value, theme-conf overriden value or 'default' */
11
9
  background: (preferences == null ? void 0 : preferences.background) ?? (backgroundDefault == null ? void 0 : backgroundDefault.variant) ?? "default",
12
10
  isBackgroundImageOverridden,
@@ -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
+ };
@@ -9,8 +9,6 @@ export interface UseZendeskGuideAPI {
9
9
  /**
10
10
  * Add Zendesk Guide
11
11
  *
12
- * @param headerColor Overrides the widget panel's theme color. Can change
13
- * across renders (e.g. once resolved from async platform config) — the
14
- * widget is updated in place, no need to keep it stable.
12
+ * @param headerColor Overrides the widget panel's theme color.
15
13
  */
16
14
  export default function useZendeskGuide(headerColor?: string): UseZendeskGuideAPI;
@@ -83,7 +83,8 @@ function useZendeskGuide(headerColor) {
83
83
  }), Object.keys(zendeskGuideConfig.module).length > 0 && setDataModule(zendeskGuideConfig.module), window.zE("webWidget", "show"), window.zE("webWidget", "updateSettings", {
84
84
  webWidget: {
85
85
  color: {
86
- theme: headerColor || zendeskGuideConfig.color || "#ffc400"
86
+ theme: zendeskGuideConfig.color || "#ffc400",
87
+ header: headerColor
87
88
  },
88
89
  zIndex: 3,
89
90
  launcher: {
@@ -116,15 +117,7 @@ function useZendeskGuide(headerColor) {
116
117
  };
117
118
  }
118
119
  })();
119
- }, [hasSupportWorkflow]), useEffect(() => {
120
- !isReady || headerColor === void 0 || window.zE("webWidget", "updateSettings", {
121
- webWidget: {
122
- color: {
123
- theme: headerColor
124
- }
125
- }
126
- });
127
- }, [headerColor, isReady]), {
120
+ }, [hasSupportWorkflow]), {
128
121
  isReady,
129
122
  isOpen,
130
123
  open,