@edifice.io/react 2.6.10-develop-b2school.20261019134247 → 2.6.10-develop-b2school.20261021144055

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 (38) hide show
  1. package/dist/components/Checkbox/Checkbox.js +1 -1
  2. package/dist/homepage.js +12 -0
  3. package/dist/icons.js +234 -232
  4. package/dist/modules/homepage/components/Header/AccountActionListPopover.d.ts +13 -0
  5. package/dist/modules/homepage/components/Header/AccountActionListPopover.js +26 -0
  6. package/dist/modules/homepage/components/Header/ActionItem.d.ts +38 -0
  7. package/dist/modules/homepage/components/Header/ActionItem.js +34 -0
  8. package/dist/modules/homepage/components/Header/Header.js +2 -12
  9. package/dist/modules/homepage/components/Notifications/NotificationList.js +2 -3
  10. package/dist/modules/homepage/components/Notifications/NotificationListSkeleton.js +7 -12
  11. package/dist/modules/homepage/components/Notifications/NotificationSkeleton.js +5 -2
  12. package/dist/modules/homepage/components/Rss/Rss.d.ts +11 -0
  13. package/dist/modules/homepage/components/Rss/Rss.js +64 -0
  14. package/dist/modules/homepage/components/Rss/RssContainer.d.ts +1 -0
  15. package/dist/modules/homepage/components/Rss/RssContainer.js +45 -0
  16. package/dist/modules/homepage/components/Rss/RssFeedForm.d.ts +13 -0
  17. package/dist/modules/homepage/components/Rss/RssFeedForm.js +69 -0
  18. package/dist/modules/homepage/components/Rss/RssFeedsModal.d.ts +11 -0
  19. package/dist/modules/homepage/components/Rss/RssFeedsModal.js +58 -0
  20. package/dist/modules/homepage/components/Rss/hooks/useRssContainer.d.ts +25 -0
  21. package/dist/modules/homepage/components/Rss/hooks/useRssContainer.js +43 -0
  22. package/dist/modules/homepage/components/Rss/index.d.ts +6 -0
  23. package/dist/modules/homepage/components/Rss/services/api/index.d.ts +5 -0
  24. package/dist/modules/homepage/components/Rss/services/api/index.js +5 -0
  25. package/dist/modules/homepage/components/Rss/services/api/rssService.d.ts +38 -0
  26. package/dist/modules/homepage/components/Rss/services/api/rssService.js +51 -0
  27. package/dist/modules/homepage/components/Rss/services/queries/rss.d.ts +28 -0
  28. package/dist/modules/homepage/components/Rss/services/queries/rss.js +71 -0
  29. package/dist/modules/homepage/components/Rss/types.d.ts +25 -0
  30. package/dist/modules/homepage/components/Rss/utils.d.ts +7 -0
  31. package/dist/modules/homepage/components/Rss/utils.js +19 -0
  32. package/dist/modules/homepage/components/UsefulLinks/UsefulLinks.js +2 -2
  33. package/dist/modules/homepage/components/UsefulLinks/UsefulLinksModal.js +2 -2
  34. package/dist/modules/homepage/components/index.d.ts +1 -0
  35. package/dist/modules/icons/components/IconLogout.d.ts +7 -0
  36. package/dist/modules/icons/components/IconLogout.js +13 -0
  37. package/dist/modules/icons/components/index.d.ts +1 -0
  38. package/package.json +6 -6
@@ -0,0 +1,71 @@
1
+ import { useQuery, useQueryClient, useMutation, queryOptions } from "@tanstack/react-query";
2
+ import { rssService } from "../api/index.js";
3
+ const rssQueryKeys = {
4
+ all: () => ["rss"],
5
+ channel: () => [...rssQueryKeys.all(), "channel"],
6
+ articles: (url) => [...rssQueryKeys.all(), "articles", url]
7
+ }, rssQueryOptions = {
8
+ getChannel() {
9
+ return queryOptions({
10
+ queryKey: rssQueryKeys.channel(),
11
+ queryFn: async () => rssService.getChannel()
12
+ });
13
+ },
14
+ getArticles(url) {
15
+ return queryOptions({
16
+ queryKey: rssQueryKeys.articles(url),
17
+ queryFn: async () => rssService.getArticles(url),
18
+ // An invalid feed URL won't fix itself: show the error state right away.
19
+ retry: !1
20
+ });
21
+ }
22
+ }, useRssChannel = () => useQuery(rssQueryOptions.getChannel()), useRssArticles = (url) => useQuery({
23
+ ...rssQueryOptions.getArticles(url ?? ""),
24
+ enabled: !!url
25
+ }), useSaveRssFeeds = () => {
26
+ const queryClient = useQueryClient();
27
+ return useMutation({
28
+ mutationFn: ({
29
+ channelId,
30
+ feeds
31
+ }) => rssService.saveFeeds(channelId, feeds),
32
+ onMutate: async ({
33
+ channelId,
34
+ feeds
35
+ }) => {
36
+ await queryClient.cancelQueries({
37
+ queryKey: rssQueryKeys.channel()
38
+ });
39
+ const previousChannel = queryClient.getQueryData(rssQueryKeys.channel());
40
+ return queryClient.setQueryData(rssQueryKeys.channel(), {
41
+ channelId,
42
+ feeds
43
+ }), {
44
+ previousChannel
45
+ };
46
+ },
47
+ onSuccess: (channelId, {
48
+ feeds
49
+ }) => {
50
+ queryClient.setQueryData(rssQueryKeys.channel(), {
51
+ channelId,
52
+ feeds
53
+ });
54
+ },
55
+ onError: (_error, _variables, context) => {
56
+ context != null && context.previousChannel && queryClient.setQueryData(rssQueryKeys.channel(), context.previousChannel);
57
+ },
58
+ onSettled: () => {
59
+ queryClient.invalidateQueries({
60
+ queryKey: rssQueryKeys.channel()
61
+ });
62
+ }
63
+ });
64
+ };
65
+ export {
66
+ rssQueryKeys,
67
+ rssQueryOptions,
68
+ useRssArticles,
69
+ useRssChannel,
70
+ useSaveRssFeeds
71
+ };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * An RSS feed followed by the user from the homepage "RSS" widget.
3
+ * Feeds have no id: they are stored as an ordered array in the user's
4
+ * RSS channel and identified by their position in it.
5
+ */
6
+ export interface RssFeed {
7
+ title: string;
8
+ link: string;
9
+ /** Legacy number of articles to display, kept as-is when editing. */
10
+ show?: number;
11
+ }
12
+ export type RssFeedPayload = Pick<RssFeed, 'title' | 'link'>;
13
+ /**
14
+ * An article of an RSS feed, as parsed by the rss backend module.
15
+ */
16
+ export interface RssArticle {
17
+ title: string;
18
+ link: string;
19
+ /** May contain HTML. */
20
+ description: string;
21
+ /** RFC 822 date, e.g. "Tue, 21 Jul 2026 08:00:00 +0200". */
22
+ pubDate: string;
23
+ }
24
+ /** Fetch status of the selected feed's articles. */
25
+ export type RssArticlesStatus = 'loading' | 'error' | 'success';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Same rule as the legacy RSS widget: an http(s) URL whose last path
3
+ * segment either has a feed extension or no extension at all.
4
+ */
5
+ export declare function isValidRssFeedUrl(value: string): boolean;
6
+ /** Feed descriptions may contain HTML: only keep their text. */
7
+ export declare function htmlToText(html: string): string;
@@ -0,0 +1,19 @@
1
+ const FEED_EXTENSIONS = [".rss", ".xml", ".rdf", ".atom", ".feed"];
2
+ function isValidRssFeedUrl(value) {
3
+ let url;
4
+ try {
5
+ url = new URL(value.trim());
6
+ } catch {
7
+ return !1;
8
+ }
9
+ if (url.protocol !== "http:" && url.protocol !== "https:") return !1;
10
+ const pathname = url.pathname.toLowerCase();
11
+ return !(pathname.split("/").pop() ?? "").includes(".") || FEED_EXTENSIONS.some((extension) => pathname.endsWith(extension));
12
+ }
13
+ function htmlToText(html) {
14
+ return (new DOMParser().parseFromString(html, "text/html").body.textContent ?? "").trim();
15
+ }
16
+ export {
17
+ htmlToText,
18
+ isValidRssFeedUrl
19
+ };
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useTranslation } from "react-i18next";
3
- import illuEmptyUsefulLinks from "@edifice.io/bootstrap/dist/images/homepage/illu-empty-useful-links.png";
3
+ import illuEmptyFeeds from "@edifice.io/bootstrap/dist/images/homepage/illu-empty-useful-links.png";
4
4
  import SvgIconEdit from "../../../icons/components/IconEdit.js";
5
5
  import HomeCard from "../HomeCard/HomeCard.js";
6
6
  import Image from "../../../../components/Image/Image.js";
@@ -18,7 +18,7 @@ function UsefulLinks({
18
18
  "data-testid": "usefullinks-button-edit"
19
19
  } }),
20
20
  /* @__PURE__ */ jsx(HomeCard.Content, { children: links.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "useful-links-widget__empty", children: [
21
- /* @__PURE__ */ jsx(Image, { src: illuEmptyUsefulLinks, alt: "", "aria-hidden": "true", style: {
21
+ /* @__PURE__ */ jsx(Image, { src: illuEmptyFeeds, alt: "", "aria-hidden": "true", style: {
22
22
  width: 160,
23
23
  height: 87
24
24
  } }),
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { useTranslation } from "react-i18next";
3
- import illuEmptyUsefulLinks from "@edifice.io/bootstrap/dist/images/homepage/illu-empty-useful-links.png";
3
+ import illuEmptyFeeds from "@edifice.io/bootstrap/dist/images/homepage/illu-empty-useful-links.png";
4
4
  import SvgIconClose from "../../../icons/components/IconClose.js";
5
5
  import SvgIconEdit from "../../../icons/components/IconEdit.js";
6
6
  import SvgIconPlus from "../../../icons/components/IconPlus.js";
@@ -29,7 +29,7 @@ function UsefulLinksModal({
29
29
  /* @__PURE__ */ jsx(ModalBeta.Body, { children: links.length === 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
30
30
  /* @__PURE__ */ jsx(Flex, { justify: "end", className: "mb-16", children: addLinkButton }),
31
31
  /* @__PURE__ */ jsxs("div", { className: "useful-links-modal__empty", children: [
32
- /* @__PURE__ */ jsx(Image, { src: illuEmptyUsefulLinks, alt: "", "aria-hidden": "true", style: {
32
+ /* @__PURE__ */ jsx(Image, { src: illuEmptyFeeds, alt: "", "aria-hidden": "true", style: {
33
33
  width: 200,
34
34
  height: 109
35
35
  } }),
@@ -10,6 +10,7 @@ export * from './LastInfos';
10
10
  export * from './MessageFlashList';
11
11
  export * from './Notifications';
12
12
  export * from './Qwant';
13
+ export * from './Rss';
13
14
  export * from './SchoolSpace';
14
15
  export * from './UsefulLinks';
15
16
  export * from './Universalis';
@@ -0,0 +1,7 @@
1
+ import { SVGProps } from 'react';
2
+ interface SVGRProps {
3
+ title?: string;
4
+ titleId?: string;
5
+ }
6
+ declare const SvgIconLogout: ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default SvgIconLogout;
@@ -0,0 +1,13 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ const SvgIconLogout = ({
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 22 22", "aria-hidden": "true", "aria-labelledby": titleId, ...props, children: [
7
+ title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
8
+ /* @__PURE__ */ jsx("path", { fill: "currentColor", d: "M11.917.917a.916.916 0 0 1 0 1.833H5.042a.46.46 0 0 0-.459.458v15.584c0 .253.206.458.459.458h6.875a.917.917 0 0 1 0 1.833H5.042a2.29 2.29 0 0 1-2.292-2.291V3.208A2.29 2.29 0 0 1 5.042.917zm3.018 5.769a.916.916 0 0 1 1.296 0l3.667 3.666a.917.917 0 0 1 0 1.296l-3.667 3.667a.916.916 0 1 1-1.296-1.296L17.956 11l-3.02-3.019a.916.916 0 0 1 0-1.295" }),
9
+ /* @__PURE__ */ jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M7.333 11c0-.506.41-.917.917-.917h11a.917.917 0 1 1 0 1.834h-11A.917.917 0 0 1 7.333 11", clipRule: "evenodd" })
10
+ ] });
11
+ export {
12
+ SvgIconLogout as default
13
+ };
@@ -85,6 +85,7 @@ export { default as IconLink } from './IconLink';
85
85
  export { default as IconListOrder } from './IconListOrder';
86
86
  export { default as IconLoader } from './IconLoader';
87
87
  export { default as IconLock } from './IconLock';
88
+ export { default as IconLogout } from './IconLogout';
88
89
  export { default as IconLsuArt } from './IconLsuArt';
89
90
  export { default as IconLsuCompetenceNumerique } from './IconLsuCompetenceNumerique';
90
91
  export { default as IconLsuEmc } from './IconLsuEmc';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.6.10-develop-b2school.20261019134247",
3
+ "version": "2.6.10-develop-b2school.20261021144055",
4
4
  "description": "Edifice React Library",
5
5
  "keywords": [
6
6
  "react",
@@ -140,9 +140,9 @@
140
140
  "swiper": "10.1.0",
141
141
  "ua-parser-js": "1.0.36",
142
142
  "zustand": "4.5.7",
143
- "@edifice.io/bootstrap": "2.6.10-develop-b2school.20261019134247",
144
- "@edifice.io/tiptap-extensions": "2.6.10-develop-b2school.20261019134247",
145
- "@edifice.io/utilities": "2.6.10-develop-b2school.20261019134247"
143
+ "@edifice.io/tiptap-extensions": "2.6.10-develop-b2school.20261021144055",
144
+ "@edifice.io/utilities": "2.6.10-develop-b2school.20261021144055",
145
+ "@edifice.io/bootstrap": "2.6.10-develop-b2school.20261021144055"
146
146
  },
147
147
  "devDependencies": {
148
148
  "@babel/plugin-transform-react-pure-annotations": "7.27.1",
@@ -173,8 +173,8 @@
173
173
  "vite": "5.4.14",
174
174
  "vite-plugin-dts": "4.5.4",
175
175
  "vite-tsconfig-paths": "5.1.4",
176
- "@edifice.io/config": "2.6.10-develop-b2school.20261019134247",
177
- "@edifice.io/client": "2.6.10-develop-b2school.20261019134247"
176
+ "@edifice.io/client": "2.6.10-develop-b2school.20261021144055",
177
+ "@edifice.io/config": "2.6.10-develop-b2school.20261021144055"
178
178
  },
179
179
  "peerDependencies": {
180
180
  "@react-spring/web": "9.7.5",