@plumile/backoffice-react 0.1.199 → 0.1.201
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/README.md +5 -0
- package/lib/esm/auth/backofficeAuthHeaders.js +18 -0
- package/lib/esm/auth/backofficeAuthHeaders.js.map +1 -0
- package/lib/esm/components/backoffice/actions/BackofficeEntityActionFormDialog.js.map +1 -1
- package/lib/esm/components/backoffice/layout/breadcrumb/buildBreadcrumbs.js.map +1 -1
- package/lib/esm/components/backoffice/layout/sidebarUtils.js.map +1 -1
- package/lib/esm/components/backoffice/pickers/EntityIdPickerDialog.js +1 -1
- package/lib/esm/components/backoffice/pickers/EntityIdPickerDialog.js.map +1 -1
- package/lib/esm/index.js +76 -75
- package/lib/esm/pages/BackofficeAcceptInvitationPage.js +7 -7
- package/lib/esm/pages/BackofficeEntityDetailLayoutPage.js +1 -1
- package/lib/esm/pages/BackofficeEntityDetailLayoutPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.helpers.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.js +169 -169
- package/lib/esm/pages/BackofficeEntityDetailPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityListDataPage.js +1 -1
- package/lib/esm/pages/BackofficeEntityListDataPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityListPage.helpers.js.map +1 -1
- package/lib/esm/pages/BackofficeLayoutPage.js +41 -41
- package/lib/esm/pages/BackofficeLayoutPage.js.map +1 -1
- package/lib/esm/pages/BackofficeLoginPage.js +11 -11
- package/lib/esm/pages/BackofficePasswordResetCompletePage.js +14 -14
- package/lib/esm/pages/BackofficeVerifyEmailPage.js +14 -14
- package/lib/esm/provider/BackofficeProvider.js +78 -77
- package/lib/esm/provider/BackofficeProvider.js.map +1 -1
- package/lib/esm/provider/entityRegistry.js +39 -36
- package/lib/esm/provider/entityRegistry.js.map +1 -1
- package/lib/esm/provider/useBackofficeAuthRouteGate.js +39 -0
- package/lib/esm/provider/useBackofficeAuthRouteGate.js.map +1 -0
- package/lib/esm/relay/createInlineReader.js.map +1 -1
- package/lib/esm/relay/envHelpers.js +30 -22
- package/lib/esm/relay/envHelpers.js.map +1 -1
- package/lib/esm/relay/typedRelayHooks.js +11 -2
- package/lib/esm/relay/typedRelayHooks.js.map +1 -1
- package/lib/esm/router/backofficeAuthPaths.js +11 -2
- package/lib/esm/router/backofficeAuthPaths.js.map +1 -1
- package/lib/esm/router/createBackofficeRoutes.js.map +1 -1
- package/lib/types/auth/backofficeAuthHeaders.d.ts +5 -0
- package/lib/types/auth/backofficeAuthHeaders.d.ts.map +1 -0
- package/lib/types/components/backoffice/actions/BackofficeEntityActionFormDialog.d.ts +2 -2
- package/lib/types/components/backoffice/actions/BackofficeEntityActionFormDialog.d.ts.map +1 -1
- package/lib/types/components/backoffice/layout/sidebarUtils.d.ts.map +1 -1
- package/lib/types/components/backoffice/pickers/EntityIdPickerDialog.d.ts.map +1 -1
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityDetailPage.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityDetailPage.helpers.d.ts +3 -3
- package/lib/types/pages/BackofficeEntityDetailPage.helpers.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityListPage.helpers.d.ts +2 -2
- package/lib/types/pages/BackofficeEntityListPage.helpers.d.ts.map +1 -1
- package/lib/types/provider/BackofficeProvider.d.ts.map +1 -1
- package/lib/types/provider/entityRegistry.d.ts.map +1 -1
- package/lib/types/provider/types.d.ts +1 -1
- package/lib/types/provider/types.d.ts.map +1 -1
- package/lib/types/provider/useBackofficeAuthRouteGate.d.ts +2 -0
- package/lib/types/provider/useBackofficeAuthRouteGate.d.ts.map +1 -0
- package/lib/types/relay/createInlineReader.d.ts +4 -1
- package/lib/types/relay/createInlineReader.d.ts.map +1 -1
- package/lib/types/relay/envHelpers.d.ts.map +1 -1
- package/lib/types/relay/typedRelayHooks.d.ts +15 -5
- package/lib/types/relay/typedRelayHooks.d.ts.map +1 -1
- package/lib/types/router/backofficeAuthPaths.d.ts +1 -0
- package/lib/types/router/backofficeAuthPaths.d.ts.map +1 -1
- package/lib/types/router/createBackofficeRoutes.d.ts +1 -1
- package/lib/types/router/createBackofficeRoutes.d.ts.map +1 -1
- package/package.json +13 -13
package/lib/esm/index.js
CHANGED
|
@@ -1,77 +1,78 @@
|
|
|
1
1
|
import { AuthRefreshNotice as e, useAuthRefreshStateSnapshot as t } from "./auth/AuthRefreshNotice.js";
|
|
2
2
|
import { TotpQrCode as n, buildTotpOtpAuthUri as r } from "./auth/TotpQrCode.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import be from "./hooks/
|
|
58
|
-
import xe from "./hooks/
|
|
59
|
-
import
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
import {
|
|
67
|
-
import {
|
|
68
|
-
import {
|
|
69
|
-
import {
|
|
70
|
-
import {
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
73
|
-
import {
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
76
|
-
import {
|
|
77
|
-
|
|
3
|
+
import { createBackofficeAuthHeaders as i } from "./auth/backofficeAuthHeaders.js";
|
|
4
|
+
import { LoginFlow as a } from "./auth/login/LoginFlow.js";
|
|
5
|
+
import { synchronizeAuthStatusQuery as o } from "./auth/login/synchronizeAuthStatusQuery.js";
|
|
6
|
+
import { AcceptInvitationScreen as s } from "./auth/pages/AcceptInvitationScreen.js";
|
|
7
|
+
import { PasswordResetCompleteScreen as c } from "./auth/pages/PasswordResetCompleteScreen.js";
|
|
8
|
+
import { PasswordResetRequestScreen as l } from "./auth/pages/PasswordResetRequestScreen.js";
|
|
9
|
+
import { VerifyEmailScreen as u } from "./auth/pages/VerifyEmailScreen.js";
|
|
10
|
+
import { requireField as d, requireLinkedRecordId as f, resolveAgentStartOutcome as p, resolveMutationOutcome as m } from "./relay/mutationResult.js";
|
|
11
|
+
import { useBackofficeConfig as h } from "./provider/BackofficeConfigContext.js";
|
|
12
|
+
import { EntityIdFilterField as g } from "./components/backoffice/filters/EntityIdFilterField.js";
|
|
13
|
+
import { BackofficeErrorBoundary as _ } from "./components/backoffice/errors/BackofficeErrorBoundary.js";
|
|
14
|
+
import { EntityIdPickerDialog as v } from "./components/backoffice/pickers/EntityIdPickerDialog.js";
|
|
15
|
+
import { BackofficeBillingUsageChart as y } from "./components/backoffice/billing/BackofficeBillingUsageChart.js";
|
|
16
|
+
import { resolveBackofficeTargetIcon as b } from "./components/backoffice/links/resolveBackofficeTargetIcon.js";
|
|
17
|
+
import { resolveBackofficeLink as x } from "./components/backoffice/links/resolveBackofficeLink.js";
|
|
18
|
+
import { useBackofficeLink as S } from "./components/backoffice/links/useBackofficeLink.js";
|
|
19
|
+
import { BackofficeInlineLink as C } from "./components/backoffice/links/BackofficeInlineLink.js";
|
|
20
|
+
import { buildDataTableColumns as w } from "./components/backoffice/columns/buildDataTableColumns.js";
|
|
21
|
+
import { BackofficeDetailBadgeRow as T } from "./components/backoffice/detail/BackofficeDetailBadgeRow.js";
|
|
22
|
+
import { BackofficeStatusMetaBadge as E } from "./components/backoffice/detail/BackofficeStatusMetaBadge.js";
|
|
23
|
+
import { BackofficeEntitySummaryHeader as D } from "./components/backoffice/detail/BackofficeEntitySummaryHeader.js";
|
|
24
|
+
import { BackofficeEnumLabel as O } from "./components/backoffice/detail/BackofficeEnumLabel.js";
|
|
25
|
+
import { BackofficeLifecycleTimelineSection as k } from "./components/backoffice/detail/BackofficeLifecycleTimelineSection.js";
|
|
26
|
+
import { BackofficeReferenceValue as A } from "./components/backoffice/detail/BackofficeReferenceValue.js";
|
|
27
|
+
import { BackofficeRelationsSummaryGrid as j } from "./components/backoffice/detail/BackofficeRelationsSummaryGrid.js";
|
|
28
|
+
import { BackofficeStatusGroup as M } from "./components/backoffice/detail/BackofficeStatusGroup.js";
|
|
29
|
+
import { BackofficeTokenUsageBreakdown as N } from "./components/backoffice/detail/BackofficeTokenUsageBreakdown.js";
|
|
30
|
+
import { BackofficeUsageCostBreakdown as P } from "./components/backoffice/detail/BackofficeUsageCostBreakdown.js";
|
|
31
|
+
import { createBackofficeEntityLinkProps as F } from "./components/backoffice/detail/createBackofficeEntityLinkProps.js";
|
|
32
|
+
import { formatListAsMarkdown as I } from "./components/backoffice/detail/detailPayloadUtils.js";
|
|
33
|
+
import { BackofficeFilterAction as L } from "./components/backoffice/filters/BackofficeFilterAction.js";
|
|
34
|
+
import { EntityFilterValue as R, EntityFilterValueText as z } from "./components/backoffice/filters/EntityFilterValue.js";
|
|
35
|
+
import { BackofficeHubTemplate as B } from "./components/backoffice/hub/BackofficeHubTemplate.js";
|
|
36
|
+
import { BackofficeLink as V } from "./components/backoffice/links/BackofficeLink.js";
|
|
37
|
+
import { BackofficeLinkLabel as H } from "./components/backoffice/links/BackofficeLinkLabel.js";
|
|
38
|
+
import { BackofficeRightPageLayout as U } from "./components/backoffice/layout/breadcrumb/BackofficeRightPageLayout.js";
|
|
39
|
+
import { BackofficeOverviewLayout as W } from "./components/backoffice/overview/BackofficeOverviewLayout.js";
|
|
40
|
+
import { BackofficeFilterableCell as G } from "./components/backoffice/shared/BackofficeFilterableCell.js";
|
|
41
|
+
import { BackofficeEntityLink as K } from "./components/backoffice/refs/BackofficeEntityLink.js";
|
|
42
|
+
import { BackofficeLazyEntityCount as q } from "./components/backoffice/refs/BackofficeLazyEntityCount.js";
|
|
43
|
+
import { BackofficeRelatedCountLink as J } from "./components/backoffice/refs/BackofficeRelatedCountLink.js";
|
|
44
|
+
import { BackofficeTabbedDetailShell as Y } from "./components/backoffice/scaffolds/BackofficeTabbedDetailShell.js";
|
|
45
|
+
import { BackofficeFormattedCurrency as X } from "./components/backoffice/shared/BackofficeFormattedCurrency.js";
|
|
46
|
+
import { BackofficeFormattedNumber as Z } from "./components/backoffice/shared/BackofficeFormattedNumber.js";
|
|
47
|
+
import { BackofficeInlineFilterRow as Q } from "./components/backoffice/shared/BackofficeInlineFilterRow.js";
|
|
48
|
+
import { BackofficeToolsDocPanel as $ } from "./components/backoffice/tools/BackofficeToolsDocPanel.js";
|
|
49
|
+
import { BackofficeToolsErrorFallback as ee } from "./components/backoffice/tools/BackofficeToolsErrorFallback.js";
|
|
50
|
+
import { BackofficeToolsJsonForm as te } from "./components/backoffice/tools/BackofficeToolsJsonForm.js";
|
|
51
|
+
import { BackofficeToolsQueryBoundary as ne } from "./components/backoffice/tools/BackofficeToolsQueryBoundary.js";
|
|
52
|
+
import { parseToolJson as re } from "./components/backoffice/tools/parseToolJson.js";
|
|
53
|
+
import { configureRelayEnvironment as ie, getEnvironment as ae, getNetwork as oe, getRelayOperationActivitySnapshot as se, getRelayTransportSnapshot as ce, reconnectRelayWebSocket as le, refreshRelayWebSocketAuthentication as ue, resetRelayStore as de, subscribeRelayOperationActivity as fe, subscribeRelayTransport as pe } from "./relay/environment.js";
|
|
54
|
+
import { base64UrlToBuffer as me, bufferToBase64Url as he, mapWebAuthnRegistrationError as ge, parseSignCount as _e } from "./modules/webauthn.js";
|
|
55
|
+
import { createUseAuth as ve } from "./hooks/useAuth.js";
|
|
56
|
+
import { useBackofficeListUrlState as ye } from "./hooks/useBackofficeListUrlState.js";
|
|
57
|
+
import { useConditionalSubscription as be } from "./hooks/useConditionalSubscription.js";
|
|
58
|
+
import xe from "./hooks/useCopyToClipboard.js";
|
|
59
|
+
import Se from "./hooks/useInfiniteConnection.js";
|
|
60
|
+
import { useRefetchNeededReload as Ce } from "./hooks/useRefetchNeededReload.js";
|
|
61
|
+
import { createI18nInstance as we } from "./i18n/createI18nInstance.js";
|
|
62
|
+
import { backofficeReactI18nResources as Te, withBackofficeReactI18nResources as Ee } from "./i18n/resources.js";
|
|
63
|
+
import { useReviewStatusLabel as De } from "./i18n/useReviewStatusLabel.js";
|
|
64
|
+
import { BackofficeProvider as Oe } from "./provider/BackofficeProvider.js";
|
|
65
|
+
import { createBackofficeLazyValue as ke } from "./provider/lazyValue.js";
|
|
66
|
+
import { decodeBase64ToUtf8 as Ae, encodeUtf8ToBase64 as je } from "./modules/base64.js";
|
|
67
|
+
import { formatFileSize as Me } from "./modules/formatFileSize.js";
|
|
68
|
+
import { uploadFilesSequentially as Ne } from "./modules/uploads.js";
|
|
69
|
+
import { resolveVisibleDetailPages as Pe } from "./pages/detail/pageResolution.js";
|
|
70
|
+
import { createInlineDataReader as Fe } from "./relay/createInlineReader.js";
|
|
71
|
+
import { appendNodeToConnections as Ie } from "./relay/connectionUtils.js";
|
|
72
|
+
import { RelayProvider as Le } from "./relay/RelayProvider.js";
|
|
73
|
+
import { useRelayOperationActivity as Re } from "./relay/useRelayOperationActivity.js";
|
|
74
|
+
import { configureBackofficeShortAccessTokenRelayEnvironment as ze, configureShortAccessTokenRelayEnvironment as Be } from "./relay/shortAccessTokenEnvironment.js";
|
|
75
|
+
import { useMutationAction as Ve } from "./relay/useMutationAction.js";
|
|
76
|
+
import { identityView as He } from "./relay/identityView.js";
|
|
77
|
+
import { useCursorResumableSubscription as Ue } from "./subscriptions/useCursorResumableSubscription.js";
|
|
78
|
+
export { s as AcceptInvitationScreen, e as AuthRefreshNotice, y as BackofficeBillingUsageChart, T as BackofficeDetailBadgeRow, K as BackofficeEntityLink, D as BackofficeEntitySummaryHeader, O as BackofficeEnumLabel, _ as BackofficeErrorBoundary, L as BackofficeFilterAction, G as BackofficeFilterableCell, X as BackofficeFormattedCurrency, Z as BackofficeFormattedNumber, B as BackofficeHubTemplate, Q as BackofficeInlineFilterRow, C as BackofficeInlineLink, q as BackofficeLazyEntityCount, k as BackofficeLifecycleTimelineSection, V as BackofficeLink, H as BackofficeLinkLabel, W as BackofficeOverviewLayout, Oe as BackofficeProvider, A as BackofficeReferenceValue, J as BackofficeRelatedCountLink, j as BackofficeRelationGrid, j as BackofficeRelationsSummaryGrid, U as BackofficeRightPageLayout, M as BackofficeStatusGroup, E as BackofficeStatusMetaBadge, Y as BackofficeTabbedDetailShell, N as BackofficeTokenUsageBreakdown, $ as BackofficeToolsDocPanel, ee as BackofficeToolsErrorFallback, te as BackofficeToolsJsonForm, ne as BackofficeToolsQueryBoundary, P as BackofficeUsageCostBreakdown, R as EntityFilterValue, z as EntityFilterValueText, g as EntityIdFilterField, v as EntityIdPickerDialog, a as LoginFlow, c as PasswordResetCompleteScreen, l as PasswordResetRequestScreen, Le as RelayProvider, n as TotpQrCode, u as VerifyEmailScreen, Ie as appendNodeToConnections, Te as backofficeReactI18nResources, me as base64UrlToBuffer, he as bufferToBase64Url, w as buildDataTableColumns, r as buildTotpOtpAuthUri, ze as configureBackofficeShortAccessTokenRelayEnvironment, ie as configureRelayEnvironment, Be as configureShortAccessTokenRelayEnvironment, i as createBackofficeAuthHeaders, F as createBackofficeEntityLinkProps, ke as createBackofficeLazyValue, we as createI18nInstance, Fe as createInlineDataReader, ve as createUseAuth, Ae as decodeBase64ToUtf8, je as encodeUtf8ToBase64, Me as formatFileSize, I as formatListAsMarkdown, ae as getEnvironment, oe as getNetwork, se as getRelayOperationActivitySnapshot, ce as getRelayTransportSnapshot, He as identityView, ge as mapWebAuthnRegistrationError, _e as parseSignCount, re as parseToolJson, le as reconnectRelayWebSocket, ue as refreshRelayWebSocketAuthentication, d as requireField, f as requireLinkedRecordId, de as resetRelayStore, p as resolveAgentStartOutcome, x as resolveBackofficeLink, b as resolveBackofficeTargetIcon, m as resolveMutationOutcome, Pe as resolveVisibleDetailPages, fe as subscribeRelayOperationActivity, pe as subscribeRelayTransport, o as synchronizeAuthStatusQuery, Ne as uploadFilesSequentially, t as useAuthRefreshStateSnapshot, h as useBackofficeConfig, S as useBackofficeLink, ye as useBackofficeListUrlState, be as useConditionalSubscription, xe as useCopyToClipboard, Ue as useCursorResumableSubscription, Se as useInfiniteConnection, Ve as useMutationAction, Ce as useRefetchNeededReload, Re as useRelayOperationActivity, De as useReviewStatusLabel, Ee as withBackofficeReactI18nResources };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { getBackofficeLoginPath as e } from "../router/backofficeAuthPaths.js";
|
|
2
|
+
import { AcceptInvitationScreen as t } from "../auth/pages/AcceptInvitationScreen.js";
|
|
3
|
+
import { useBackofficeConfig as n } from "../provider/BackofficeConfigContext.js";
|
|
4
|
+
import { useBackofficeAuth as r } from "../hooks/useBackofficeAuth.js";
|
|
5
5
|
import { useCallback as i, useContext as a } from "react";
|
|
6
6
|
import { jsx as o } from "react/jsx-runtime";
|
|
7
7
|
import s from "@plumile/router/routing/RoutingContext.js";
|
|
8
8
|
//#region src/pages/BackofficeAcceptInvitationPage.tsx
|
|
9
9
|
var c = () => {
|
|
10
|
-
let c = a(s), { basePath: l } =
|
|
10
|
+
let c = a(s), { basePath: l } = n(), u = r(), d = i(() => {
|
|
11
11
|
c?.history.push({ pathname: l });
|
|
12
12
|
}, [l, c?.history]), f = i(() => {
|
|
13
|
-
c?.history.push({ pathname:
|
|
13
|
+
c?.history.push({ pathname: e(l) });
|
|
14
14
|
}, [l, c?.history]);
|
|
15
|
-
return /* @__PURE__ */ o(
|
|
15
|
+
return /* @__PURE__ */ o(t, {
|
|
16
16
|
auth: u,
|
|
17
17
|
onSuccessRedirect: d,
|
|
18
18
|
onBackToLogin: f
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useBackofficeReactTranslation as e } from "../i18n/useBackofficeReactTranslation.js";
|
|
2
2
|
import { useBackofficeConfig as t } from "../provider/BackofficeConfigContext.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useBackofficeRuntimeFragment as n } from "../relay/typedRelayHooks.js";
|
|
4
4
|
import { BackofficeDetailBadgeRow as r } from "../components/backoffice/detail/BackofficeDetailBadgeRow.js";
|
|
5
5
|
import { BackofficeRightPageLayout as i } from "../components/backoffice/layout/breadcrumb/BackofficeRightPageLayout.js";
|
|
6
6
|
import { buildEntityDetailBreadcrumb as a } from "../components/backoffice/layout/breadcrumb/buildBreadcrumbs.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeEntityDetailLayoutPage.js","names":[],"sources":["../../../src/pages/BackofficeEntityDetailLayoutPage.tsx"],"sourcesContent":["import { Suspense, type JSX, type ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport * as ReactRelay from 'react-relay';\nimport Link from '@plumile/router/routing/Link.js';\nimport useLocation from '@plumile/router/routing/useLocation.js';\n\nimport { BACKOFFICE_DATE_TIME_OPTIONS } from '@plumile/backoffice-core/constants.js';\nimport { setWhereValue } from '@plumile/backoffice-core/filters/where.js';\nimport type {\n BackofficeEntityManifestItem,\n BackofficePreparedDetailLayoutDataRoute,\n BackofficeResolvedDetailLayoutFacetConfig,\n} from '@plumile/backoffice-core/types.js';\nimport { FormattedDate } from '@plumile/ui/atomic/atoms/formatted-date/FormattedDate.js';\nimport { Tabs } from '@plumile/ui/atomic/molecules/tabs/Tabs.js';\nimport { Tag } from '@plumile/ui/backoffice/atoms/tag/Tag.js';\nimport { BackofficeKeyValueList } from '@plumile/ui/backoffice/molecules/backoffice_key_value_list/BackofficeKeyValueList.js';\nimport { BackofficePageHeader } from '@plumile/ui/backoffice/molecules/backoffice_page_header/BackofficePageHeader.js';\nimport {\n BackofficeRelationsMenu,\n type BackofficeRelationsMenuItem,\n} from '@plumile/ui/backoffice/molecules/backoffice_relations_menu/BackofficeRelationsMenu.js';\nimport { Spinner } from '@plumile/ui/backoffice/atoms/spinner/Spinner.js';\nimport { DetailPageTemplate } from '@plumile/ui/backoffice/templates/detail_page_template/DetailPageTemplate.js';\n\nimport { BackofficeDetailBadgeRow } from '../components/backoffice/detail/BackofficeDetailBadgeRow.js';\nimport { BackofficeLazyEntityCount } from '../components/backoffice/refs/BackofficeLazyEntityCount.js';\nimport { BackofficeEntityDetailNotFound } from '../components/backoffice/scaffolds/BackofficeEntityDetailNotFound.js';\nimport { BackofficeRightPageLayout } from '../components/backoffice/layout/breadcrumb/BackofficeRightPageLayout.js';\nimport { buildEntityDetailBreadcrumb } from '../components/backoffice/layout/breadcrumb/buildBreadcrumbs.js';\nimport { useBackofficeReactTranslation } from '../i18n/useBackofficeReactTranslation.js';\nimport { useBackofficeConfig } from '../provider/BackofficeConfigContext.js';\nimport { useBackofficeFragment } from '../relay/typedRelayHooks.js';\nimport * as pageStyles from './backofficeEntityDetailPage.css.js';\nimport {\n resolveLabel,\n resolveRelationValue,\n} from './BackofficeEntityDetailPage.helpers.js';\nimport { resolveHeaderItems } from './BackofficeEntityDetailPage.view-helpers.js';\nimport { BackofficeEntityDetailLayoutContextProvider } from './detail/BackofficeEntityDetailLayoutContext.js';\nimport { buildTabsItems } from './detail/buildTabsItems.js';\nimport { resolveVisibleDetailPages } from './detail/pageResolution.js';\nimport { BackofficeRedirect } from './BackofficeRedirect.js';\n\nconst { usePreloadedQuery } = ReactRelay;\n\nconst normalizePath = (value: string): string => {\n return value.trim().replace(/^\\/+|\\/+$/g, '');\n};\n\nconst resolveActivePagePath = (\n pathname: string,\n id: string,\n config: BackofficeResolvedDetailLayoutFacetConfig,\n): string => {\n const pages = [config.pages.mainPage, ...(config.pages.subPages ?? [])];\n const activePage = pages.find((page) => {\n return pathname === config.routes.detailPage(id, page.id);\n });\n return activePage?.path ?? '';\n};\n\nconst RelationCountLoading = (): JSX.Element => {\n return (\n <span className={pageStyles.relationCountLoading}>\n <Spinner size={12} />\n </span>\n );\n};\n\nconst DetailPageContentLoading = (): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n return (\n <div role=\"status\" aria-live=\"polite\" aria-busy=\"true\">\n <Spinner size={20} ariaLabel={t('common.loading')} />\n </div>\n );\n};\n\nexport type BackofficeEntityDetailLayoutPageProps = {\n entityManifest: BackofficeEntityManifestItem;\n config: BackofficeResolvedDetailLayoutFacetConfig;\n prepared: BackofficePreparedDetailLayoutDataRoute;\n children?: ReactNode;\n};\n\ntype BackofficeEntityDetailLayoutPageContentProps = {\n config: BackofficeResolvedDetailLayoutFacetConfig;\n prepared: BackofficePreparedDetailLayoutDataRoute;\n layoutNodeRef: unknown;\n children?: ReactNode;\n};\n\nconst BackofficeEntityDetailLayoutPageContent = ({\n config,\n prepared,\n layoutNodeRef,\n children,\n}: BackofficeEntityDetailLayoutPageContentProps): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const { entities } = useBackofficeConfig();\n const { pathname } = useLocation();\n const layoutNode = useBackofficeFragment<unknown, unknown>(\n config.layoutPage.fragment,\n layoutNodeRef,\n );\n\n const layoutView = config.layoutPage.toView(layoutNode);\n const activePagePath = resolveActivePagePath(pathname, prepared.id, config);\n const resolvedPages = resolveVisibleDetailPages({\n mainPage: config.pages.mainPage,\n subPages: config.pages.subPages,\n activePagePath,\n node: layoutView,\n });\n\n if (!resolvedPages.hasVisiblePages || resolvedPages.activePage == null) {\n return <BackofficeRedirect to={config.routes.list} />;\n }\n\n const { activePage } = resolvedPages;\n if (\n activePagePath !== '' &&\n normalizePath(activePage.path) !== normalizePath(activePagePath)\n ) {\n return (\n <BackofficeRedirect\n to={config.routes.detailPage(prepared.id, activePage.id)}\n />\n );\n }\n\n const tabsItems = buildTabsItems({\n pages: resolvedPages.pages,\n id: prepared.id,\n tApp,\n detailPageHref: config.routes.detailPage,\n });\n const resolveEntityHref = (entityId: string, refId: string) => {\n const entityConfig = entities[entityId];\n if (entityConfig == null) {\n return null;\n }\n return entityConfig.routes.detail(refId);\n };\n const header = resolveHeaderItems(config.header, layoutView, {\n tApp,\n t,\n resolveEntityHref,\n renderLink: (href, label) => {\n return (\n <Link to={href} preloadOnHover=\"code-and-data\">\n {label}\n </Link>\n );\n },\n renderDate: (value, fallback) => {\n return (\n <FormattedDate\n value={value}\n options={BACKOFFICE_DATE_TIME_OPTIONS}\n fallback={fallback}\n />\n );\n },\n renderTag: (tone, label) => {\n return <Tag tone={tone}>{label}</Tag>;\n },\n renderBadgeRow: (items) => {\n return <BackofficeDetailBadgeRow items={items} />;\n },\n });\n const relationMenuItems: BackofficeRelationsMenuItem[] = (\n config.relations ?? []\n ).flatMap((relation) => {\n const { path, target, whereKey } = relation;\n const value = resolveRelationValue(relation.value(layoutView));\n if (value == null) {\n return [];\n }\n\n const entityManifest = entities[target];\n if (entityManifest?.hasList !== true) {\n return [];\n }\n\n const where = setWhereValue(null, whereKey, value, path);\n if (where == null) {\n return [];\n }\n\n const encoded = entityManifest.listNavigation.encode({ where });\n\n return [\n {\n id: relation.id,\n label: resolveLabel(relation.label, tApp),\n count: (\n <BackofficeLazyEntityCount\n entity={target}\n loadingFallback={<RelationCountLoading />}\n where={where}\n />\n ),\n destination: {\n pathname: entityManifest.routes.list,\n filters: encoded.filters,\n query: encoded.query,\n },\n },\n ];\n });\n const breadcrumb = buildEntityDetailBreadcrumb({\n config,\n tApp,\n entityId: prepared.id,\n layoutView,\n pageLabel: activePage.label(tApp),\n pageId: activePage.id,\n });\n let headerMetaNode: JSX.Element | undefined;\n if (header.status != null || header.badges != null) {\n headerMetaNode = (\n <div className={pageStyles.headerMeta}>\n {header.status}\n {header.badges}\n </div>\n );\n }\n let headerItemsNode: JSX.Element | null = null;\n if (header.items != null && header.items.length > 0) {\n headerItemsNode = (\n <div className={pageStyles.headerMetaList}>\n <BackofficeKeyValueList items={header.items} />\n </div>\n );\n }\n let headerActionsNode: JSX.Element | undefined;\n if (relationMenuItems.length > 0) {\n headerActionsNode = (\n <div className={pageStyles.headerRelationGroup}>\n <BackofficeRelationsMenu\n label={t('relations.menu.label')}\n items={relationMenuItems}\n />\n </div>\n );\n }\n\n const headerNode = (\n <div className={pageStyles.headerBlock}>\n <BackofficePageHeader\n title={header.title}\n subtitle={header.subtitle}\n meta={headerMetaNode}\n actions={headerActionsNode}\n />\n {headerItemsNode}\n </div>\n );\n let tabsNode: JSX.Element | null = null;\n if (resolvedPages.pages.length > 1) {\n tabsNode = (\n <Tabs items={tabsItems} activeId={activePage.id} variant=\"underline\" />\n );\n }\n\n return (\n <BackofficeEntityDetailLayoutContextProvider\n value={{\n activePage,\n config,\n entityId: prepared.id,\n layoutView,\n tabsItems,\n visiblePages: resolvedPages.pages,\n }}\n >\n <BackofficeRightPageLayout breadcrumb={breadcrumb}>\n <DetailPageTemplate\n headerNode={headerNode}\n tabsNode={tabsNode}\n headerDensity=\"compact\"\n >\n <Suspense fallback={<DetailPageContentLoading />}>\n {children}\n </Suspense>\n </DetailPageTemplate>\n </BackofficeRightPageLayout>\n </BackofficeEntityDetailLayoutContextProvider>\n );\n};\n\nexport const BackofficeEntityDetailLayoutPage = ({\n config,\n prepared,\n children,\n}: BackofficeEntityDetailLayoutPageProps): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const layoutQueryData = usePreloadedQuery(\n config.layoutPage.query,\n prepared.layoutQuery,\n );\n const layoutNodeRef = config.layoutPage.resolveNode(layoutQueryData, {\n id: prepared.id,\n });\n\n if (layoutNodeRef == null) {\n return (\n <BackofficeRightPageLayout\n breadcrumb={[\n {\n kind: 'link',\n target: {\n kind: 'entity-list',\n entityId: config.id,\n },\n label: config.label(tApp),\n },\n {\n kind: 'current',\n target: {\n kind: 'entity-detail',\n entityId: config.id,\n id: prepared.id,\n },\n label: t('detail.notFound'),\n },\n ]}\n >\n <BackofficeEntityDetailNotFound listHref={config.routes.list} />\n </BackofficeRightPageLayout>\n );\n }\n\n return (\n <BackofficeEntityDetailLayoutPageContent\n config={config}\n prepared={prepared}\n layoutNodeRef={layoutNodeRef}\n >\n {children}\n </BackofficeEntityDetailLayoutPageContent>\n );\n};\n\nexport default BackofficeEntityDetailLayoutPage;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,IAAM,EAAE,mBAAA,MAAsB,GAExB,KAAiB,MACd,EAAM,KAAK,CAAC,CAAC,QAAQ,cAAc,EAAE,GAGxC,KACJ,GACA,GACA,MAGmB,CADJ,EAAO,MAAM,UAAU,GAAI,EAAO,MAAM,YAAY,CAAC,CACjD,CAAA,CAAM,MAAM,MACtB,MAAa,EAAO,OAAO,WAAW,GAAI,EAAK,EAAE,CAEnD,CAAA,EAAY,QAAQ,IAGvB,UAEF,kBAAC,QAAD;CAAM,WAAW;CACf,UAAA,kBAAC,GAAD,EAAS,MAAM,GAAK,CAAA;AAChB,CAAA,GAIJ,UAA8C;CAClD,IAAM,EAAE,MAAM,EAA8B;CAC5C,OACE,kBAAC,OAAD;EAAK,MAAK;EAAS,aAAU;EAAS,aAAU;EAC9C,UAAA,kBAAC,GAAD;GAAS,MAAM;GAAI,WAAW,EAAE,gBAAgB;EAAI,CAAA;C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"sources":["../../../src/pages/BackofficeEntityDetailLayoutPage.tsx"],"sourcesContent":["import { Suspense, type JSX, type ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\nimport * as ReactRelay from 'react-relay';\nimport Link from '@plumile/router/routing/Link.js';\nimport useLocation from '@plumile/router/routing/useLocation.js';\n\nimport { BACKOFFICE_DATE_TIME_OPTIONS } from '@plumile/backoffice-core/constants.js';\nimport { setWhereValue } from '@plumile/backoffice-core/filters/where.js';\nimport type {\n BackofficeEntityManifestItem,\n BackofficePreparedDetailLayoutDataRoute,\n BackofficeResolvedDetailLayoutFacetConfig,\n} from '@plumile/backoffice-core/types.js';\nimport { FormattedDate } from '@plumile/ui/atomic/atoms/formatted-date/FormattedDate.js';\nimport { Tabs } from '@plumile/ui/atomic/molecules/tabs/Tabs.js';\nimport { Tag } from '@plumile/ui/backoffice/atoms/tag/Tag.js';\nimport { BackofficeKeyValueList } from '@plumile/ui/backoffice/molecules/backoffice_key_value_list/BackofficeKeyValueList.js';\nimport { BackofficePageHeader } from '@plumile/ui/backoffice/molecules/backoffice_page_header/BackofficePageHeader.js';\nimport {\n BackofficeRelationsMenu,\n type BackofficeRelationsMenuItem,\n} from '@plumile/ui/backoffice/molecules/backoffice_relations_menu/BackofficeRelationsMenu.js';\nimport { Spinner } from '@plumile/ui/backoffice/atoms/spinner/Spinner.js';\nimport { DetailPageTemplate } from '@plumile/ui/backoffice/templates/detail_page_template/DetailPageTemplate.js';\n\nimport { BackofficeDetailBadgeRow } from '../components/backoffice/detail/BackofficeDetailBadgeRow.js';\nimport { BackofficeLazyEntityCount } from '../components/backoffice/refs/BackofficeLazyEntityCount.js';\nimport { BackofficeEntityDetailNotFound } from '../components/backoffice/scaffolds/BackofficeEntityDetailNotFound.js';\nimport { BackofficeRightPageLayout } from '../components/backoffice/layout/breadcrumb/BackofficeRightPageLayout.js';\nimport { buildEntityDetailBreadcrumb } from '../components/backoffice/layout/breadcrumb/buildBreadcrumbs.js';\nimport { useBackofficeReactTranslation } from '../i18n/useBackofficeReactTranslation.js';\nimport { useBackofficeConfig } from '../provider/BackofficeConfigContext.js';\nimport { useBackofficeRuntimeFragment } from '../relay/typedRelayHooks.js';\nimport * as pageStyles from './backofficeEntityDetailPage.css.js';\nimport {\n resolveLabel,\n resolveRelationValue,\n} from './BackofficeEntityDetailPage.helpers.js';\nimport { resolveHeaderItems } from './BackofficeEntityDetailPage.view-helpers.js';\nimport { BackofficeEntityDetailLayoutContextProvider } from './detail/BackofficeEntityDetailLayoutContext.js';\nimport { buildTabsItems } from './detail/buildTabsItems.js';\nimport { resolveVisibleDetailPages } from './detail/pageResolution.js';\nimport { BackofficeRedirect } from './BackofficeRedirect.js';\n\nconst { usePreloadedQuery } = ReactRelay;\n\nconst normalizePath = (value: string): string => {\n return value.trim().replace(/^\\/+|\\/+$/g, '');\n};\n\nconst resolveActivePagePath = (\n pathname: string,\n id: string,\n config: BackofficeResolvedDetailLayoutFacetConfig,\n): string => {\n const pages = [config.pages.mainPage, ...(config.pages.subPages ?? [])];\n const activePage = pages.find((page) => {\n return pathname === config.routes.detailPage(id, page.id);\n });\n return activePage?.path ?? '';\n};\n\nconst RelationCountLoading = (): JSX.Element => {\n return (\n <span className={pageStyles.relationCountLoading}>\n <Spinner size={12} />\n </span>\n );\n};\n\nconst DetailPageContentLoading = (): JSX.Element => {\n const { t } = useBackofficeReactTranslation();\n return (\n <div role=\"status\" aria-live=\"polite\" aria-busy=\"true\">\n <Spinner size={20} ariaLabel={t('common.loading')} />\n </div>\n );\n};\n\nexport type BackofficeEntityDetailLayoutPageProps = {\n entityManifest: BackofficeEntityManifestItem;\n config: BackofficeResolvedDetailLayoutFacetConfig;\n prepared: BackofficePreparedDetailLayoutDataRoute;\n children?: ReactNode;\n};\n\ntype BackofficeEntityDetailLayoutPageContentProps = {\n config: BackofficeResolvedDetailLayoutFacetConfig;\n prepared: BackofficePreparedDetailLayoutDataRoute;\n layoutNodeRef: unknown;\n children?: ReactNode;\n};\n\nconst BackofficeEntityDetailLayoutPageContent = ({\n config,\n prepared,\n layoutNodeRef,\n children,\n}: BackofficeEntityDetailLayoutPageContentProps): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const { entities } = useBackofficeConfig();\n const { pathname } = useLocation();\n const layoutNode = useBackofficeRuntimeFragment(\n config.layoutPage.fragment,\n layoutNodeRef,\n );\n\n const layoutView = config.layoutPage.toView(layoutNode);\n const activePagePath = resolveActivePagePath(pathname, prepared.id, config);\n const resolvedPages = resolveVisibleDetailPages({\n mainPage: config.pages.mainPage,\n subPages: config.pages.subPages,\n activePagePath,\n node: layoutView,\n });\n\n if (!resolvedPages.hasVisiblePages || resolvedPages.activePage == null) {\n return <BackofficeRedirect to={config.routes.list} />;\n }\n\n const { activePage } = resolvedPages;\n if (\n activePagePath !== '' &&\n normalizePath(activePage.path) !== normalizePath(activePagePath)\n ) {\n return (\n <BackofficeRedirect\n to={config.routes.detailPage(prepared.id, activePage.id)}\n />\n );\n }\n\n const tabsItems = buildTabsItems({\n pages: resolvedPages.pages,\n id: prepared.id,\n tApp,\n detailPageHref: config.routes.detailPage,\n });\n const resolveEntityHref = (entityId: string, refId: string) => {\n const entityConfig = entities[entityId];\n if (entityConfig == null) {\n return null;\n }\n return entityConfig.routes.detail(refId);\n };\n const header = resolveHeaderItems(config.header, layoutView, {\n tApp,\n t,\n resolveEntityHref,\n renderLink: (href, label) => {\n return (\n <Link to={href} preloadOnHover=\"code-and-data\">\n {label}\n </Link>\n );\n },\n renderDate: (value, fallback) => {\n return (\n <FormattedDate\n value={value}\n options={BACKOFFICE_DATE_TIME_OPTIONS}\n fallback={fallback}\n />\n );\n },\n renderTag: (tone, label) => {\n return <Tag tone={tone}>{label}</Tag>;\n },\n renderBadgeRow: (items) => {\n return <BackofficeDetailBadgeRow items={items} />;\n },\n });\n const relationMenuItems: BackofficeRelationsMenuItem[] = (\n config.relations ?? []\n ).flatMap((relation) => {\n const { path, target, whereKey } = relation;\n const value = resolveRelationValue(relation.value(layoutView));\n if (value == null) {\n return [];\n }\n\n const entityManifest = entities[target];\n if (entityManifest?.hasList !== true) {\n return [];\n }\n\n const where = setWhereValue(null, whereKey, value, path);\n if (where == null) {\n return [];\n }\n\n const encoded = entityManifest.listNavigation.encode({ where });\n\n return [\n {\n id: relation.id,\n label: resolveLabel(relation.label, tApp),\n count: (\n <BackofficeLazyEntityCount\n entity={target}\n loadingFallback={<RelationCountLoading />}\n where={where}\n />\n ),\n destination: {\n pathname: entityManifest.routes.list,\n filters: encoded.filters,\n query: encoded.query,\n },\n },\n ];\n });\n const breadcrumb = buildEntityDetailBreadcrumb({\n config,\n tApp,\n entityId: prepared.id,\n layoutView,\n pageLabel: activePage.label(tApp),\n pageId: activePage.id,\n });\n let headerMetaNode: JSX.Element | undefined;\n if (header.status != null || header.badges != null) {\n headerMetaNode = (\n <div className={pageStyles.headerMeta}>\n {header.status}\n {header.badges}\n </div>\n );\n }\n let headerItemsNode: JSX.Element | null = null;\n if (header.items != null && header.items.length > 0) {\n headerItemsNode = (\n <div className={pageStyles.headerMetaList}>\n <BackofficeKeyValueList items={header.items} />\n </div>\n );\n }\n let headerActionsNode: JSX.Element | undefined;\n if (relationMenuItems.length > 0) {\n headerActionsNode = (\n <div className={pageStyles.headerRelationGroup}>\n <BackofficeRelationsMenu\n label={t('relations.menu.label')}\n items={relationMenuItems}\n />\n </div>\n );\n }\n\n const headerNode = (\n <div className={pageStyles.headerBlock}>\n <BackofficePageHeader\n title={header.title}\n subtitle={header.subtitle}\n meta={headerMetaNode}\n actions={headerActionsNode}\n />\n {headerItemsNode}\n </div>\n );\n let tabsNode: JSX.Element | null = null;\n if (resolvedPages.pages.length > 1) {\n tabsNode = (\n <Tabs items={tabsItems} activeId={activePage.id} variant=\"underline\" />\n );\n }\n\n return (\n <BackofficeEntityDetailLayoutContextProvider\n value={{\n activePage,\n config,\n entityId: prepared.id,\n layoutView,\n tabsItems,\n visiblePages: resolvedPages.pages,\n }}\n >\n <BackofficeRightPageLayout breadcrumb={breadcrumb}>\n <DetailPageTemplate\n headerNode={headerNode}\n tabsNode={tabsNode}\n headerDensity=\"compact\"\n >\n <Suspense fallback={<DetailPageContentLoading />}>\n {children}\n </Suspense>\n </DetailPageTemplate>\n </BackofficeRightPageLayout>\n </BackofficeEntityDetailLayoutContextProvider>\n );\n};\n\nexport const BackofficeEntityDetailLayoutPage = ({\n config,\n prepared,\n children,\n}: BackofficeEntityDetailLayoutPageProps): JSX.Element => {\n const { t: tApp } = useTranslation();\n const { t } = useBackofficeReactTranslation();\n const layoutQueryData = usePreloadedQuery(\n config.layoutPage.query,\n prepared.layoutQuery,\n );\n const layoutNodeRef = config.layoutPage.resolveNode(layoutQueryData, {\n id: prepared.id,\n });\n\n if (layoutNodeRef == null) {\n return (\n <BackofficeRightPageLayout\n breadcrumb={[\n {\n kind: 'link',\n target: {\n kind: 'entity-list',\n entityId: config.id,\n },\n label: config.label(tApp),\n },\n {\n kind: 'current',\n target: {\n kind: 'entity-detail',\n entityId: config.id,\n id: prepared.id,\n },\n label: t('detail.notFound'),\n },\n ]}\n >\n <BackofficeEntityDetailNotFound listHref={config.routes.list} />\n </BackofficeRightPageLayout>\n );\n }\n\n return (\n <BackofficeEntityDetailLayoutPageContent\n config={config}\n prepared={prepared}\n layoutNodeRef={layoutNodeRef}\n >\n {children}\n </BackofficeEntityDetailLayoutPageContent>\n );\n};\n\nexport default BackofficeEntityDetailLayoutPage;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,IAAM,EAAE,mBAAA,MAAsB,GAExB,KAAiB,MACd,EAAM,KAAK,CAAC,CAAC,QAAQ,cAAc,EAAE,GAGxC,KACJ,GACA,GACA,MAGmB,CADJ,EAAO,MAAM,UAAU,GAAI,EAAO,MAAM,YAAY,CAAC,CACjD,CAAA,CAAM,MAAM,MACtB,MAAa,EAAO,OAAO,WAAW,GAAI,EAAK,EAAE,CAEnD,CAAA,EAAY,QAAQ,IAGvB,UAE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MAAM;IACN,UAAU,EAAO;IACjB,IAAI,EAAS;GACf;GACA,OAAO,EAAE,iBAAiB;EAC5B,CACF;EAEA,UAAA,kBAAC,GAAD,EAAgC,UAAU,EAAO,OAAO,KAAO,CAAA;CACtC,CAAA,IAK7B,kBAAC,GAAD;EACU;EACE;EACK;EAEd;CACsC,CAAA;AAE7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackofficeEntityDetailPage.helpers.js","names":[],"sources":["../../../src/pages/BackofficeEntityDetailPage.helpers.ts"],"sourcesContent":["import type {\n BackofficeBadgeTone,\n BackofficeEntityActionSpec,\n
|
|
1
|
+
{"version":3,"file":"BackofficeEntityDetailPage.helpers.js","names":[],"sources":["../../../src/pages/BackofficeEntityDetailPage.helpers.ts"],"sourcesContent":["import type {\n BackofficeBadgeTone,\n BackofficeEntityActionSpec,\n BackofficeRuntimeEntityFormMutationActionSpec,\n BackofficeRuntimeEntityMutationActionSpec,\n BackofficeEntityRouteActionSpec,\n BackofficeValueLabel,\n I18nLabel,\n} from '@plumile/backoffice-core/types.js';\nimport type { MutationPayloadBase } from '../relay/mutationResult.js';\nimport type { TFunction } from 'i18next';\n\nexport const resolveLabel = (label: I18nLabel, tApp: TFunction): string => {\n return label(tApp);\n};\n\nexport const isPlainObject = (\n value: unknown,\n): value is Record<string, unknown> => {\n return typeof value === 'object' && value != null && !Array.isArray(value);\n};\n\nexport const extractMutationPayload = (\n response: unknown,\n): MutationPayloadBase | null => {\n if (!isPlainObject(response)) {\n return null;\n }\n\n for (const value of Object.values(response)) {\n if (isPlainObject(value) && ('status' in value || 'result' in value)) {\n return value;\n }\n }\n\n return null;\n};\n\nexport const isRouteAction = <Node>(\n action: BackofficeEntityActionSpec<Node>,\n): action is BackofficeEntityRouteActionSpec<Node> => {\n return action.kind === 'route';\n};\n\nexport const isMutationAction = <Node>(\n action: BackofficeEntityActionSpec<Node>,\n): action is BackofficeRuntimeEntityMutationActionSpec<Node> => {\n return action.kind === 'mutation';\n};\n\nexport const isFormMutationAction = <Node>(\n action: BackofficeEntityActionSpec<Node>,\n): action is BackofficeRuntimeEntityFormMutationActionSpec<Node> => {\n return action.kind === 'formMutation';\n};\n\nexport const resolveValueLabel = (\n value: BackofficeValueLabel | null | undefined,\n tApp: TFunction,\n): string | number | null => {\n if (typeof value === 'function') {\n return value(tApp);\n }\n if (value == null) {\n return null;\n }\n return value;\n};\n\nexport const resolveRelationValue = (value: string | null): string | null => {\n if (value == null) {\n return null;\n }\n const trimmed = value.trim();\n if (trimmed === '') {\n return null;\n }\n return trimmed;\n};\n\nexport const isEmptyText = (\n value: string | number | null | undefined,\n): boolean => {\n if (value == null) {\n return true;\n }\n if (typeof value === 'string') {\n return value.trim() === '';\n }\n return false;\n};\n\nexport const resolveBadgeTone = <Node>(\n tone: BackofficeBadgeTone | ((node: Node) => BackofficeBadgeTone) | undefined,\n node: Node,\n): BackofficeBadgeTone | undefined => {\n if (typeof tone === 'function') {\n return tone(node);\n }\n return tone;\n};\n"],"mappings":";AAYA,IAAa,KAAgB,GAAkB,MACtC,EAAM,CAAI,GAGN,KACX,MAEO,OAAO,KAAU,cAAY,KAAiB,CAAC,MAAM,QAAQ,CAAK,GAG9D,KACX,MAC+B;CAC/B,IAAI,CAAC,EAAc,CAAQ,GACzB,OAAO;CAGT,KAAK,IAAM,KAAS,OAAO,OAAO,CAAQ,GACxC,IAAI,EAAc,CAAK,MAAM,YAAY,KAAS,YAAY,IAC5D,OAAO;CAIX,OAAO;AACT,GAEa,KACX,MAEO,EAAO,SAAS,SAGZ,KACX,MAEO,EAAO,SAAS,YAGZ,KACX,MAEO,EAAO,SAAS,gBAGZ,KACX,GACA,MAEI,OAAO,KAAU,aACZ,EAAM,CAAI,IAEf,KACK,MAKE,KAAwB,MAAwC;CAC3E,IAAI,KAAS,MACX,OAAO;CAET,IAAM,IAAU,EAAM,KAAK;CAI3B,OAHI,MAAY,KACP,OAEF;AACT,GAEa,KACX,MAEI,KAAS,QAGT,OAAO,KAAU,YACZ,EAAM,KAAK,MAAM,IAKf,KACX,GACA,MAEI,OAAO,KAAS,aACX,EAAK,CAAI,IAEX"}
|