@edifice.io/react 2.6.9-develop.20261013171251 → 2.6.10-develop-b2school.20261019104630

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 (133) hide show
  1. package/dist/components/Layout/Layout.js +12 -4
  2. package/dist/components/Layout/components/Header.js +4 -4
  3. package/dist/components/Layout/components/NavLink.d.ts +3 -3
  4. package/dist/components/Layout/components/NavLink.js +5 -3
  5. package/dist/components/Tree/utilities/tree.js +21 -1
  6. package/dist/homepage.js +62 -24
  7. package/dist/hooks/index.d.ts +2 -0
  8. package/dist/hooks/useBackground/useBackground.d.ts +1 -1
  9. package/dist/hooks/useCarbonioUnread/index.d.ts +1 -0
  10. package/dist/hooks/useCarbonioUnread/useCarbonioUnread.d.ts +5 -0
  11. package/dist/hooks/useCarbonioUnread/useCarbonioUnread.js +24 -0
  12. package/dist/hooks/useNextcloudSearch/index.d.ts +1 -0
  13. package/dist/hooks/useNextcloudSearch/useNextcloudSearch.d.ts +14 -0
  14. package/dist/hooks/useNextcloudSearch/useNextcloudSearch.js +64 -0
  15. package/dist/hooks/useZendeskGuide/useZendeskGuide.d.ts +2 -6
  16. package/dist/hooks/useZendeskGuide/useZendeskGuide.js +11 -8
  17. package/dist/icons.js +404 -402
  18. package/dist/index.js +160 -152
  19. package/dist/modules/HelpZone/HelpZone.js +6 -8
  20. package/dist/modules/HelpZone/HelpZoneContainer.js +2 -5
  21. package/dist/modules/homepage/components/Agenda/Agenda.d.ts +10 -0
  22. package/dist/modules/homepage/components/Agenda/Agenda.js +54 -0
  23. package/dist/modules/homepage/components/Agenda/AgendaContainer.d.ts +1 -0
  24. package/dist/modules/homepage/components/Agenda/AgendaContainer.js +14 -0
  25. package/dist/modules/homepage/components/Agenda/AgendaEventCard.d.ts +10 -0
  26. package/dist/modules/homepage/components/Agenda/AgendaEventCard.js +30 -0
  27. package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.d.ts +14 -0
  28. package/dist/modules/homepage/components/Agenda/hooks/useAgendaContainer.js +27 -0
  29. package/dist/modules/homepage/components/Agenda/index.d.ts +3 -0
  30. package/dist/modules/homepage/components/Agenda/services/api/agendaService.d.ts +24 -0
  31. package/dist/modules/homepage/components/Agenda/services/api/agendaService.js +45 -0
  32. package/dist/modules/homepage/components/Agenda/services/api/index.d.ts +4 -0
  33. package/dist/modules/homepage/components/Agenda/services/api/index.js +5 -0
  34. package/dist/modules/homepage/components/Agenda/services/queries/agenda.d.ts +19 -0
  35. package/dist/modules/homepage/components/Agenda/services/queries/agenda.js +26 -0
  36. package/dist/modules/homepage/components/BriefMe/BriefMe.d.ts +9 -0
  37. package/dist/modules/homepage/components/BriefMe/BriefMe.js +59 -0
  38. package/dist/modules/homepage/components/BriefMe/BriefMeContainer.d.ts +4 -0
  39. package/dist/modules/homepage/components/BriefMe/BriefMeContainer.js +17 -0
  40. package/dist/modules/homepage/components/BriefMe/index.d.ts +4 -0
  41. package/dist/modules/homepage/components/BriefMe/types.d.ts +17 -0
  42. package/dist/modules/homepage/components/BriefMe/types.js +8 -0
  43. package/dist/modules/homepage/components/BriefMe/useBriefMe.d.ts +31 -0
  44. package/dist/modules/homepage/components/BriefMe/useBriefMe.js +51 -0
  45. package/dist/modules/homepage/components/Cantine/Cantine.d.ts +7 -0
  46. package/dist/modules/homepage/components/Cantine/Cantine.js +44 -0
  47. package/dist/modules/homepage/components/Cantine/CantineContainer.d.ts +4 -0
  48. package/dist/modules/homepage/components/Cantine/CantineContainer.js +18 -0
  49. package/dist/modules/homepage/components/Cantine/CantineModal.d.ts +24 -0
  50. package/dist/modules/homepage/components/Cantine/CantineModal.js +88 -0
  51. package/dist/modules/homepage/components/Cantine/CantineModalContainer.d.ts +7 -0
  52. package/dist/modules/homepage/components/Cantine/CantineModalContainer.js +12 -0
  53. package/dist/modules/homepage/components/Cantine/components/CantineLegend.d.ts +5 -0
  54. package/dist/modules/homepage/components/Cantine/components/CantineLegend.js +22 -0
  55. package/dist/modules/homepage/components/Cantine/components/CantineMenuSection.d.ts +6 -0
  56. package/dist/modules/homepage/components/Cantine/components/CantineMenuSection.js +28 -0
  57. package/dist/modules/homepage/components/Cantine/components/cantineLabels.d.ts +12 -0
  58. package/dist/modules/homepage/components/Cantine/components/cantineLabels.js +60 -0
  59. package/dist/modules/homepage/components/Cantine/hooks/useCantine.d.ts +11 -0
  60. package/dist/modules/homepage/components/Cantine/hooks/useCantine.js +20 -0
  61. package/dist/modules/homepage/components/Cantine/hooks/useCantineMenu.d.ts +24 -0
  62. package/dist/modules/homepage/components/Cantine/hooks/useCantineMenu.js +65 -0
  63. package/dist/modules/homepage/components/Cantine/hooks/useCantineModal.d.ts +23 -0
  64. package/dist/modules/homepage/components/Cantine/hooks/useCantineModal.js +43 -0
  65. package/dist/modules/homepage/components/Cantine/index.d.ts +7 -0
  66. package/dist/modules/homepage/components/Cantine/types.d.ts +42 -0
  67. package/dist/modules/homepage/components/Communities/Communities.js +4 -4
  68. package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.d.ts +16 -0
  69. package/dist/modules/homepage/components/GenerationHdf/GenerationHdf.js +48 -0
  70. package/dist/modules/homepage/components/GenerationHdf/GenerationHdfContainer.d.ts +4 -0
  71. package/dist/modules/homepage/components/GenerationHdf/GenerationHdfContainer.js +12 -0
  72. package/dist/modules/homepage/components/GenerationHdf/formatSolde.d.ts +1 -0
  73. package/dist/modules/homepage/components/GenerationHdf/formatSolde.js +6 -0
  74. package/dist/modules/homepage/components/GenerationHdf/index.d.ts +3 -0
  75. package/dist/modules/homepage/components/GenerationHdf/useGenerationHdf.d.ts +10 -0
  76. package/dist/modules/homepage/components/GenerationHdf/useGenerationHdf.js +68 -0
  77. package/dist/modules/homepage/components/Header/Header.js +37 -14
  78. package/dist/modules/homepage/components/Header/MyAppsPopover.d.ts +5 -0
  79. package/dist/modules/homepage/components/Header/MyAppsPopover.js +28 -0
  80. package/dist/modules/homepage/components/Header/useSafeHoverPopover.js +32 -0
  81. package/dist/modules/homepage/components/HomeCard/HomeCardHeader.d.ts +5 -1
  82. package/dist/modules/homepage/components/HomeCard/HomeCardHeader.js +1 -1
  83. package/dist/modules/homepage/components/MessageFlashList/MessageFlash.js +1 -1
  84. package/dist/modules/homepage/components/Notifications/NotificationList.js +5 -5
  85. package/dist/modules/homepage/components/Notifications/NotificationSkeleton.js +2 -2
  86. package/dist/modules/homepage/components/Notifications/components/NotificationFilterMenu.js +1 -5
  87. package/dist/modules/homepage/components/Notifications/components/NotificationFilterModal.js +10 -12
  88. package/dist/modules/homepage/components/Notifications/components/NotificationOptionsMenu.js +3 -9
  89. package/dist/modules/homepage/components/Notifications/components/ReportNotificationModal.js +6 -12
  90. package/dist/modules/homepage/components/Notifications/components/notificationAdapter.js +12 -10
  91. package/dist/modules/homepage/components/Notifications/hooks/useNotificationList.js +9 -10
  92. package/dist/modules/homepage/components/Qwant/Qwant.d.ts +4 -0
  93. package/dist/modules/homepage/components/Qwant/Qwant.js +41 -0
  94. package/dist/modules/homepage/components/Qwant/QwantContainer.d.ts +1 -0
  95. package/dist/modules/homepage/components/Qwant/QwantContainer.js +10 -0
  96. package/dist/modules/homepage/components/Qwant/index.d.ts +3 -0
  97. package/dist/modules/homepage/components/SchoolSpace/SchoolSpaceContainer.js +1 -1
  98. package/dist/modules/homepage/components/Universalis/Universalis.d.ts +8 -0
  99. package/dist/modules/homepage/components/Universalis/Universalis.js +62 -0
  100. package/dist/modules/homepage/components/Universalis/UniversalisContainer.d.ts +1 -0
  101. package/dist/modules/homepage/components/Universalis/UniversalisContainer.js +16 -0
  102. package/dist/modules/homepage/components/Universalis/index.d.ts +3 -0
  103. package/dist/modules/homepage/components/UserSpace/UserSpace.d.ts +3 -1
  104. package/dist/modules/homepage/components/UserSpace/UserSpace.js +13 -7
  105. package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.d.ts +4 -2
  106. package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.js +3 -2
  107. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.d.ts +16 -0
  108. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.js +15 -0
  109. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.d.ts +21 -0
  110. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.js +47 -0
  111. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/index.d.ts +2 -0
  112. package/dist/modules/homepage/components/index.d.ts +8 -1
  113. package/dist/modules/homepage/{components/SchoolSpace → hooks}/useUserSchools.d.ts +2 -2
  114. package/dist/modules/homepage/{components/SchoolSpace → hooks}/useUserSchools.js +4 -4
  115. package/dist/modules/icons/components/IconAddWidget.d.ts +7 -0
  116. package/dist/modules/icons/components/IconAddWidget.js +12 -0
  117. package/dist/modules/icons/components/index.d.ts +1 -0
  118. package/dist/modules/multimedia/FileCard/NextcloudFileCard.d.ts +25 -0
  119. package/dist/modules/multimedia/FileCard/NextcloudFileCard.js +102 -0
  120. package/dist/modules/multimedia/FileCard/index.d.ts +2 -0
  121. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.d.ts +2 -2
  122. package/dist/modules/multimedia/MediaLibrary/MediaLibrary.js +36 -11
  123. package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.d.ts +1 -0
  124. package/dist/modules/multimedia/MediaLibrary/innertabs/Nextcloud.js +48 -0
  125. package/dist/modules/multimedia/MediaLibrary/innertabs/index.d.ts +1 -0
  126. package/dist/modules/multimedia/MediaLibrary/innertabs/index.js +2 -0
  127. package/dist/modules/multimedia/Nextcloud/Nextcloud.d.ts +24 -0
  128. package/dist/modules/multimedia/Nextcloud/Nextcloud.js +120 -0
  129. package/dist/modules/multimedia/Nextcloud/index.d.ts +2 -0
  130. package/dist/modules/multimedia/Workspace/Workspace.js +8 -5
  131. package/dist/modules/multimedia/index.d.ts +1 -0
  132. package/dist/multimedia.js +16 -12
  133. package/package.json +6 -6
@@ -1,7 +1,9 @@
1
1
  import { ReactNode } from 'react';
2
- export declare function UserSpaceContainer({ children }: {
2
+ export interface UserSpaceContainerProps {
3
3
  children?: ReactNode;
4
- }): import("react/jsx-runtime").JSX.Element | null;
4
+ onCustomizeWidgetsClick?: () => void;
5
+ }
6
+ export declare function UserSpaceContainer({ children, onCustomizeWidgetsClick, }: UserSpaceContainerProps): import("react/jsx-runtime").JSX.Element | null;
5
7
  export declare namespace UserSpaceContainer {
6
8
  var displayName: string;
7
9
  }
@@ -2,7 +2,8 @@ import { jsx } from "react/jsx-runtime";
2
2
  import UserSpace from "./UserSpace.js";
3
3
  import useUser from "../../../../hooks/useUser/useUser.js";
4
4
  function UserSpaceContainer({
5
- children
5
+ children,
6
+ onCustomizeWidgetsClick
6
7
  }) {
7
8
  var _a;
8
9
  const {
@@ -12,7 +13,7 @@ function UserSpaceContainer({
12
13
  } = useUser();
13
14
  if (!user || !userDescription) return null;
14
15
  const name = user.username || "", profile = ((_a = userDescription.profiles) == null ? void 0 : _a[0]) || "Guest";
15
- return /* @__PURE__ */ jsx(UserSpace, { name, profile, avatar, children });
16
+ return /* @__PURE__ */ jsx(UserSpace, { name, profile, avatar, onCustomizeWidgetsClick, children });
16
17
  }
17
18
  export {
18
19
  UserSpaceContainer
@@ -0,0 +1,16 @@
1
+ import { ComponentPropsWithoutRef } from 'react';
2
+ export interface WidgetToggleProps extends Omit<ComponentPropsWithoutRef<'button'>, 'onClick' | 'type' | 'role' | 'aria-checked'> {
3
+ 'checked': boolean;
4
+ 'onChange': () => void;
5
+ 'aria-label': string;
6
+ }
7
+ /**
8
+ * Dedicated on/off control for a widget row in `WidgetsPersonalizationPanel`.
9
+ * The generic `Switch` component doesn't match this panel's design (size,
10
+ * filled-vs-outlined states), so this is a small purpose-built control
11
+ * rather than a `Switch` variant.
12
+ */
13
+ export declare function WidgetToggle({ checked, onChange, disabled, ...rest }: WidgetToggleProps): import("react/jsx-runtime").JSX.Element;
14
+ export declare namespace WidgetToggle {
15
+ var displayName: string;
16
+ }
@@ -0,0 +1,15 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import clsx from "clsx";
3
+ function WidgetToggle({
4
+ checked,
5
+ onChange,
6
+ disabled,
7
+ ...rest
8
+ }) {
9
+ return /* @__PURE__ */ jsx("button", { type: "button", role: "switch", "aria-checked": checked, disabled, className: clsx("widget-toggle", {
10
+ "widget-toggle--checked": checked
11
+ }), onClick: onChange, ...rest, children: /* @__PURE__ */ jsx("span", { className: "widget-toggle__knob" }) });
12
+ }
13
+ export {
14
+ WidgetToggle
15
+ };
@@ -0,0 +1,21 @@
1
+ import { ReactNode } from 'react';
2
+ export interface WidgetPersonalizationItem {
3
+ id: string;
4
+ label: string;
5
+ icon: ReactNode;
6
+ checked: boolean;
7
+ /** When true, the widget is pinned by an admin: no toggle, lock icon instead. */
8
+ locked?: boolean;
9
+ }
10
+ export interface WidgetsPersonalizationPanelProps {
11
+ items: WidgetPersonalizationItem[];
12
+ isLoading?: boolean;
13
+ onToggle: (id: string) => void;
14
+ onClose: () => void;
15
+ title?: string;
16
+ description?: string;
17
+ }
18
+ export declare function WidgetsPersonalizationPanel({ items, isLoading, onToggle, onClose, title, description, }: WidgetsPersonalizationPanelProps): import("react/jsx-runtime").JSX.Element;
19
+ export declare namespace WidgetsPersonalizationPanel {
20
+ var displayName: string;
21
+ }
@@ -0,0 +1,47 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useTranslation } from "react-i18next";
3
+ import clsx from "clsx";
4
+ import SvgIconClose from "../../../icons/components/IconClose.js";
5
+ import SvgIconLock from "../../../icons/components/IconLock.js";
6
+ import { WidgetToggle } from "./WidgetToggle.js";
7
+ import Heading from "../../../../components/Heading/Heading.js";
8
+ import IconButton from "../../../../components/Button/IconButton.js";
9
+ import TextSkeleton from "../../../../components/Skeleton/TextSkeleton.js";
10
+ const SKELETON_ROWS = 5;
11
+ function WidgetsPersonalizationPanel({
12
+ items,
13
+ isLoading = !1,
14
+ onToggle,
15
+ onClose,
16
+ title,
17
+ description
18
+ }) {
19
+ const {
20
+ t
21
+ } = useTranslation();
22
+ return /* @__PURE__ */ jsxs("div", { className: "widgets-personalization-panel", children: [
23
+ /* @__PURE__ */ jsxs("div", { className: "widgets-personalization-panel__header", children: [
24
+ /* @__PURE__ */ jsx(Heading, { level: "h2", headingStyle: "h5", className: "widgets-personalization-panel__title", children: title ?? t("homepage.widgetsPersonalization.title") }),
25
+ /* @__PURE__ */ jsx(IconButton, { icon: /* @__PURE__ */ jsx(SvgIconClose, {}), variant: "ghost", color: "tertiary", "aria-label": t("close"), onClick: onClose, "data-testid": "widgetspersonalization-button-close" })
26
+ ] }),
27
+ /* @__PURE__ */ jsx("p", { className: "widgets-personalization-panel__description", children: description ?? t("homepage.widgetsPersonalization.description") }),
28
+ isLoading ? /* @__PURE__ */ jsx("ul", { className: "widgets-personalization-panel__list", "aria-hidden": "true", children: Array.from({
29
+ length: SKELETON_ROWS
30
+ }).map((_, index) => /* @__PURE__ */ jsxs("li", { className: "widgets-personalization-panel__item widgets-personalization-panel__item--skeleton", children: [
31
+ /* @__PURE__ */ jsx(TextSkeleton, { className: "widgets-personalization-panel__item-icon-skeleton" }),
32
+ /* @__PURE__ */ jsx(TextSkeleton, { className: "widgets-personalization-panel__item-label-skeleton" })
33
+ ] }, index)) }) : items.length === 0 ? /* @__PURE__ */ jsx("div", { className: "widgets-personalization-panel__empty", children: /* @__PURE__ */ jsx("p", { className: "widgets-personalization-panel__empty-text", children: t("homepage.widgetsPersonalization.empty") }) }) : /* @__PURE__ */ jsx("ul", { className: "widgets-personalization-panel__list", children: items.map((item) => /* @__PURE__ */ jsxs("li", { className: clsx("widgets-personalization-panel__item", {
34
+ "widgets-personalization-panel__item--checked": item.checked && !item.locked,
35
+ "widgets-personalization-panel__item--locked": item.locked
36
+ }), "data-testid": `widgetspersonalization-item-${item.id}`, children: [
37
+ /* @__PURE__ */ jsx("span", { className: "widgets-personalization-panel__item-icon", "aria-hidden": "true", children: item.icon }),
38
+ /* @__PURE__ */ jsx("span", { className: "widgets-personalization-panel__item-label", children: item.label }),
39
+ item.locked ? /* @__PURE__ */ jsx("span", { className: "widgets-personalization-panel__item-lock", role: "img", "aria-label": t("homepage.widgetsPersonalization.locked"), "data-testid": `widgetspersonalization-lock-${item.id}`, children: /* @__PURE__ */ jsx(SvgIconLock, {}) }) : /* @__PURE__ */ jsx(WidgetToggle, { checked: item.checked, onChange: () => onToggle(item.id), "aria-label": t("homepage.widgetsPersonalization.toggle", {
40
+ label: item.label
41
+ }), "data-testid": `widgetspersonalization-toggle-${item.id}` })
42
+ ] }, item.id)) })
43
+ ] });
44
+ }
45
+ export {
46
+ WidgetsPersonalizationPanel
47
+ };
@@ -0,0 +1,2 @@
1
+ export * from './WidgetsPersonalizationPanel';
2
+ export * from './WidgetToggle';
@@ -1,10 +1,17 @@
1
+ export * from './Agenda';
2
+ export * from './Communities';
3
+ export * from './BriefMe';
4
+ export * from './Cantine';
1
5
  export * from './Favorites';
6
+ export * from './GenerationHdf';
2
7
  export * from './Header';
3
8
  export * from './HomeCard';
4
9
  export * from './LastInfos';
5
10
  export * from './MessageFlashList';
6
11
  export * from './Notifications';
12
+ export * from './Qwant';
7
13
  export * from './SchoolSpace';
8
14
  export * from './UsefulLinks';
15
+ export * from './Universalis';
9
16
  export * from './UserSpace';
10
- export * from './Communities';
17
+ export * from './WidgetsPersonalizationPanel';
@@ -1,5 +1,5 @@
1
- import { School } from '@edifice.io/client';
2
- export declare function useUserSchools(): {
1
+ import { School, WidgetName } from '@edifice.io/client';
2
+ export declare function useUserSchools(widgetName?: WidgetName): {
3
3
  schools: School[];
4
4
  selectedSchool: School | undefined;
5
5
  handleSelectedSchoolChange: (school: School) => void;
@@ -1,15 +1,15 @@
1
1
  import { WIDGET_NAME } from "@edifice.io/client";
2
2
  import { useState, useEffect } from "react";
3
- import useWidget from "../../hooks/useWidget.js";
4
- import useSession from "../../../../hooks/useSession/useSession.js";
5
- function useUserSchools() {
3
+ import useWidget from "./useWidget.js";
4
+ import useSession from "../../../hooks/useSession/useSession.js";
5
+ function useUserSchools(widgetName = WIDGET_NAME.SCHOOL) {
6
6
  var _a, _b;
7
7
  const {
8
8
  data: session
9
9
  } = useSession(), {
10
10
  preference,
11
11
  savePreference
12
- } = useWidget(WIDGET_NAME.SCHOOL), [selectedSchool, setSelectedSchool] = useState(), [schools, setSchools] = useState((_a = session == null ? void 0 : session.userDescription) == null ? void 0 : _a.schools);
12
+ } = useWidget(widgetName), [selectedSchool, setSelectedSchool] = useState(), [schools, setSchools] = useState((_a = session == null ? void 0 : session.userDescription) == null ? void 0 : _a.schools);
13
13
  return useEffect(() => {
14
14
  var _a2;
15
15
  const newSchools = (_a2 = session == null ? void 0 : session.userDescription) == null ? void 0 : _a2.schools;
@@ -0,0 +1,7 @@
1
+ import { SVGProps } from 'react';
2
+ interface SVGRProps {
3
+ title?: string;
4
+ titleId?: string;
5
+ }
6
+ declare const SvgIconAddWidget: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default SvgIconAddWidget;
@@ -0,0 +1,12 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ const SvgIconAddWidget = ({
3
+ title,
4
+ titleId,
5
+ ...props
6
+ }) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 20 20", "aria-hidden": "true", "aria-labelledby": titleId, ...props, children: [
7
+ title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
8
+ /* @__PURE__ */ jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M15.834 10.833c.46 0 .833.373.833.834v2.5h2.5a.833.833 0 0 1 0 1.666h-2.5v2.5a.833.833 0 0 1-1.667 0v-2.5h-2.5a.833.833 0 0 1 0-1.666H15v-2.5c0-.46.373-.834.834-.834M8.333 3.333A.833.833 0 0 0 7.5 2.5h-5a.833.833 0 0 0-.833.833v13.334c0 .46.373.833.833.833h5c.46 0 .833-.373.833-.833zM10 16.667a2.5 2.5 0 0 1-2.5 2.5h-5a2.5 2.5 0 0 1-2.5-2.5V3.333a2.5 2.5 0 0 1 2.5-2.5h5a2.5 2.5 0 0 1 2.5 2.5zM18.334 3.333A.833.833 0 0 0 17.5 2.5h-3.333a.833.833 0 0 0-.833.833v3.334c0 .46.373.833.833.833H17.5c.46 0 .834-.373.834-.833zM20 6.667a2.5 2.5 0 0 1-2.5 2.5h-3.333a2.5 2.5 0 0 1-2.5-2.5V3.333a2.5 2.5 0 0 1 2.5-2.5H17.5a2.5 2.5 0 0 1 2.5 2.5z", clipRule: "evenodd" })
9
+ ] });
10
+ export {
11
+ SvgIconAddWidget as default
12
+ };
@@ -1,4 +1,5 @@
1
1
  export { default as IconAddUser } from './IconAddUser';
2
+ export { default as IconAddWidget } from './IconAddWidget';
2
3
  export { default as IconAdd } from './IconAdd';
3
4
  export { default as IconAdjustSettings } from './IconAdjustSettings';
4
5
  export { default as IconAiFill } from './IconAiFill';
@@ -0,0 +1,25 @@
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;
@@ -0,0 +1,102 @@
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 NextcloudFileCard = ({
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.nextcloud().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
+ NextcloudFileCard as default
102
+ };
@@ -1,2 +1,4 @@
1
1
  export { default as FileCard } from './FileCard';
2
2
  export * from './FileCard';
3
+ export { default as NextcloudFileCard } from './NextcloudFileCard';
4
+ export * from './NextcloudFileCard';
@@ -1,4 +1,4 @@
1
- import { WorkspaceElement, WorkspaceVisibility } from '@edifice.io/client';
1
+ import { NextcloudDocument, WorkspaceElement, WorkspaceVisibility } from '@edifice.io/client';
2
2
  import { TabsItemProps } from '../../../components';
3
3
  import { ExternalLinkTabProps } from './innertabs/ExternalLink';
4
4
  import { InternalLinkTabProps, InternalLinkTabResult } from './innertabs/InternalLink';
@@ -54,7 +54,7 @@ export interface MediaLibraryRef {
54
54
  /**
55
55
  * The resulting type depends on the actual selected Tab when modal is closed.
56
56
  */
57
- export type MediaLibraryResult = WorkspaceElement[] | WorkspaceElement | InternalLinkTabResult | string | /*TODO type des autres résultats ?*/ any;
57
+ export type MediaLibraryResult = WorkspaceElement[] | WorkspaceElement | NextcloudDocument[] | InternalLinkTabResult | string | /*TODO type des autres résultats ?*/ any;
58
58
  /**
59
59
  * MediaLibrary component properties
60
60
  */
@@ -5,6 +5,7 @@ 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";
8
9
  import SvgIconGlobe from "../../icons/components/IconGlobe.js";
9
10
  import SvgIconMic from "../../icons/components/IconMic.js";
10
11
  import SvgIconRecordVideo from "../../icons/components/IconRecordVideo.js";
@@ -12,6 +13,7 @@ import SvgIconSmartphone from "../../icons/components/IconSmartphone.js";
12
13
  import { InnerTabs } from "./innertabs/index.js";
13
14
  import { MediaLibraryContext } from "./MediaLibraryContext.js";
14
15
  import useHasWorkflow from "../../../hooks/useHasWorkflow/useHasWorkflow.js";
16
+ import usePublicConf from "../../../hooks/usePublicConf/usePublicConf.js";
15
17
  import useHttpErrorToast from "../../../hooks/useHttpErrorToast/useHttpErrorToast.js";
16
18
  import Modal from "../../../components/Modal/Modal.js";
17
19
  import { Tabs } from "../../../components/Tabs/components/Tabs.js";
@@ -29,6 +31,8 @@ const orderedTabs = [
29
31
  // Filesystem browser + drag'n'drop of files
30
32
  "workspace",
31
33
  // Media browser
34
+ "nextcloud",
35
+ // Nextcloud media browser
32
36
  "video-embedder"
33
37
  // Link to a hosted video
34
38
  ], mediaLibraryTypes = {
@@ -70,7 +74,7 @@ const orderedTabs = [
70
74
  onCancel,
71
75
  onTabChange
72
76
  }, ref) => {
73
- var _a;
77
+ var _a, _b;
74
78
  const linkTabProps = useRef(), refModal = useRef(null);
75
79
  useImperativeHandle(ref, () => ({
76
80
  show,
@@ -81,7 +85,9 @@ const orderedTabs = [
81
85
  }));
82
86
  const {
83
87
  t
84
- } = useTranslation(), workspaceCreateWorkflow = useHasWorkflow("org.entcore.workspace.controllers.WorkspaceController|addDocument"), videoCaptureWorkflow = useHasWorkflow("com.opendigitaleducation.video.controllers.VideoController|capture"), [type, setType] = useState(null);
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"), {
89
+ 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);
85
91
  useHttpErrorToast({
86
92
  active: !!type,
87
93
  isDismissible: !0,
@@ -96,6 +102,14 @@ const orderedTabs = [
96
102
  availableFor: ["audio", "video", "image", "attachment"],
97
103
  isEnable: null
98
104
  },
105
+ nextcloud: {
106
+ id: "nextcloud",
107
+ icon: /* @__PURE__ */ jsx(SvgIconGlobe2, {}),
108
+ label: t("bbm.nextcloud"),
109
+ content: /* @__PURE__ */ jsx(InnerTabs.Nextcloud, {}),
110
+ availableFor: ["audio", "video", "image", "attachment"],
111
+ isEnable: () => !!enableNextcloudTab
112
+ },
99
113
  upload: {
100
114
  id: "upload",
101
115
  icon: /* @__PURE__ */ jsx(SvgIconSmartphone, {}),
@@ -162,7 +176,7 @@ const orderedTabs = [
162
176
  ), [defaultTabId, setDefaultTabId] = useState(), defaultTabIdx = useMemo(() => {
163
177
  const index = tabs.findIndex((t2) => t2.id === defaultTabId);
164
178
  return 0 > index || index >= tabs.length ? 0 : index;
165
- }, [tabs, defaultTabId]), [resultCounter, setResultCounter] = useState(), [result, setResult] = useState(), [deletionsOnCancel, setDeletionsOnCancel] = useState([]), [onSuccessAction, setPreSuccess] = useState();
179
+ }, [tabs, defaultTabId]), [resultCounter, setResultCounter] = useState(), [result, setResult] = useState(), [deletionsOnCancel, setDeletionsOnCancel] = useState([]), [onSuccessAction, setPreSuccess] = useState(), [isSubmitting, setIsSubmitting] = useState(!1);
166
180
  function setVisibleTab(tab) {
167
181
  throw tabs.findIndex((t2) => t2.id === tab) < 0 ? "tab.not.visible" : "not.implemented.yet";
168
182
  }
@@ -177,22 +191,33 @@ const orderedTabs = [
177
191
  linkTabProps.current = props, "resourceId" in props || "appPrefix" in props || setDefaultTabId("external-link"), setType("hyperlink");
178
192
  };
179
193
  useEffect(() => {
180
- var _a2, _b;
194
+ var _a2, _b2;
181
195
  const typeKey = type || "none";
182
- !defaultTabId && typeof ((_a2 = mediaLibraryTypes[typeKey]) == null ? void 0 : _a2.defaultTab) == "string" && setDefaultTabId((_b = mediaLibraryTypes[typeKey]) == null ? void 0 : _b.defaultTab);
196
+ !defaultTabId && typeof ((_a2 = mediaLibraryTypes[typeKey]) == null ? void 0 : _a2.defaultTab) == "string" && setDefaultTabId((_b2 = mediaLibraryTypes[typeKey]) == null ? void 0 : _b2.defaultTab);
183
197
  }, [defaultTabId, type]);
184
- const modalHeader = t(((_a = mediaLibraryTypes[type ?? "none"]) == null ? void 0 : _a.title) ?? "bbm"), resetState = () => {
198
+ const modalHeader = t(((_b = mediaLibraryTypes[type ?? "none"]) == null ? void 0 : _b.title) ?? "bbm"), resetState = () => {
185
199
  linkTabProps.current = void 0, setResult(void 0), setResultCounter(void 0), setDefaultTabId(void 0), setPreSuccess(void 0), setDeletionsOnCancel([]);
186
200
  }, handleTabChange = (tab) => {
187
201
  onTabChange == null || onTabChange(tab, deletionsOnCancel), resetState();
188
202
  }, handleOnSuccess = useCallback(() => {
203
+ if (isSubmitting) return;
189
204
  const triggerSuccess = async (result2) => {
190
205
  result2 instanceof Array && ["protected", "public"].findIndex((v) => v === visibility) >= 0 && (result2 = await odeServices.workspace().transferDocuments(result2, appCode ?? "media-library", visibility)), onSuccess(result2);
191
206
  };
192
- onSuccessAction ? onSuccessAction().then((result2) => {
193
- triggerSuccess(result2);
194
- }) : result && triggerSuccess(result), resetState();
195
- }, [onSuccessAction, result, onSuccess, visibility, appCode]), handleOnCancel = () => {
207
+ (async () => {
208
+ setIsSubmitting(!0);
209
+ try {
210
+ if (onSuccessAction) {
211
+ const asyncResult = await onSuccessAction();
212
+ await triggerSuccess(asyncResult);
213
+ } else result && await triggerSuccess(result);
214
+ resetState();
215
+ } catch {
216
+ } finally {
217
+ setIsSubmitting(!1);
218
+ }
219
+ })();
220
+ }, [isSubmitting, onSuccessAction, result, onSuccess, visibility, appCode]), handleOnCancel = () => {
196
221
  onCancel(deletionsOnCancel), resetState();
197
222
  };
198
223
  return type && /* @__PURE__ */ jsx(MediaLibraryContext.Provider, { value: {
@@ -214,7 +239,7 @@ const orderedTabs = [
214
239
  ] }) }),
215
240
  /* @__PURE__ */ jsxs(Modal.Footer, { children: [
216
241
  /* @__PURE__ */ jsx(Button, { type: "button", color: "tertiary", variant: "ghost", onClick: handleOnCancel, children: t("cancel") }),
217
- /* @__PURE__ */ jsx(Button, { type: "button", color: "primary", variant: "filled", disabled: typeof result > "u", onClick: handleOnSuccess, children: resultCounter && resultCounter > 1 ? t("addMultiple", {
242
+ /* @__PURE__ */ jsx(Button, { type: "button", color: "primary", variant: "filled", disabled: typeof result > "u" || isSubmitting, onClick: handleOnSuccess, children: resultCounter && resultCounter > 1 ? t("addMultiple", {
218
243
  number: resultCounter
219
244
  }) : t("add") })
220
245
  ] })
@@ -0,0 +1 @@
1
+ export declare const Nextcloud: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,48 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { odeServices } from "@edifice.io/client";
3
+ import { useMediaLibraryContext } from "../MediaLibraryContext.js";
4
+ import useUser from "../../../../hooks/useUser/useUser.js";
5
+ import Nextcloud$1 from "../../Nextcloud/Nextcloud.js";
6
+ const Nextcloud = () => {
7
+ const {
8
+ appCode,
9
+ visibility,
10
+ type,
11
+ setResultCounter,
12
+ setResult,
13
+ setPreSuccess,
14
+ multiple
15
+ } = useMediaLibraryContext(), {
16
+ user
17
+ } = useUser();
18
+ function getDocumentRoleFilter() {
19
+ switch (type) {
20
+ case "image":
21
+ return "img";
22
+ case "audio":
23
+ return "audio";
24
+ case "video":
25
+ return "video";
26
+ default:
27
+ return null;
28
+ }
29
+ }
30
+ function handleSelect(result) {
31
+ setResultCounter(result.length), result.length ? (setResult(result), setPreSuccess(() => () => user != null && user.userId ? odeServices.nextcloud().copyDocumentToWorkspace(
32
+ user.userId,
33
+ result.map((doc) => doc.path),
34
+ void 0,
35
+ // Copy the documents straight to their final place, the way an
36
+ // upload does, instead of leaving a copy in the user's own
37
+ // documents for the modal to transfer afterwards.
38
+ {
39
+ application: appCode,
40
+ visibility
41
+ }
42
+ ) : Promise.resolve([]))) : (setResult(), setPreSuccess(void 0));
43
+ }
44
+ return /* @__PURE__ */ jsx(Nextcloud$1, { roles: getDocumentRoleFilter(), onSelect: handleSelect, multiple, className: "border rounded overflow-y-auto" });
45
+ };
46
+ export {
47
+ Nextcloud
48
+ };
@@ -4,6 +4,7 @@ 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;
7
8
  InternalLink: ({ target, resourceId, appPrefix, }: import('./InternalLink').InternalLinkTabProps) => import("react/jsx-runtime").JSX.Element;
8
9
  Iframe: () => import("react/jsx-runtime").JSX.Element;
9
10
  VideoEmbedder: () => import("react/jsx-runtime").JSX.Element;
@@ -2,6 +2,7 @@ import { Audio } from "./Audio.js";
2
2
  import { ExternalLink } from "./ExternalLink.js";
3
3
  import { Iframe } from "./Iframe.js";
4
4
  import { InternalLink } from "./InternalLink.js";
5
+ import { Nextcloud } from "./Nextcloud.js";
5
6
  import { Upload } from "./Upload.js";
6
7
  import { Video } from "./Video.js";
7
8
  import { VideoEmbedder } from "./VideoEmbedder.js";
@@ -12,6 +13,7 @@ const InnerTabs = {
12
13
  Upload,
13
14
  ExternalLink,
14
15
  Workspace,
16
+ Nextcloud,
15
17
  InternalLink,
16
18
  Iframe,
17
19
  VideoEmbedder
@@ -0,0 +1,24 @@
1
+ import { NextcloudDocument, Role } from '@edifice.io/client';
2
+ /**
3
+ * Nextcloud component properties
4
+ */
5
+ export interface NextcloudProps {
6
+ /**
7
+ * Notify parent when media elements are successfully selected.
8
+ */
9
+ onSelect: (result: NextcloudDocument[]) => void;
10
+ /**
11
+ * Boolean to know if we can select 1 or many files.
12
+ */
13
+ multiple?: boolean | undefined;
14
+ /**
15
+ * Document roles to filter files by; null (default) shows all roles.
16
+ */
17
+ roles?: Role | Role[] | null;
18
+ /**
19
+ * Optional class for styling purpose
20
+ */
21
+ className?: string;
22
+ }
23
+ declare const Nextcloud: ({ onSelect, multiple, roles, className, }: NextcloudProps) => import("react/jsx-runtime").JSX.Element;
24
+ export default Nextcloud;