@edifice.io/react 2.6.5-develop-b2school.20260914145143 → 2.6.5-develop.20260915170334

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 (56) hide show
  1. package/dist/components/Form/FormText.js +6 -11
  2. package/dist/components/Input/Input.d.ts +2 -11
  3. package/dist/components/Input/Input.js +21 -38
  4. package/dist/components/Label/Label.js +4 -4
  5. package/dist/components/Table/components/Table.d.ts +2 -2
  6. package/dist/components/Table/components/TableTd.d.ts +1 -1
  7. package/dist/components/Table/components/TableTh.d.ts +1 -1
  8. package/dist/components/index.d.ts +0 -2
  9. package/dist/homepage.js +1 -12
  10. package/dist/hooks/index.d.ts +0 -1
  11. package/dist/hooks/useClickOutside/useClickOutside.d.ts +1 -1
  12. package/dist/hooks/useClickOutside/useClickOutside.js +2 -3
  13. package/dist/hooks/useUploadFiles/index.d.ts +1 -0
  14. package/dist/hooks/useUploadFiles/useUploadFiles.d.ts +11 -1
  15. package/dist/hooks/useUploadFiles/useUploadFiles.js +12 -7
  16. package/dist/index.js +160 -166
  17. package/dist/modules/homepage/components/Header/Header.js +4 -11
  18. package/dist/modules/homepage/components/UserSpace/hooks/useProfileLinks.js +8 -18
  19. package/dist/modules/homepage/components/index.d.ts +0 -1
  20. package/dist/modules/multimedia/MediaLibrary/innertabs/Upload.js +34 -7
  21. package/dist/modules/multimedia/UploadFiles/UploadFiles.d.ts +2 -1
  22. package/package.json +6 -6
  23. package/dist/components/LinkPill/LinkPill.d.ts +0 -45
  24. package/dist/components/LinkPill/LinkPill.js +0 -27
  25. package/dist/components/LinkPill/index.d.ts +0 -2
  26. package/dist/components/ModalBeta/ModalBeta.d.ts +0 -47
  27. package/dist/components/ModalBeta/ModalBeta.js +0 -62
  28. package/dist/components/ModalBeta/ModalBetaBody.d.ts +0 -19
  29. package/dist/components/ModalBeta/ModalBetaBody.js +0 -15
  30. package/dist/components/ModalBeta/ModalBetaContext.d.ts +0 -7
  31. package/dist/components/ModalBeta/ModalBetaContext.js +0 -15
  32. package/dist/components/ModalBeta/ModalBetaFooter.d.ts +0 -13
  33. package/dist/components/ModalBeta/ModalBetaFooter.js +0 -7
  34. package/dist/components/ModalBeta/ModalBetaHeader.d.ts +0 -23
  35. package/dist/components/ModalBeta/ModalBetaHeader.js +0 -31
  36. package/dist/components/ModalBeta/index.d.ts +0 -2
  37. package/dist/hooks/useUserPreferences/index.d.ts +0 -1
  38. package/dist/hooks/useUserPreferences/useUserPreferences.d.ts +0 -9
  39. package/dist/hooks/useUserPreferences/useUserPreferences.js +0 -39
  40. package/dist/modules/homepage/components/UsefulLinks/LinkForm.d.ts +0 -13
  41. package/dist/modules/homepage/components/UsefulLinks/LinkForm.js +0 -67
  42. package/dist/modules/homepage/components/UsefulLinks/UsefulLinks.d.ts +0 -6
  43. package/dist/modules/homepage/components/UsefulLinks/UsefulLinks.js +0 -29
  44. package/dist/modules/homepage/components/UsefulLinks/UsefulLinksContainer.d.ts +0 -1
  45. package/dist/modules/homepage/components/UsefulLinks/UsefulLinksContainer.js +0 -40
  46. package/dist/modules/homepage/components/UsefulLinks/UsefulLinksModal.d.ts +0 -11
  47. package/dist/modules/homepage/components/UsefulLinks/UsefulLinksModal.js +0 -65
  48. package/dist/modules/homepage/components/UsefulLinks/hooks/useUsefulLinksContainer.d.ts +0 -19
  49. package/dist/modules/homepage/components/UsefulLinks/hooks/useUsefulLinksContainer.js +0 -26
  50. package/dist/modules/homepage/components/UsefulLinks/index.d.ts +0 -5
  51. package/dist/modules/homepage/components/UsefulLinks/services/api/index.d.ts +0 -6
  52. package/dist/modules/homepage/components/UsefulLinks/services/api/index.js +0 -5
  53. package/dist/modules/homepage/components/UsefulLinks/services/api/usefulLinksService.d.ts +0 -31
  54. package/dist/modules/homepage/components/UsefulLinks/services/api/usefulLinksService.js +0 -50
  55. package/dist/modules/homepage/components/UsefulLinks/services/queries/usefulLinks.d.ts +0 -20
  56. package/dist/modules/homepage/components/UsefulLinks/services/queries/usefulLinks.js +0 -65
@@ -1,19 +0,0 @@
1
- import { UsefulLink, UsefulLinkPayload } from '@edifice.io/client';
2
- /** Maximum number of useful links a user can save. */
3
- export declare const MAX_USEFUL_LINKS = 10;
4
- export interface UseUsefulLinksContainerReturn {
5
- links: UsefulLink[];
6
- isLoading: boolean;
7
- error: Error | null;
8
- /** Whether the user can still add a new link (fewer than MAX_USEFUL_LINKS). */
9
- canAddLink: boolean;
10
- createLink: (payload: UsefulLinkPayload) => Promise<UsefulLink>;
11
- isCreating: boolean;
12
- updateLink: (id: string, payload: UsefulLinkPayload) => Promise<UsefulLink>;
13
- isUpdating: boolean;
14
- deleteLink: (id: string) => void;
15
- }
16
- /**
17
- * Custom hook that provides useful links data and CRUD handlers.
18
- */
19
- export declare const useUsefulLinksContainer: () => UseUsefulLinksContainerReturn;
@@ -1,26 +0,0 @@
1
- import { useUsefulLinks, useCreateUsefulLink, useUpdateUsefulLink, useDeleteUsefulLink } from "../services/queries/usefulLinks.js";
2
- const MAX_USEFUL_LINKS = 10, useUsefulLinksContainer = () => {
3
- const {
4
- data: links,
5
- isLoading,
6
- error
7
- } = useUsefulLinks(), createMutation = useCreateUsefulLink(), updateMutation = useUpdateUsefulLink(), deleteMutation = useDeleteUsefulLink();
8
- return {
9
- links: links ?? [],
10
- isLoading,
11
- error,
12
- canAddLink: ((links == null ? void 0 : links.length) ?? 0) < MAX_USEFUL_LINKS,
13
- createLink: (payload) => createMutation.mutateAsync(payload),
14
- isCreating: createMutation.isPending,
15
- updateLink: (id, payload) => updateMutation.mutateAsync({
16
- id,
17
- payload
18
- }),
19
- isUpdating: updateMutation.isPending,
20
- deleteLink: (id) => deleteMutation.mutate(id)
21
- };
22
- };
23
- export {
24
- MAX_USEFUL_LINKS,
25
- useUsefulLinksContainer
26
- };
@@ -1,5 +0,0 @@
1
- export * from './LinkForm';
2
- export * from './UsefulLinks';
3
- export * from './UsefulLinksContainer';
4
- export * from './UsefulLinksModal';
5
- export * from './hooks/useUsefulLinksContainer';
@@ -1,6 +0,0 @@
1
- export declare const usefulLinksService: {
2
- getUsefulLinks(): Promise<import('@edifice.io/client').UsefulLink[]>;
3
- createUsefulLink(payload: import('@edifice.io/client').UsefulLinkPayload): Promise<import('@edifice.io/client').UsefulLink>;
4
- updateUsefulLink(id: string, payload: import('@edifice.io/client').UsefulLinkPayload): Promise<import('@edifice.io/client').UsefulLink>;
5
- deleteUsefulLink(id: string): Promise<void>;
6
- };
@@ -1,5 +0,0 @@
1
- import { createUsefulLinksService } from "./usefulLinksService.js";
2
- const usefulLinksService = createUsefulLinksService("");
3
- export {
4
- usefulLinksService
5
- };
@@ -1,31 +0,0 @@
1
- import { UsefulLink, UsefulLinkPayload } from '@edifice.io/client';
2
- /**
3
- * Creates a useful links service with methods to manage the current user's
4
- * personal "useful links" (homepage "Liens utiles" widget).
5
- *
6
- * Backend contract: `GET`/`POST`/`PUT`/`DELETE /bookmark/api/v2/bookmarks`.
7
- * `POST`/`PUT` only return the bookmark's `_id`, not the full resource.
8
- * Known error code: `bookmark.widget.bad.request.limit.reached` (POST, 400,
9
- * once the user already has 10 links). `PUT` returns 401 if the id doesn't
10
- * belong to the user, `DELETE` returns 404 if the id doesn't exist.
11
- *
12
- * @param baseURL The base URL for the useful links service API.
13
- */
14
- export declare const createUsefulLinksService: (baseURL: string) => {
15
- /**
16
- * Get the current user's useful links.
17
- */
18
- getUsefulLinks(): Promise<UsefulLink[]>;
19
- /**
20
- * Create a new useful link.
21
- */
22
- createUsefulLink(payload: UsefulLinkPayload): Promise<UsefulLink>;
23
- /**
24
- * Update an existing useful link.
25
- */
26
- updateUsefulLink(id: string, payload: UsefulLinkPayload): Promise<UsefulLink>;
27
- /**
28
- * Delete a useful link.
29
- */
30
- deleteUsefulLink(id: string): Promise<void>;
31
- };
@@ -1,50 +0,0 @@
1
- import { odeServices } from "@edifice.io/client";
2
- const toUsefulLink = ({
3
- _id,
4
- name,
5
- url
6
- }) => ({
7
- id: _id,
8
- name,
9
- url
10
- }), createUsefulLinksService = (baseURL) => ({
11
- /**
12
- * Get the current user's useful links.
13
- */
14
- async getUsefulLinks() {
15
- const {
16
- bookmarks
17
- } = await odeServices.http().get(`${baseURL}/bookmark/api/v2/bookmarks`);
18
- return bookmarks.map(toUsefulLink);
19
- },
20
- /**
21
- * Create a new useful link.
22
- */
23
- async createUsefulLink(payload) {
24
- const {
25
- _id
26
- } = await odeServices.http().postJson(`${baseURL}/bookmark/api/v2/bookmarks`, payload);
27
- return {
28
- id: _id,
29
- ...payload
30
- };
31
- },
32
- /**
33
- * Update an existing useful link.
34
- */
35
- async updateUsefulLink(id, payload) {
36
- return await odeServices.http().putJson(`${baseURL}/bookmark/api/v2/bookmarks/${id}`, payload), {
37
- id,
38
- ...payload
39
- };
40
- },
41
- /**
42
- * Delete a useful link.
43
- */
44
- async deleteUsefulLink(id) {
45
- await odeServices.http().delete(`${baseURL}/bookmark/api/v2/bookmarks/${id}`);
46
- }
47
- });
48
- export {
49
- createUsefulLinksService
50
- };
@@ -1,20 +0,0 @@
1
- import { UsefulLink, UsefulLinkPayload } from '@edifice.io/client';
2
- export declare const usefulLinksQueryKeys: {
3
- all: () => readonly ["usefulLinks"];
4
- };
5
- export declare const usefulLinksQueryOptions: {
6
- getUsefulLinks(): import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<UsefulLink[], Error, UsefulLink[], import('@tanstack/react-query').QueryKey>, "queryFn"> & {
7
- queryFn?: import('@tanstack/react-query').QueryFunction<UsefulLink[], import('@tanstack/react-query').QueryKey, never> | undefined;
8
- } & {
9
- queryKey: import('@tanstack/react-query').DataTag<import('@tanstack/react-query').QueryKey, UsefulLink[]>;
10
- };
11
- };
12
- export declare const useUsefulLinks: () => import('@tanstack/react-query').UseQueryResult<UsefulLink[], Error>;
13
- export declare const useCreateUsefulLink: () => import('@tanstack/react-query').UseMutationResult<UsefulLink, Error, UsefulLinkPayload, unknown>;
14
- export declare const useUpdateUsefulLink: () => import('@tanstack/react-query').UseMutationResult<UsefulLink, Error, {
15
- id: string;
16
- payload: UsefulLinkPayload;
17
- }, unknown>;
18
- export declare const useDeleteUsefulLink: () => import('@tanstack/react-query').UseMutationResult<void, Error, string, {
19
- previousLinks: UsefulLink[] | undefined;
20
- }>;
@@ -1,65 +0,0 @@
1
- import { useQuery, useQueryClient, useMutation, queryOptions } from "@tanstack/react-query";
2
- import { usefulLinksService } from "../api/index.js";
3
- const usefulLinksQueryKeys = {
4
- all: () => ["usefulLinks"]
5
- }, usefulLinksQueryOptions = {
6
- getUsefulLinks() {
7
- return queryOptions({
8
- queryKey: usefulLinksQueryKeys.all(),
9
- queryFn: async () => usefulLinksService.getUsefulLinks()
10
- });
11
- }
12
- }, useUsefulLinks = () => useQuery(usefulLinksQueryOptions.getUsefulLinks()), useCreateUsefulLink = () => {
13
- const queryClient = useQueryClient();
14
- return useMutation({
15
- mutationFn: (payload) => usefulLinksService.createUsefulLink(payload),
16
- onSuccess: () => {
17
- queryClient.invalidateQueries({
18
- queryKey: usefulLinksQueryKeys.all()
19
- });
20
- }
21
- });
22
- }, useUpdateUsefulLink = () => {
23
- const queryClient = useQueryClient();
24
- return useMutation({
25
- mutationFn: ({
26
- id,
27
- payload
28
- }) => usefulLinksService.updateUsefulLink(id, payload),
29
- onSuccess: () => {
30
- queryClient.invalidateQueries({
31
- queryKey: usefulLinksQueryKeys.all()
32
- });
33
- }
34
- });
35
- }, useDeleteUsefulLink = () => {
36
- const queryClient = useQueryClient();
37
- return useMutation({
38
- mutationFn: (id) => usefulLinksService.deleteUsefulLink(id),
39
- onMutate: async (id) => {
40
- await queryClient.cancelQueries({
41
- queryKey: usefulLinksQueryKeys.all()
42
- });
43
- const previousLinks = queryClient.getQueryData(usefulLinksQueryKeys.all());
44
- return queryClient.setQueryData(usefulLinksQueryKeys.all(), (links) => links == null ? void 0 : links.filter((link) => link.id !== id)), {
45
- previousLinks
46
- };
47
- },
48
- onError: (_error, _id, context) => {
49
- context != null && context.previousLinks && queryClient.setQueryData(usefulLinksQueryKeys.all(), context.previousLinks);
50
- },
51
- onSettled: () => {
52
- queryClient.invalidateQueries({
53
- queryKey: usefulLinksQueryKeys.all()
54
- });
55
- }
56
- });
57
- };
58
- export {
59
- useCreateUsefulLink,
60
- useDeleteUsefulLink,
61
- useUpdateUsefulLink,
62
- useUsefulLinks,
63
- usefulLinksQueryKeys,
64
- usefulLinksQueryOptions
65
- };