@edifice.io/react 2.5.13-develop.20260305174832 → 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/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/hooks/useConversation/useConversation.js +2 -4
- package/dist/hooks/usePreferences/usePreferences.d.ts +3 -3
- package/dist/hooks/useToast/useToast.js +5 -5
- 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 +6 -6
- 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/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
|
@@ -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
|
|
@@ -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,
|
|
@@ -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",
|
|
@@ -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/
|
|
140
|
-
"@edifice.io/
|
|
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
package/dist/_virtual/de_DE3.js
DELETED
package/dist/_virtual/de_DE4.js
DELETED
package/dist/_virtual/de_DE5.js
DELETED
package/dist/_virtual/de_DE6.js
DELETED
package/dist/_virtual/es_ES.js
DELETED
package/dist/_virtual/es_ES2.js
DELETED
package/dist/_virtual/es_ES3.js
DELETED
package/dist/_virtual/es_ES4.js
DELETED
package/dist/_virtual/es_ES5.js
DELETED
package/dist/_virtual/es_ES6.js
DELETED
package/dist/_virtual/fr_FR.js
DELETED
package/dist/_virtual/fr_FR2.js
DELETED
package/dist/_virtual/fr_FR3.js
DELETED
package/dist/_virtual/fr_FR4.js
DELETED
package/dist/_virtual/fr_FR5.js
DELETED
package/dist/_virtual/fr_FR6.js
DELETED
package/dist/_virtual/it_IT.js
DELETED
package/dist/_virtual/it_IT2.js
DELETED
package/dist/_virtual/it_IT3.js
DELETED
package/dist/_virtual/it_IT4.js
DELETED
package/dist/_virtual/it_IT5.js
DELETED
package/dist/_virtual/it_IT6.js
DELETED
package/dist/_virtual/pt_PT.js
DELETED
package/dist/_virtual/pt_PT2.js
DELETED
package/dist/_virtual/pt_PT3.js
DELETED
package/dist/_virtual/pt_PT4.js
DELETED
package/dist/_virtual/pt_PT5.js
DELETED
package/dist/_virtual/pt_PT6.js
DELETED
package/dist/_virtual/typeof.js
DELETED