@plumile/backoffice-react 0.1.88 → 0.1.90
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/lib/esm/{AcceptInvitationScreen-dnOvRx4Z.js → AcceptInvitationScreen-DLc4aovr.js} +8 -7
- package/lib/esm/AcceptInvitationScreen-DLc4aovr.js.map +1 -0
- package/lib/esm/{AuthPanel-DiHejPoq.js → AuthPanel-BaIRFGbX.js} +2 -2
- package/lib/esm/{AuthPanel-DiHejPoq.js.map → AuthPanel-BaIRFGbX.js.map} +1 -1
- package/lib/esm/{BackofficeAcceptInvitationPage-CGht2ka0.js → BackofficeAcceptInvitationPage-D0dZnrV7.js} +4 -4
- package/lib/esm/{BackofficeAcceptInvitationPage-CGht2ka0.js.map → BackofficeAcceptInvitationPage-D0dZnrV7.js.map} +1 -1
- package/lib/esm/{BackofficeDashboardPage-h1OWb_rV.js → BackofficeDashboardPage-YWvoQODn.js} +33 -33
- package/lib/esm/{BackofficeDashboardPage-h1OWb_rV.js.map → BackofficeDashboardPage-YWvoQODn.js.map} +1 -1
- package/lib/esm/{BackofficeDetailPayload-iVx66o_6.js → BackofficeDetailPayload-P61MDRLE.js} +2 -2
- package/lib/esm/{BackofficeDetailPayload-iVx66o_6.js.map → BackofficeDetailPayload-P61MDRLE.js.map} +1 -1
- package/lib/esm/{BackofficeEntityActionFormDialog-V4QXnvpy.js → BackofficeEntityActionFormDialog-BgRTJ_JS.js} +3 -4
- package/lib/esm/{BackofficeEntityActionFormDialog-V4QXnvpy.js.map → BackofficeEntityActionFormDialog-BgRTJ_JS.js.map} +1 -1
- package/lib/esm/{BackofficeEntityDetailPage-CIyGKwVP.js → BackofficeEntityDetailPage-DPFXbJxC.js} +34 -34
- package/lib/esm/{BackofficeEntityDetailPage-CIyGKwVP.js.map → BackofficeEntityDetailPage-DPFXbJxC.js.map} +1 -1
- package/lib/esm/{BackofficeEntityListPage-DmZozSNk.js → BackofficeEntityListPage-C8Ucmc_E.js} +3 -4
- package/lib/esm/{BackofficeEntityListPage-DmZozSNk.js.map → BackofficeEntityListPage-C8Ucmc_E.js.map} +1 -1
- package/lib/esm/{useBackofficeReactTranslation-WfXU8kCf.js → BackofficeErrorBoundary-BwRVSDHU.js} +3 -9
- package/lib/esm/BackofficeErrorBoundary-BwRVSDHU.js.map +1 -0
- package/lib/esm/{BackofficeLayoutPage-DtFDn_nU.js → BackofficeLayoutPage-j3VUX3Tu.js} +35 -35
- package/lib/esm/{BackofficeLayoutPage-DtFDn_nU.js.map → BackofficeLayoutPage-j3VUX3Tu.js.map} +1 -1
- package/lib/esm/{BackofficeLoginPage-BvOPqbKO.js → BackofficeLoginPage-DgdIWTeu.js} +5 -5
- package/lib/esm/{BackofficeLoginPage-BvOPqbKO.js.map → BackofficeLoginPage-DgdIWTeu.js.map} +1 -1
- package/lib/esm/{BackofficePasswordResetCompletePage-ZLhghfhC.js → BackofficePasswordResetCompletePage-CF_0t3Nq.js} +4 -5
- package/lib/esm/BackofficePasswordResetCompletePage-CF_0t3Nq.js.map +1 -0
- package/lib/esm/{BackofficePasswordResetRequestPage-BLNHQD79.js → BackofficePasswordResetRequestPage-BJOrQXcy.js} +4 -4
- package/lib/esm/BackofficePasswordResetRequestPage-BJOrQXcy.js.map +1 -0
- package/lib/esm/{BackofficeVerifyEmailPage-BSTtLXdx.js → BackofficeVerifyEmailPage-C81LlsNM.js} +4 -5
- package/lib/esm/BackofficeVerifyEmailPage-C81LlsNM.js.map +1 -0
- package/lib/esm/{EntityFilterValue-B5ZGHO_u.js → EntityFilterValue-BWUdPBwp.js} +10 -9
- package/lib/esm/{EntityFilterValue-B5ZGHO_u.js.map → EntityFilterValue-BWUdPBwp.js.map} +1 -1
- package/lib/esm/{EntityIdPickerDialog-DbTnDU4v.js → EntityIdPickerDialog-Yhmr-WsV.js} +9 -9
- package/lib/esm/{EntityIdPickerDialog-DbTnDU4v.js.map → EntityIdPickerDialog-Yhmr-WsV.js.map} +1 -1
- package/lib/esm/{LazyBackofficeEntityActionFormDialog-BE3wVfU6.js → LazyBackofficeEntityActionFormDialog-DVPQyWlr.js} +8 -7
- package/lib/esm/{LazyBackofficeEntityActionFormDialog-BE3wVfU6.js.map → LazyBackofficeEntityActionFormDialog-DVPQyWlr.js.map} +1 -1
- package/lib/esm/{PasswordResetCompleteScreen-B0P_tZg2.js → PasswordResetCompleteScreen-Cgg96DPo.js} +6 -5
- package/lib/esm/PasswordResetCompleteScreen-Cgg96DPo.js.map +1 -0
- package/lib/esm/{PasswordResetRequestScreen-p9s0dblR.js → PasswordResetRequestScreen-I1nFvGLd.js} +6 -5
- package/lib/esm/PasswordResetRequestScreen-I1nFvGLd.js.map +1 -0
- package/lib/esm/{VerifyEmailScreen--9lxOGlW.js → VerifyEmailScreen-Br5KyHjg.js} +7 -6
- package/lib/esm/VerifyEmailScreen-Br5KyHjg.js.map +1 -0
- package/lib/esm/backoffice-react.js +843 -1012
- package/lib/esm/backoffice-react.js.map +1 -1
- package/lib/esm/loginPage.css-B7Io_DuU.js +6 -0
- package/lib/esm/loginPage.css-B7Io_DuU.js.map +1 -0
- package/lib/esm/{synchronizeAuthStatusQuery-By_lNCnP.js → synchronizeAuthStatusQuery-1juorUEX.js} +47 -46
- package/lib/esm/synchronizeAuthStatusQuery-1juorUEX.js.map +1 -0
- package/lib/esm/{useAuth-OVPPa9bO.js → useAuth-BdSNpGqe.js} +43 -42
- package/lib/esm/useAuth-BdSNpGqe.js.map +1 -0
- package/lib/esm/{useBackofficeAuth-BvEoEqnB.js → useBackofficeAuth-C16Euw2X.js} +3 -3
- package/lib/esm/{useBackofficeAuth-BvEoEqnB.js.map → useBackofficeAuth-C16Euw2X.js.map} +1 -1
- package/lib/esm/{useBackofficeLazyValue-Dnii1_dE.js → useBackofficeLazyValue-Bh_13h8A.js} +2 -2
- package/lib/esm/{useBackofficeLazyValue-Dnii1_dE.js.map → useBackofficeLazyValue-Bh_13h8A.js.map} +1 -1
- package/lib/esm/useBackofficeReactTranslation-Btt58EIo.js +18 -0
- package/lib/esm/useBackofficeReactTranslation-Btt58EIo.js.map +1 -0
- package/lib/types/i18n/resources.d.ts +211 -409
- package/lib/types/i18n/resources.d.ts.map +1 -1
- package/lib/types/provider/BackofficeProvider.d.ts.map +1 -1
- package/package.json +7 -5
- package/lib/esm/AcceptInvitationScreen-dnOvRx4Z.js.map +0 -1
- package/lib/esm/BackofficeConfigContext-R0t1owTI.js +0 -12
- package/lib/esm/BackofficeConfigContext-R0t1owTI.js.map +0 -1
- package/lib/esm/BackofficePasswordResetCompletePage-ZLhghfhC.js.map +0 -1
- package/lib/esm/BackofficePasswordResetRequestPage-BLNHQD79.js.map +0 -1
- package/lib/esm/BackofficeVerifyEmailPage-BSTtLXdx.js.map +0 -1
- package/lib/esm/PasswordResetCompleteScreen-B0P_tZg2.js.map +0 -1
- package/lib/esm/PasswordResetRequestScreen-p9s0dblR.js.map +0 -1
- package/lib/esm/VerifyEmailScreen--9lxOGlW.js.map +0 -1
- package/lib/esm/loginPage.css-CBJ1Ozm5.js +0 -12
- package/lib/esm/loginPage.css-CBJ1Ozm5.js.map +0 -1
- package/lib/esm/synchronizeAuthStatusQuery-By_lNCnP.js.map +0 -1
- package/lib/esm/useAuth-OVPPa9bO.js.map +0 -1
- package/lib/esm/useBackofficeReactTranslation-WfXU8kCf.js.map +0 -1
- package/lib/types/i18n/useSharedTranslation.d.ts +0 -3
- package/lib/types/i18n/useSharedTranslation.d.ts.map +0 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { t as e } from "./useBackofficeReactTranslation-Btt58EIo.js";
|
|
2
|
+
import { a as t, d as n, s as r } from "./loginPage.css-B7Io_DuU.js";
|
|
3
|
+
import { o as i } from "./useAuth-BdSNpGqe.js";
|
|
4
|
+
import { t as a } from "./AuthPanel-BaIRFGbX.js";
|
|
4
5
|
import { useCallback as o, useMemo as s, useState as c } from "react";
|
|
5
6
|
import { AuthLayout as l, Button as u, FormError as d, FormField as f } from "@plumile/ui";
|
|
6
7
|
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
7
8
|
//#region src/auth/pages/AcceptInvitationScreen.tsx
|
|
8
9
|
var h = ({ auth: h, onSuccessRedirect: g, onBackToLogin: _, token: v }) => {
|
|
9
|
-
let { t: y } =
|
|
10
|
+
let { t: y } = e(), { acceptInvitation: b } = h, [x, S] = c("idle"), [C, w] = c(""), [T, E] = c(""), [D, O] = c(!1), [k, A] = c(null), j = s(() => v ?? (typeof window > "u" ? "" : new URLSearchParams(window.location.search).get("token") ?? ""), [v]), M = o((e) => {
|
|
10
11
|
if (e.preventDefault(), j === "") {
|
|
11
12
|
A(y("auth.acceptInvitation.errors.missingToken")), S("error");
|
|
12
13
|
return;
|
|
@@ -55,7 +56,7 @@ var h = ({ auth: h, onSuccessRedirect: g, onBackToLogin: _, token: v }) => {
|
|
|
55
56
|
});
|
|
56
57
|
let F;
|
|
57
58
|
return F = x === "completed" ? /* @__PURE__ */ p("div", {
|
|
58
|
-
className:
|
|
59
|
+
className: n,
|
|
59
60
|
children: /* @__PURE__ */ p("p", {
|
|
60
61
|
className: r,
|
|
61
62
|
children: y("auth.acceptInvitation.status.success")
|
|
@@ -63,7 +64,7 @@ var h = ({ auth: h, onSuccessRedirect: g, onBackToLogin: _, token: v }) => {
|
|
|
63
64
|
}) : /* @__PURE__ */ p(a, {
|
|
64
65
|
description: y("auth.acceptInvitation.subtitle"),
|
|
65
66
|
children: /* @__PURE__ */ m("form", {
|
|
66
|
-
className:
|
|
67
|
+
className: t,
|
|
67
68
|
onSubmit: M,
|
|
68
69
|
noValidate: !0,
|
|
69
70
|
children: [
|
|
@@ -113,4 +114,4 @@ var h = ({ auth: h, onSuccessRedirect: g, onBackToLogin: _, token: v }) => {
|
|
|
113
114
|
//#endregion
|
|
114
115
|
export { h as t };
|
|
115
116
|
|
|
116
|
-
//# sourceMappingURL=AcceptInvitationScreen-
|
|
117
|
+
//# sourceMappingURL=AcceptInvitationScreen-DLc4aovr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AcceptInvitationScreen-DLc4aovr.js","names":[],"sources":["../../src/auth/pages/AcceptInvitationScreen.tsx"],"sourcesContent":["/* eslint-disable no-ternary */\nimport {\n useCallback,\n useMemo,\n useState,\n type FormEvent,\n type JSX,\n} from 'react';\nimport { useBackofficeReactTranslation } from '../../i18n/useBackofficeReactTranslation.js';\n\nimport { AuthLayout, Button, FormError, FormField } from '@plumile/ui';\n\nimport type { UseAuthReturn } from '../../hooks/useAuth.js';\nimport { MfaChallengeForm } from '../login/MfaChallengeForm.js';\nimport AuthPanel from '../login/AuthPanel.js';\nimport * as styles from '../login/loginPage.css.js';\n\ntype AcceptanceState = 'pending' | 'mfa' | 'completed' | 'error' | 'idle';\n\ntype Props = {\n auth: UseAuthReturn;\n onSuccessRedirect: () => void;\n onBackToLogin: () => void;\n token?: string;\n};\n\nexport const AcceptInvitationScreen = ({\n auth,\n onSuccessRedirect,\n onBackToLogin,\n token,\n}: Props): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n const { acceptInvitation } = auth;\n const [status, setStatus] = useState<AcceptanceState>('idle');\n const [password, setPassword] = useState('');\n const [passwordConfirmation, setPasswordConfirmation] = useState('');\n const [isSubmitting, setIsSubmitting] = useState(false);\n const [errorMessage, setErrorMessage] = useState<string | null>(null);\n\n const resolvedToken = useMemo(() => {\n if (token != null) {\n return token;\n }\n if (typeof window === 'undefined') {\n return '';\n }\n const params = new URLSearchParams(window.location.search);\n return params.get('token') ?? '';\n }, [token]);\n\n const handleSubmit = useCallback(\n (event: FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n if (resolvedToken === '') {\n setErrorMessage(t('auth.acceptInvitation.errors.missingToken'));\n setStatus('error');\n return;\n }\n\n if (password !== passwordConfirmation) {\n setErrorMessage(t('auth.acceptInvitation.errors.passwordMismatch'));\n setStatus('error');\n return;\n }\n\n setStatus('pending');\n setErrorMessage(null);\n setIsSubmitting(true);\n\n // eslint-disable-next-line no-void\n void acceptInvitation({\n token: resolvedToken,\n password,\n passwordConfirmation,\n })\n .then((result) => {\n if (result === 'mfa-required') {\n setStatus('mfa');\n return;\n }\n setStatus('completed');\n onSuccessRedirect();\n })\n .catch((error) => {\n setStatus('error');\n if (error instanceof Error) {\n setErrorMessage(error.message);\n } else if (typeof error === 'string') {\n setErrorMessage(error);\n } else {\n setErrorMessage(t('auth.acceptInvitation.errors.default'));\n }\n })\n .finally(() => {\n setIsSubmitting(false);\n });\n },\n [\n acceptInvitation,\n onSuccessRedirect,\n password,\n passwordConfirmation,\n resolvedToken,\n t,\n ],\n );\n\n const handleMfaSuccess = useCallback(() => {\n setStatus('completed');\n onSuccessRedirect();\n }, [onSuccessRedirect]);\n\n const handleRetry = useCallback(() => {\n setStatus('idle');\n setErrorMessage(null);\n setIsSubmitting(false);\n }, []);\n\n if (status === 'mfa') {\n return (\n <AuthLayout\n title={t('auth.acceptInvitation.mfaTitle')}\n subtitle={t('auth.acceptInvitation.mfaSubtitle')}\n >\n <MfaChallengeForm\n auth={auth}\n onSuccess={handleMfaSuccess}\n onBack={() => {\n auth.reset();\n handleRetry();\n }}\n />\n </AuthLayout>\n );\n }\n\n let content: JSX.Element;\n if (status === 'completed') {\n content = (\n <div className={styles.stack}>\n <p className={styles.helper}>\n {t('auth.acceptInvitation.status.success')}\n </p>\n </div>\n );\n } else {\n content = (\n <AuthPanel description={t('auth.acceptInvitation.subtitle')}>\n <form className={styles.formSurface} onSubmit={handleSubmit} noValidate>\n {errorMessage != null ? <FormError>{errorMessage}</FormError> : null}\n <FormField\n label={t('auth.acceptInvitation.form.passwordLabel')}\n name=\"password\"\n type=\"password\"\n value={password}\n onChange={(event) => {\n setPassword(event.target.value);\n setErrorMessage(null);\n if (status === 'error') {\n setStatus('idle');\n }\n }}\n placeholder={t('auth.acceptInvitation.form.passwordPlaceholder')}\n autoComplete=\"new-password\"\n required\n />\n <FormField\n label={t('auth.acceptInvitation.form.confirmLabel')}\n name=\"password-confirmation\"\n type=\"password\"\n value={passwordConfirmation}\n onChange={(event) => {\n setPasswordConfirmation(event.target.value);\n setErrorMessage(null);\n if (status === 'error') {\n setStatus('idle');\n }\n }}\n placeholder={t('auth.acceptInvitation.form.confirmPlaceholder')}\n autoComplete=\"new-password\"\n required\n />\n <Button type=\"submit\" isLoading={isSubmitting}>\n {status === 'pending'\n ? t('auth.acceptInvitation.status.workingButton')\n : t('auth.acceptInvitation.form.submit')}\n </Button>\n <Button type=\"button\" variant=\"secondary\" onClick={onBackToLogin}>\n {t('auth.acceptInvitation.actions.backToLogin')}\n </Button>\n </form>\n </AuthPanel>\n );\n }\n\n return (\n <AuthLayout title={t('auth.acceptInvitation.title')}>{content}</AuthLayout>\n );\n};\n"],"mappings":";;;;;;;;AA0BA,IAAa,KAA0B,EACrC,SACA,sBACA,kBACA,eACwB;CACxB,IAAM,EAAE,SAAM,GAA+B,EACvC,EAAE,wBAAqB,GACvB,CAAC,GAAQ,KAAa,EAA0B,OAAO,EACvD,CAAC,GAAU,KAAe,EAAS,GAAG,EACtC,CAAC,GAAsB,KAA2B,EAAS,GAAG,EAC9D,CAAC,GAAc,KAAmB,EAAS,GAAM,EACjD,CAAC,GAAc,KAAmB,EAAwB,KAAK,EAE/D,IAAgB,QAChB,MAGA,OAAO,SAAW,MACb,KAGF,IADY,gBAAgB,OAAO,SAAS,OAC5C,CAAO,IAAI,QAAQ,IAAI,KAC7B,CAAC,EAAM,CAAC,EAEL,IAAe,GAClB,MAAsC;AAErC,MADA,EAAM,gBAAgB,EAClB,MAAkB,IAAI;AAExB,GADA,EAAgB,EAAE,4CAA4C,CAAC,EAC/D,EAAU,QAAQ;AAClB;;AAGF,MAAI,MAAa,GAAsB;AAErC,GADA,EAAgB,EAAE,gDAAgD,CAAC,EACnE,EAAU,QAAQ;AAClB;;AAQG,EALL,EAAU,UAAU,EACpB,EAAgB,KAAK,EACrB,EAAgB,GAAK,EAGh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B,KAAK,EACjB,MAAW,WACb,EAAU,OAAO;;KAGrB,aAAa,EAAE,iDAAiD;KAChE,cAAa;KACb,UAAA;KACA,CAAA;IACF,kBAAC,GAAD;KACE,OAAO,EAAE,0CAA0C;KACnD,MAAK;KACL,MAAK;KACL,OAAO;KACP,WAAW,MAAU;AAGnB,MAFA,EAAwB,EAAM,OAAO,MAAM,EAC3C,EAAgB,KAAK,EACjB,MAAW,WACb,EAAU,OAAO;;KAGrB,aAAa,EAAE,gDAAgD;KAC/D,cAAa;KACb,UAAA;KACA,CAAA;IACF,kBAAC,GAAD;KAAQ,MAAK;KAAS,WAAW;eAE3B,EADH,MAAW,YACN,+CACA,oCAAoC;KACnC,CAAA;IACT,kBAAC,GAAD;KAAQ,MAAK;KAAS,SAAQ;KAAY,SAAS;eAChD,EAAE,4CAA4C;KACxC,CAAA;IACJ;;EACG,CAAA,EAKd,kBAAC,GAAD;EAAY,OAAO,EAAE,8BAA8B;YAAG;EAAqB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as e, l as t, n, s as r, u as i } from "./loginPage.css-
|
|
1
|
+
import { i as e, l as t, n, s as r, u as i } from "./loginPage.css-B7Io_DuU.js";
|
|
2
2
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
3
3
|
//#region src/auth/login/AuthPanel.tsx
|
|
4
4
|
var s = ({ title: s, description: c, children: l, footer: u }) => /* @__PURE__ */ a("div", {
|
|
@@ -25,4 +25,4 @@ var s = ({ title: s, description: c, children: l, footer: u }) => /* @__PURE__ *
|
|
|
25
25
|
//#endregion
|
|
26
26
|
export { s as t };
|
|
27
27
|
|
|
28
|
-
//# sourceMappingURL=AuthPanel-
|
|
28
|
+
//# sourceMappingURL=AuthPanel-BaIRFGbX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthPanel-
|
|
1
|
+
{"version":3,"file":"AuthPanel-BaIRFGbX.js","names":[],"sources":["../../src/auth/login/AuthPanel.tsx"],"sourcesContent":["/* eslint-disable no-ternary */\nimport { type JSX, type ReactNode } from 'react';\n\nimport * as styles from './loginPage.css.js';\n\ntype Props = {\n title?: string;\n description?: string;\n children: ReactNode;\n footer?: ReactNode;\n};\n\nexport const AuthPanel = ({\n title,\n description,\n children,\n footer,\n}: Props): JSX.Element => {\n return (\n <div className={styles.panel}>\n <div className={styles.block}>\n {title != null ? <h2 className={styles.panelTitle}>{title}</h2> : null}\n {description != null ? (\n <p className={styles.helper}>{description}</p>\n ) : null}\n {children}\n {footer != null ? <div className={styles.footer}>{footer}</div> : null}\n </div>\n </div>\n );\n};\n\nexport default AuthPanel;\n"],"mappings":";;;AAYA,IAAa,KAAa,EACxB,UACA,gBACA,aACA,QAAA,QAGE,kBAAC,OAAD;CAAK,WAAW;WACd,kBAAC,OAAD;EAAK,WAAW;YAAhB;GACG,KAAS,OAAwD,OAAjD,kBAAC,MAAD;IAAI,WAAW;cAAoB;IAAW,CAAA;GAC9D,KAAe,OAEZ,OADF,kBAAC,KAAD;IAAG,WAAW;cAAgB;IAAgB,CAAA;GAE/C;GACA,KAAU,OAAuD,OAAhD,kBAAC,OAAD;IAAK,WAAW;cAAgB;IAAa,CAAA;GAC3D;;CACF,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "./AcceptInvitationScreen-
|
|
3
|
-
import { t as n } from "./useBackofficeAuth-
|
|
1
|
+
import { r as e } from "./useBackofficeReactTranslation-Btt58EIo.js";
|
|
2
|
+
import { t } from "./AcceptInvitationScreen-DLc4aovr.js";
|
|
3
|
+
import { t as n } from "./useBackofficeAuth-C16Euw2X.js";
|
|
4
4
|
import { t as r } from "./backofficeAuthPaths-BiJvoI5Q.js";
|
|
5
5
|
import { useCallback as i, useContext as a } from "react";
|
|
6
6
|
import { RoutingContext as o } from "@plumile/router";
|
|
@@ -21,4 +21,4 @@ var c = () => {
|
|
|
21
21
|
//#endregion
|
|
22
22
|
export { c as BackofficeAcceptInvitationPage, c as default };
|
|
23
23
|
|
|
24
|
-
//# sourceMappingURL=BackofficeAcceptInvitationPage-
|
|
24
|
+
//# sourceMappingURL=BackofficeAcceptInvitationPage-D0dZnrV7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeAcceptInvitationPage-
|
|
1
|
+
{"version":3,"file":"BackofficeAcceptInvitationPage-D0dZnrV7.js","names":[],"sources":["../../src/pages/BackofficeAcceptInvitationPage.tsx"],"sourcesContent":["import { useCallback, useContext, type JSX } from 'react';\nimport { RoutingContext } from '@plumile/router';\n\nimport { AcceptInvitationScreen } from '../auth/pages/AcceptInvitationScreen.js';\nimport { useBackofficeAuth } from '../hooks/useBackofficeAuth.js';\nimport { useBackofficeConfig } from '../provider/BackofficeConfigContext.js';\nimport { getBackofficeLoginPath } from '../router/backofficeAuthPaths.js';\n\nexport const BackofficeAcceptInvitationPage = (): JSX.Element => {\n const routerContext = useContext(RoutingContext);\n const { basePath } = useBackofficeConfig();\n const auth = useBackofficeAuth();\n\n const handleSuccessRedirect = useCallback(() => {\n routerContext?.history.push({ pathname: basePath });\n }, [basePath, routerContext?.history]);\n\n const handleBackToLogin = useCallback(() => {\n routerContext?.history.push({ pathname: getBackofficeLoginPath(basePath) });\n }, [basePath, routerContext?.history]);\n\n return (\n <AcceptInvitationScreen\n auth={auth}\n onSuccessRedirect={handleSuccessRedirect}\n onBackToLogin={handleBackToLogin}\n />\n );\n};\n\nexport default BackofficeAcceptInvitationPage;\n"],"mappings":";;;;;;;;AAQA,IAAa,UAAoD;CAC/D,IAAM,IAAgB,EAAW,EAAe,EAC1C,EAAE,gBAAa,GAAqB;AAW1C,QACE,kBAAC,GAAD;EACQ,MAZG,GAYH;EACN,mBAX0B,QAAkB;AAC9C,MAAe,QAAQ,KAAK,EAAE,UAAU,GAAU,CAAC;KAClD,CAAC,GAAU,GAAe,QAAQ,CASd;EACnB,eARsB,QAAkB;AAC1C,MAAe,QAAQ,KAAK,EAAE,UAAU,EAAuB,EAAS,EAAE,CAAC;KAC1E,CAAC,GAAU,GAAe,QAAQ,CAMlB;EACf,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { r as e, t } from "./useBackofficeReactTranslation-Btt58EIo.js";
|
|
2
|
+
import { t as n } from "./BackofficeErrorBoundary-BwRVSDHU.js";
|
|
3
3
|
import { n as r, t as i } from "./BackofficeRightPageLayout-DZQvIHnj.js";
|
|
4
|
-
import { a } from "./useBackofficeLazyValue-
|
|
4
|
+
import { a } from "./useBackofficeLazyValue-Bh_13h8A.js";
|
|
5
5
|
import { t as o } from "./buildBreadcrumbs-CqF9Nh6x.js";
|
|
6
6
|
import { Suspense as s } from "react";
|
|
7
7
|
import { useTranslation as c } from "react-i18next";
|
|
@@ -18,21 +18,21 @@ var g = (e, t) => e(t), _ = (e, t) => {
|
|
|
18
18
|
case "textBlock": return e.title;
|
|
19
19
|
default: return t.title;
|
|
20
20
|
}
|
|
21
|
-
}, v = (e) => "query" in e && e.query != null, y = "txvbqb9iy txvbqbbz7 txvbqbaop", b = "txvbqb9ip txvbqbai7 txvbqbao7", x = "txvbqba7 txvbqbamy txvbqbehy", S = "txvbqb9ip txvbqbajy txvbqbqi7 txvbqb8vg", { useLazyLoadQuery: C } = p, w = ({ widget:
|
|
22
|
-
let { t: a } = c(), { t: o } =
|
|
23
|
-
if (
|
|
24
|
-
title: g(
|
|
21
|
+
}, v = (e) => "query" in e && e.query != null, y = "txvbqb9iy txvbqbbz7 txvbqbaop", b = "txvbqb9ip txvbqbai7 txvbqbao7", x = "txvbqba7 txvbqbamy txvbqbehy", S = "txvbqb9ip txvbqbajy txvbqbqi7 txvbqb8vg", { useLazyLoadQuery: C } = p, w = ({ widget: n, globalData: i }) => {
|
|
22
|
+
let { t: a } = c(), { t: o } = t(), { entities: s } = e(), d = (e) => "resolve" in n && n.resolve != null ? n.resolve(e) : null;
|
|
23
|
+
if (n.kind === "textBlock") return /* @__PURE__ */ m(f, {
|
|
24
|
+
title: g(n.title, a),
|
|
25
25
|
children: /* @__PURE__ */ m("div", {
|
|
26
26
|
className: b,
|
|
27
|
-
children: g(
|
|
27
|
+
children: g(n.body, a)
|
|
28
28
|
})
|
|
29
29
|
});
|
|
30
|
-
if (
|
|
31
|
-
let e = s[
|
|
30
|
+
if (n.kind === "shortcut") {
|
|
31
|
+
let e = s[n.entityId];
|
|
32
32
|
if (e == null) return null;
|
|
33
|
-
let
|
|
33
|
+
let t = g(n.label, a);
|
|
34
34
|
return e.kind === "tool" ? /* @__PURE__ */ m(f, {
|
|
35
|
-
title:
|
|
35
|
+
title: t,
|
|
36
36
|
children: /* @__PURE__ */ m("div", {
|
|
37
37
|
className: S,
|
|
38
38
|
children: /* @__PURE__ */ m(l, {
|
|
@@ -41,7 +41,7 @@ var g = (e, t) => e(t), _ = (e, t) => {
|
|
|
41
41
|
})
|
|
42
42
|
})
|
|
43
43
|
}) : /* @__PURE__ */ m(f, {
|
|
44
|
-
title:
|
|
44
|
+
title: t,
|
|
45
45
|
children: /* @__PURE__ */ m("div", {
|
|
46
46
|
className: S,
|
|
47
47
|
children: /* @__PURE__ */ m(l, {
|
|
@@ -51,10 +51,10 @@ var g = (e, t) => e(t), _ = (e, t) => {
|
|
|
51
51
|
})
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
if (
|
|
54
|
+
if (n.kind === "tablePreview") {
|
|
55
55
|
let e = d(i);
|
|
56
56
|
if (e == null) return null;
|
|
57
|
-
let
|
|
57
|
+
let t = r(e.columns, {
|
|
58
58
|
tApp: a,
|
|
59
59
|
t: o,
|
|
60
60
|
resolveEntityHref: (e, t) => {
|
|
@@ -63,9 +63,9 @@ var g = (e, t) => e(t), _ = (e, t) => {
|
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
return /* @__PURE__ */ m(f, {
|
|
66
|
-
title: g(
|
|
66
|
+
title: g(n.title, a),
|
|
67
67
|
children: /* @__PURE__ */ m(u, {
|
|
68
|
-
columns:
|
|
68
|
+
columns: t,
|
|
69
69
|
rows: e.rows,
|
|
70
70
|
getRowId: (e, t) => {
|
|
71
71
|
if (typeof e == "object" && e) {
|
|
@@ -77,12 +77,12 @@ var g = (e, t) => e(t), _ = (e, t) => {
|
|
|
77
77
|
})
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
|
-
if (
|
|
81
|
-
let e = s[
|
|
80
|
+
if (n.kind === "entityCount") {
|
|
81
|
+
let e = s[n.entityId];
|
|
82
82
|
if (e?.kind !== "list-detail") return null;
|
|
83
|
-
let
|
|
84
|
-
return typeof
|
|
85
|
-
title: g(
|
|
83
|
+
let t = d(i), r = o("common.notAvailable");
|
|
84
|
+
return typeof t?.count == "number" && (r = t.count), /* @__PURE__ */ m(f, {
|
|
85
|
+
title: g(n.label, a),
|
|
86
86
|
children: /* @__PURE__ */ h("div", {
|
|
87
87
|
className: b,
|
|
88
88
|
children: [/* @__PURE__ */ m("div", {
|
|
@@ -103,7 +103,7 @@ var g = (e, t) => e(t), _ = (e, t) => {
|
|
|
103
103
|
widget: e,
|
|
104
104
|
globalData: C(e.query, {}, { fetchPolicy: "store-or-network" })
|
|
105
105
|
}), E = ({ config: e, globalData: r }) => {
|
|
106
|
-
let { t: i } = c(), { t: a } =
|
|
106
|
+
let { t: i } = c(), { t: a } = t();
|
|
107
107
|
return /* @__PURE__ */ m(d, {
|
|
108
108
|
header: {
|
|
109
109
|
title: g(e.title, i),
|
|
@@ -111,14 +111,14 @@ var g = (e, t) => e(t), _ = (e, t) => {
|
|
|
111
111
|
},
|
|
112
112
|
children: /* @__PURE__ */ m("div", {
|
|
113
113
|
className: y,
|
|
114
|
-
children: e.widgets.map((
|
|
115
|
-
let o = v(
|
|
116
|
-
widget:
|
|
114
|
+
children: e.widgets.map((t) => {
|
|
115
|
+
let o = v(t) ? /* @__PURE__ */ m(T, { widget: t }) : /* @__PURE__ */ m(w, {
|
|
116
|
+
widget: t,
|
|
117
117
|
globalData: r
|
|
118
118
|
});
|
|
119
|
-
return /* @__PURE__ */ m(
|
|
119
|
+
return /* @__PURE__ */ m(n, {
|
|
120
120
|
fallback: () => /* @__PURE__ */ m(f, {
|
|
121
|
-
title: g(_(
|
|
121
|
+
title: g(_(t, e), i),
|
|
122
122
|
children: /* @__PURE__ */ m("div", {
|
|
123
123
|
className: b,
|
|
124
124
|
children: a("common.notAvailable")
|
|
@@ -126,7 +126,7 @@ var g = (e, t) => e(t), _ = (e, t) => {
|
|
|
126
126
|
}),
|
|
127
127
|
children: /* @__PURE__ */ m(s, {
|
|
128
128
|
fallback: /* @__PURE__ */ m(f, {
|
|
129
|
-
title: g(_(
|
|
129
|
+
title: g(_(t, e), i),
|
|
130
130
|
children: /* @__PURE__ */ m("div", {
|
|
131
131
|
className: b,
|
|
132
132
|
children: a("common.loading")
|
|
@@ -134,7 +134,7 @@ var g = (e, t) => e(t), _ = (e, t) => {
|
|
|
134
134
|
}),
|
|
135
135
|
children: o
|
|
136
136
|
})
|
|
137
|
-
},
|
|
137
|
+
}, t.id);
|
|
138
138
|
})
|
|
139
139
|
})
|
|
140
140
|
});
|
|
@@ -142,11 +142,11 @@ var g = (e, t) => e(t), _ = (e, t) => {
|
|
|
142
142
|
config: e,
|
|
143
143
|
globalData: C(e.query, {}, { fetchPolicy: "store-or-network" })
|
|
144
144
|
}), O = () => {
|
|
145
|
-
let { t } = c(), { t: r } =
|
|
145
|
+
let { t: n } = c(), { t: r } = t(), { entities: s } = e(), u = a(), p = o(r);
|
|
146
146
|
if (u == null) {
|
|
147
147
|
let e = Object.values(s).filter((e) => e.kind === "list-detail" && e.hasList).map((e) => ({
|
|
148
148
|
config: e,
|
|
149
|
-
label: g(e.label,
|
|
149
|
+
label: g(e.label, n)
|
|
150
150
|
})).sort((e, t) => e.label.localeCompare(t.label));
|
|
151
151
|
return /* @__PURE__ */ m(i, {
|
|
152
152
|
breadcrumb: p,
|
|
@@ -191,4 +191,4 @@ var g = (e, t) => e(t), _ = (e, t) => {
|
|
|
191
191
|
//#endregion
|
|
192
192
|
export { O as BackofficeDashboardPage, O as default };
|
|
193
193
|
|
|
194
|
-
//# sourceMappingURL=BackofficeDashboardPage-
|
|
194
|
+
//# sourceMappingURL=BackofficeDashboardPage-YWvoQODn.js.map
|
package/lib/esm/{BackofficeDashboardPage-h1OWb_rV.js.map → BackofficeDashboardPage-YWvoQODn.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeDashboardPage-h1OWb_rV.js","names":[],"sources":["../../src/pages/BackofficeDashboardPage.helpers.ts","../../src/pages/backofficeDashboardPage.css.ts","../../src/pages/BackofficeDashboardPage.tsx"],"sourcesContent":["import type {\n BackofficeDashboardConfig,\n BackofficeDashboardWidget,\n I18nLabel,\n} from '@plumile/backoffice-core/types.js';\nimport type { TFunction } from 'i18next';\nimport type { GraphQLTaggedNode } from 'relay-runtime';\n\nexport const resolveLabel = (label: I18nLabel, tApp: TFunction): string => {\n return label(tApp);\n};\n\nexport const getWidgetLabel = (\n widget: BackofficeDashboardWidget,\n config: BackofficeDashboardConfig,\n): I18nLabel => {\n switch (widget.kind) {\n case 'entityCount':\n case 'shortcut':\n return widget.label;\n case 'tablePreview':\n case 'textBlock':\n return widget.title;\n default:\n return config.title;\n }\n};\n\nexport const hasWidgetQuery = (\n widget: BackofficeDashboardWidget,\n): widget is BackofficeDashboardWidget & { query: GraphQLTaggedNode } => {\n return 'query' in widget && widget.query != null;\n};\n","import { sprinkles } from '@plumile/ui';\n\nexport const tilesGrid = sprinkles({\n display: 'grid',\n gridTemplateColumns: 'autoFillMinmax320',\n gap: 4,\n});\n\nexport const tileBody = sprinkles({\n display: 'flex',\n flexDirection: 'column',\n gap: 2,\n});\n\nexport const tileCount = sprinkles({\n fontSize: '3xl',\n fontWeight: 'bold',\n lineHeight: 1,\n});\n\nexport const links = sprinkles({\n display: 'flex',\n flexWrap: 'wrap',\n rowGap: 2,\n columnGap: 3,\n});\n","/* eslint-disable no-ternary */\nimport { type JSX, Suspense } from 'react';\nimport { Link } from '@plumile/router';\nimport type {\n BackofficeDashboardConfig,\n BackofficeDashboardWidget,\n} from '@plumile/backoffice-core/types.js';\nimport { DataTable, DetailPageTemplate, InfoTile } from '@plumile/ui';\nimport { useTranslation } from 'react-i18next';\nimport * as ReactRelay from 'react-relay';\nimport type { GraphQLTaggedNode, OperationType } from 'relay-runtime';\n\nimport { BackofficeErrorBoundary } from '../components/backoffice/errors/BackofficeErrorBoundary.js';\nimport { useBackofficeReactTranslation } from '../i18n/useBackofficeReactTranslation.js';\nimport { useBackofficeConfig } from '../provider/BackofficeConfigContext.js';\nimport { useBackofficeDashboardConfig } from '../provider/useBackofficeLazyValue.js';\nimport { buildDataTableColumns } from '../components/backoffice/columns/buildDataTableColumns.js';\nimport { BackofficeRightPageLayout } from '../components/backoffice/layout/breadcrumb/BackofficeRightPageLayout.js';\nimport { buildDashboardBreadcrumb } from '../components/backoffice/layout/breadcrumb/buildBreadcrumbs.js';\nimport {\n getWidgetLabel,\n hasWidgetQuery,\n resolveLabel,\n} from './BackofficeDashboardPage.helpers.js';\n\nimport * as styles from './backofficeDashboardPage.css.js';\n\nconst { useLazyLoadQuery } = ReactRelay;\n\ntype WidgetContentProps = {\n widget: BackofficeDashboardWidget;\n globalData: unknown;\n};\n\nconst WidgetContent = ({\n widget,\n globalData,\n}: WidgetContentProps): JSX.Element | null => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const { entities } = useBackofficeConfig();\n\n const resolveData = (data: unknown): unknown => {\n if ('resolve' in widget && widget.resolve != null) {\n return widget.resolve(data);\n }\n return null;\n };\n\n if (widget.kind === 'textBlock') {\n const title = resolveLabel(widget.title, tApp);\n const body = resolveLabel(widget.body, tApp);\n return (\n <InfoTile title={title}>\n <div className={styles.tileBody}>{body}</div>\n </InfoTile>\n );\n }\n\n if (widget.kind === 'shortcut') {\n const entity = entities[widget.entityId];\n if (entity == null) {\n return null;\n }\n const title = resolveLabel(widget.label, tApp);\n if (entity.kind === 'tool') {\n return (\n <InfoTile title={title}>\n <div className={styles.links}>\n <Link to={entity.routes.list}>\n {t('dashboard.actions.openTool')}\n </Link>\n </div>\n </InfoTile>\n );\n }\n return (\n <InfoTile title={title}>\n <div className={styles.links}>\n <Link to={entity.routes.list}>{t('dashboard.actions.openList')}</Link>\n </div>\n </InfoTile>\n );\n }\n\n if (widget.kind === 'tablePreview') {\n const resolved = resolveData(globalData) as {\n columns: readonly unknown[];\n rows: readonly unknown[];\n } | null;\n if (resolved == null) {\n return null;\n }\n const columns = buildDataTableColumns(resolved.columns as never, {\n tApp,\n t,\n resolveEntityHref: (entityId, refId) => {\n const entityConfig = entities[entityId];\n if (entityConfig == null) {\n return null;\n }\n return entityConfig.routes.detail(refId);\n },\n });\n const title = resolveLabel(widget.title, tApp);\n return (\n <InfoTile title={title}>\n <DataTable\n columns={columns}\n rows={resolved.rows}\n getRowId={(row, index) => {\n if (row != null && typeof row === 'object') {\n const record = row as Record<string, unknown>;\n const { id } = record;\n if (typeof id === 'string' && id.trim() !== '') {\n return id;\n }\n }\n return String(index);\n }}\n />\n </InfoTile>\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (widget.kind === 'entityCount') {\n const entityManifest = entities[widget.entityId];\n if (entityManifest?.kind !== 'list-detail') {\n return null;\n }\n const resolved = resolveData(globalData) as { count: number | null } | null;\n let countLabel: number | string = t('common.notAvailable');\n if (typeof resolved?.count === 'number') {\n countLabel = resolved.count;\n }\n const title = resolveLabel(widget.label, tApp);\n return (\n <InfoTile title={title}>\n <div className={styles.tileBody}>\n <div className={styles.tileCount}>{countLabel}</div>\n <div className={styles.links}>\n <Link to={entityManifest.routes.list}>\n {t('dashboard.actions.openList')}\n </Link>\n </div>\n </div>\n </InfoTile>\n );\n }\n\n return null;\n};\n\ntype WidgetWithQueryProps = {\n widget: BackofficeDashboardWidget & { query: GraphQLTaggedNode };\n};\n\nconst WidgetWithQuery = ({ widget }: WidgetWithQueryProps): JSX.Element => {\n const data = useLazyLoadQuery<OperationType>(\n widget.query,\n {},\n {\n fetchPolicy: 'store-or-network',\n },\n );\n\n return <WidgetContent widget={widget} globalData={data} />;\n};\n\ntype DashboardContentProps = {\n config: BackofficeDashboardConfig;\n globalData: unknown;\n};\n\nconst DashboardContent = ({\n config,\n globalData,\n}: DashboardContentProps): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n\n const title = resolveLabel(config.title, tApp);\n const subtitle =\n config.subtitle != null ? resolveLabel(config.subtitle, tApp) : undefined;\n\n return (\n <DetailPageTemplate\n header={{\n title,\n subtitle: subtitle ?? t('dashboard.subtitle'),\n }}\n >\n <div className={styles.tilesGrid}>\n {config.widgets.map((widget) => {\n const content = hasWidgetQuery(widget) ? (\n <WidgetWithQuery widget={widget} />\n ) : (\n <WidgetContent widget={widget} globalData={globalData} />\n );\n\n return (\n <BackofficeErrorBoundary\n key={widget.id}\n fallback={() => {\n return (\n <InfoTile\n title={resolveLabel(getWidgetLabel(widget, config), tApp)}\n >\n <div className={styles.tileBody}>\n {t('common.notAvailable')}\n </div>\n </InfoTile>\n );\n }}\n >\n <Suspense\n fallback={\n <InfoTile\n title={resolveLabel(getWidgetLabel(widget, config), tApp)}\n >\n <div className={styles.tileBody}>{t('common.loading')}</div>\n </InfoTile>\n }\n >\n {content}\n </Suspense>\n </BackofficeErrorBoundary>\n );\n })}\n </div>\n </DetailPageTemplate>\n );\n};\n\ntype DashboardWithQueryProps = {\n config: BackofficeDashboardConfig;\n};\n\nconst DashboardWithQuery = ({\n config,\n}: DashboardWithQueryProps): JSX.Element => {\n const data = useLazyLoadQuery<OperationType>(\n config.query as never,\n {},\n { fetchPolicy: 'store-or-network' },\n );\n\n return <DashboardContent config={config} globalData={data} />;\n};\n\nexport const BackofficeDashboardPage = (): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const { entities } = useBackofficeConfig();\n const dashboard = useBackofficeDashboardConfig();\n const breadcrumb = buildDashboardBreadcrumb(t);\n\n if (dashboard == null) {\n const items = Object.values(entities)\n .filter((config) => {\n return config.kind === 'list-detail' && config.hasList;\n })\n .map((config) => {\n return {\n config,\n label: resolveLabel(config.label, tApp),\n };\n })\n .sort((left, right) => {\n return left.label.localeCompare(right.label);\n });\n\n return (\n <BackofficeRightPageLayout breadcrumb={breadcrumb}>\n <DetailPageTemplate\n header={{\n title: t('dashboard.title'),\n subtitle: t('dashboard.subtitle'),\n }}\n >\n <div className={styles.tilesGrid}>\n {items.map(({ config, label }) => {\n return (\n <InfoTile key={config.id} title={label}>\n <div className={styles.tileBody}>\n <div className={styles.tileCount}>\n {t('common.notAvailable')}\n </div>\n <div className={styles.links}>\n <Link to={config.routes.list}>\n {t('dashboard.actions.openList')}\n </Link>\n </div>\n </div>\n </InfoTile>\n );\n })}\n </div>\n </DetailPageTemplate>\n </BackofficeRightPageLayout>\n );\n }\n\n if (dashboard.query != null) {\n return (\n <BackofficeRightPageLayout breadcrumb={breadcrumb}>\n <DashboardWithQuery config={dashboard} />\n </BackofficeRightPageLayout>\n );\n }\n\n return (\n <BackofficeRightPageLayout breadcrumb={breadcrumb}>\n <DashboardContent config={dashboard} globalData={null} />\n </BackofficeRightPageLayout>\n );\n};\n\nexport default BackofficeDashboardPage;\n"],"mappings":";;;;;;;;;;;;AAQA,IAAa,KAAgB,GAAkB,MACtC,EAAM,EAAK,EAGP,KACX,GACA,MACc;AACd,SAAQ,EAAO,MAAf;EACE,KAAK;EACL,KAAK,WACH,QAAO,EAAO;EAChB,KAAK;EACL,KAAK,YACH,QAAO,EAAO;EAChB,QACE,QAAO,EAAO;;GAIP,KACX,MAEO,WAAW,KAAU,EAAO,SAAS,mKEJxC,EAAE,wBAAqB,GAOvB,KAAiB,EACrB,WACA,oBAC4C;CAC5C,IAAM,EAAE,GAAG,MAAS,GAAgB,EAC9B,EAAE,SAAM,GAA+B,EACvC,EAAE,gBAAa,GAAq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EAAE,6BAA6B;SAC3B,CAAA;QACH,CAAA,CACF;;MACG,EAXI,EAAO,GAWX,CAEb;KACE,CAAA;IACa,CAAA;GACK,CAAA;;AAYhC,QARI,EAAU,SAAS,OASrB,kBAAC,GAAD;EAAuC;YACrC,kBAAC,GAAD;GAAkB,QAAQ;GAAW,YAAY;GAAQ,CAAA;EAC/B,CAAA,GAT1B,kBAAC,GAAD;EAAuC;YACrC,kBAAC,GAAD,EAAoB,QAAQ,GAAa,CAAA;EACf,CAAA"}
|
|
1
|
+
{"version":3,"file":"BackofficeDashboardPage-YWvoQODn.js","names":[],"sources":["../../src/pages/BackofficeDashboardPage.helpers.ts","../../src/pages/backofficeDashboardPage.css.ts","../../src/pages/BackofficeDashboardPage.tsx"],"sourcesContent":["import type {\n BackofficeDashboardConfig,\n BackofficeDashboardWidget,\n I18nLabel,\n} from '@plumile/backoffice-core/types.js';\nimport type { TFunction } from 'i18next';\nimport type { GraphQLTaggedNode } from 'relay-runtime';\n\nexport const resolveLabel = (label: I18nLabel, tApp: TFunction): string => {\n return label(tApp);\n};\n\nexport const getWidgetLabel = (\n widget: BackofficeDashboardWidget,\n config: BackofficeDashboardConfig,\n): I18nLabel => {\n switch (widget.kind) {\n case 'entityCount':\n case 'shortcut':\n return widget.label;\n case 'tablePreview':\n case 'textBlock':\n return widget.title;\n default:\n return config.title;\n }\n};\n\nexport const hasWidgetQuery = (\n widget: BackofficeDashboardWidget,\n): widget is BackofficeDashboardWidget & { query: GraphQLTaggedNode } => {\n return 'query' in widget && widget.query != null;\n};\n","import { sprinkles } from '@plumile/ui';\n\nexport const tilesGrid = sprinkles({\n display: 'grid',\n gridTemplateColumns: 'autoFillMinmax320',\n gap: 4,\n});\n\nexport const tileBody = sprinkles({\n display: 'flex',\n flexDirection: 'column',\n gap: 2,\n});\n\nexport const tileCount = sprinkles({\n fontSize: '3xl',\n fontWeight: 'bold',\n lineHeight: 1,\n});\n\nexport const links = sprinkles({\n display: 'flex',\n flexWrap: 'wrap',\n rowGap: 2,\n columnGap: 3,\n});\n","/* eslint-disable no-ternary */\nimport { type JSX, Suspense } from 'react';\nimport { Link } from '@plumile/router';\nimport type {\n BackofficeDashboardConfig,\n BackofficeDashboardWidget,\n} from '@plumile/backoffice-core/types.js';\nimport { DataTable, DetailPageTemplate, InfoTile } from '@plumile/ui';\nimport { useTranslation } from 'react-i18next';\nimport * as ReactRelay from 'react-relay';\nimport type { GraphQLTaggedNode, OperationType } from 'relay-runtime';\n\nimport { BackofficeErrorBoundary } from '../components/backoffice/errors/BackofficeErrorBoundary.js';\nimport { useBackofficeReactTranslation } from '../i18n/useBackofficeReactTranslation.js';\nimport { useBackofficeConfig } from '../provider/BackofficeConfigContext.js';\nimport { useBackofficeDashboardConfig } from '../provider/useBackofficeLazyValue.js';\nimport { buildDataTableColumns } from '../components/backoffice/columns/buildDataTableColumns.js';\nimport { BackofficeRightPageLayout } from '../components/backoffice/layout/breadcrumb/BackofficeRightPageLayout.js';\nimport { buildDashboardBreadcrumb } from '../components/backoffice/layout/breadcrumb/buildBreadcrumbs.js';\nimport {\n getWidgetLabel,\n hasWidgetQuery,\n resolveLabel,\n} from './BackofficeDashboardPage.helpers.js';\n\nimport * as styles from './backofficeDashboardPage.css.js';\n\nconst { useLazyLoadQuery } = ReactRelay;\n\ntype WidgetContentProps = {\n widget: BackofficeDashboardWidget;\n globalData: unknown;\n};\n\nconst WidgetContent = ({\n widget,\n globalData,\n}: WidgetContentProps): JSX.Element | null => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const { entities } = useBackofficeConfig();\n\n const resolveData = (data: unknown): unknown => {\n if ('resolve' in widget && widget.resolve != null) {\n return widget.resolve(data);\n }\n return null;\n };\n\n if (widget.kind === 'textBlock') {\n const title = resolveLabel(widget.title, tApp);\n const body = resolveLabel(widget.body, tApp);\n return (\n <InfoTile title={title}>\n <div className={styles.tileBody}>{body}</div>\n </InfoTile>\n );\n }\n\n if (widget.kind === 'shortcut') {\n const entity = entities[widget.entityId];\n if (entity == null) {\n return null;\n }\n const title = resolveLabel(widget.label, tApp);\n if (entity.kind === 'tool') {\n return (\n <InfoTile title={title}>\n <div className={styles.links}>\n <Link to={entity.routes.list}>\n {t('dashboard.actions.openTool')}\n </Link>\n </div>\n </InfoTile>\n );\n }\n return (\n <InfoTile title={title}>\n <div className={styles.links}>\n <Link to={entity.routes.list}>{t('dashboard.actions.openList')}</Link>\n </div>\n </InfoTile>\n );\n }\n\n if (widget.kind === 'tablePreview') {\n const resolved = resolveData(globalData) as {\n columns: readonly unknown[];\n rows: readonly unknown[];\n } | null;\n if (resolved == null) {\n return null;\n }\n const columns = buildDataTableColumns(resolved.columns as never, {\n tApp,\n t,\n resolveEntityHref: (entityId, refId) => {\n const entityConfig = entities[entityId];\n if (entityConfig == null) {\n return null;\n }\n return entityConfig.routes.detail(refId);\n },\n });\n const title = resolveLabel(widget.title, tApp);\n return (\n <InfoTile title={title}>\n <DataTable\n columns={columns}\n rows={resolved.rows}\n getRowId={(row, index) => {\n if (row != null && typeof row === 'object') {\n const record = row as Record<string, unknown>;\n const { id } = record;\n if (typeof id === 'string' && id.trim() !== '') {\n return id;\n }\n }\n return String(index);\n }}\n />\n </InfoTile>\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (widget.kind === 'entityCount') {\n const entityManifest = entities[widget.entityId];\n if (entityManifest?.kind !== 'list-detail') {\n return null;\n }\n const resolved = resolveData(globalData) as { count: number | null } | null;\n let countLabel: number | string = t('common.notAvailable');\n if (typeof resolved?.count === 'number') {\n countLabel = resolved.count;\n }\n const title = resolveLabel(widget.label, tApp);\n return (\n <InfoTile title={title}>\n <div className={styles.tileBody}>\n <div className={styles.tileCount}>{countLabel}</div>\n <div className={styles.links}>\n <Link to={entityManifest.routes.list}>\n {t('dashboard.actions.openList')}\n </Link>\n </div>\n </div>\n </InfoTile>\n );\n }\n\n return null;\n};\n\ntype WidgetWithQueryProps = {\n widget: BackofficeDashboardWidget & { query: GraphQLTaggedNode };\n};\n\nconst WidgetWithQuery = ({ widget }: WidgetWithQueryProps): JSX.Element => {\n const data = useLazyLoadQuery<OperationType>(\n widget.query,\n {},\n {\n fetchPolicy: 'store-or-network',\n },\n );\n\n return <WidgetContent widget={widget} globalData={data} />;\n};\n\ntype DashboardContentProps = {\n config: BackofficeDashboardConfig;\n globalData: unknown;\n};\n\nconst DashboardContent = ({\n config,\n globalData,\n}: DashboardContentProps): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n\n const title = resolveLabel(config.title, tApp);\n const subtitle =\n config.subtitle != null ? resolveLabel(config.subtitle, tApp) : undefined;\n\n return (\n <DetailPageTemplate\n header={{\n title,\n subtitle: subtitle ?? t('dashboard.subtitle'),\n }}\n >\n <div className={styles.tilesGrid}>\n {config.widgets.map((widget) => {\n const content = hasWidgetQuery(widget) ? (\n <WidgetWithQuery widget={widget} />\n ) : (\n <WidgetContent widget={widget} globalData={globalData} />\n );\n\n return (\n <BackofficeErrorBoundary\n key={widget.id}\n fallback={() => {\n return (\n <InfoTile\n title={resolveLabel(getWidgetLabel(widget, config), tApp)}\n >\n <div className={styles.tileBody}>\n {t('common.notAvailable')}\n </div>\n </InfoTile>\n );\n }}\n >\n <Suspense\n fallback={\n <InfoTile\n title={resolveLabel(getWidgetLabel(widget, config), tApp)}\n >\n <div className={styles.tileBody}>{t('common.loading')}</div>\n </InfoTile>\n }\n >\n {content}\n </Suspense>\n </BackofficeErrorBoundary>\n );\n })}\n </div>\n </DetailPageTemplate>\n );\n};\n\ntype DashboardWithQueryProps = {\n config: BackofficeDashboardConfig;\n};\n\nconst DashboardWithQuery = ({\n config,\n}: DashboardWithQueryProps): JSX.Element => {\n const data = useLazyLoadQuery<OperationType>(\n config.query as never,\n {},\n { fetchPolicy: 'store-or-network' },\n );\n\n return <DashboardContent config={config} globalData={data} />;\n};\n\nexport const BackofficeDashboardPage = (): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const { entities } = useBackofficeConfig();\n const dashboard = useBackofficeDashboardConfig();\n const breadcrumb = buildDashboardBreadcrumb(t);\n\n if (dashboard == null) {\n const items = Object.values(entities)\n .filter((config) => {\n return config.kind === 'list-detail' && config.hasList;\n })\n .map((config) => {\n return {\n config,\n label: resolveLabel(config.label, tApp),\n };\n })\n .sort((left, right) => {\n return left.label.localeCompare(right.label);\n });\n\n return (\n <BackofficeRightPageLayout breadcrumb={breadcrumb}>\n <DetailPageTemplate\n header={{\n title: t('dashboard.title'),\n subtitle: t('dashboard.subtitle'),\n }}\n >\n <div className={styles.tilesGrid}>\n {items.map(({ config, label }) => {\n return (\n <InfoTile key={config.id} title={label}>\n <div className={styles.tileBody}>\n <div className={styles.tileCount}>\n {t('common.notAvailable')}\n </div>\n <div className={styles.links}>\n <Link to={config.routes.list}>\n {t('dashboard.actions.openList')}\n </Link>\n </div>\n </div>\n </InfoTile>\n );\n })}\n </div>\n </DetailPageTemplate>\n </BackofficeRightPageLayout>\n );\n }\n\n if (dashboard.query != null) {\n return (\n <BackofficeRightPageLayout breadcrumb={breadcrumb}>\n <DashboardWithQuery config={dashboard} />\n </BackofficeRightPageLayout>\n );\n }\n\n return (\n <BackofficeRightPageLayout breadcrumb={breadcrumb}>\n <DashboardContent config={dashboard} globalData={null} />\n </BackofficeRightPageLayout>\n );\n};\n\nexport default BackofficeDashboardPage;\n"],"mappings":";;;;;;;;;;;;AAQA,IAAa,KAAgB,GAAkB,MACtC,EAAM,EAAK,EAGP,KACX,GACA,MACc;AACd,SAAQ,EAAO,MAAf;EACE,KAAK;EACL,KAAK,WACH,QAAO,EAAO;EAChB,KAAK;EACL,KAAK,YACH,QAAO,EAAO;EAChB,QACE,QAAO,EAAO;;GAIP,KACX,MAEO,WAAW,KAAU,EAAO,SAAS,mKEJxC,EAAE,wBAAqB,GAOvB,KAAiB,EACrB,WACA,oBAC4C;CAC5C,IAAM,EAAE,GAAG,MAAS,GAAgB,EAC9B,EAAE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kBAAC,GAAD;SAAM,IAAI,EAAO,OAAO;mBACrB,EAAE,6BAA6B;SAC3B,CAAA;QACH,CAAA,CACF;;MACG,EAXI,EAAO,GAWX,CAEb;KACE,CAAA;IACa,CAAA;GACK,CAAA;;AAYhC,QARI,EAAU,SAAS,OASrB,kBAAC,GAAD;EAAuC;YACrC,kBAAC,GAAD;GAAkB,QAAQ;GAAW,YAAY;GAAQ,CAAA;EAC/B,CAAA,GAT1B,kBAAC,GAAD;EAAuC;YACrC,kBAAC,GAAD,EAAoB,QAAQ,GAAa,CAAA;EACf,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./useBackofficeReactTranslation-
|
|
1
|
+
import { t as e } from "./useBackofficeReactTranslation-Btt58EIo.js";
|
|
2
2
|
import { useTranslation as t } from "react-i18next";
|
|
3
3
|
import { CopyableText as n, LazyMarkdownRenderer as r, Tag as i, cx as a } from "@plumile/ui";
|
|
4
4
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
@@ -91,4 +91,4 @@ var C = ({ title: t, content: n, format: i = "markdown", description: a }) => {
|
|
|
91
91
|
//#endregion
|
|
92
92
|
export { l as a, h as i, S as n, x as r, C as t };
|
|
93
93
|
|
|
94
|
-
//# sourceMappingURL=BackofficeDetailPayload-
|
|
94
|
+
//# sourceMappingURL=BackofficeDetailPayload-P61MDRLE.js.map
|
package/lib/esm/{BackofficeDetailPayload-iVx66o_6.js.map → BackofficeDetailPayload-P61MDRLE.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeDetailPayload-iVx66o_6.js","names":[],"sources":["../../src/components/backoffice/detail/backofficeDetailBadgeRow.css.ts","../../src/components/backoffice/detail/BackofficeDetailBadgeRow.tsx","../../src/components/backoffice/detail/backofficeDetailField.css.ts","../../src/components/backoffice/detail/BackofficeDetailField.tsx","../../src/components/backoffice/detail/backofficeDetailSection.css.ts","../../src/components/backoffice/detail/BackofficeDetailSection.tsx","../../src/components/backoffice/detail/detailPayloadUtils.ts","../../src/components/backoffice/detail/BackofficeDetailPayload.tsx"],"sourcesContent":["import { sprinkles } from '@plumile/ui';\n\nexport const row = sprinkles({\n display: 'flex',\n flexWrap: 'wrap',\n gap: 2,\n alignItems: 'center',\n});\n","/* eslint-disable no-ternary */\nimport { type JSX } from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { BackofficeBadgeItem } from '@plumile/backoffice-core/types.js';\nimport { Tag } from '@plumile/ui';\n\nimport * as styles from './backofficeDetailBadgeRow.css.js';\n\nexport type BackofficeDetailBadgeRowProps = {\n items: readonly BackofficeBadgeItem[];\n};\n\nexport const BackofficeDetailBadgeRow = ({\n items,\n}: BackofficeDetailBadgeRowProps): JSX.Element => {\n const { t } = useTranslation();\n return (\n <div className={styles.row}>\n {items.map((item) => {\n const label =\n typeof item.label === 'function' ? item.label(t) : item.label;\n return (\n <Tag key={item.id} tone={item.tone ?? 'neutral'}>\n {label}\n </Tag>\n );\n })}\n </div>\n );\n};\n\nexport default BackofficeDetailBadgeRow;\n","import { style } from '@vanilla-extract/css';\nimport { sprinkles } from '@plumile/ui';\n\nexport const field = sprinkles({\n display: 'flex',\n flexDirection: 'column',\n gap: 1,\n minWidth: 0,\n});\n\nexport const label = sprinkles({\n fontSize: 'xs',\n textTransform: 'uppercase',\n letterSpacing: 'capsTight',\n color: 'textSecondary',\n});\n\nexport const value = sprinkles({\n fontSize: 'sm',\n color: 'text',\n wordBreak: 'break-word',\n});\n\nexport const fullWidth = sprinkles({\n gridColumn: 'span-full',\n});\n\nexport const size = {\n xs: style({ maxWidth: '10ch' }),\n s: style({ maxWidth: '18ch' }),\n m: style({ maxWidth: '28ch' }),\n l: style({ maxWidth: '44ch' }),\n xl: style({ maxWidth: '64ch' }),\n fluid: style({ maxWidth: '100%' }),\n};\n","import { type JSX, type ReactNode } from 'react';\nimport type { BackofficeFieldSize } from '@plumile/backoffice-core/types.js';\n\nimport { CopyableText, cx } from '@plumile/ui';\n\nimport { useBackofficeReactTranslation } from '../../../i18n/useBackofficeReactTranslation.js';\n\nimport * as styles from './backofficeDetailField.css.js';\n\nexport type BackofficeDetailFieldProps = {\n id: string;\n label: string;\n size: BackofficeFieldSize;\n value: ReactNode | null | undefined;\n copyValue?: string;\n fullWidth?: boolean;\n};\n\nexport const BackofficeDetailField = ({\n label,\n size,\n value,\n copyValue,\n fullWidth = false,\n}: BackofficeDetailFieldProps): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n let resolvedValue: ReactNode = value;\n if (\n resolvedValue == null ||\n (typeof resolvedValue === 'string' && resolvedValue.trim() === '')\n ) {\n resolvedValue = t('common.notAvailable');\n }\n\n if (copyValue != null && copyValue !== '') {\n resolvedValue = (\n <CopyableText\n value={copyValue}\n copyValue={copyValue}\n truncate={false}\n copyLabel={t('common.actions.copy')}\n copiedLabel={t('common.actions.copied')}\n />\n );\n }\n\n const fieldClassNames = [styles.field, styles.size[size]];\n if (fullWidth) {\n fieldClassNames.push(styles.fullWidth);\n }\n\n return (\n <div className={cx(...fieldClassNames)}>\n <span className={styles.label}>{label}</span>\n <div className={styles.value}>{resolvedValue}</div>\n </div>\n );\n};\n\nexport default BackofficeDetailField;\n","import { sprinkles } from '@plumile/ui';\n\nexport const section = sprinkles({\n display: 'flex',\n flexDirection: 'column',\n gap: 4,\n padding: 6,\n borderRadius: 'md',\n backgroundColor: 'surface',\n borderWidth: 'default',\n borderStyle: 'solid',\n borderColor: 'borderSubtle',\n boxShadow: 'inkSoft',\n});\n\nexport const header = sprinkles({\n display: 'flex',\n flexDirection: 'column',\n gap: 1,\n});\n\nexport const title = sprinkles({\n fontSize: 'base',\n fontWeight: 'semibold',\n color: 'text',\n});\n\nexport const description = sprinkles({\n fontSize: 'sm',\n color: 'textSecondary',\n});\n\nexport const grid = sprinkles({\n display: 'grid',\n gap: 4,\n gridTemplateColumns: 'autoFitMinmax220',\n});\n","import { type JSX, type ReactNode } from 'react';\n\nimport {\n BackofficeDetailField,\n type BackofficeDetailFieldProps,\n} from './BackofficeDetailField.js';\nimport * as styles from './backofficeDetailSection.css.js';\n\nexport type BackofficeDetailSectionProps = {\n title: string;\n description?: string;\n items?: readonly BackofficeDetailFieldProps[];\n children?: ReactNode;\n};\n\nexport const BackofficeDetailSection = ({\n title,\n description,\n items,\n children,\n}: BackofficeDetailSectionProps): JSX.Element => {\n let descriptionNode: JSX.Element | null = null;\n if (description != null && description !== '') {\n descriptionNode = <p className={styles.description}>{description}</p>;\n }\n\n let itemsNode: JSX.Element | null = null;\n if (items != null && items.length > 0) {\n itemsNode = (\n <div className={styles.grid}>\n {items.map((item) => {\n return <BackofficeDetailField key={item.id} {...item} />;\n })}\n </div>\n );\n }\n\n return (\n <section className={styles.section}>\n <header className={styles.header}>\n <h3 className={styles.title}>{title}</h3>\n {descriptionNode}\n </header>\n {itemsNode}\n {children}\n </section>\n );\n};\n\nexport default BackofficeDetailSection;\n","/**\n * Formats a JSON payload into a fenced Markdown code block.\n */\nexport function formatJsonPayload(value: unknown): string {\n if (value == null) {\n return '';\n }\n try {\n return `\\`\\`\\`json\\n${JSON.stringify(value, null, 2)}\\n\\`\\`\\``;\n } catch {\n let fallback = '[unserializable]';\n if (typeof value === 'string') {\n fallback = value;\n } else if (typeof value === 'number' || typeof value === 'boolean') {\n fallback = String(value);\n }\n return `\\`\\`\\`\\n${fallback}\\n\\`\\`\\``;\n }\n}\n\n/**\n * Formats a list of strings as a Markdown bullet list.\n */\nexport function formatListAsMarkdown(items: readonly string[]): string {\n if (items.length === 0) {\n return '';\n }\n return items\n .map((item) => {\n return `- ${item}`;\n })\n .join('\\n');\n}\n","import { type JSX } from 'react';\n\nimport { LazyMarkdownRenderer } from '@plumile/ui';\n\nimport { useBackofficeReactTranslation } from '../../../i18n/useBackofficeReactTranslation.js';\nimport { BackofficeDetailSection } from './BackofficeDetailSection.js';\nimport { formatJsonPayload } from './detailPayloadUtils.js';\n\nexport type BackofficeDetailPayloadProps = {\n title: string;\n content: unknown;\n format?: 'markdown' | 'json' | 'text';\n description?: string;\n};\n\nexport const BackofficeDetailPayload = ({\n title,\n content,\n format = 'markdown',\n description,\n}: BackofficeDetailPayloadProps): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n let resolved = '';\n if (format === 'json') {\n resolved = formatJsonPayload(content);\n } else if (content != null) {\n if (typeof content === 'string') {\n resolved = content;\n } else if (typeof content === 'number' || typeof content === 'boolean') {\n resolved = String(content);\n } else {\n resolved = formatJsonPayload(content);\n }\n }\n\n if (resolved.trim() === '') {\n resolved = t('common.notAvailable');\n }\n\n return (\n <BackofficeDetailSection title={title} description={description}>\n <LazyMarkdownRenderer content={resolved} />\n </BackofficeDetailSection>\n );\n};\n\nexport default BackofficeDetailPayload;\n"],"mappings":";;;;;kDCaa,KAA4B,EACvC,eACgD;CAChD,IAAM,EAAE,SAAM,GAAgB;AAC9B,QACE,kBAAC,OAAD;EAAK,WAAW;YACb,EAAM,KAAK,MAAS;GACnB,IAAM,IACJ,OAAO,EAAK,SAAU,aAAa,EAAK,MAAM,EAAE,GAAG,EAAK;AAC1D,UACE,kBAAC,GAAD;IAAmB,MAAM,EAAK,QAAQ;cACnC;IACG,EAFI,EAAK,GAET;IAER;EACE,CAAA;;;;;;;;GEVG,KAAyB,EACpC,OAAA,GACA,MAAA,GACA,OAAA,GACA,cACA,WAAA,IAAY,SACiC;CAC7C,IAAM,EAAE,SAAM,GAA+B,EACzC,IAA2B;AAQ/B,EANE,KAAiB,QAChB,OAAO,KAAkB,YAAY,EAAc,MAAM,KAAK,QAE/D,IAAgB,EAAE,sBAAsB,GAGtC,KAAa,QAAQ,MAAc,OACrC,IACE,kBAAC,GAAD;EACE,OAAO;EACI;EACX,UAAU;EACV,WAAW,EAAE,sBAAsB;EACnC,aAAa,EAAE,wBAAwB;EACvC,CAAA;CAIN,IAAM,IAAkB,CAAC,GAAc,EAAY,GAAM;AAKzD,QAJI,KACF,EAAgB,KAAK,EAAiB,EAItC,kBAAC,OAAD;EAAK,WAAW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InC,kBAAC,GAAD;EAAgC;EAAoB;YAClD,kBAAC,GAAD,EAAsB,SAAS,GAAY,CAAA;EACnB,CAAA"}
|
|
1
|
+
{"version":3,"file":"BackofficeDetailPayload-P61MDRLE.js","names":[],"sources":["../../src/components/backoffice/detail/backofficeDetailBadgeRow.css.ts","../../src/components/backoffice/detail/BackofficeDetailBadgeRow.tsx","../../src/components/backoffice/detail/backofficeDetailField.css.ts","../../src/components/backoffice/detail/BackofficeDetailField.tsx","../../src/components/backoffice/detail/backofficeDetailSection.css.ts","../../src/components/backoffice/detail/BackofficeDetailSection.tsx","../../src/components/backoffice/detail/detailPayloadUtils.ts","../../src/components/backoffice/detail/BackofficeDetailPayload.tsx"],"sourcesContent":["import { sprinkles } from '@plumile/ui';\n\nexport const row = sprinkles({\n display: 'flex',\n flexWrap: 'wrap',\n gap: 2,\n alignItems: 'center',\n});\n","/* eslint-disable no-ternary */\nimport { type JSX } from 'react';\nimport { useTranslation } from 'react-i18next';\n\nimport type { BackofficeBadgeItem } from '@plumile/backoffice-core/types.js';\nimport { Tag } from '@plumile/ui';\n\nimport * as styles from './backofficeDetailBadgeRow.css.js';\n\nexport type BackofficeDetailBadgeRowProps = {\n items: readonly BackofficeBadgeItem[];\n};\n\nexport const BackofficeDetailBadgeRow = ({\n items,\n}: BackofficeDetailBadgeRowProps): JSX.Element => {\n const { t } = useTranslation();\n return (\n <div className={styles.row}>\n {items.map((item) => {\n const label =\n typeof item.label === 'function' ? item.label(t) : item.label;\n return (\n <Tag key={item.id} tone={item.tone ?? 'neutral'}>\n {label}\n </Tag>\n );\n })}\n </div>\n );\n};\n\nexport default BackofficeDetailBadgeRow;\n","import { style } from '@vanilla-extract/css';\nimport { sprinkles } from '@plumile/ui';\n\nexport const field = sprinkles({\n display: 'flex',\n flexDirection: 'column',\n gap: 1,\n minWidth: 0,\n});\n\nexport const label = sprinkles({\n fontSize: 'xs',\n textTransform: 'uppercase',\n letterSpacing: 'capsTight',\n color: 'textSecondary',\n});\n\nexport const value = sprinkles({\n fontSize: 'sm',\n color: 'text',\n wordBreak: 'break-word',\n});\n\nexport const fullWidth = sprinkles({\n gridColumn: 'span-full',\n});\n\nexport const size = {\n xs: style({ maxWidth: '10ch' }),\n s: style({ maxWidth: '18ch' }),\n m: style({ maxWidth: '28ch' }),\n l: style({ maxWidth: '44ch' }),\n xl: style({ maxWidth: '64ch' }),\n fluid: style({ maxWidth: '100%' }),\n};\n","import { type JSX, type ReactNode } from 'react';\nimport type { BackofficeFieldSize } from '@plumile/backoffice-core/types.js';\n\nimport { CopyableText, cx } from '@plumile/ui';\n\nimport { useBackofficeReactTranslation } from '../../../i18n/useBackofficeReactTranslation.js';\n\nimport * as styles from './backofficeDetailField.css.js';\n\nexport type BackofficeDetailFieldProps = {\n id: string;\n label: string;\n size: BackofficeFieldSize;\n value: ReactNode | null | undefined;\n copyValue?: string;\n fullWidth?: boolean;\n};\n\nexport const BackofficeDetailField = ({\n label,\n size,\n value,\n copyValue,\n fullWidth = false,\n}: BackofficeDetailFieldProps): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n let resolvedValue: ReactNode = value;\n if (\n resolvedValue == null ||\n (typeof resolvedValue === 'string' && resolvedValue.trim() === '')\n ) {\n resolvedValue = t('common.notAvailable');\n }\n\n if (copyValue != null && copyValue !== '') {\n resolvedValue = (\n <CopyableText\n value={copyValue}\n copyValue={copyValue}\n truncate={false}\n copyLabel={t('common.actions.copy')}\n copiedLabel={t('common.actions.copied')}\n />\n );\n }\n\n const fieldClassNames = [styles.field, styles.size[size]];\n if (fullWidth) {\n fieldClassNames.push(styles.fullWidth);\n }\n\n return (\n <div className={cx(...fieldClassNames)}>\n <span className={styles.label}>{label}</span>\n <div className={styles.value}>{resolvedValue}</div>\n </div>\n );\n};\n\nexport default BackofficeDetailField;\n","import { sprinkles } from '@plumile/ui';\n\nexport const section = sprinkles({\n display: 'flex',\n flexDirection: 'column',\n gap: 4,\n padding: 6,\n borderRadius: 'md',\n backgroundColor: 'surface',\n borderWidth: 'default',\n borderStyle: 'solid',\n borderColor: 'borderSubtle',\n boxShadow: 'inkSoft',\n});\n\nexport const header = sprinkles({\n display: 'flex',\n flexDirection: 'column',\n gap: 1,\n});\n\nexport const title = sprinkles({\n fontSize: 'base',\n fontWeight: 'semibold',\n color: 'text',\n});\n\nexport const description = sprinkles({\n fontSize: 'sm',\n color: 'textSecondary',\n});\n\nexport const grid = sprinkles({\n display: 'grid',\n gap: 4,\n gridTemplateColumns: 'autoFitMinmax220',\n});\n","import { type JSX, type ReactNode } from 'react';\n\nimport {\n BackofficeDetailField,\n type BackofficeDetailFieldProps,\n} from './BackofficeDetailField.js';\nimport * as styles from './backofficeDetailSection.css.js';\n\nexport type BackofficeDetailSectionProps = {\n title: string;\n description?: string;\n items?: readonly BackofficeDetailFieldProps[];\n children?: ReactNode;\n};\n\nexport const BackofficeDetailSection = ({\n title,\n description,\n items,\n children,\n}: BackofficeDetailSectionProps): JSX.Element => {\n let descriptionNode: JSX.Element | null = null;\n if (description != null && description !== '') {\n descriptionNode = <p className={styles.description}>{description}</p>;\n }\n\n let itemsNode: JSX.Element | null = null;\n if (items != null && items.length > 0) {\n itemsNode = (\n <div className={styles.grid}>\n {items.map((item) => {\n return <BackofficeDetailField key={item.id} {...item} />;\n })}\n </div>\n );\n }\n\n return (\n <section className={styles.section}>\n <header className={styles.header}>\n <h3 className={styles.title}>{title}</h3>\n {descriptionNode}\n </header>\n {itemsNode}\n {children}\n </section>\n );\n};\n\nexport default BackofficeDetailSection;\n","/**\n * Formats a JSON payload into a fenced Markdown code block.\n */\nexport function formatJsonPayload(value: unknown): string {\n if (value == null) {\n return '';\n }\n try {\n return `\\`\\`\\`json\\n${JSON.stringify(value, null, 2)}\\n\\`\\`\\``;\n } catch {\n let fallback = '[unserializable]';\n if (typeof value === 'string') {\n fallback = value;\n } else if (typeof value === 'number' || typeof value === 'boolean') {\n fallback = String(value);\n }\n return `\\`\\`\\`\\n${fallback}\\n\\`\\`\\``;\n }\n}\n\n/**\n * Formats a list of strings as a Markdown bullet list.\n */\nexport function formatListAsMarkdown(items: readonly string[]): string {\n if (items.length === 0) {\n return '';\n }\n return items\n .map((item) => {\n return `- ${item}`;\n })\n .join('\\n');\n}\n","import { type JSX } from 'react';\n\nimport { LazyMarkdownRenderer } from '@plumile/ui';\n\nimport { useBackofficeReactTranslation } from '../../../i18n/useBackofficeReactTranslation.js';\nimport { BackofficeDetailSection } from './BackofficeDetailSection.js';\nimport { formatJsonPayload } from './detailPayloadUtils.js';\n\nexport type BackofficeDetailPayloadProps = {\n title: string;\n content: unknown;\n format?: 'markdown' | 'json' | 'text';\n description?: string;\n};\n\nexport const BackofficeDetailPayload = ({\n title,\n content,\n format = 'markdown',\n description,\n}: BackofficeDetailPayloadProps): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n let resolved = '';\n if (format === 'json') {\n resolved = formatJsonPayload(content);\n } else if (content != null) {\n if (typeof content === 'string') {\n resolved = content;\n } else if (typeof content === 'number' || typeof content === 'boolean') {\n resolved = String(content);\n } else {\n resolved = formatJsonPayload(content);\n }\n }\n\n if (resolved.trim() === '') {\n resolved = t('common.notAvailable');\n }\n\n return (\n <BackofficeDetailSection title={title} description={description}>\n <LazyMarkdownRenderer content={resolved} />\n </BackofficeDetailSection>\n );\n};\n\nexport default BackofficeDetailPayload;\n"],"mappings":";;;;;kDCaa,KAA4B,EACvC,eACgD;CAChD,IAAM,EAAE,SAAM,GAAgB;AAC9B,QACE,kBAAC,OAAD;EAAK,WAAW;YACb,EAAM,KAAK,MAAS;GACnB,IAAM,IACJ,OAAO,EAAK,SAAU,aAAa,EAAK,MAAM,EAAE,GAAG,EAAK;AAC1D,UACE,kBAAC,GAAD;IAAmB,MAAM,EAAK,QAAQ;cACnC;IACG,EAFI,EAAK,GAET;IAER;EACE,CAAA;;;;;;;;GEVG,KAAyB,EACpC,OAAA,GACA,MAAA,GACA,OAAA,GACA,cACA,WAAA,IAAY,SACiC;CAC7C,IAAM,EAAE,SAAM,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D,IAAW,OAAO,EAAM,GAEnB,WAAW,EAAS;;;;;ACD/B,IAAa,KAA2B,EACtC,UACA,YACA,YAAS,YACT,qBAC+C;CAC/C,IAAM,EAAE,SAAM,GAA+B,EACzC,IAAW;AAiBf,QAhBI,MAAW,SACb,IAAW,EAAkB,EAAQ,GAC5B,KAAW,SACpB,AAKE,IALE,OAAO,KAAY,WACV,IACF,OAAO,KAAY,YAAY,OAAO,KAAY,YAChD,OAAO,EAAQ,GAEf,EAAkB,EAAQ,GAIrC,EAAS,MAAM,KAAK,OACtB,IAAW,EAAE,sBAAsB,GAInC,kBAAC,GAAD;EAAgC;EAAoB;YAClD,kBAAC,GAAD,EAAsB,SAAS,GAAY,CAAA;EACnB,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "./
|
|
3
|
-
import { i as n, t as r } from "./EntityIdPickerDialog-DbTnDU4v.js";
|
|
1
|
+
import { r as e, t } from "./useBackofficeReactTranslation-Btt58EIo.js";
|
|
2
|
+
import { i as n, t as r } from "./EntityIdPickerDialog-Yhmr-WsV.js";
|
|
4
3
|
import { i } from "./mutationResult-CcQMY13J.js";
|
|
5
4
|
import { n as a, t as o } from "./toastViewAction-BGTS7vqm.js";
|
|
6
5
|
import { useCallback as s, useContext as ee, useEffect as te, useMemo as c, useState as l } from "react";
|
|
@@ -510,4 +509,4 @@ var pe = "txvbqb9ip txvbqbai7 txvbqbaog", me = "txvbqb9ip txvbqbdp7 txvbqbao7",
|
|
|
510
509
|
//#endregion
|
|
511
510
|
export { S as BackofficeEntityActionFormDialog, S as default };
|
|
512
511
|
|
|
513
|
-
//# sourceMappingURL=BackofficeEntityActionFormDialog-
|
|
512
|
+
//# sourceMappingURL=BackofficeEntityActionFormDialog-BgRTJ_JS.js.map
|