@edifice.io/react 2.6.6-develop.20260923152855 → 2.6.7-develop-b2school.20260928143952

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 (96) hide show
  1. package/dist/components/Alert/Alert.js +47 -23
  2. package/dist/components/Form/FormText.js +11 -6
  3. package/dist/components/Input/Input.d.ts +11 -2
  4. package/dist/components/Input/Input.js +43 -21
  5. package/dist/components/Label/Label.js +4 -4
  6. package/dist/components/Layout/Layout.js +30 -15
  7. package/dist/components/LinkPill/LinkPill.d.ts +41 -0
  8. package/dist/components/LinkPill/LinkPill.js +28 -0
  9. package/dist/components/LinkPill/index.d.ts +2 -0
  10. package/dist/components/ModalBeta/ModalBeta.d.ts +47 -0
  11. package/dist/components/ModalBeta/ModalBeta.js +62 -0
  12. package/dist/components/ModalBeta/ModalBetaBody.d.ts +19 -0
  13. package/dist/components/ModalBeta/ModalBetaBody.js +15 -0
  14. package/dist/components/ModalBeta/ModalBetaContext.d.ts +7 -0
  15. package/dist/components/ModalBeta/ModalBetaContext.js +15 -0
  16. package/dist/components/ModalBeta/ModalBetaFooter.d.ts +13 -0
  17. package/dist/components/ModalBeta/ModalBetaFooter.js +7 -0
  18. package/dist/components/ModalBeta/ModalBetaHeader.d.ts +23 -0
  19. package/dist/components/ModalBeta/ModalBetaHeader.js +31 -0
  20. package/dist/components/ModalBeta/index.d.ts +2 -0
  21. package/dist/components/PageLayout/PageLayout.d.ts +4 -0
  22. package/dist/components/PageLayout/PageLayout.js +37 -14
  23. package/dist/components/PageLayout/components/PageLayoutContent.js +5 -1
  24. package/dist/components/PageLayout/components/PageLayoutHelpZone.d.ts +12 -0
  25. package/dist/components/PageLayout/components/PageLayoutHelpZone.js +6 -0
  26. package/dist/components/Table/components/Table.d.ts +2 -2
  27. package/dist/components/Table/components/TableTd.d.ts +1 -1
  28. package/dist/components/Table/components/TableTh.d.ts +1 -1
  29. package/dist/components/index.d.ts +2 -0
  30. package/dist/homepage.js +16 -1
  31. package/dist/hooks/index.d.ts +2 -0
  32. package/dist/hooks/useBackground/index.d.ts +1 -0
  33. package/dist/hooks/useBackground/useBackground.d.ts +7 -0
  34. package/dist/hooks/useBackground/useBackground.js +16 -0
  35. package/dist/hooks/useClickOutside/useClickOutside.d.ts +1 -1
  36. package/dist/hooks/useClickOutside/useClickOutside.js +3 -2
  37. package/dist/hooks/useToast/useToast.d.ts +1 -0
  38. package/dist/hooks/useToast/useToast.js +12 -9
  39. package/dist/hooks/useUserPreferences/index.d.ts +1 -0
  40. package/dist/hooks/useUserPreferences/useUserPreferences.d.ts +9 -0
  41. package/dist/hooks/useUserPreferences/useUserPreferences.js +40 -0
  42. package/dist/hooks/useZendeskGuide/useZendeskGuide.d.ts +16 -2
  43. package/dist/hooks/useZendeskGuide/useZendeskGuide.js +58 -24
  44. package/dist/icons.js +404 -402
  45. package/dist/index.js +168 -160
  46. package/dist/modules/HelpZone/HelpZone.d.ts +13 -0
  47. package/dist/modules/HelpZone/HelpZone.js +52 -0
  48. package/dist/modules/HelpZone/HelpZoneContainer.d.ts +4 -0
  49. package/dist/modules/HelpZone/HelpZoneContainer.js +18 -0
  50. package/dist/modules/HelpZone/index.d.ts +3 -0
  51. package/dist/modules/homepage/components/Favorites/Favorites.js +2 -2
  52. package/dist/modules/homepage/components/Header/Header.js +11 -4
  53. package/dist/modules/homepage/components/HomeCard/HomeCard.d.ts +1 -1
  54. package/dist/modules/homepage/components/HomeCard/HomeCardHeader.d.ts +15 -1
  55. package/dist/modules/homepage/components/HomeCard/HomeCardHeader.js +2 -1
  56. package/dist/modules/homepage/components/Notifications/components/NotificationFilterModal.js +36 -26
  57. package/dist/modules/homepage/components/Notifications/components/ReportNotificationModal.js +1 -1
  58. package/dist/modules/homepage/components/Notifications/services/queries/notification.js +9 -2
  59. package/dist/modules/homepage/components/UsefulLinks/LinkForm.d.ts +13 -0
  60. package/dist/modules/homepage/components/UsefulLinks/LinkForm.js +67 -0
  61. package/dist/modules/homepage/components/UsefulLinks/UsefulLinks.d.ts +6 -0
  62. package/dist/modules/homepage/components/UsefulLinks/UsefulLinks.js +31 -0
  63. package/dist/modules/homepage/components/UsefulLinks/UsefulLinksContainer.d.ts +1 -0
  64. package/dist/modules/homepage/components/UsefulLinks/UsefulLinksContainer.js +40 -0
  65. package/dist/modules/homepage/components/UsefulLinks/UsefulLinksModal.d.ts +11 -0
  66. package/dist/modules/homepage/components/UsefulLinks/UsefulLinksModal.js +65 -0
  67. package/dist/modules/homepage/components/UsefulLinks/hooks/useUsefulLinksContainer.d.ts +19 -0
  68. package/dist/modules/homepage/components/UsefulLinks/hooks/useUsefulLinksContainer.js +26 -0
  69. package/dist/modules/homepage/components/UsefulLinks/index.d.ts +5 -0
  70. package/dist/modules/homepage/components/UsefulLinks/services/api/index.d.ts +6 -0
  71. package/dist/modules/homepage/components/UsefulLinks/services/api/index.js +5 -0
  72. package/dist/modules/homepage/components/UsefulLinks/services/api/usefulLinksService.d.ts +31 -0
  73. package/dist/modules/homepage/components/UsefulLinks/services/api/usefulLinksService.js +50 -0
  74. package/dist/modules/homepage/components/UsefulLinks/services/queries/usefulLinks.d.ts +20 -0
  75. package/dist/modules/homepage/components/UsefulLinks/services/queries/usefulLinks.js +65 -0
  76. package/dist/modules/homepage/components/UserSpace/UserSpace.d.ts +3 -1
  77. package/dist/modules/homepage/components/UserSpace/UserSpace.js +13 -7
  78. package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.d.ts +4 -2
  79. package/dist/modules/homepage/components/UserSpace/UserSpaceContainer.js +3 -2
  80. package/dist/modules/homepage/components/UserSpace/hooks/useProfileLinks.js +18 -8
  81. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.d.ts +16 -0
  82. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetToggle.js +15 -0
  83. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.d.ts +21 -0
  84. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/WidgetsPersonalizationPanel.js +47 -0
  85. package/dist/modules/homepage/components/WidgetsPersonalizationPanel/index.d.ts +2 -0
  86. package/dist/modules/homepage/components/index.d.ts +3 -1
  87. package/dist/modules/icons/components/IconAddWidget.d.ts +7 -0
  88. package/dist/modules/icons/components/IconAddWidget.js +12 -0
  89. package/dist/modules/icons/components/index.d.ts +1 -0
  90. package/dist/modules/icons/components/logo/IconLogoEdificeFull.d.ts +7 -0
  91. package/dist/modules/icons/components/logo/IconLogoEdificeFull.js +26 -0
  92. package/dist/modules/icons/components/logo/IconLogoEdificeSmall.d.ts +7 -0
  93. package/dist/modules/icons/components/logo/IconLogoEdificeSmall.js +17 -0
  94. package/dist/modules/icons/components/logo/index.d.ts +2 -0
  95. package/dist/modules/widgets/index.d.ts +1 -1
  96. package/package.json +6 -6
@@ -0,0 +1,7 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ const ModalBetaFooter = ({
3
+ children
4
+ }) => /* @__PURE__ */ jsx("div", { className: "modal-beta-footer", children });
5
+ export {
6
+ ModalBetaFooter as default
7
+ };
@@ -0,0 +1,23 @@
1
+ import { ReactNode } from 'react';
2
+ export interface ModalBetaHeaderProps {
3
+ /**
4
+ * Method called on modal close
5
+ */
6
+ onModalClose: () => void;
7
+ /**
8
+ * Modal title
9
+ */
10
+ children: ReactNode;
11
+ /**
12
+ * Optional text displayed below the title
13
+ */
14
+ subtitle?: ReactNode;
15
+ }
16
+ /**
17
+ * ModalBeta Header
18
+ */
19
+ declare const ModalBetaHeader: {
20
+ ({ onModalClose, children, subtitle, }: ModalBetaHeaderProps): import("react/jsx-runtime").JSX.Element;
21
+ displayName: string;
22
+ };
23
+ export default ModalBetaHeader;
@@ -0,0 +1,31 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useRef, useEffect } from "react";
3
+ import { useTranslation } from "react-i18next";
4
+ import SvgIconClose from "../../modules/icons/components/IconClose.js";
5
+ import ButtonBeta from "../ButtonBeta/ButtonBeta.js";
6
+ import { useModalBetaContext } from "./ModalBetaContext.js";
7
+ const ModalBetaHeader = ({
8
+ onModalClose,
9
+ children,
10
+ subtitle
11
+ }) => {
12
+ const {
13
+ ariaLabelId,
14
+ focusId
15
+ } = useModalBetaContext(), closeButtonRef = useRef(null), {
16
+ t
17
+ } = useTranslation();
18
+ return useEffect(() => {
19
+ var _a;
20
+ focusId || (_a = closeButtonRef.current) == null || _a.focus();
21
+ }, [focusId]), /* @__PURE__ */ jsxs("div", { className: "modal-beta-header", children: [
22
+ /* @__PURE__ */ jsxs("div", { className: "modal-beta-title-row", children: [
23
+ /* @__PURE__ */ jsx("h2", { id: ariaLabelId, className: "modal-beta-title", tabIndex: -1, children }),
24
+ /* @__PURE__ */ jsx(ButtonBeta, { ref: closeButtonRef, "aria-label": t("close"), title: t("close"), type: "button", variant: "ghost", color: "tertiary", leftIcon: /* @__PURE__ */ jsx(SvgIconClose, {}), onClick: onModalClose })
25
+ ] }),
26
+ subtitle && /* @__PURE__ */ jsx("p", { className: "modal-beta-subtitle", children: subtitle })
27
+ ] });
28
+ };
29
+ export {
30
+ ModalBetaHeader as default
31
+ };
@@ -0,0 +1,2 @@
1
+ export { default as ModalBeta } from './ModalBeta';
2
+ export * from './ModalBeta';
@@ -41,5 +41,9 @@ declare const PageLayout: {
41
41
  ({ children, onClose, closeButton, backdrop, className, ...props }: import('./components/PageLayoutOverlay').PageLayoutOverlayProps): import("react/jsx-runtime").JSX.Element;
42
42
  displayName: string;
43
43
  };
44
+ HelpZone: {
45
+ (): import("react/jsx-runtime").JSX.Element;
46
+ displayName: string;
47
+ };
44
48
  };
45
49
  export default PageLayout;
@@ -1,15 +1,21 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useMemo, Children, isValidElement } from "react";
3
3
  import clsx from "clsx";
4
+ import { useTranslation } from "react-i18next";
4
5
  import PageLayoutBreadcrumb from "./components/PageLayoutBreadcrumb.js";
5
6
  import PageLayoutContent from "./components/PageLayoutContent.js";
6
7
  import PageLayoutHeader from "./components/PageLayoutHeader.js";
8
+ import PageLayoutHelpZone from "./components/PageLayoutHelpZone.js";
7
9
  import PageLayoutOverlay from "./components/PageLayoutOverlay.js";
8
10
  import PageLayoutSidebarLeft from "./components/PageLayoutSidebarLeft.js";
9
11
  import PageLayoutSidebarRight from "./components/PageLayoutSidebarRight.js";
10
12
  import { PageLayoutContext } from "./PageLayoutContext.js";
13
+ import useCookiesConsent from "../../hooks/useCookiesConsent/useCookiesConsent.js";
14
+ import useToast from "../../hooks/useToast/useToast.js";
15
+ import Alert from "../Alert/Alert.js";
16
+ import ButtonBeta from "../ButtonBeta/ButtonBeta.js";
11
17
  function analyzeChildren(children) {
12
- let hasLeftSidebar = !1, hasRightSidebar = !1, breadcrumb = null, overlay = null;
18
+ let hasLeftSidebar = !1, hasRightSidebar = !1, breadcrumb = null, overlay = null, helpZone = null;
13
19
  const headerChildren = [], mainChildren = [];
14
20
  return Children.toArray(children).forEach((child) => {
15
21
  if (/* @__PURE__ */ isValidElement(child))
@@ -23,6 +29,9 @@ function analyzeChildren(children) {
23
29
  case PageLayoutOverlay:
24
30
  overlay = child;
25
31
  break;
32
+ case PageLayoutHelpZone:
33
+ helpZone = child;
34
+ break;
26
35
  case PageLayoutSidebarLeft:
27
36
  hasLeftSidebar = !0, mainChildren.push(child);
28
37
  break;
@@ -41,6 +50,7 @@ function analyzeChildren(children) {
41
50
  hasRightSidebar,
42
51
  breadcrumb,
43
52
  overlay,
53
+ helpZone,
44
54
  headerChildren,
45
55
  mainChildren
46
56
  };
@@ -54,15 +64,22 @@ const Root = ({
54
64
  className,
55
65
  ...props
56
66
  }) => {
57
- const contextValue = useMemo(() => ({
67
+ const {
68
+ t
69
+ } = useTranslation(), {
70
+ showCookiesConsent,
71
+ handleConsultCookies,
72
+ handleCloseCookiesConsent
73
+ } = useCookiesConsent(), contextValue = useMemo(() => ({
58
74
  variant,
59
75
  scrollMode,
60
76
  noPadding
61
- }), [variant, scrollMode, noPadding]), {
77
+ }), [variant, scrollMode, noPadding]), renderToaster = useToast().renderToaster(), {
62
78
  hasLeftSidebar,
63
79
  hasRightSidebar,
64
80
  breadcrumb,
65
81
  overlay,
82
+ helpZone,
66
83
  headerChildren,
67
84
  mainChildren
68
85
  } = analyzeChildren(children), mainAreaClasses = clsx("pagelayout-mainarea", {
@@ -71,23 +88,29 @@ const Root = ({
71
88
  "has-right-sidebar-only": !hasLeftSidebar && hasRightSidebar,
72
89
  "has-gap": withGap
73
90
  }), isFullpage = variant === "fullpage";
74
- return /* @__PURE__ */ jsx(PageLayoutContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs("div", { className: clsx("pagelayout", `pagelayout-${variant}`, scrollMode && `pagelayout-scroll-${scrollMode}`, className), ...props, children: [
75
- headerChildren,
76
- headerChildren.length > 0 && /* @__PURE__ */ jsx("div", { className: "pagelayout-headerspacer" }),
77
- !isFullpage && breadcrumb,
78
- /* @__PURE__ */ jsxs("div", { className: mainAreaClasses, children: [
79
- isFullpage && breadcrumb,
80
- mainChildren
91
+ return /* @__PURE__ */ jsxs(PageLayoutContext.Provider, { value: contextValue, children: [
92
+ /* @__PURE__ */ jsxs("div", { className: clsx("pagelayout", `pagelayout-${variant}`, scrollMode && `pagelayout-scroll-${scrollMode}`, className), ...props, children: [
93
+ headerChildren,
94
+ headerChildren.length > 0 && /* @__PURE__ */ jsx("div", { className: "pagelayout-headerspacer" }),
95
+ !isFullpage && breadcrumb,
96
+ /* @__PURE__ */ jsxs("div", { className: mainAreaClasses, children: [
97
+ isFullpage && breadcrumb,
98
+ mainChildren
99
+ ] }),
100
+ overlay,
101
+ showCookiesConsent && /* @__PURE__ */ jsx(Alert, { type: "info", 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") })
81
102
  ] }),
82
- overlay
83
- ] }) });
103
+ helpZone,
104
+ renderToaster
105
+ ] });
84
106
  }, PageLayout = Object.assign(Root, {
85
107
  Header: PageLayoutHeader,
86
108
  Breadcrumb: PageLayoutBreadcrumb,
87
109
  SidebarLeft: PageLayoutSidebarLeft,
88
110
  Content: PageLayoutContent,
89
111
  SidebarRight: PageLayoutSidebarRight,
90
- Overlay: PageLayoutOverlay
112
+ Overlay: PageLayoutOverlay,
113
+ HelpZone: PageLayoutHelpZone
91
114
  });
92
115
  export {
93
116
  PageLayout as default
@@ -1,15 +1,19 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import clsx from "clsx";
3
3
  import { usePageLayout } from "../PageLayoutContext.js";
4
+ import useBackground from "../../../hooks/useBackground/useBackground.js";
4
5
  const PageLayoutContent = ({
5
6
  children,
6
7
  className,
7
8
  ...props
8
9
  }) => {
9
10
  const {
11
+ productOverride,
12
+ background
13
+ } = useBackground(), {
10
14
  noPadding
11
15
  } = usePageLayout();
12
- return /* @__PURE__ */ jsx("main", { className: clsx("pagelayout-content", {
16
+ return /* @__PURE__ */ jsx("main", { "data-product": productOverride, "data-background": background, className: clsx("pagelayout-content", {
13
17
  "pagelayout-content--no-padding": noPadding == null ? void 0 : noPadding.content
14
18
  }, className), ...props, children });
15
19
  };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Opt-in slot: renders the floating Edifice help zone (badge + support
3
+ * button). Requires `EdificeClientProvider` and `EdificeThemeProvider`
4
+ * higher in the tree (used internally by `useZendeskGuide`) — kept opt-in
5
+ * rather than baked into `PageLayout` itself so standalone consumers
6
+ * without those providers don't crash at render.
7
+ */
8
+ declare const PageLayoutHelpZone: {
9
+ (): import("react/jsx-runtime").JSX.Element;
10
+ displayName: string;
11
+ };
12
+ export default PageLayoutHelpZone;
@@ -0,0 +1,6 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { HelpZoneContainer } from "../../../modules/HelpZone/HelpZoneContainer.js";
3
+ const PageLayoutHelpZone = () => /* @__PURE__ */ jsx(HelpZoneContainer, {});
4
+ export {
5
+ PageLayoutHelpZone as default
6
+ };
@@ -13,7 +13,7 @@ declare const Table: import('react').ForwardRefExoticComponent<{
13
13
  displayName: string;
14
14
  };
15
15
  Th: {
16
- (props: React.HTMLAttributes<HTMLTableCellElement>): import("react/jsx-runtime").JSX.Element;
16
+ (props: React.ThHTMLAttributes<HTMLTableCellElement>): import("react/jsx-runtime").JSX.Element;
17
17
  displayName: string;
18
18
  };
19
19
  Tbody: {
@@ -25,7 +25,7 @@ declare const Table: import('react').ForwardRefExoticComponent<{
25
25
  displayName: string;
26
26
  };
27
27
  Td: {
28
- (props: React.HTMLAttributes<HTMLTableCellElement>): import("react/jsx-runtime").JSX.Element;
28
+ (props: React.TdHTMLAttributes<HTMLTableCellElement>): import("react/jsx-runtime").JSX.Element;
29
29
  displayName: string;
30
30
  };
31
31
  };
@@ -1,4 +1,4 @@
1
1
  export declare const TableTd: {
2
- (props: React.HTMLAttributes<HTMLTableCellElement>): import("react/jsx-runtime").JSX.Element;
2
+ (props: React.TdHTMLAttributes<HTMLTableCellElement>): import("react/jsx-runtime").JSX.Element;
3
3
  displayName: string;
4
4
  };
@@ -1,4 +1,4 @@
1
1
  export declare const TableTh: {
2
- (props: React.HTMLAttributes<HTMLTableCellElement>): import("react/jsx-runtime").JSX.Element;
2
+ (props: React.ThHTMLAttributes<HTMLTableCellElement>): import("react/jsx-runtime").JSX.Element;
3
3
  displayName: string;
4
4
  };
@@ -28,6 +28,7 @@ export * from './Image';
28
28
  export * from './Input';
29
29
  export * from './Label';
30
30
  export * from './Layout';
31
+ export * from './LinkPill';
31
32
  export * from './List';
32
33
  export * from './Loading';
33
34
  export * from './LoadingScreen';
@@ -36,6 +37,7 @@ export * from './LogoBeta';
36
37
  export * from './MediaViewer';
37
38
  export * from './Menu';
38
39
  export * from './Modal';
40
+ export * from './ModalBeta';
39
41
  export * from './PageLayout';
40
42
  export * from './Pagination';
41
43
  export * from './Popover';
package/dist/homepage.js CHANGED
@@ -16,9 +16,16 @@ import { Favorites } from "./modules/homepage/components/Favorites/Favorites.js"
16
16
  import { FavoritesContainer } from "./modules/homepage/components/Favorites/FavoritesContainer.js";
17
17
  import { LastInfosContainer } from "./modules/homepage/components/LastInfos/LastInfosContainer.js";
18
18
  import { LastInfosList } from "./modules/homepage/components/LastInfos/LastInfosList.js";
19
+ import { LinkForm } from "./modules/homepage/components/UsefulLinks/LinkForm.js";
20
+ import { MAX_USEFUL_LINKS, useUsefulLinksContainer } from "./modules/homepage/components/UsefulLinks/hooks/useUsefulLinksContainer.js";
19
21
  import { MessageFlashListContainer } from "./modules/homepage/components/MessageFlashList/MessageFlashListContainer.js";
20
22
  import { SchoolSpaceContainer } from "./modules/homepage/components/SchoolSpace/SchoolSpaceContainer.js";
23
+ import { UsefulLinks } from "./modules/homepage/components/UsefulLinks/UsefulLinks.js";
24
+ import { UsefulLinksContainer } from "./modules/homepage/components/UsefulLinks/UsefulLinksContainer.js";
25
+ import { UsefulLinksModal } from "./modules/homepage/components/UsefulLinks/UsefulLinksModal.js";
21
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";
22
29
  import { useCommunities } from "./modules/homepage/components/Communities/useCommunities.js";
23
30
  export {
24
31
  default2 as Communities,
@@ -32,6 +39,8 @@ export {
32
39
  default7 as LastInfos,
33
40
  LastInfosContainer,
34
41
  LastInfosList,
42
+ LinkForm,
43
+ MAX_USEFUL_LINKS,
35
44
  default8 as MessageFlash,
36
45
  default9 as MessageFlashList,
37
46
  MessageFlashListContainer,
@@ -40,7 +49,13 @@ export {
40
49
  NotificationListContainer,
41
50
  default12 as SchoolSpace,
42
51
  SchoolSpaceContainer,
52
+ UsefulLinks,
53
+ UsefulLinksContainer,
54
+ UsefulLinksModal,
43
55
  default13 as UserSpace,
44
56
  UserSpaceContainer,
45
- useCommunities
57
+ WidgetToggle,
58
+ WidgetsPersonalizationPanel,
59
+ useCommunities,
60
+ useUsefulLinksContainer
46
61
  };
@@ -1,3 +1,4 @@
1
+ export * from './useBackground';
1
2
  export * from './useBookmark';
2
3
  export * from './useBreakpoint';
3
4
  export * from './useBrowserInfo';
@@ -34,6 +35,7 @@ export * from './useUiOverride';
34
35
  export * from './useUpload';
35
36
  export * from './useUploadFiles';
36
37
  export * from './useUser';
38
+ export * from './useUserPreferences';
37
39
  export * from './useWorkspaceFile';
38
40
  export * from './useWorkspaceFolders';
39
41
  export * from './useWorkspaceSearch';
@@ -0,0 +1 @@
1
+ export { default as useBackground, type Background } from './useBackground';
@@ -0,0 +1,7 @@
1
+ export type Background = 'default' | 'pink-200' | 'yellow-200' | 'orange-200' | 'blue-200' | 'green-200';
2
+ declare const _default: () => {
3
+ background: Background;
4
+ isBackgroundImageOverridden: boolean;
5
+ productOverride: string | undefined;
6
+ };
7
+ export default _default;
@@ -0,0 +1,16 @@
1
+ import useUiOverride from "../useUiOverride/useUiOverride.js";
2
+ import useUserPreferences from "../useUserPreferences/useUserPreferences.js";
3
+ const useBackground = () => {
4
+ const backgroundOverride = useUiOverride("layout.background"), backgroundDefault = useUiOverride("background.default"), {
5
+ preferences
6
+ } = useUserPreferences(), isBackgroundImageOverridden = (backgroundOverride == null ? void 0 : backgroundOverride.variant) === "image";
7
+ return {
8
+ /* Actual background is either : user's prefered value, theme-conf overriden value or 'default' */
9
+ background: (preferences == null ? void 0 : preferences.background) ?? (backgroundDefault == null ? void 0 : backgroundDefault.variant) ?? "default",
10
+ isBackgroundImageOverridden,
11
+ productOverride: backgroundOverride == null ? void 0 : backgroundOverride.theme
12
+ };
13
+ };
14
+ export {
15
+ useBackground as default
16
+ };
@@ -1 +1 @@
1
- export default function useClickOutside<T extends HTMLElement = any>(handler: () => void, events?: string[] | null, nodes?: Array<HTMLElement | null>): import('react').MutableRefObject<T | null>;
1
+ export default function useClickOutside<T extends HTMLElement = any>(handler: () => void, events?: string[] | null, nodes?: Array<HTMLElement | null>, enabled?: boolean): import('react').MutableRefObject<T | null>;
@@ -1,8 +1,9 @@
1
1
  import { useRef, useEffect } from "react";
2
2
  const DEFAULT_EVENTS = ["mousedown", "touchstart"];
3
- function useClickOutside(handler, events, nodes) {
3
+ function useClickOutside(handler, events, nodes, enabled = !0) {
4
4
  const ref = useRef(null);
5
5
  return useEffect(() => {
6
+ if (!enabled) return;
6
7
  const listener = (event) => {
7
8
  const {
8
9
  target
@@ -19,7 +20,7 @@ function useClickOutside(handler, events, nodes) {
19
20
  document.removeEventListener(fn, listener);
20
21
  });
21
22
  };
22
- }, [ref, handler, nodes, events]), ref;
23
+ }, [ref, handler, nodes, events, enabled]), ref;
23
24
  }
24
25
  export {
25
26
  useClickOutside as default
@@ -7,6 +7,7 @@ export interface CustomToastOptions {
7
7
  duration?: number;
8
8
  }
9
9
  export default function useToast(): {
10
+ renderToaster: () => import("react/jsx-runtime").JSX.Element;
10
11
  success: (message: string | ReactNode, options?: CustomToastOptions) => string;
11
12
  error: (message: string | ReactNode, options?: CustomToastOptions) => string;
12
13
  info: (message: string | ReactNode, options?: CustomToastOptions) => string;
@@ -1,27 +1,30 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import toast from "react-hot-toast";
2
+ import toast, { Toaster } from "react-hot-toast";
3
3
  import Alert from "../../components/Alert/Alert.js";
4
4
  const DEFAULT_POSITION = "top-right", DEFAULT_DURATION = 5e3;
5
5
  function useToast() {
6
6
  return {
7
- success: (message, options) => toast.custom(/* @__PURE__ */ jsx(Alert, { type: "success", isToast: !0, isDismissible: options == null ? void 0 : options.isDismissible, className: "mb-12", children: message }), {
7
+ renderToaster: () => /* @__PURE__ */ jsx(Toaster, { containerClassName: "toaster-container", toastOptions: {
8
+ position: "top-right"
9
+ } }),
10
+ success: (message, options) => toast.custom((t) => /* @__PURE__ */ jsx(Alert, { type: "success", isToast: !0, isDismissible: options == null ? void 0 : options.isDismissible, autoClose: !(options != null && options.isDismissible), autoCloseDelay: (options == null ? void 0 : options.duration) ?? DEFAULT_DURATION, onClose: () => toast.dismiss(t.id), className: "mb-12", children: message }), {
8
11
  id: options == null ? void 0 : options.id,
9
- duration: (options == null ? void 0 : options.duration) ?? DEFAULT_DURATION,
12
+ duration: 1 / 0,
10
13
  position: (options == null ? void 0 : options.position) ?? DEFAULT_POSITION
11
14
  }),
12
- error: (message, options) => toast.custom(/* @__PURE__ */ jsx(Alert, { type: "danger", isToast: !0, isDismissible: options == null ? void 0 : options.isDismissible, className: "mb-12", children: message }), {
15
+ error: (message, options) => toast.custom((t) => /* @__PURE__ */ jsx(Alert, { type: "danger", isToast: !0, isDismissible: options == null ? void 0 : options.isDismissible, autoClose: !(options != null && options.isDismissible), autoCloseDelay: (options == null ? void 0 : options.duration) ?? DEFAULT_DURATION, onClose: () => toast.dismiss(t.id), className: "mb-12", children: message }), {
13
16
  id: options == null ? void 0 : options.id,
14
- duration: (options == null ? void 0 : options.duration) ?? DEFAULT_DURATION,
17
+ duration: 1 / 0,
15
18
  position: (options == null ? void 0 : options.position) ?? DEFAULT_POSITION
16
19
  }),
17
- info: (message, options) => toast.custom(/* @__PURE__ */ jsx(Alert, { type: "info", isToast: !0, isDismissible: options == null ? void 0 : options.isDismissible, className: "mb-12", children: message }), {
20
+ info: (message, options) => toast.custom((t) => /* @__PURE__ */ jsx(Alert, { type: "info", isToast: !0, isDismissible: options == null ? void 0 : options.isDismissible, autoClose: !(options != null && options.isDismissible), autoCloseDelay: (options == null ? void 0 : options.duration) ?? DEFAULT_DURATION, onClose: () => toast.dismiss(t.id), className: "mb-12", children: message }), {
18
21
  id: options == null ? void 0 : options.id,
19
- duration: (options == null ? void 0 : options.duration) ?? DEFAULT_DURATION,
22
+ duration: 1 / 0,
20
23
  position: (options == null ? void 0 : options.position) ?? DEFAULT_POSITION
21
24
  }),
22
- warning: (message, options) => toast.custom(/* @__PURE__ */ jsx(Alert, { type: "warning", isToast: !0, isDismissible: options == null ? void 0 : options.isDismissible, className: "mb-12", children: message }), {
25
+ warning: (message, options) => toast.custom((t) => /* @__PURE__ */ jsx(Alert, { type: "warning", isToast: !0, isDismissible: options == null ? void 0 : options.isDismissible, autoClose: !(options != null && options.isDismissible), autoCloseDelay: (options == null ? void 0 : options.duration) ?? DEFAULT_DURATION, onClose: () => toast.dismiss(t.id), className: "mb-12", children: message }), {
23
26
  id: options == null ? void 0 : options.id,
24
- duration: (options == null ? void 0 : options.duration) ?? DEFAULT_DURATION,
27
+ duration: 1 / 0,
25
28
  position: (options == null ? void 0 : options.position) ?? DEFAULT_POSITION
26
29
  }),
27
30
  loading: toast.loading,
@@ -0,0 +1 @@
1
+ export { default, useUserPreferences } from './useUserPreferences';
@@ -0,0 +1,9 @@
1
+ export declare const USER_PREFERENCES_QUERY_KEY: string[];
2
+ export declare function useUserPreferences<T extends Record<string, any> = Record<string, any>>(): {
3
+ preferences: T | undefined;
4
+ isLoading: boolean;
5
+ isError: boolean;
6
+ refetch: (options?: import('@tanstack/react-query').RefetchOptions) => Promise<import('@tanstack/react-query').QueryObserverResult<T, Error>>;
7
+ savePreferences: (preferences: T) => Promise<T>;
8
+ };
9
+ export default useUserPreferences;
@@ -0,0 +1,40 @@
1
+ import { odeServices } from "@edifice.io/client";
2
+ import { useQueryClient, useQuery, queryOptions, useMutation } from "@tanstack/react-query";
3
+ const USER_PREFERENCES_QUERY_KEY = ["user", "preferences"];
4
+ function useUserPreferences() {
5
+ const queryClient = useQueryClient(), {
6
+ data: preferences,
7
+ isLoading,
8
+ isError,
9
+ refetch
10
+ } = useQuery(queryOptions({
11
+ queryKey: USER_PREFERENCES_QUERY_KEY,
12
+ queryFn: () => odeServices.conf().getUserPreferences(),
13
+ staleTime: 15e3
14
+ })), mutation = useMutation({
15
+ mutationFn: (preferences2) => odeServices.conf().saveUserPreferences(preferences2),
16
+ onMutate: async (preferences2) => {
17
+ queryClient.setQueryData(USER_PREFERENCES_QUERY_KEY, preferences2);
18
+ },
19
+ onError: () => {
20
+ queryClient.invalidateQueries({
21
+ queryKey: USER_PREFERENCES_QUERY_KEY
22
+ });
23
+ },
24
+ onSuccess: (preferences2) => {
25
+ queryClient.setQueryData(USER_PREFERENCES_QUERY_KEY, preferences2);
26
+ }
27
+ });
28
+ return {
29
+ preferences,
30
+ isLoading,
31
+ isError,
32
+ refetch,
33
+ savePreferences: (preferences2) => mutation.mutateAsync(preferences2)
34
+ };
35
+ }
36
+ export {
37
+ USER_PREFERENCES_QUERY_KEY,
38
+ useUserPreferences as default,
39
+ useUserPreferences
40
+ };
@@ -1,2 +1,16 @@
1
- /** Add Zendesk Guide */
2
- export default function useZendeskGuide(): null;
1
+ export interface UseZendeskGuideAPI {
2
+ /** True once the widget script is loaded and configured. */
3
+ isReady: boolean;
4
+ /** True while the widget panel is open. */
5
+ isOpen: boolean;
6
+ open: () => void;
7
+ close: () => void;
8
+ }
9
+ /**
10
+ * Add Zendesk Guide
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.
15
+ */
16
+ export default function useZendeskGuide(headerColor?: string): UseZendeskGuideAPI;
@@ -5,7 +5,7 @@ import { useEdificeTheme } from "../../providers/EdificeThemeProvider/EdificeThe
5
5
  import useUser from "../useUser/useUser.js";
6
6
  import useIsAdml from "../useIsAdml/useIsAdml.js";
7
7
  import useHasWorkflow from "../useHasWorkflow/useHasWorkflow.js";
8
- function useZendeskGuide() {
8
+ function useZendeskGuide(headerColor) {
9
9
  const {
10
10
  currentLanguage
11
11
  } = useEdificeClient(), {
@@ -14,7 +14,13 @@ function useZendeskGuide() {
14
14
  isAdml
15
15
  } = useIsAdml(), {
16
16
  theme
17
- } = useEdificeTheme(), isMobileView = window.innerWidth <= 768, hasSupportWorkflow = useHasWorkflow("net.atos.entng.support.controllers.DisplayController|view"), [locationPathname, setLocationPathname] = useState(""), [dataModule, setDataModule] = useState(void 0), setZendeskGuideLabels = () => {
17
+ } = useEdificeTheme(), isMobileView = window.innerWidth <= 768, hasSupportWorkflow = useHasWorkflow("net.atos.entng.support.controllers.DisplayController|view"), [locationPathname, setLocationPathname] = useState(""), [dataModule, setDataModule] = useState(void 0), [isReady, setIsReady] = useState(!1), [isOpen, setIsOpen] = useState(!1), open = () => {
18
+ var _a;
19
+ (_a = window.zE) == null || _a.call(window, "webWidget", "open");
20
+ }, close = () => {
21
+ var _a;
22
+ (_a = window.zE) == null || _a.call(window, "webWidget", "close");
23
+ }, setZendeskGuideLabels = () => {
18
24
  const modulePathnameSplit = locationPathname.split("/");
19
25
  let moduleLabel = "", labels = "";
20
26
  if (dataModule != null && dataModule.labels && Object.keys(dataModule == null ? void 0 : dataModule.labels).length > 0 && modulePathnameSplit.length > 1) {
@@ -33,8 +39,40 @@ function useZendeskGuide() {
33
39
  return useEffect(() => {
34
40
  window.location.pathname !== locationPathname && setLocationPathname(window.location.pathname), !(dataModule === void 0 || Object.keys(dataModule).length === 0) && setZendeskGuideLabels();
35
41
  }, [window.location.pathname, dataModule]), useEffect(() => {
36
- document.getElementById("ze-snippet") || hasSupportWorkflow === void 0 || (async () => {
37
- const zendeskGuideConfig = await odeServices.http().get("/zendeskGuide/config");
42
+ const registerWidgetHandlers = () => {
43
+ window.zE("webWidget:on", "open", function() {
44
+ setIsOpen(!0), hasSupportWorkflow && window.zE("webWidget", "updateSettings", {
45
+ webWidget: {
46
+ contactForm: {
47
+ suppress: !1
48
+ }
49
+ }
50
+ });
51
+ }), window.zE("webWidget:on", "close", function() {
52
+ setIsOpen(!1);
53
+ }), window.zE("webWidget:on", "userEvent", function(ref) {
54
+ const category = ref.category, action = ref.action, properties = ref.properties;
55
+ action === "Contact Form Shown" && category === "Zendesk Web Widget" && properties && properties.name === "contact-form" && hasSupportWorkflow && (window.zE("webWidget", "updateSettings", {
56
+ webWidget: {
57
+ contactForm: {
58
+ suppress: !0
59
+ }
60
+ }
61
+ }), window.zE("webWidget", "close"), window.open("/support/tickets/new", "_blank"));
62
+ });
63
+ };
64
+ if (document.getElementById("ze-snippet")) {
65
+ window.zE && (registerWidgetHandlers(), setIsReady(!0));
66
+ return;
67
+ }
68
+ hasSupportWorkflow !== void 0 && (async () => {
69
+ let zendeskGuideConfig;
70
+ try {
71
+ zendeskGuideConfig = await odeServices.http().get("/zendeskGuide/config");
72
+ } catch (error) {
73
+ console.warn("[useZendeskGuide] Failed to fetch the support widget config from `/zendeskGuide/config` — the widget (and HelpZone's button) won't show up. If you're running a local dev server, check that `/zendeskGuide` is proxied to your backend in your app's Vite dev proxy config.", error);
74
+ return;
75
+ }
38
76
  if (zendeskGuideConfig && zendeskGuideConfig.key && zendeskGuideConfig.key !== "") {
39
77
  const scriptZendesk = document.createElement("script");
40
78
  scriptZendesk.id = "ze-snippet", scriptZendesk.src = `https://static.zdassets.com/ekr/snippet.js?key=${zendeskGuideConfig.key}`, document.body.appendChild(scriptZendesk).onload = () => {
@@ -45,7 +83,7 @@ function useZendeskGuide() {
45
83
  }), Object.keys(zendeskGuideConfig.module).length > 0 && setDataModule(zendeskGuideConfig.module), window.zE("webWidget", "show"), window.zE("webWidget", "updateSettings", {
46
84
  webWidget: {
47
85
  color: {
48
- theme: zendeskGuideConfig.color || "#ffc400"
86
+ theme: headerColor || zendeskGuideConfig.color || "#ffc400"
49
87
  },
50
88
  zIndex: 3,
51
89
  launcher: {
@@ -74,28 +112,24 @@ function useZendeskGuide() {
74
112
  }
75
113
  }
76
114
  });
77
- }), window.zE("webWidget:on", "open", function() {
78
- hasSupportWorkflow && window.zE("webWidget", "updateSettings", {
79
- webWidget: {
80
- contactForm: {
81
- suppress: !1
82
- }
83
- }
84
- });
85
- }), window.zE("webWidget:on", "userEvent", function(ref) {
86
- const category = ref.category, action = ref.action, properties = ref.properties;
87
- action === "Contact Form Shown" && category === "Zendesk Web Widget" && properties && properties.name === "contact-form" && hasSupportWorkflow && (window.zE("webWidget", "updateSettings", {
88
- webWidget: {
89
- contactForm: {
90
- suppress: !0
91
- }
92
- }
93
- }), window.zE("webWidget", "close"), window.open("/support/tickets/new", "_blank"));
94
- });
115
+ }), registerWidgetHandlers(), setIsReady(!0);
95
116
  };
96
117
  }
97
118
  })();
98
- }, [hasSupportWorkflow]), null;
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]), {
128
+ isReady,
129
+ isOpen,
130
+ open,
131
+ close
132
+ };
99
133
  }
100
134
  export {
101
135
  useZendeskGuide as default