@edifice.io/react 2.5.13-develop-pedago.20260316113612 → 2.5.13-develop.20260316160930
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.
- package/dist/components/AddAttachments/AddAttachments.d.ts +3 -6
- package/dist/components/AddAttachments/AddAttachments.js +29 -17
- package/dist/components/AddAttachments/models/attachment.d.ts +0 -1
- package/dist/components/Badge/Badge.js +0 -1
- package/dist/components/Layout/components/WidgetApps.js +2 -2
- package/dist/components/MediaViewer/PdfViewer.js +14 -4
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +8 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +12 -6
- package/dist/components/index.d.ts +0 -1
- package/dist/hooks/useConversation/useConversation.js +2 -4
- package/dist/hooks/useDropzone/useDropzone.js +4 -4
- package/dist/hooks/usePreferences/usePreferences.d.ts +3 -3
- package/dist/hooks/useToast/useToast.js +5 -5
- package/dist/index.js +0 -6
- package/dist/modules/modals/OnboardingModal/OnboardingModal.d.ts +28 -2
- package/dist/modules/modals/OnboardingModal/OnboardingModal.js +13 -9
- package/dist/modules/modals/OnboardingModal/useOnboardingModal.d.ts +4 -1
- package/dist/modules/modals/OnboardingModal/useOnboardingModal.js +28 -20
- package/dist/modules/modals/ShareModal/ShareResources.js +1 -1
- package/dist/providers/AntThemeProvider/AntProvider.js +5 -5
- package/package.json +7 -7
- package/dist/_virtual/common.js +0 -4
- package/dist/_virtual/de_DE.js +0 -4
- package/dist/_virtual/de_DE2.js +0 -4
- package/dist/_virtual/de_DE3.js +0 -4
- package/dist/_virtual/de_DE4.js +0 -4
- package/dist/_virtual/de_DE5.js +0 -4
- package/dist/_virtual/de_DE6.js +0 -4
- package/dist/_virtual/defineProperty.js +0 -4
- package/dist/_virtual/es_ES.js +0 -4
- package/dist/_virtual/es_ES2.js +0 -4
- package/dist/_virtual/es_ES3.js +0 -4
- package/dist/_virtual/es_ES4.js +0 -4
- package/dist/_virtual/es_ES5.js +0 -4
- package/dist/_virtual/es_ES6.js +0 -4
- package/dist/_virtual/fr_FR.js +0 -4
- package/dist/_virtual/fr_FR2.js +0 -4
- package/dist/_virtual/fr_FR3.js +0 -4
- package/dist/_virtual/fr_FR4.js +0 -4
- package/dist/_virtual/fr_FR5.js +0 -4
- package/dist/_virtual/fr_FR6.js +0 -4
- package/dist/_virtual/interopRequireDefault.js +0 -4
- package/dist/_virtual/it_IT.js +0 -4
- package/dist/_virtual/it_IT2.js +0 -4
- package/dist/_virtual/it_IT3.js +0 -4
- package/dist/_virtual/it_IT4.js +0 -4
- package/dist/_virtual/it_IT5.js +0 -4
- package/dist/_virtual/it_IT6.js +0 -4
- package/dist/_virtual/objectSpread2.js +0 -4
- package/dist/_virtual/pt_PT.js +0 -4
- package/dist/_virtual/pt_PT2.js +0 -4
- package/dist/_virtual/pt_PT3.js +0 -4
- package/dist/_virtual/pt_PT4.js +0 -4
- package/dist/_virtual/pt_PT5.js +0 -4
- package/dist/_virtual/pt_PT6.js +0 -4
- package/dist/_virtual/toPrimitive.js +0 -4
- package/dist/_virtual/toPropertyKey.js +0 -4
- package/dist/_virtual/typeof.js +0 -4
- package/dist/components/AddAttachments/hooks/useFileToAttachment.d.ts +0 -3
- package/dist/components/AddAttachments/hooks/useFileToAttachment.js +0 -16
- package/dist/components/UserSearch/UserSearch.d.ts +0 -7
- package/dist/components/UserSearch/UserSearch.js +0 -82
- package/dist/components/UserSearch/index.d.ts +0 -3
- package/dist/components/UserSearch/types/types.d.ts +0 -29
- package/dist/components/UserSearch/types/visible.d.ts +0 -24
- package/dist/components/UserSearch/types/visible.js +0 -4
- package/dist/node_modules/.pnpm/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/defineProperty.js +0 -18
- package/dist/node_modules/.pnpm/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/interopRequireDefault.js +0 -13
- package/dist/node_modules/.pnpm/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/objectSpread2.js +0 -31
- package/dist/node_modules/.pnpm/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/toPrimitive.js +0 -20
- package/dist/node_modules/.pnpm/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/toPropertyKey.js +0 -15
- package/dist/node_modules/.pnpm/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/typeof.js +0 -16
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/calendar/locale/de_DE.js +0 -11
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/calendar/locale/es_ES.js +0 -11
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/calendar/locale/fr_FR.js +0 -11
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/calendar/locale/it_IT.js +0 -11
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/calendar/locale/pt_PT.js +0 -11
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/date-picker/locale/de_DE.js +0 -22
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/date-picker/locale/es_ES.js +0 -22
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/date-picker/locale/fr_FR.js +0 -27
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/date-picker/locale/it_IT.js +0 -20
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/date-picker/locale/pt_PT.js +0 -45
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/locale/de_DE.js +0 -145
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/locale/es_ES.js +0 -145
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/locale/fr_FR.js +0 -144
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/locale/it_IT.js +0 -156
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/locale/pt_PT.js +0 -158
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/time-picker/locale/de_DE.js +0 -10
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/time-picker/locale/es_ES.js +0 -10
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/time-picker/locale/fr_FR.js +0 -10
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/time-picker/locale/it_IT.js +0 -10
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/lib/time-picker/locale/pt_PT.js +0 -10
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/locale/de_DE.js +0 -8
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/locale/es_ES.js +0 -8
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/locale/fr_FR.js +0 -8
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/locale/it_IT.js +0 -8
- package/dist/node_modules/.pnpm/antd@5.29.3_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/antd/locale/pt_PT.js +0 -8
- package/dist/node_modules/.pnpm/rc-pagination@5.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-pagination/lib/locale/de_DE.js +0 -21
- package/dist/node_modules/.pnpm/rc-pagination@5.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-pagination/lib/locale/es_ES.js +0 -21
- package/dist/node_modules/.pnpm/rc-pagination@5.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-pagination/lib/locale/fr_FR.js +0 -21
- package/dist/node_modules/.pnpm/rc-pagination@5.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-pagination/lib/locale/it_IT.js +0 -21
- package/dist/node_modules/.pnpm/rc-pagination@5.1.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-pagination/lib/locale/pt_PT.js +0 -21
- package/dist/node_modules/.pnpm/rc-picker@4.11.3_dayjs@1.11.19_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-picker/lib/locale/common.js +0 -14
- package/dist/node_modules/.pnpm/rc-picker@4.11.3_dayjs@1.11.19_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-picker/lib/locale/de_DE.js +0 -37
- package/dist/node_modules/.pnpm/rc-picker@4.11.3_dayjs@1.11.19_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-picker/lib/locale/es_ES.js +0 -37
- package/dist/node_modules/.pnpm/rc-picker@4.11.3_dayjs@1.11.19_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-picker/lib/locale/fr_FR.js +0 -38
- package/dist/node_modules/.pnpm/rc-picker@4.11.3_dayjs@1.11.19_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-picker/lib/locale/it_IT.js +0 -37
- package/dist/node_modules/.pnpm/rc-picker@4.11.3_dayjs@1.11.19_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/rc-picker/lib/locale/pt_PT.js +0 -39
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { Attachment } from './models/attachment';
|
|
2
|
-
export type SingleAttachmentType = Attachment;
|
|
3
|
-
export { useFileToAttachment } from './hooks/useFileToAttachment';
|
|
4
2
|
export interface AddAttachmentsProps {
|
|
5
3
|
attachments: Attachment[];
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
onRemoveAttachment?: (attachmentId: string) => void;
|
|
4
|
+
onFilesSelected: (files: File[]) => void;
|
|
5
|
+
onRemoveAttachment: (attachmentId: string) => void;
|
|
9
6
|
editMode?: boolean;
|
|
10
7
|
isMutating?: boolean;
|
|
11
8
|
onCopyToWorkspace?: (attachments: Attachment[], folderId: string) => Promise<boolean>;
|
|
@@ -15,7 +12,7 @@ export interface AddAttachmentsProps {
|
|
|
15
12
|
downloadAllUrl?: string;
|
|
16
13
|
}
|
|
17
14
|
export declare const AddAttachments: {
|
|
18
|
-
({ attachments,
|
|
15
|
+
({ attachments, onFilesSelected, onRemoveAttachment, editMode, isMutating, onCopyToWorkspace, getDownloadUrl, downloadAllUrl, }: AddAttachmentsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
19
16
|
displayName: string;
|
|
20
17
|
};
|
|
21
18
|
export default AddAttachments;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import clsx from "clsx";
|
|
3
|
-
import { useRef, useState } from "react";
|
|
3
|
+
import { useRef, useState, useEffect } from "react";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
5
|
import SvgIconDelete from "../../modules/icons/components/IconDelete.js";
|
|
6
6
|
import SvgIconDownload from "../../modules/icons/components/IconDownload.js";
|
|
@@ -8,13 +8,22 @@ import SvgIconFolderAdd from "../../modules/icons/components/IconFolderAdd.js";
|
|
|
8
8
|
import SvgIconPlus from "../../modules/icons/components/IconPlus.js";
|
|
9
9
|
import { AddAttachmentToWorkspaceModal } from "./components/AddAttachmentToWorkspaceModal.js";
|
|
10
10
|
import { SingleAttachment } from "./components/SingleAttachment.js";
|
|
11
|
-
import { useFileToAttachment } from "./hooks/useFileToAttachment.js";
|
|
12
11
|
import Flex from "../Flex/Flex.js";
|
|
13
12
|
import IconButton from "../Button/IconButton.js";
|
|
14
13
|
import Button from "../Button/Button.js";
|
|
14
|
+
function fileToAttachment(file) {
|
|
15
|
+
return {
|
|
16
|
+
id: `${file.name}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`,
|
|
17
|
+
charset: "UTF-8",
|
|
18
|
+
contentTransferEncoding: "binary",
|
|
19
|
+
contentType: file.type || "application/octet-stream",
|
|
20
|
+
filename: file.name,
|
|
21
|
+
name: file.name,
|
|
22
|
+
size: file.size
|
|
23
|
+
};
|
|
24
|
+
}
|
|
15
25
|
const AddAttachments = ({
|
|
16
26
|
attachments,
|
|
17
|
-
onChange,
|
|
18
27
|
onFilesSelected,
|
|
19
28
|
onRemoveAttachment,
|
|
20
29
|
editMode = !1,
|
|
@@ -25,8 +34,10 @@ const AddAttachments = ({
|
|
|
25
34
|
}) => {
|
|
26
35
|
const {
|
|
27
36
|
t
|
|
28
|
-
} = useTranslation(), inputRef = useRef(null),
|
|
29
|
-
if (
|
|
37
|
+
} = useTranslation(), inputRef = useRef(null), [optimisticAttachments, setOptimisticAttachments] = useState([]), [attachmentsToAddToWorkspace, setAttachmentsToAddToWorkspace] = useState(void 0), prevAttachmentsLengthRef = useRef(attachments.length), displayedAttachments = [...attachments, ...optimisticAttachments];
|
|
38
|
+
if (useEffect(() => {
|
|
39
|
+
attachments.length > prevAttachmentsLengthRef.current && setOptimisticAttachments([]), prevAttachmentsLengthRef.current = attachments.length;
|
|
40
|
+
}, [attachments.length]), !editMode && !displayedAttachments.length) return null;
|
|
30
41
|
const resetInputValue = () => {
|
|
31
42
|
inputRef.current && (inputRef.current.value = "");
|
|
32
43
|
}, handleAttachClick = () => {
|
|
@@ -35,34 +46,36 @@ const AddAttachments = ({
|
|
|
35
46
|
}, handleFileChange = (event) => {
|
|
36
47
|
const files = Array.from(event.target.files ?? []);
|
|
37
48
|
if (files.length > 0) {
|
|
38
|
-
|
|
39
|
-
|
|
49
|
+
onFilesSelected(files);
|
|
50
|
+
const newOptimistic = files.map(fileToAttachment);
|
|
51
|
+
setOptimisticAttachments((prev) => [...prev, ...newOptimistic]);
|
|
40
52
|
}
|
|
41
53
|
resetInputValue();
|
|
42
54
|
}, handleDetachAllClick = () => {
|
|
43
|
-
|
|
55
|
+
setOptimisticAttachments([]), attachments.forEach((attachment) => {
|
|
56
|
+
onRemoveAttachment(attachment.id);
|
|
57
|
+
}), resetInputValue();
|
|
44
58
|
}, handleDetachClick = (attachmentId) => {
|
|
45
|
-
|
|
46
|
-
onChange == null || onChange(next), onRemoveAttachment == null || onRemoveAttachment(attachmentId), resetInputValue();
|
|
59
|
+
optimisticAttachments.some((attachment) => attachment.id === attachmentId) ? setOptimisticAttachments((prev) => prev.filter((attachment) => attachment.id !== attachmentId)) : onRemoveAttachment(attachmentId), resetInputValue();
|
|
47
60
|
}, handleCopyToWorkspace = (attachments2) => {
|
|
48
61
|
setAttachmentsToAddToWorkspace(attachments2);
|
|
49
62
|
}, className = clsx("bg-gray-200 rounded px-12 py-8 message-attachments align-self-start gap-8 d-flex flex-column mw-100", {
|
|
50
63
|
"border add-attachments-edit mx-16": editMode
|
|
51
64
|
});
|
|
52
65
|
return /* @__PURE__ */ jsxs("div", { className, "data-drag-handle": !0, children: [
|
|
53
|
-
!!
|
|
66
|
+
!!displayedAttachments.length && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54
67
|
/* @__PURE__ */ jsxs(Flex, { direction: "row", align: "center", justify: "between", className: "border-bottom", children: [
|
|
55
68
|
/* @__PURE__ */ jsx("span", { className: "caption fw-bold my-8", children: t("attachments") }),
|
|
56
|
-
|
|
57
|
-
onCopyToWorkspace && /* @__PURE__ */ jsx(IconButton, { title: t("conversation.copy.all.toworkspace"), color: "tertiary", type: "button", icon: /* @__PURE__ */ jsx(SvgIconFolderAdd, {}), onClick: () => handleCopyToWorkspace(
|
|
69
|
+
displayedAttachments.length > 1 && /* @__PURE__ */ jsxs("div", { children: [
|
|
70
|
+
onCopyToWorkspace && /* @__PURE__ */ jsx(IconButton, { title: t("conversation.copy.all.toworkspace"), color: "tertiary", type: "button", icon: /* @__PURE__ */ jsx(SvgIconFolderAdd, {}), onClick: () => handleCopyToWorkspace(displayedAttachments), variant: "ghost" }),
|
|
58
71
|
downloadAllUrl && /* @__PURE__ */ jsx("a", { href: downloadAllUrl, download: !0, children: /* @__PURE__ */ jsx(IconButton, { title: t("download.all.attachment"), color: "tertiary", type: "button", icon: /* @__PURE__ */ jsx(SvgIconDownload, {}), variant: "ghost" }) }),
|
|
59
72
|
editMode && /* @__PURE__ */ jsx(IconButton, { title: t("remove.all.attachment"), color: "danger", type: "button", icon: /* @__PURE__ */ jsx(SvgIconDelete, {}), variant: "ghost", onClick: handleDetachAllClick, disabled: isMutating })
|
|
60
73
|
] })
|
|
61
74
|
] }),
|
|
62
|
-
/* @__PURE__ */ jsx("ul", { className: "d-flex gap-8 flex-column list-unstyled m-0", children:
|
|
75
|
+
/* @__PURE__ */ jsx("ul", { className: "d-flex gap-8 flex-column list-unstyled m-0", children: displayedAttachments.map((attachment) => /* @__PURE__ */ jsx("li", { className: "mw-100", children: /* @__PURE__ */ jsx(SingleAttachment, { attachment, editMode, onDelete: handleDetachClick, onCopyToWorkspace: onCopyToWorkspace ? (attachment2) => handleCopyToWorkspace([attachment2]) : void 0, getDownloadUrl, disabled: isMutating }) }, attachment.id)) })
|
|
63
76
|
] }),
|
|
64
77
|
editMode && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
65
|
-
/* @__PURE__ */ jsx(Button, { color: "secondary", variant: "ghost", isLoading: isMutating, onClick: handleAttachClick, disabled: isMutating, className: "align-self-start", leftIcon: /* @__PURE__ */ jsx(SvgIconPlus, {}),
|
|
78
|
+
/* @__PURE__ */ jsx(Button, { color: "secondary", variant: "ghost", isLoading: isMutating, onClick: handleAttachClick, disabled: isMutating, className: "align-self-start", leftIcon: /* @__PURE__ */ jsx(SvgIconPlus, {}), children: t("add.attachment") }),
|
|
66
79
|
/* @__PURE__ */ jsx("input", { ref: inputRef, multiple: !0, type: "file", name: "attachment-input", id: "attachment-input", onChange: handleFileChange, hidden: !0 })
|
|
67
80
|
] }),
|
|
68
81
|
onCopyToWorkspace && !!attachmentsToAddToWorkspace && /* @__PURE__ */ jsx(AddAttachmentToWorkspaceModal, { isOpen: !0, onModalClose: () => setAttachmentsToAddToWorkspace(void 0), attachments: attachmentsToAddToWorkspace, onCopyToWorkspace })
|
|
@@ -70,6 +83,5 @@ const AddAttachments = ({
|
|
|
70
83
|
};
|
|
71
84
|
export {
|
|
72
85
|
AddAttachments,
|
|
73
|
-
AddAttachments as default
|
|
74
|
-
useFileToAttachment
|
|
86
|
+
AddAttachments as default
|
|
75
87
|
};
|
|
@@ -21,7 +21,6 @@ const Badge = /* @__PURE__ */ forwardRef(({
|
|
|
21
21
|
const colorAppClassName = getIconClass(variant.app), backgroundLightAppClassName = getBackgroundLightIconClass(variant.app), borderAppClassName = getBorderIconClass(variant.app);
|
|
22
22
|
badgeColorClassName = `${colorAppClassName} ${backgroundLightAppClassName} ${borderAppClassName}`;
|
|
23
23
|
}
|
|
24
|
-
console.log(badgeColorClassName);
|
|
25
24
|
const classes = clsx("badge rounded-pill", (variant.type === "content" || variant.type === "user") && "background" in variant ? "bg-gray-200" : (variant.type === "content" || variant.type === "user") && !("background" in variant) ? "border border-0" : "", variant.type === "content" && `text-${variant.level}`, variant.type === "notification" && `badge-notification bg-${variant.level} text-light border border-0`, variant.type === "user" && `badge-profile-${variant.profile.toLowerCase()}`, variant.type === "link" && "badge-link border border-0", variant.type === "chip" && "bg-gray-200", variant.type === "beta" && badgeColorClassName, className);
|
|
26
25
|
return /* @__PURE__ */ jsxs("span", { ref, className: classes, ...restProps, children: [
|
|
27
26
|
variant.type === "chip" && /* @__PURE__ */ jsx("div", { className: "d-flex fw-800 align-items-center", children }),
|
|
@@ -11,10 +11,10 @@ const WidgetAppsFooter = () => {
|
|
|
11
11
|
}) => {
|
|
12
12
|
const {
|
|
13
13
|
t
|
|
14
|
-
} = useTranslation();
|
|
14
|
+
} = useTranslation(), getAppName = (data) => data.prefix && data.prefix.length > 1 ? t(data.prefix.substring(1)) : t(data.displayName) || "";
|
|
15
15
|
return /* @__PURE__ */ jsxs("div", { className: "widget-body d-flex flex-wrap", children: [
|
|
16
16
|
!bookmarkedApps.length && /* @__PURE__ */ jsx("div", { className: "text-dark", children: t("navbar.myapps.more") }),
|
|
17
|
-
bookmarkedApps.slice(0, 6).map((app, index) => /* @__PURE__ */ jsx("a", { href: app.address, className: "bookmarked-app", target: appToOpenOnBlank.includes(app.name) || app.isExternal || app.category === "connector" ? "_blank" : void 0, rel: appToOpenOnBlank.includes(app.name) || app.isExternal || app.category === "connector" ? "noopener noreferrer" : void 0, children: /* @__PURE__ */ jsx(AppIcon, { app, size: "32" }) }, index))
|
|
17
|
+
bookmarkedApps.slice(0, 6).map((app, index) => /* @__PURE__ */ jsx("a", { href: app.address, title: getAppName(app), className: "bookmarked-app", target: appToOpenOnBlank.includes(app.name) || app.isExternal || app.category === "connector" ? "_blank" : void 0, rel: appToOpenOnBlank.includes(app.name) || app.isExternal || app.category === "connector" ? "noopener noreferrer" : void 0, children: /* @__PURE__ */ jsx(AppIcon, { app, size: "32" }) }, index))
|
|
18
18
|
] });
|
|
19
19
|
};
|
|
20
20
|
export {
|
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useRef } from "react";
|
|
3
|
-
import { Document, Page } from "react-pdf";
|
|
2
|
+
import { useState, useRef, useEffect } from "react";
|
|
4
3
|
import LoadingScreen from "../LoadingScreen/LoadingScreen.js";
|
|
5
4
|
function PdfViewer({
|
|
6
5
|
mediaUrl,
|
|
7
6
|
scale
|
|
8
7
|
}) {
|
|
9
|
-
const [numPages, setNumPages] = useState(null),
|
|
8
|
+
const [numPages, setNumPages] = useState(null), [Document, setDocument] = useState(null), [Page, setPage] = useState(null), [isLoading, setIsLoading] = useState(!0), pagesRef = useRef([]);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
(async () => {
|
|
11
|
+
try {
|
|
12
|
+
const reactPdf = await import("react-pdf");
|
|
13
|
+
setDocument(() => reactPdf.Document), setPage(() => reactPdf.Page), setIsLoading(!1);
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.error("Failed to load react-pdf:", error);
|
|
16
|
+
}
|
|
17
|
+
})();
|
|
18
|
+
}, []);
|
|
19
|
+
const onDocumentLoadSuccess = ({
|
|
10
20
|
numPages: numPages2
|
|
11
21
|
}) => {
|
|
12
22
|
setNumPages(numPages2);
|
|
13
23
|
};
|
|
14
|
-
return /* @__PURE__ */ jsx("div", { style: {
|
|
24
|
+
return isLoading || !Document || !Page ? /* @__PURE__ */ jsx(LoadingScreen, {}) : /* @__PURE__ */ jsx("div", { style: {
|
|
15
25
|
width: `calc(600px * ${scale})`,
|
|
16
26
|
height: "calc(100vh - 52px)",
|
|
17
27
|
overflowY: "auto",
|
|
@@ -27,6 +27,14 @@ export interface SegmentedControlProps extends Omit<React.HTMLAttributes<HTMLDiv
|
|
|
27
27
|
* Selected value
|
|
28
28
|
*/
|
|
29
29
|
value?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Variant of the segmented control, affecting its styling.
|
|
32
|
+
* - 'default': standard segmented control with borders.
|
|
33
|
+
* - 'ghost': borderless segmented control, relying on background and text color for distinction.
|
|
34
|
+
*
|
|
35
|
+
* @default 'default'
|
|
36
|
+
*/
|
|
37
|
+
variant?: 'default' | 'ghost';
|
|
30
38
|
/**
|
|
31
39
|
* Callback called when value changes
|
|
32
40
|
*/
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
2
|
import { Segmented } from "antd";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { forwardRef } from "react";
|
|
4
5
|
const SegmentedControl = /* @__PURE__ */ forwardRef(({
|
|
5
6
|
options,
|
|
6
7
|
value,
|
|
7
8
|
onChange,
|
|
9
|
+
variant = "default",
|
|
10
|
+
className,
|
|
8
11
|
...htmlProps
|
|
9
12
|
}, ref) => {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const transformedOptions = options.map((option) => ({
|
|
14
|
+
...option,
|
|
15
|
+
label: /* @__PURE__ */ jsx("span", { "data-testid": `segmented-option-${option.value}`, children: option.label })
|
|
16
|
+
})), classNames = clsx(className, {
|
|
17
|
+
ghost: variant === "ghost"
|
|
18
|
+
}), antProps = {
|
|
19
|
+
options: transformedOptions,
|
|
15
20
|
value,
|
|
16
21
|
onChange,
|
|
17
22
|
ref,
|
|
23
|
+
className: classNames,
|
|
18
24
|
...htmlProps
|
|
19
25
|
};
|
|
20
26
|
return /* @__PURE__ */ jsx(Segmented, { ...antProps });
|
|
@@ -6,13 +6,11 @@ const useConversation = () => {
|
|
|
6
6
|
const zimbraWorkflow = useHasWorkflow("fr.openent.zimbra.controllers.ZimbraController|view"), zimbraPreauth = useHasWorkflow("fr.openent.zimbra.controllers.ZimbraController|preauth"), [msgLink, setMsgLink] = useState(""), queryParams = {
|
|
7
7
|
unread: !0,
|
|
8
8
|
_: (/* @__PURE__ */ new Date()).getTime()
|
|
9
|
-
}
|
|
10
|
-
zimbraWorkflow || (queryParams.queryparam_token = (/* @__PURE__ */ new Date()).getTime());
|
|
11
|
-
const {
|
|
9
|
+
}, {
|
|
12
10
|
data: messages
|
|
13
11
|
} = useQuery({
|
|
14
12
|
queryKey: ["folder", "count", "inbox"],
|
|
15
|
-
queryFn: async () => await odeServices.http().get(zimbraWorkflow ? "/zimbra/count/INBOX" : "/conversation/count/inbox", {
|
|
13
|
+
queryFn: async () => await odeServices.http().get(zimbraWorkflow ? "/zimbra/count/INBOX" : "/conversation/api/count/inbox", {
|
|
16
14
|
queryParams
|
|
17
15
|
}),
|
|
18
16
|
staleTime: 5 * 60 * 1e3
|
|
@@ -35,11 +35,11 @@ const useDropzone = (props) => {
|
|
|
35
35
|
}, convertHEICImages = async (files2) => {
|
|
36
36
|
if (files2 === null || files2.length === 0)
|
|
37
37
|
return [];
|
|
38
|
-
let
|
|
39
|
-
return files2.some((file) => HEIC_MIME_TYPES.includes(file.type)) && (
|
|
40
|
-
if (
|
|
38
|
+
let heic2any;
|
|
39
|
+
return files2.some((file) => HEIC_MIME_TYPES.includes(file.type)) && (heic2any = (await import("heic2any")).default), Promise.all(files2.map(async (file) => {
|
|
40
|
+
if (HEIC_MIME_TYPES.includes(file.type) && heic2any)
|
|
41
41
|
try {
|
|
42
|
-
const converted = await
|
|
42
|
+
const converted = await heic2any({
|
|
43
43
|
blob: file,
|
|
44
44
|
toType: "image/jpeg"
|
|
45
45
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default function usePreferences(name: string): {
|
|
2
|
-
getPreference: () => Promise<
|
|
3
|
-
savePreference: (value:
|
|
1
|
+
export default function usePreferences<T = any>(name: string): {
|
|
2
|
+
getPreference: () => Promise<T>;
|
|
3
|
+
savePreference: (value: T) => Promise<void>;
|
|
4
4
|
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import toast from "react-hot-toast";
|
|
3
3
|
import Alert from "../../components/Alert/Alert.js";
|
|
4
|
-
const DEFAULT_POSITION = "top-right";
|
|
4
|
+
const DEFAULT_POSITION = "top-right", DEFAULT_DURATION = 5e3;
|
|
5
5
|
function useToast() {
|
|
6
6
|
return {
|
|
7
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 }), {
|
|
8
8
|
id: options == null ? void 0 : options.id,
|
|
9
|
-
duration: options == null ? void 0 : options.duration,
|
|
9
|
+
duration: (options == null ? void 0 : options.duration) ?? DEFAULT_DURATION,
|
|
10
10
|
position: (options == null ? void 0 : options.position) ?? DEFAULT_POSITION
|
|
11
11
|
}),
|
|
12
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 }), {
|
|
13
13
|
id: options == null ? void 0 : options.id,
|
|
14
|
-
duration: options == null ? void 0 : options.duration,
|
|
14
|
+
duration: (options == null ? void 0 : options.duration) ?? DEFAULT_DURATION,
|
|
15
15
|
position: (options == null ? void 0 : options.position) ?? DEFAULT_POSITION
|
|
16
16
|
}),
|
|
17
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 }), {
|
|
18
18
|
id: options == null ? void 0 : options.id,
|
|
19
|
-
duration: options == null ? void 0 : options.duration,
|
|
19
|
+
duration: (options == null ? void 0 : options.duration) ?? DEFAULT_DURATION,
|
|
20
20
|
position: (options == null ? void 0 : options.position) ?? DEFAULT_POSITION
|
|
21
21
|
}),
|
|
22
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 }), {
|
|
23
23
|
id: options == null ? void 0 : options.id,
|
|
24
|
-
duration: options == null ? void 0 : options.duration,
|
|
24
|
+
duration: (options == null ? void 0 : options.duration) ?? DEFAULT_DURATION,
|
|
25
25
|
position: (options == null ? void 0 : options.position) ?? DEFAULT_POSITION
|
|
26
26
|
}),
|
|
27
27
|
loading: toast.loading,
|
package/dist/index.js
CHANGED
|
@@ -133,8 +133,6 @@ import { Toolbar } from "./components/Toolbar/Toolbar.js";
|
|
|
133
133
|
import { TreeNode } from "./components/TreeView/TreeNode.js";
|
|
134
134
|
import { TreeNodeFolderWrapper, addNode, arrayUnique, deleteNode, findNodeById, findParentNode, findPathById, findTreeNode, getAncestors, hasChildren, modifyNode, moveNode, updateNode, wrapTreeNode } from "./components/TreeView/utilities/treeview.js";
|
|
135
135
|
import { Upload } from "./modules/multimedia/MediaLibrary/innertabs/Upload.js";
|
|
136
|
-
import { UserSearch } from "./components/UserSearch/UserSearch.js";
|
|
137
|
-
import { VisibleType } from "./components/UserSearch/types/visible.js";
|
|
138
136
|
import { buildTree, determineNewParentId, findItemIndexInTree, flattenNodes, flattenTree, generateUpdateData, getActiveAndOverNodes, getDragDepth, getIndicesToUpdate, getProjection, updateParentIds } from "./components/Tree/utilities/tree-sortable.js";
|
|
139
137
|
import { checkUserRight } from "./utilities/check-user-rights/check-user-rights.js";
|
|
140
138
|
import { emptyScreenMapping } from "./utilities/emptyscreen-mapping/emptyscreen-mapping.js";
|
|
@@ -143,7 +141,6 @@ import { mergeRefs, setRef } from "./utilities/refs/ref.js";
|
|
|
143
141
|
import { useCheckable } from "./hooks/useCheckable/useCheckable.js";
|
|
144
142
|
import { useEdificeClient } from "./providers/EdificeClientProvider/EdificeClientProvider.hook.js";
|
|
145
143
|
import { useEdificeTheme } from "./providers/EdificeThemeProvider/EdificeThemeProvider.hook.js";
|
|
146
|
-
import { useFileToAttachment } from "./components/AddAttachments/hooks/useFileToAttachment.js";
|
|
147
144
|
import { useTreeSortable } from "./components/Tree/hooks/useTreeSortable.js";
|
|
148
145
|
import { useTreeView } from "./components/TreeView/hooks/useTreeView.js";
|
|
149
146
|
export {
|
|
@@ -243,10 +240,8 @@ export {
|
|
|
243
240
|
Upload,
|
|
244
241
|
default67 as UploadCard,
|
|
245
242
|
default68 as UploadFiles,
|
|
246
|
-
UserSearch,
|
|
247
243
|
default69 as VideoEmbed,
|
|
248
244
|
default70 as VideoRecorder,
|
|
249
|
-
VisibleType,
|
|
250
245
|
default71 as VisuallyHidden,
|
|
251
246
|
WORKSPACE_SHARED_FOLDER_ID,
|
|
252
247
|
WORKSPACE_USER_FOLDER_ID,
|
|
@@ -296,7 +291,6 @@ export {
|
|
|
296
291
|
useEdificeClient,
|
|
297
292
|
default85 as useEdificeIcons,
|
|
298
293
|
useEdificeTheme,
|
|
299
|
-
useFileToAttachment,
|
|
300
294
|
default86 as useHasWorkflow,
|
|
301
295
|
default87 as useHover,
|
|
302
296
|
default88 as useHttpErrorToast,
|
|
@@ -38,11 +38,37 @@ export interface OnboardingModalRef {
|
|
|
38
38
|
setIsOpen: (isOpen: boolean) => void;
|
|
39
39
|
handleSavePreference: () => void;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Result of a custom display check. Must contain the following data :
|
|
43
|
+
* - display: a boolean indicating whether the modal should be shown when truthy or hidden if falsy;
|
|
44
|
+
* - nextState: the next state to persist when onboarding is done.
|
|
45
|
+
*/
|
|
46
|
+
export interface DisplayRuleCheckResult<T> {
|
|
47
|
+
display: boolean;
|
|
48
|
+
nextState: T;
|
|
49
|
+
}
|
|
50
|
+
export interface OnboardingProps<T = boolean> {
|
|
42
51
|
id: string;
|
|
43
52
|
items: ModalItemsProps[];
|
|
44
53
|
modalOptions?: ModalOptionsProps;
|
|
45
54
|
isOnboardingChange?: (isOnboarding: boolean) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Allow the parent component to control the rule for showing/hiding the modal.
|
|
57
|
+
*
|
|
58
|
+
* If undefined, the component will manage a visible/hidden state on its own.
|
|
59
|
+
*
|
|
60
|
+
* If defined, this function is called with the previously known state (if any).
|
|
61
|
+
* It can then compute the next state and return a DisplayRuleCheckResult.
|
|
62
|
+
*
|
|
63
|
+
* Note that the user may close the modal without finishing their onboarding.
|
|
64
|
+
* In this case, the next state is not persisted.
|
|
65
|
+
*/
|
|
66
|
+
onDisplayRuleCheck?: (previousState?: T) => DisplayRuleCheckResult<T>;
|
|
46
67
|
}
|
|
47
|
-
declare const
|
|
68
|
+
declare const OnboardingModalInner: <T = boolean>({ id, items, modalOptions, isOnboardingChange, onDisplayRuleCheck, }: OnboardingProps<T>, ref: React.Ref<OnboardingModalRef>) => import('react').ReactPortal | null;
|
|
69
|
+
declare const OnboardingModal: (<T = boolean>(props: OnboardingProps<T> & {
|
|
70
|
+
ref?: React.Ref<OnboardingModalRef>;
|
|
71
|
+
}) => ReturnType<typeof OnboardingModalInner>) & {
|
|
72
|
+
displayName?: string;
|
|
73
|
+
};
|
|
48
74
|
export default OnboardingModal;
|
|
@@ -8,11 +8,15 @@ import { useOnboardingModal } from "./useOnboardingModal.js";
|
|
|
8
8
|
import Modal from "../../../components/Modal/Modal.js";
|
|
9
9
|
import Image from "../../../components/Image/Image.js";
|
|
10
10
|
import Button from "../../../components/Button/Button.js";
|
|
11
|
-
const
|
|
11
|
+
const OnboardingModalInner = ({
|
|
12
12
|
id,
|
|
13
13
|
items,
|
|
14
14
|
modalOptions = {},
|
|
15
|
-
isOnboardingChange
|
|
15
|
+
isOnboardingChange,
|
|
16
|
+
onDisplayRuleCheck = (previousState) => ({
|
|
17
|
+
display: previousState === !0,
|
|
18
|
+
nextState: !1
|
|
19
|
+
})
|
|
16
20
|
}, ref) => {
|
|
17
21
|
var _a;
|
|
18
22
|
const [swiperInstance, setSwiperInstance] = useState(), [swiperProgress, setSwiperprogress] = useState(0), {
|
|
@@ -20,12 +24,12 @@ const OnboardingModal = /* @__PURE__ */ forwardRef(({
|
|
|
20
24
|
isOnboarding,
|
|
21
25
|
setIsOpen,
|
|
22
26
|
handleSavePreference
|
|
23
|
-
} = useOnboardingModal(id);
|
|
27
|
+
} = useOnboardingModal(id, onDisplayRuleCheck);
|
|
24
28
|
useImperativeHandle(ref, () => ({
|
|
25
29
|
setIsOpen,
|
|
26
30
|
handleSavePreference
|
|
27
31
|
})), useEffect(() => {
|
|
28
|
-
isOnboardingChange
|
|
32
|
+
isOnboardingChange == null || isOnboardingChange(isOnboarding);
|
|
29
33
|
}, [isOnboarding, isOnboardingChange]), useEffect(() => {
|
|
30
34
|
const link = document.createElement("link");
|
|
31
35
|
return link.href = "https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css", link.rel = "stylesheet", link.type = "text/css", document.head.appendChild(link), () => {
|
|
@@ -44,7 +48,7 @@ const OnboardingModal = /* @__PURE__ */ forwardRef(({
|
|
|
44
48
|
}, handleCloseWithoutPreference = () => {
|
|
45
49
|
setIsOpen(!1), setSwiperprogress(0);
|
|
46
50
|
};
|
|
47
|
-
return /* @__PURE__ */ createPortal(/* @__PURE__ */ jsxs(Modal, { id: "onboarding-modal", "data-testid": "modal-onboarding", size: "md", isOpen, focusId: "nextButtonId", onModalClose: handleCloseWithoutPreference, children: [
|
|
51
|
+
return isOpen ? /* @__PURE__ */ createPortal(/* @__PURE__ */ jsxs(Modal, { id: "onboarding-modal", "data-testid": "modal-onboarding", size: "md", isOpen, focusId: "nextButtonId", onModalClose: handleCloseWithoutPreference, children: [
|
|
48
52
|
/* @__PURE__ */ jsx(Modal.Header, { onModalClose: handleCloseWithoutPreference, centered: !0, children: t(currentTitle || "explorer.modal.onboarding.trash.title") }),
|
|
49
53
|
/* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsx(Swiper, { modules: [Pagination], onSwiper: (swiper) => {
|
|
50
54
|
setSwiperInstance(swiper);
|
|
@@ -61,13 +65,13 @@ const OnboardingModal = /* @__PURE__ */ forwardRef(({
|
|
|
61
65
|
/* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
|
62
66
|
/* @__PURE__ */ jsx(Button, { "data-testid": "modal-onboarding-later", type: "button", color: "tertiary", variant: "ghost", onClick: handleCloseWithoutPreference, children: t("explorer.modal.onboarding.trash.later") }),
|
|
63
67
|
swiperProgress > 0 && /* @__PURE__ */ jsx(Button, { "data-testid": "modal-onboarding-previous", type: "button", color: "primary", variant: "outline", onClick: () => swiperInstance.slidePrev(), children: t(prevText || "explorer.modal.onboarding.trash.prev") }),
|
|
64
|
-
swiperProgress < 1 && /* @__PURE__ */ jsx(Button, { id: "nextButtonId", "data-testid": "modal-onboarding-next", type: "button", color: "primary", variant: "filled", onClick: () => swiperInstance.slideNext(), children: t(nextText || "explorer.modal.onboarding.trash.next") }),
|
|
65
|
-
swiperProgress === 1 && /* @__PURE__ */ jsx(Button, { "data-testid": "modal-onboarding-close", type: "button", color: "primary", variant: "filled", onClick: () => {
|
|
68
|
+
items.length > 1 && swiperProgress < 1 && /* @__PURE__ */ jsx(Button, { id: "nextButtonId", "data-testid": "modal-onboarding-next", type: "button", color: "primary", variant: "filled", onClick: () => swiperInstance.slideNext(), children: t(nextText || "explorer.modal.onboarding.trash.next") }),
|
|
69
|
+
(items.length === 1 || swiperProgress === 1) && /* @__PURE__ */ jsx(Button, { "data-testid": "modal-onboarding-close", type: "button", color: "primary", variant: "filled", onClick: () => {
|
|
66
70
|
isOnboarding ? handleCloseWithPreference() : handleCloseWithoutPreference();
|
|
67
71
|
}, children: t(closeText || "explorer.modal.onboarding.trash.close") })
|
|
68
72
|
] })
|
|
69
|
-
] }), document.getElementById("portal") || document.body);
|
|
70
|
-
});
|
|
73
|
+
] }), document.getElementById("portal") || document.body) : null;
|
|
74
|
+
}, OnboardingModal = /* @__PURE__ */ forwardRef(OnboardingModalInner);
|
|
71
75
|
export {
|
|
72
76
|
OnboardingModal as default
|
|
73
77
|
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export declare const useOnboardingModal: (id: string) => {
|
|
1
|
+
export declare const useOnboardingModal: <T>(id: string, applyDisplayRule: (previousState?: T) => {
|
|
2
|
+
display: boolean;
|
|
3
|
+
nextState: T;
|
|
4
|
+
}) => {
|
|
2
5
|
isOpen: boolean;
|
|
3
6
|
setIsOpen: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
4
7
|
isOnboarding: boolean;
|
|
@@ -1,28 +1,36 @@
|
|
|
1
|
-
import { useState, useEffect } from "react";
|
|
2
|
-
import
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { useRef, useState, useEffect, useCallback } from "react";
|
|
2
|
+
import usePreferences from "../../../hooks/usePreferences/usePreferences.js";
|
|
3
|
+
const useOnboardingModal = (id, applyDisplayRule) => {
|
|
4
|
+
const state = useRef(), [isOpen, setIsOpen] = useState(!1), [isOnboarding, setIsOnboarding] = useState(!1), {
|
|
5
|
+
getPreference,
|
|
6
|
+
savePreference
|
|
7
|
+
} = usePreferences(id);
|
|
8
|
+
useEffect(() => {
|
|
8
9
|
(async () => {
|
|
9
|
-
const response = await
|
|
10
|
-
if (response)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
const response = await getPreference();
|
|
11
|
+
if (response)
|
|
12
|
+
if (applyDisplayRule) {
|
|
13
|
+
const {
|
|
14
|
+
display,
|
|
15
|
+
nextState
|
|
16
|
+
} = applyDisplayRule(response.key);
|
|
17
|
+
setIsOpen(display), setIsOnboarding(display), state.current = nextState;
|
|
18
|
+
} else
|
|
19
|
+
response.key === !0 && setIsOpen(!0), setIsOnboarding(!!response.key), state.current = void 0;
|
|
20
|
+
else
|
|
21
|
+
setIsOpen(!0), setIsOnboarding(!0), state.current = void 0;
|
|
18
22
|
})();
|
|
19
|
-
}, [
|
|
23
|
+
}, []);
|
|
24
|
+
const handleSavePreference = useCallback(async () => {
|
|
25
|
+
await savePreference({
|
|
26
|
+
key: state.current
|
|
27
|
+
}), setIsOpen(!1), setIsOnboarding(!1);
|
|
28
|
+
}, [savePreference, setIsOpen, setIsOnboarding]);
|
|
29
|
+
return {
|
|
20
30
|
isOpen,
|
|
21
31
|
setIsOpen,
|
|
22
32
|
isOnboarding,
|
|
23
|
-
handleSavePreference
|
|
24
|
-
await saveOnboardingTrash(id), setIsOpen(!1), setIsOnboarding(!1);
|
|
25
|
-
}
|
|
33
|
+
handleSavePreference
|
|
26
34
|
};
|
|
27
35
|
};
|
|
28
36
|
export {
|
|
@@ -139,7 +139,7 @@ const ShareResources = /* @__PURE__ */ forwardRef(({
|
|
|
139
139
|
/* @__PURE__ */ jsx(Button, { "data-testid": "share-bookmark-show-button", color: "tertiary", leftIcon: /* @__PURE__ */ jsx(SvgIconBookmark, {}), rightIcon: /* @__PURE__ */ jsx(SvgIconRafterDown, { title: t("show"), className: "w-16 min-w-0", style: {
|
|
140
140
|
transition: "rotate 0.2s ease-out",
|
|
141
141
|
rotate: showBookmarkInput ? "-180deg" : "0deg"
|
|
142
|
-
} }), type: "button", variant: "ghost", className: "fw-normal", onClick: () => toggleBookmarkInput(!showBookmarkInput), children: t("share.save.sharebookmark") }),
|
|
142
|
+
} }), type: "button", variant: "ghost", className: "fw-normal text-start", onClick: () => toggleBookmarkInput(!showBookmarkInput), children: t("share.save.sharebookmark") }),
|
|
143
143
|
showBookmarkInput && /* @__PURE__ */ jsx(ShareBookmark, { refBookmark, bookmark, onBookmarkChange: handleBookmarkChange, onSave: handleOnSaveBookmark })
|
|
144
144
|
] })
|
|
145
145
|
] });
|
|
@@ -3,11 +3,11 @@ import { ConfigProvider } from "antd";
|
|
|
3
3
|
import { antTheme } from "./antThemeConfig.js";
|
|
4
4
|
/* empty css */
|
|
5
5
|
import { useEdificeClient } from "../EdificeClientProvider/EdificeClientProvider.hook.js";
|
|
6
|
-
import frFR from "
|
|
7
|
-
import deDE from "
|
|
8
|
-
import esES from "
|
|
9
|
-
import itIT from "
|
|
10
|
-
import ptPT from "
|
|
6
|
+
import frFR from "antd/locale/fr_FR";
|
|
7
|
+
import deDE from "antd/locale/de_DE";
|
|
8
|
+
import esES from "antd/locale/es_ES";
|
|
9
|
+
import itIT from "antd/locale/it_IT";
|
|
10
|
+
import ptPT from "antd/locale/pt_PT";
|
|
11
11
|
const antdLocaleMap = {
|
|
12
12
|
fr: frFR,
|
|
13
13
|
de: deDE,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/react",
|
|
3
|
-
"version": "2.5.13-develop
|
|
3
|
+
"version": "2.5.13-develop.20260316160930",
|
|
4
4
|
"description": "Edifice React Library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"clsx": "^2.1.1",
|
|
124
124
|
"dayjs": "1.11.19",
|
|
125
125
|
"emoji-picker-react": "4.5.2",
|
|
126
|
-
"
|
|
126
|
+
"heic2any": "0.0.4",
|
|
127
127
|
"html-react-parser": "4.2.1",
|
|
128
128
|
"ohash": "1.1.3",
|
|
129
129
|
"pako": "2.1.0",
|
|
@@ -135,9 +135,9 @@
|
|
|
135
135
|
"swiper": "^10.1.0",
|
|
136
136
|
"ua-parser-js": "^1.0.36",
|
|
137
137
|
"react-pdf": "10.2.0",
|
|
138
|
-
"@edifice.io/bootstrap": "2.5.13-develop
|
|
139
|
-
"@edifice.io/tiptap-extensions": "2.5.13-develop
|
|
140
|
-
"@edifice.io/utilities": "2.5.13-develop
|
|
138
|
+
"@edifice.io/bootstrap": "2.5.13-develop.20260316160930",
|
|
139
|
+
"@edifice.io/tiptap-extensions": "2.5.13-develop.20260316160930",
|
|
140
|
+
"@edifice.io/utilities": "2.5.13-develop.20260316160930"
|
|
141
141
|
},
|
|
142
142
|
"devDependencies": {
|
|
143
143
|
"@babel/plugin-transform-react-pure-annotations": "^7.23.3",
|
|
@@ -168,8 +168,8 @@
|
|
|
168
168
|
"vite": "^5.4.11",
|
|
169
169
|
"vite-plugin-dts": "^4.1.0",
|
|
170
170
|
"vite-tsconfig-paths": "^5.0.1",
|
|
171
|
-
"@edifice.io/client": "2.5.13-develop
|
|
172
|
-
"@edifice.io/config": "2.5.13-develop
|
|
171
|
+
"@edifice.io/client": "2.5.13-develop.20260316160930",
|
|
172
|
+
"@edifice.io/config": "2.5.13-develop.20260316160930"
|
|
173
173
|
},
|
|
174
174
|
"peerDependencies": {
|
|
175
175
|
"@react-spring/web": "^9.7.5",
|
package/dist/_virtual/common.js
DELETED
package/dist/_virtual/de_DE.js
DELETED
package/dist/_virtual/de_DE2.js
DELETED