@plumile/backoffice-react 0.1.198 → 0.1.199

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.
@@ -194,10 +194,12 @@ var c = (e, t, n) => {
194
194
  break;
195
195
  case "number": {
196
196
  let e = t.value(o), n = null;
197
- if (e != null) if (t.format === "currency") {
198
- let t = h(e);
199
- n = s("span", { title: g?.(e) ?? void 0 }, t);
200
- } else n = t.format === "percent" ? _(e) : m(e);
197
+ if (e != null) {
198
+ if (t.format === "currency") {
199
+ let t = h(e);
200
+ n = s("span", { title: g?.(e) ?? void 0 }, t);
201
+ } else n = t.format === "percent" ? _(e) : m(e);
202
+ }
201
203
  T.push({
202
204
  id: O,
203
205
  label: i(t.label, d),
@@ -1 +1 @@
1
- {"version":3,"file":"BackofficeEntityDetailPage.view-helpers.js","names":[],"sources":["../../../src/pages/BackofficeEntityDetailPage.view-helpers.ts"],"sourcesContent":["/* eslint-disable no-ternary */\nimport type {\n BackofficeBadgeItem,\n BackofficeColumnSpec,\n BackofficeDetailBlockSpec,\n BackofficeDetailFieldSpec,\n BackofficeDetailHeaderConfig,\n BackofficeDetailHeaderMetaSpec,\n BackofficeDetailHeaderStatusSpec,\n BackofficeFieldSize,\n BackofficeFlagVariant,\n BackofficeInlineValueSpec,\n BackofficePayloadFormat,\n BackofficeTone,\n BackofficeValueLabel,\n} from '@plumile/backoffice-core/types.js';\nimport type { DataTableColumn } from '@plumile/ui/components/data-table/DataTable.js';\nimport type { TFunction } from 'i18next';\nimport { Fragment, createElement, type ReactNode } from 'react';\n\nimport {\n isEmptyText,\n resolveLabel,\n resolveBadgeTone,\n resolveValueLabel,\n} from './BackofficeEntityDetailPage.helpers.js';\nimport {\n normalizeTechnicalIdentifier,\n TechnicalIdentifierValue,\n type TechnicalIdentifierVariant,\n} from '../components/backoffice/technical/TechnicalIdentifierValue.js';\n\nexport type ResolvedFieldItem = {\n id: string;\n label: string;\n size: BackofficeFieldSize;\n value: ReactNode;\n copyValue?: string;\n fullWidth?: boolean;\n};\n\nexport type ResolvedHeaderItem = {\n id: string;\n label: string;\n value: ReactNode;\n};\n\nexport type FlagIconName =\n | 'shield-lock'\n | 'shield-off'\n | 'settings-check'\n | 'settings-x'\n | 'x-badge'\n | 'chat-check'\n | 'key'\n | 'key-off'\n | 'lock'\n | 'lock-open'\n | 'robot-check'\n | 'robot-x'\n | 'rocket'\n | 'rocket-off';\n\nexport type ResolvedFlagTag = {\n tone: 'neutral' | 'info' | 'success' | 'warning' | 'danger';\n label: string;\n iconName?: FlagIconName;\n};\n\nexport const resolveFlagTag = (\n variant: BackofficeFlagVariant,\n value: boolean,\n t: TFunction,\n): ResolvedFlagTag => {\n switch (variant) {\n case 'yesNo':\n return value\n ? { tone: 'success', label: t('common.boolean.yes') }\n : { tone: 'neutral', label: t('common.boolean.no') };\n case 'capability':\n return value\n ? {\n tone: 'success',\n label: t('flags.capability.allowed'),\n iconName: 'shield-lock',\n }\n : {\n tone: 'neutral',\n label: t('flags.capability.denied'),\n iconName: 'shield-off',\n };\n case 'enabled':\n return value\n ? {\n tone: 'success',\n label: t('flags.enabled.enabled'),\n iconName: 'settings-check',\n }\n : {\n tone: 'neutral',\n label: t('flags.enabled.disabled'),\n iconName: 'settings-x',\n };\n case 'failure':\n return value\n ? {\n tone: 'danger',\n label: t('flags.failure.failed'),\n iconName: 'x-badge',\n }\n : {\n tone: 'success',\n label: t('flags.failure.ok'),\n iconName: 'chat-check',\n };\n case 'encrypted':\n return value\n ? {\n tone: 'info',\n label: t('flags.encrypted.encrypted'),\n iconName: 'key',\n }\n : {\n tone: 'neutral',\n label: t('flags.encrypted.notEncrypted'),\n iconName: 'key-off',\n };\n case 'locked':\n return value\n ? {\n tone: 'warning',\n label: t('flags.locked.locked'),\n iconName: 'lock',\n }\n : {\n tone: 'success',\n label: t('flags.locked.unlocked'),\n iconName: 'lock-open',\n };\n case 'default':\n return value\n ? { tone: 'info', label: t('flags.default.default') }\n : { tone: 'neutral', label: t('flags.default.notDefault') };\n case 'agentManaged':\n return value\n ? {\n tone: 'info',\n label: t('flags.agentManaged.agentManaged'),\n iconName: 'robot-check',\n }\n : {\n tone: 'neutral',\n label: t('flags.agentManaged.userManaged'),\n iconName: 'robot-x',\n };\n case 'deployedProduction':\n return value\n ? {\n tone: 'success',\n label: t('flags.deployedProduction.deployed'),\n iconName: 'rocket',\n }\n : {\n tone: 'neutral',\n label: t('flags.deployedProduction.notDeployed'),\n iconName: 'rocket-off',\n };\n case 'forced':\n return value\n ? { tone: 'warning', label: t('flags.forced.forced') }\n : { tone: 'neutral', label: t('flags.forced.normal') };\n default:\n throw new Error(`Unsupported flag variant: ${String(variant)}`);\n }\n};\n\nexport const resolveInlineValue = (\n value: BackofficeInlineValueSpec,\n options: {\n tApp: TFunction;\n t: TFunction;\n resolveEntityHref?: (entityId: string, refId: string) => string | null;\n renderLink: (href: string, label: ReactNode) => ReactNode;\n },\n): ReactNode => {\n const { tApp, t, resolveEntityHref, renderLink } = options;\n const fallback = t('common.notAvailable');\n\n if (value.type === 'text') {\n const resolved = resolveValueLabel(value.value, tApp);\n return isEmptyText(resolved) ? fallback : resolved;\n }\n\n if (value.type === 'entityRef') {\n const { id } = value;\n if (id == null || id.trim() === '') {\n return fallback;\n }\n const resolvedLabel = resolveValueLabel(value.label, tApp);\n const label =\n resolvedLabel != null && String(resolvedLabel).trim() !== ''\n ? resolvedLabel\n : null;\n if (label == null) {\n return fallback;\n }\n const href = resolveEntityHref?.(value.entity, id) ?? null;\n return href != null ? renderLink(href, label) : label;\n }\n\n const { href } = value;\n if (href == null || href.trim() === '') {\n return fallback;\n }\n const label = resolveValueLabel(value.label, tApp);\n if (isEmptyText(label)) {\n return fallback;\n }\n return renderLink(href, label);\n};\n\nexport const resolveHeaderMeta = <Node>(\n meta: BackofficeDetailHeaderMetaSpec<Node>,\n node: Node,\n options: {\n tApp: TFunction;\n t: TFunction;\n resolveEntityHref?: (entityId: string, refId: string) => string | null;\n renderDate: (\n value: string | number | null | undefined,\n fallback: string,\n ) => ReactNode;\n renderLink: (href: string, label: ReactNode) => ReactNode;\n },\n): ReactNode => {\n const { tApp, t, resolveEntityHref, renderDate, renderLink } = options;\n const fallback = t('common.notAvailable');\n\n if (meta.type === 'dateTime') {\n return renderDate(meta.value(node), fallback);\n }\n\n if (meta.type === 'entityRef') {\n const idValue = meta.id(node);\n if (idValue == null || idValue.trim() === '') {\n return fallback;\n }\n const labelValue = resolveValueLabel(meta.value?.(node), tApp);\n const label =\n labelValue != null && String(labelValue).trim() !== ''\n ? labelValue\n : null;\n if (label == null) {\n return fallback;\n }\n const href = resolveEntityHref?.(meta.entity, idValue) ?? null;\n return href != null ? renderLink(href, label) : label;\n }\n\n if (meta.type === 'link') {\n const href = meta.href(node);\n const labelValue = resolveValueLabel(meta.value(node), tApp);\n if (href == null || href.trim() === '' || isEmptyText(labelValue)) {\n return fallback;\n }\n return renderLink(href, labelValue);\n }\n\n const value = resolveValueLabel(meta.value(node), tApp);\n return isEmptyText(value) ? fallback : value;\n};\n\nexport const resolveHeaderStatus = <Node>(\n status: BackofficeDetailHeaderStatusSpec<Node>,\n node: Node,\n tApp: TFunction,\n renderers: {\n renderBadgeRow: (items: readonly BackofficeBadgeItem[]) => ReactNode;\n renderTag: (\n tone: ReturnType<typeof resolveBadgeTone<Node>>,\n label: string,\n ) => ReactNode;\n },\n): ReactNode | undefined => {\n if (status.type === 'badgeRow') {\n const items = status.items(node).map((item) => {\n const resolvedLabel = resolveValueLabel(item.label, tApp);\n const label = resolvedLabel == null ? '' : String(resolvedLabel);\n return { ...item, label };\n });\n if (items.length === 0) {\n return undefined;\n }\n return renderers.renderBadgeRow(items);\n }\n\n const value = resolveValueLabel(status.value(node), tApp);\n const label = value == null ? '' : String(value);\n if (label.trim() === '') {\n return undefined;\n }\n const tone = resolveBadgeTone(status.tone, node);\n return renderers.renderTag(tone, label);\n};\n\nexport const buildFieldItems = <Node>(\n fields: readonly BackofficeDetailFieldSpec<Node>[],\n node: Node,\n options: {\n tApp: TFunction;\n t: TFunction;\n resolveEntityHref?: (entityId: string, refId: string) => string | null;\n formatNumber: (value: number | null | undefined) => string;\n formatCurrency: (value: number | null | undefined) => string;\n formatCurrencyTitle?: (value: number | null | undefined) => string | null;\n formatPercent: (value: number | null | undefined) => string;\n renderTag: (\n tone: ReturnType<typeof resolveBadgeTone<Node>>,\n label: string,\n ) => ReactNode;\n renderBadgeRow: (items: readonly BackofficeBadgeItem[]) => ReactNode;\n renderDate: (\n value: string | number | null | undefined,\n fallback: string,\n ) => ReactNode;\n renderFlagTag: (tag: ResolvedFlagTag) => ReactNode;\n renderLink: (href: string, label: ReactNode) => ReactNode;\n renderTaggedValue: (\n tag: {\n label: string;\n tone?: ReturnType<typeof resolveBadgeTone<Node>>;\n } | null,\n value: ReactNode,\n ) => ReactNode;\n wrapCustomNode: (id: string, node: ReactNode) => ReactNode;\n },\n): {\n items: ResolvedFieldItem[];\n customNodes: ReactNode[];\n} => {\n const {\n tApp,\n t,\n resolveEntityHref,\n formatNumber,\n formatCurrency,\n formatCurrencyTitle,\n formatPercent,\n renderTag,\n renderBadgeRow,\n renderDate,\n renderFlagTag,\n renderLink,\n renderTaggedValue,\n wrapCustomNode,\n } = options;\n const items: ResolvedFieldItem[] = [];\n const customNodes: ReactNode[] = [];\n const fallback = t('common.notAvailable');\n\n fields.forEach((field, index) => {\n const id = `${field.type}-${index}`;\n\n switch (field.type) {\n case 'text': {\n const value = resolveValueLabel(field.value(node), tApp);\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value,\n copyValue: field.copyValue?.(node) ?? undefined,\n fullWidth: field.fullWidth,\n });\n break;\n }\n case 'badge': {\n const value = resolveValueLabel(field.value(node), tApp);\n const label = value != null ? String(value) : '';\n const tone = resolveBadgeTone(field.tone, node);\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value: label.trim() !== '' ? renderTag(tone, label) : null,\n });\n break;\n }\n case 'badgeRow': {\n const badgeItems = field.items(node).map((item) => {\n const resolvedLabel = resolveValueLabel(item.label, tApp);\n const label = resolvedLabel == null ? '' : String(resolvedLabel);\n return { ...item, label };\n });\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value: badgeItems.length > 0 ? renderBadgeRow(badgeItems) : null,\n fullWidth: field.fullWidth,\n });\n break;\n }\n case 'dateTime': {\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value: renderDate(field.value(node), fallback),\n });\n break;\n }\n case 'number': {\n const value = field.value(node);\n let formatted: ReactNode | null = null;\n if (value != null) {\n if (field.format === 'currency') {\n const label = formatCurrency(value);\n formatted = createElement(\n 'span',\n { title: formatCurrencyTitle?.(value) ?? undefined },\n label,\n );\n } else if (field.format === 'percent') {\n formatted = formatPercent(value);\n } else {\n formatted = formatNumber(value);\n }\n }\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value: formatted,\n });\n break;\n }\n case 'flag': {\n const value = field.value(node);\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value:\n value != null\n ? renderFlagTag(resolveFlagTag(field.variant, value, t))\n : null,\n });\n break;\n }\n case 'entityRef': {\n const idValue = field.id(node);\n let value: ReactNode | null = null;\n if (idValue != null && idValue.trim() !== '') {\n const labelValue = field.value?.(node);\n const label =\n labelValue != null && labelValue.trim() !== '' ? labelValue : null;\n const href = resolveEntityHref?.(field.entity, idValue) ?? null;\n if (label != null) {\n value = href != null ? renderLink(href, label) : label;\n }\n }\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value: value ?? fallback,\n });\n break;\n }\n case 'technicalIdentifier': {\n const value = field.value(node);\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value:\n value == null\n ? null\n : createElement(TechnicalIdentifierValue, {\n value,\n copyValue: field.copyValue?.(node) ?? undefined,\n variant: field.variant,\n copyLabel: t('common.actions.copy'),\n }),\n copyValue: field.copyValue?.(node) ?? undefined,\n fullWidth: field.fullWidth,\n });\n break;\n }\n case 'link': {\n const href = field.href(node);\n const labelValue = field.value(node);\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value:\n href != null && href.trim() !== '' && !isEmptyText(labelValue)\n ? renderLink(href, labelValue)\n : null,\n });\n break;\n }\n case 'taggedValue': {\n const tag = field.tag(node);\n const valueNode = resolveInlineValue(field.value(node), {\n tApp,\n t,\n resolveEntityHref,\n renderLink,\n });\n const resolvedTag =\n tag == null\n ? null\n : {\n ...tag,\n label: (() => {\n const labelValue = resolveValueLabel(tag.label, tApp);\n return labelValue == null ? '' : String(labelValue);\n })(),\n };\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value:\n resolvedTag != null || valueNode != null\n ? renderTaggedValue(resolvedTag, valueNode)\n : null,\n fullWidth: field.fullWidth,\n });\n break;\n }\n case 'custom': {\n const custom = field.render(node) as ReactNode;\n if (custom == null) {\n break;\n }\n if (field.label != null) {\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value: custom,\n fullWidth: field.fullWidth,\n });\n break;\n }\n customNodes.push(wrapCustomNode(id, custom));\n break;\n }\n default:\n break;\n }\n });\n\n return { items, customNodes };\n};\n\nexport const resolveHeaderItems = <Node>(\n header: BackofficeDetailHeaderConfig<Node>,\n node: Node,\n options: {\n tApp: TFunction;\n t: TFunction;\n resolveEntityHref?: (entityId: string, refId: string) => string | null;\n renderLink: (href: string, label: ReactNode) => ReactNode;\n renderDate: (\n value: string | number | null | undefined,\n fallback: string,\n ) => ReactNode;\n renderTag: (\n tone: ReturnType<typeof resolveBadgeTone<Node>>,\n label: string,\n ) => ReactNode;\n renderBadgeRow: (items: readonly BackofficeBadgeItem[]) => ReactNode;\n },\n): {\n title: string;\n subtitle?: ReactNode;\n badges?: ReactNode;\n status?: ReactNode;\n items?: readonly ResolvedHeaderItem[];\n} => {\n const {\n tApp,\n t,\n resolveEntityHref,\n renderLink,\n renderDate,\n renderTag,\n renderBadgeRow,\n } = options;\n const resolvedTitle =\n header.titleValue?.(node, tApp) ?? resolveLabel(header.title, tApp);\n const rawNodeId =\n node != null &&\n typeof node === 'object' &&\n 'id' in node &&\n typeof node.id === 'string'\n ? node.id.trim()\n : null;\n const title =\n resolvedTitle.trim() === '' ||\n (rawNodeId != null && resolvedTitle.trim() === rawNodeId)\n ? resolveLabel(header.title, tApp)\n : resolvedTitle;\n\n let subtitleNode: ReactNode | undefined;\n if (header.subtitleItems != null && header.subtitleItems.length > 0) {\n const { subtitleItems } = header;\n const separator = header.subtitleSeparator ?? ' / ';\n const parts: ReactNode[] = [];\n subtitleItems.forEach((item, index) => {\n parts.push(\n createElement(\n 'span',\n { key: item.id },\n resolveInlineValue(item.value(node), {\n tApp,\n t,\n resolveEntityHref,\n renderLink,\n }),\n ),\n );\n if (index < subtitleItems.length - 1) {\n parts.push(createElement('span', { key: `${item.id}-sep` }, separator));\n }\n });\n subtitleNode = createElement('span', null, ...parts);\n } else {\n const subtitleValue =\n header.subtitleValue?.(node, tApp) ??\n (header.subtitle != null ? resolveLabel(header.subtitle, tApp) : null);\n subtitleNode =\n subtitleValue != null && subtitleValue.trim() !== ''\n ? subtitleValue\n : undefined;\n }\n\n const badgeNodes: ReactNode[] = [];\n header.badges?.forEach((badge, index) => {\n const label = resolveLabel(badge.label, tApp);\n const resolvedValue = resolveValueLabel(badge.value(node), tApp);\n const value = resolvedValue == null ? '' : String(resolvedValue);\n if (value.trim() === '') {\n return;\n }\n badgeNodes.push(\n renderTag(resolveBadgeTone(badge.tone, node), `${label}: ${value}`),\n );\n if (typeof badgeNodes[badgeNodes.length - 1] === 'object') {\n badgeNodes[badgeNodes.length - 1] = createElement(\n Fragment,\n { key: `${label}-${index}` },\n badgeNodes[badgeNodes.length - 1],\n );\n }\n });\n\n const status =\n header.status != null\n ? resolveHeaderStatus(header.status, node, tApp, {\n renderBadgeRow,\n renderTag,\n })\n : undefined;\n\n const items = header.meta?.map((meta, index) => {\n const label = resolveLabel(meta.label, tApp);\n return {\n id: `${label}-${index}`,\n label,\n value: resolveHeaderMeta(meta, node, {\n tApp,\n t,\n resolveEntityHref,\n renderDate,\n renderLink,\n }),\n };\n });\n\n return {\n title,\n subtitle: subtitleNode,\n badges:\n badgeNodes.length > 0\n ? createElement(Fragment, null, ...badgeNodes)\n : undefined,\n status,\n items,\n };\n};\n\nconst renderTimelinePayload = (payload: unknown): ReactNode | undefined => {\n if (payload == null) {\n return undefined;\n }\n if (\n typeof payload === 'string' ||\n typeof payload === 'number' ||\n typeof payload === 'boolean'\n ) {\n return String(payload);\n }\n\n try {\n return createElement('pre', null, JSON.stringify(payload, null, 2));\n } catch {\n const fallback =\n payload instanceof Error ? payload.message : '[unserializable payload]';\n return createElement('pre', null, fallback);\n }\n};\n\nconst resolveTechnicalVariant = (\n refKind: 'id' | 'slug' | 'path' | 'url' | 'hash' | 'external' | 'text',\n): TechnicalIdentifierVariant | null => {\n if (refKind === 'id' || refKind === 'hash' || refKind === 'external') {\n return refKind;\n }\n return null;\n};\n\nconst renderReferenceValue = (args: {\n value: BackofficeValueLabel;\n href?: string | null;\n refKind: 'id' | 'slug' | 'path' | 'url' | 'hash' | 'external' | 'text';\n copyValue?: string | null;\n tApp: TFunction;\n t: TFunction;\n renderLink: (href: string, label: ReactNode) => ReactNode;\n}): ReactNode => {\n const { value, href, refKind, copyValue, tApp, t, renderLink } = args;\n const resolvedValue = resolveValueLabel(value, tApp);\n const technicalVariant = resolveTechnicalVariant(refKind);\n if (technicalVariant != null) {\n const normalized = normalizeTechnicalIdentifier(resolvedValue);\n if (normalized == null) {\n return t('common.notAvailable');\n }\n return createElement(TechnicalIdentifierValue, {\n value: normalized,\n copyValue: copyValue ?? normalized,\n variant: technicalVariant,\n copyLabel: t('common.actions.copy'),\n });\n }\n if (href != null && href.trim() !== '' && !isEmptyText(resolvedValue)) {\n return renderLink(href, resolvedValue);\n }\n return resolvedValue ?? t('common.notAvailable');\n};\n\nexport const renderBlocks = <Node>(\n blocks: readonly BackofficeDetailBlockSpec<Node>[] | undefined,\n node: Node,\n options: {\n tApp: TFunction;\n t: TFunction;\n resolveEntityHref: (entityId: string, refId: string) => string | null;\n keyPrefix?: string;\n renderLink: (href: string, label: ReactNode) => ReactNode;\n renderDate: (\n value: string | number | Date | null | undefined,\n fallback: string,\n ) => ReactNode;\n renderTag: (tone: BackofficeTone, label: string) => ReactNode;\n renderMetricGroup: (args: {\n key: string;\n title: string;\n description?: string;\n density?: 'compact' | 'comfortable';\n items: readonly {\n id: string;\n label: string;\n value: ReactNode;\n hint?: ReactNode;\n tone?: BackofficeTone;\n copyValue?: string;\n }[];\n }) => ReactNode;\n renderTimeline: (args: {\n key: string;\n title: string;\n description?: string;\n events: readonly {\n id: string;\n label: string;\n timestamp?: ReactNode;\n description?: ReactNode;\n actor?: ReactNode;\n tone?: BackofficeTone;\n payload?: ReactNode;\n }[];\n }) => ReactNode;\n renderAuditTimeline: (args: {\n key: string;\n title: string;\n description?: string;\n events: readonly {\n id: string;\n title: ReactNode;\n time?: ReactNode;\n actor?: ReactNode;\n source?: ReactNode;\n }[];\n }) => ReactNode;\n renderRelations: (args: {\n key: string;\n title: string;\n description?: string;\n items: readonly {\n id: string;\n label: string;\n count?: ReactNode;\n href?: string;\n description?: ReactNode;\n tone?: BackofficeTone;\n }[];\n }) => ReactNode;\n renderContextStack: (args: {\n key: string;\n title: string;\n items: readonly {\n id: string;\n label: string;\n value: ReactNode | null | undefined;\n }[];\n }) => ReactNode;\n renderCustomSection: (\n key: string,\n title: string,\n child: ReactNode,\n ) => ReactNode;\n wrapCustomNode: (key: string, node: ReactNode) => ReactNode;\n resolveTableColumns: (\n columns: readonly BackofficeColumnSpec[],\n ) => readonly DataTableColumn<unknown>[];\n renderTable: (args: {\n key: string;\n title: string;\n description?: string;\n columns: readonly DataTableColumn<unknown>[];\n rows: readonly unknown[];\n }) => ReactNode;\n renderPayload: (args: {\n key: string;\n title: string;\n description?: string;\n content: unknown;\n format: BackofficePayloadFormat;\n }) => ReactNode;\n renderKeyValueListSection: (args: {\n key: string;\n title: string;\n description?: string;\n items: readonly { id: string; label: string; value: ReactNode }[];\n }) => ReactNode;\n },\n): ReactNode[] => {\n const { tApp, t, keyPrefix } = options;\n if (blocks == null || blocks.length === 0) {\n return [];\n }\n\n return blocks.map((block, index): ReactNode => {\n const key =\n keyPrefix != null\n ? `${keyPrefix}-${block.kind}-${index}`\n : `${block.kind}-${index}`;\n\n if (block.kind === 'custom') {\n const custom = block.render(node) as ReactNode;\n if (custom == null) {\n return null;\n }\n if (block.label != null) {\n return options.renderCustomSection(\n key,\n resolveLabel(block.label, tApp),\n custom,\n );\n }\n return options.wrapCustomNode(key, custom);\n }\n\n const title =\n 'title' in block\n ? resolveLabel(block.title, tApp)\n : resolveLabel(block.label, tApp);\n const description =\n block.description != null\n ? resolveLabel(block.description, tApp)\n : undefined;\n\n if (block.kind === 'summary') {\n return options.renderKeyValueListSection({\n key,\n title,\n description,\n items: block.items.map((item) => {\n const value = resolveValueLabel(item.value(node), tApp);\n const href = item.href?.(node);\n const tone = item.tone?.(node);\n let valueNode: ReactNode = value ?? t('common.notAvailable');\n if (href != null && href.trim() !== '' && !isEmptyText(value)) {\n valueNode = options.renderLink(href, value);\n } else if (tone != null && !isEmptyText(value)) {\n valueNode = options.renderTag(tone, String(value));\n }\n return {\n id: item.id,\n label: resolveLabel(item.label, tApp),\n value: valueNode,\n };\n }),\n });\n }\n\n if (block.kind === 'metrics') {\n return options.renderMetricGroup({\n key,\n title,\n description,\n density: block.density,\n items: block.items.map((item) => {\n const formattedValue = item.formattedValue?.(node);\n const value = resolveValueLabel(item.value(node), tApp);\n return {\n id: item.id,\n label: resolveLabel(item.label, tApp),\n value: formattedValue ?? value ?? t('common.notAvailable'),\n hint: resolveValueLabel(item.hint?.(node), tApp),\n tone: item.tone?.(node),\n copyValue: item.copyValue?.(node) ?? undefined,\n };\n }),\n });\n }\n\n if (block.kind === 'states') {\n return options.renderKeyValueListSection({\n key,\n title,\n description,\n items: block.states.map((state) => {\n const display = state.getDisplay(state.value(node), node);\n return {\n id: state.id,\n label: resolveLabel(state.label, tApp),\n value: options.renderTag(\n display.tone,\n String(\n resolveValueLabel(display.label, tApp) ??\n t('common.notAvailable'),\n ),\n ),\n };\n }),\n });\n }\n\n if (block.kind === 'context') {\n return options.renderContextStack({\n key,\n title,\n items: block.items.map((item) => {\n const value = resolveValueLabel(item.value(node), tApp);\n const href = item.href?.(node);\n return {\n id: item.id,\n label: resolveLabel(item.label, tApp),\n value:\n href != null && href.trim() !== '' && !isEmptyText(value)\n ? options.renderLink(href, value)\n : value,\n };\n }),\n });\n }\n\n if (block.kind === 'relationSummary') {\n return options.renderRelations({\n key,\n title,\n description,\n items: block.items.map((item) => {\n return {\n id: item.id,\n label: resolveLabel(item.label, tApp),\n count: item.count?.(node) ?? null,\n href: item.href?.(node) ?? undefined,\n description: resolveValueLabel(item.description?.(node), tApp),\n tone: item.tone?.(node),\n };\n }),\n });\n }\n\n if (block.kind === 'timeline') {\n return options.renderTimeline({\n key,\n title,\n description,\n events: block.events.map((event) => {\n const state = event.state?.(node);\n const stateLabel =\n state == null ? null : resolveValueLabel(state.label, tApp);\n const stateText = stateLabel == null ? null : String(stateLabel);\n return {\n id: event.id,\n label:\n stateText == null || stateText.trim() === ''\n ? resolveLabel(event.label, tApp)\n : `${resolveLabel(event.label, tApp)}: ${stateText}`,\n timestamp:\n event.timestamp == null\n ? undefined\n : options.renderDate(\n event.timestamp(node),\n t('common.notAvailable'),\n ),\n description: resolveValueLabel(event.description?.(node), tApp),\n actor: resolveValueLabel(event.actor?.(node), tApp),\n tone: state?.tone,\n payload: renderTimelinePayload(event.payload?.(node)),\n };\n }),\n });\n }\n\n if (block.kind === 'audit') {\n return options.renderAuditTimeline({\n key,\n title,\n description,\n events: block.items.map((item) => {\n const actor = resolveValueLabel(item.actor?.(node), tApp);\n const source = resolveValueLabel(item.source?.(node), tApp);\n return {\n id: item.id,\n title: resolveLabel(item.label, tApp),\n time: options.renderDate(\n item.timestamp?.(node),\n t('common.notAvailable'),\n ),\n actor: isEmptyText(actor) ? undefined : actor,\n source: isEmptyText(source) ? undefined : source,\n };\n }),\n });\n }\n\n if (block.kind === 'references') {\n return options.renderKeyValueListSection({\n key,\n title,\n description,\n items: block.references.map((reference) => {\n const href = reference.href?.(node);\n return {\n id: reference.id,\n label: resolveLabel(reference.label, tApp),\n value: renderReferenceValue({\n value: reference.value(node),\n href,\n refKind: reference.refKind ?? 'text',\n copyValue: reference.copyValue?.(node) ?? undefined,\n tApp,\n t,\n renderLink: options.renderLink,\n }),\n };\n }),\n });\n }\n\n if (block.kind === 'actionResult') {\n const items: { id: string; label: string; value: ReactNode }[] = [];\n const status = block.status?.(node);\n if (status != null) {\n items.push({\n id: `${block.id}-status`,\n label: t('detail.actionResult.status'),\n value: options.renderTag(\n status.tone,\n String(\n resolveValueLabel(status.label, tApp) ?? t('common.notAvailable'),\n ),\n ),\n });\n }\n const message = resolveValueLabel(block.message?.(node), tApp);\n if (!isEmptyText(message)) {\n items.push({\n id: `${block.id}-message`,\n label: t('detail.actionResult.message'),\n value: message,\n });\n }\n block.references?.forEach((reference) => {\n items.push({\n id: reference.id,\n label: resolveLabel(reference.label, tApp),\n value: renderReferenceValue({\n value: reference.value(node),\n href: reference.href?.(node),\n refKind: reference.refKind ?? 'text',\n copyValue: reference.copyValue?.(node) ?? undefined,\n tApp,\n t,\n renderLink: options.renderLink,\n }),\n });\n });\n return options.renderKeyValueListSection({\n key,\n title,\n description,\n items,\n });\n }\n\n if (block.kind === 'technicalFacts') {\n return options.renderKeyValueListSection({\n key,\n title,\n description,\n items: block.facts.map((fact) => {\n const value = resolveValueLabel(fact.value(node), tApp);\n const href = fact.href?.(node);\n const copyValue = fact.copyValue?.(node) ?? undefined;\n return {\n id: fact.id,\n label: resolveLabel(fact.label, tApp),\n value:\n copyValue != null && copyValue.trim() !== ''\n ? createElement(TechnicalIdentifierValue, {\n value: value ?? copyValue,\n copyValue,\n variant: 'external',\n copyLabel: t('common.actions.copy'),\n })\n : href != null && href.trim() !== '' && !isEmptyText(value)\n ? options.renderLink(href, value)\n : (value ?? t('common.notAvailable')),\n };\n }),\n });\n }\n\n if (block.kind === 'table') {\n return options.renderTable({\n key,\n title,\n description,\n columns: options.resolveTableColumns(block.columns),\n rows: block.rows(node) as readonly unknown[],\n });\n }\n\n return options.renderPayload({\n key,\n title,\n description,\n content: block.value(node),\n format: block.format ?? 'json',\n });\n });\n};\n"],"mappings":";;;;AAqEA,IAAa,KACX,GACA,GACA,MACoB;CACpB,QAAQ,GAAR;EACE,KAAK,SACH,OAAO,IACH;GAAE,MAAM;GAAW,OAAO,EAAE,oBAAoB;EAAE,IAClD;GAAE,MAAM;GAAW,OAAO,EAAE,mBAAmB;EAAE;EACvD,KAAK,cACH,OAAO,IACH;GACE,MAAM;GACN,OAAO,EAAE,0BAA0B;GACnC,UAAU;EACZ,IACA;GACE,MAAM;GACN,OAAO,EAAE,yBAAyB;GAClC,UAAU;EACZ;EACN,KAAK,WACH,OAAO,IACH;GACE,MAAM;GACN,OAAO,EAAE,uBAAuB;GAChC,UAAU;EACZ,IACA;GACE,MAAM;GACN,OAAO,EAAE,wBAAwB;GACjC,UAAU;EACZ;EACN,KAAK,WACH,OAAO,IACH;GACE,MAAM;GACN,OAAO,EAAE,sBAAsB;GAC/B,UAAU;EACZ,IACA;GACE,MAAM;GACN,OAAO,EAAE,kBAAkB;GAC3B,UAAU;EACZ;EACN,KAAK,aACH,OAAO,IACH;GACE,MAAM;GACN,OAAO,EAAE,2BAA2B;GACpC,UAAU;EACZ,IACA;GACE,MAAM;GACN,OAAO,EAAE,8BAA8B;GACvC,UAAU;EACZ;EACN,KAAK,UACH,OAAO,IACH;GACE,MAAM;GACN,OAAO,EAAE,qBAAqB;GAC9B,UAAU;EACZ,IACA;GACE,MAAM;GACN,OAAO,EAAE,uBAAuB;GAChC,UAAU;EACZ;EACN,KAAK,WACH,OAAO,IACH;GAAE,MAAM;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M,KACtC,EAAc,GAA0B;MACtC,OAAO,KAAS;MAChB;MACA,SAAS;MACT,WAAW,EAAE,qBAAqB;KACpC,CAAC,IACD,KAAQ,QAAQ,EAAK,KAAK,MAAM,MAAM,CAAC,EAAY,CAAK,IACtD,EAAQ,WAAW,GAAM,CAAK,IAC7B,KAAS,EAAE,qBAAqB;IAC3C;GACF,CAAC;EACH,CAAC,IAGC,EAAM,SAAS,UACV,EAAQ,YAAY;GACzB;GACA;GACA;GACA,SAAS,EAAQ,oBAAoB,EAAM,OAAO;GAClD,MAAM,EAAM,KAAK,CAAI;EACvB,CAAC,IAGI,EAAQ,cAAc;GAC3B;GACA;GACA;GACA,SAAS,EAAM,MAAM,CAAI;GACzB,QAAQ,EAAM,UAAU;EAC1B,CAAC;CACH,CAAC;AACH"}
1
+ {"version":3,"file":"BackofficeEntityDetailPage.view-helpers.js","names":[],"sources":["../../../src/pages/BackofficeEntityDetailPage.view-helpers.ts"],"sourcesContent":["/* eslint-disable no-ternary */\nimport type {\n BackofficeBadgeItem,\n BackofficeColumnSpec,\n BackofficeDetailBlockSpec,\n BackofficeDetailFieldSpec,\n BackofficeDetailHeaderConfig,\n BackofficeDetailHeaderMetaSpec,\n BackofficeDetailHeaderStatusSpec,\n BackofficeFieldSize,\n BackofficeFlagVariant,\n BackofficeInlineValueSpec,\n BackofficePayloadFormat,\n BackofficeTone,\n BackofficeValueLabel,\n} from '@plumile/backoffice-core/types.js';\nimport type { DataTableColumn } from '@plumile/ui/components/data-table/DataTable.js';\nimport type { TFunction } from 'i18next';\nimport { Fragment, createElement, type ReactNode } from 'react';\n\nimport {\n isEmptyText,\n resolveLabel,\n resolveBadgeTone,\n resolveValueLabel,\n} from './BackofficeEntityDetailPage.helpers.js';\nimport {\n normalizeTechnicalIdentifier,\n TechnicalIdentifierValue,\n type TechnicalIdentifierVariant,\n} from '../components/backoffice/technical/TechnicalIdentifierValue.js';\n\nexport type ResolvedFieldItem = {\n id: string;\n label: string;\n size: BackofficeFieldSize;\n value: ReactNode;\n copyValue?: string;\n fullWidth?: boolean;\n};\n\nexport type ResolvedHeaderItem = {\n id: string;\n label: string;\n value: ReactNode;\n};\n\nexport type FlagIconName =\n | 'shield-lock'\n | 'shield-off'\n | 'settings-check'\n | 'settings-x'\n | 'x-badge'\n | 'chat-check'\n | 'key'\n | 'key-off'\n | 'lock'\n | 'lock-open'\n | 'robot-check'\n | 'robot-x'\n | 'rocket'\n | 'rocket-off';\n\nexport type ResolvedFlagTag = {\n tone: 'neutral' | 'info' | 'success' | 'warning' | 'danger';\n label: string;\n iconName?: FlagIconName;\n};\n\nexport const resolveFlagTag = (\n variant: BackofficeFlagVariant,\n value: boolean,\n t: TFunction,\n): ResolvedFlagTag => {\n switch (variant) {\n case 'yesNo':\n return value\n ? { tone: 'success', label: t('common.boolean.yes') }\n : { tone: 'neutral', label: t('common.boolean.no') };\n case 'capability':\n return value\n ? {\n tone: 'success',\n label: t('flags.capability.allowed'),\n iconName: 'shield-lock',\n }\n : {\n tone: 'neutral',\n label: t('flags.capability.denied'),\n iconName: 'shield-off',\n };\n case 'enabled':\n return value\n ? {\n tone: 'success',\n label: t('flags.enabled.enabled'),\n iconName: 'settings-check',\n }\n : {\n tone: 'neutral',\n label: t('flags.enabled.disabled'),\n iconName: 'settings-x',\n };\n case 'failure':\n return value\n ? {\n tone: 'danger',\n label: t('flags.failure.failed'),\n iconName: 'x-badge',\n }\n : {\n tone: 'success',\n label: t('flags.failure.ok'),\n iconName: 'chat-check',\n };\n case 'encrypted':\n return value\n ? {\n tone: 'info',\n label: t('flags.encrypted.encrypted'),\n iconName: 'key',\n }\n : {\n tone: 'neutral',\n label: t('flags.encrypted.notEncrypted'),\n iconName: 'key-off',\n };\n case 'locked':\n return value\n ? {\n tone: 'warning',\n label: t('flags.locked.locked'),\n iconName: 'lock',\n }\n : {\n tone: 'success',\n label: t('flags.locked.unlocked'),\n iconName: 'lock-open',\n };\n case 'default':\n return value\n ? { tone: 'info', label: t('flags.default.default') }\n : { tone: 'neutral', label: t('flags.default.notDefault') };\n case 'agentManaged':\n return value\n ? {\n tone: 'info',\n label: t('flags.agentManaged.agentManaged'),\n iconName: 'robot-check',\n }\n : {\n tone: 'neutral',\n label: t('flags.agentManaged.userManaged'),\n iconName: 'robot-x',\n };\n case 'deployedProduction':\n return value\n ? {\n tone: 'success',\n label: t('flags.deployedProduction.deployed'),\n iconName: 'rocket',\n }\n : {\n tone: 'neutral',\n label: t('flags.deployedProduction.notDeployed'),\n iconName: 'rocket-off',\n };\n case 'forced':\n return value\n ? { tone: 'warning', label: t('flags.forced.forced') }\n : { tone: 'neutral', label: t('flags.forced.normal') };\n default:\n throw new Error(`Unsupported flag variant: ${String(variant)}`);\n }\n};\n\nexport const resolveInlineValue = (\n value: BackofficeInlineValueSpec,\n options: {\n tApp: TFunction;\n t: TFunction;\n resolveEntityHref?: (entityId: string, refId: string) => string | null;\n renderLink: (href: string, label: ReactNode) => ReactNode;\n },\n): ReactNode => {\n const { tApp, t, resolveEntityHref, renderLink } = options;\n const fallback = t('common.notAvailable');\n\n if (value.type === 'text') {\n const resolved = resolveValueLabel(value.value, tApp);\n return isEmptyText(resolved) ? fallback : resolved;\n }\n\n if (value.type === 'entityRef') {\n const { id } = value;\n if (id == null || id.trim() === '') {\n return fallback;\n }\n const resolvedLabel = resolveValueLabel(value.label, tApp);\n const label =\n resolvedLabel != null && String(resolvedLabel).trim() !== ''\n ? resolvedLabel\n : null;\n if (label == null) {\n return fallback;\n }\n const href = resolveEntityHref?.(value.entity, id) ?? null;\n return href != null ? renderLink(href, label) : label;\n }\n\n const { href } = value;\n if (href == null || href.trim() === '') {\n return fallback;\n }\n const label = resolveValueLabel(value.label, tApp);\n if (isEmptyText(label)) {\n return fallback;\n }\n return renderLink(href, label);\n};\n\nexport const resolveHeaderMeta = <Node>(\n meta: BackofficeDetailHeaderMetaSpec<Node>,\n node: Node,\n options: {\n tApp: TFunction;\n t: TFunction;\n resolveEntityHref?: (entityId: string, refId: string) => string | null;\n renderDate: (\n value: string | number | null | undefined,\n fallback: string,\n ) => ReactNode;\n renderLink: (href: string, label: ReactNode) => ReactNode;\n },\n): ReactNode => {\n const { tApp, t, resolveEntityHref, renderDate, renderLink } = options;\n const fallback = t('common.notAvailable');\n\n if (meta.type === 'dateTime') {\n return renderDate(meta.value(node), fallback);\n }\n\n if (meta.type === 'entityRef') {\n const idValue = meta.id(node);\n if (idValue == null || idValue.trim() === '') {\n return fallback;\n }\n const labelValue = resolveValueLabel(meta.value?.(node), tApp);\n const label =\n labelValue != null && String(labelValue).trim() !== ''\n ? labelValue\n : null;\n if (label == null) {\n return fallback;\n }\n const href = resolveEntityHref?.(meta.entity, idValue) ?? null;\n return href != null ? renderLink(href, label) : label;\n }\n\n if (meta.type === 'link') {\n const href = meta.href(node);\n const labelValue = resolveValueLabel(meta.value(node), tApp);\n if (href == null || href.trim() === '' || isEmptyText(labelValue)) {\n return fallback;\n }\n return renderLink(href, labelValue);\n }\n\n const value = resolveValueLabel(meta.value(node), tApp);\n return isEmptyText(value) ? fallback : value;\n};\n\nexport const resolveHeaderStatus = <Node>(\n status: BackofficeDetailHeaderStatusSpec<Node>,\n node: Node,\n tApp: TFunction,\n renderers: {\n renderBadgeRow: (items: readonly BackofficeBadgeItem[]) => ReactNode;\n renderTag: (\n tone: ReturnType<typeof resolveBadgeTone<Node>>,\n label: string,\n ) => ReactNode;\n },\n): ReactNode | undefined => {\n if (status.type === 'badgeRow') {\n const items = status.items(node).map((item) => {\n const resolvedLabel = resolveValueLabel(item.label, tApp);\n const label = resolvedLabel == null ? '' : String(resolvedLabel);\n return { ...item, label };\n });\n if (items.length === 0) {\n return undefined;\n }\n return renderers.renderBadgeRow(items);\n }\n\n const value = resolveValueLabel(status.value(node), tApp);\n const label = value == null ? '' : String(value);\n if (label.trim() === '') {\n return undefined;\n }\n const tone = resolveBadgeTone(status.tone, node);\n return renderers.renderTag(tone, label);\n};\n\nexport const buildFieldItems = <Node>(\n fields: readonly BackofficeDetailFieldSpec<Node>[],\n node: Node,\n options: {\n tApp: TFunction;\n t: TFunction;\n resolveEntityHref?: (entityId: string, refId: string) => string | null;\n formatNumber: (value: number | null | undefined) => string;\n formatCurrency: (value: number | null | undefined) => string;\n formatCurrencyTitle?: (value: number | null | undefined) => string | null;\n formatPercent: (value: number | null | undefined) => string;\n renderTag: (\n tone: ReturnType<typeof resolveBadgeTone<Node>>,\n label: string,\n ) => ReactNode;\n renderBadgeRow: (items: readonly BackofficeBadgeItem[]) => ReactNode;\n renderDate: (\n value: string | number | null | undefined,\n fallback: string,\n ) => ReactNode;\n renderFlagTag: (tag: ResolvedFlagTag) => ReactNode;\n renderLink: (href: string, label: ReactNode) => ReactNode;\n renderTaggedValue: (\n tag: {\n label: string;\n tone?: ReturnType<typeof resolveBadgeTone<Node>>;\n } | null,\n value: ReactNode,\n ) => ReactNode;\n wrapCustomNode: (id: string, node: ReactNode) => ReactNode;\n },\n): {\n items: ResolvedFieldItem[];\n customNodes: ReactNode[];\n} => {\n const {\n tApp,\n t,\n resolveEntityHref,\n formatNumber,\n formatCurrency,\n formatCurrencyTitle,\n formatPercent,\n renderTag,\n renderBadgeRow,\n renderDate,\n renderFlagTag,\n renderLink,\n renderTaggedValue,\n wrapCustomNode,\n } = options;\n const items: ResolvedFieldItem[] = [];\n const customNodes: ReactNode[] = [];\n const fallback = t('common.notAvailable');\n\n fields.forEach((field, index) => {\n const id = `${field.type}-${index}`;\n\n switch (field.type) {\n case 'text': {\n const value = resolveValueLabel(field.value(node), tApp);\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value,\n copyValue: field.copyValue?.(node) ?? undefined,\n fullWidth: field.fullWidth,\n });\n break;\n }\n case 'badge': {\n const value = resolveValueLabel(field.value(node), tApp);\n const label = value != null ? String(value) : '';\n const tone = resolveBadgeTone(field.tone, node);\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value: label.trim() !== '' ? renderTag(tone, label) : null,\n });\n break;\n }\n case 'badgeRow': {\n const badgeItems = field.items(node).map((item) => {\n const resolvedLabel = resolveValueLabel(item.label, tApp);\n const label = resolvedLabel == null ? '' : String(resolvedLabel);\n return { ...item, label };\n });\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value: badgeItems.length > 0 ? renderBadgeRow(badgeItems) : null,\n fullWidth: field.fullWidth,\n });\n break;\n }\n case 'dateTime': {\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value: renderDate(field.value(node), fallback),\n });\n break;\n }\n case 'number': {\n const value = field.value(node);\n let formatted: ReactNode | null = null;\n if (value != null) {\n if (field.format === 'currency') {\n const label = formatCurrency(value);\n formatted = createElement(\n 'span',\n { title: formatCurrencyTitle?.(value) ?? undefined },\n label,\n );\n } else if (field.format === 'percent') {\n formatted = formatPercent(value);\n } else {\n formatted = formatNumber(value);\n }\n }\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value: formatted,\n });\n break;\n }\n case 'flag': {\n const value = field.value(node);\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value:\n value != null\n ? renderFlagTag(resolveFlagTag(field.variant, value, t))\n : null,\n });\n break;\n }\n case 'entityRef': {\n const idValue = field.id(node);\n let value: ReactNode | null = null;\n if (idValue != null && idValue.trim() !== '') {\n const labelValue = field.value?.(node);\n const label =\n labelValue != null && labelValue.trim() !== '' ? labelValue : null;\n const href = resolveEntityHref?.(field.entity, idValue) ?? null;\n if (label != null) {\n value = href != null ? renderLink(href, label) : label;\n }\n }\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value: value ?? fallback,\n });\n break;\n }\n case 'technicalIdentifier': {\n const value = field.value(node);\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value:\n value == null\n ? null\n : createElement(TechnicalIdentifierValue, {\n value,\n copyValue: field.copyValue?.(node) ?? undefined,\n variant: field.variant,\n copyLabel: t('common.actions.copy'),\n }),\n copyValue: field.copyValue?.(node) ?? undefined,\n fullWidth: field.fullWidth,\n });\n break;\n }\n case 'link': {\n const href = field.href(node);\n const labelValue = field.value(node);\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value:\n href != null && href.trim() !== '' && !isEmptyText(labelValue)\n ? renderLink(href, labelValue)\n : null,\n });\n break;\n }\n case 'taggedValue': {\n const tag = field.tag(node);\n const valueNode = resolveInlineValue(field.value(node), {\n tApp,\n t,\n resolveEntityHref,\n renderLink,\n });\n const resolvedTag =\n tag == null\n ? null\n : {\n ...tag,\n label: (() => {\n const labelValue = resolveValueLabel(tag.label, tApp);\n return labelValue == null ? '' : String(labelValue);\n })(),\n };\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value:\n resolvedTag != null || valueNode != null\n ? renderTaggedValue(resolvedTag, valueNode)\n : null,\n fullWidth: field.fullWidth,\n });\n break;\n }\n case 'custom': {\n const custom = field.render(node) as ReactNode;\n if (custom == null) {\n break;\n }\n if (field.label != null) {\n items.push({\n id,\n label: resolveLabel(field.label, tApp),\n size: field.size,\n value: custom,\n fullWidth: field.fullWidth,\n });\n break;\n }\n customNodes.push(wrapCustomNode(id, custom));\n break;\n }\n default:\n break;\n }\n });\n\n return { items, customNodes };\n};\n\nexport const resolveHeaderItems = <Node>(\n header: BackofficeDetailHeaderConfig<Node>,\n node: Node,\n options: {\n tApp: TFunction;\n t: TFunction;\n resolveEntityHref?: (entityId: string, refId: string) => string | null;\n renderLink: (href: string, label: ReactNode) => ReactNode;\n renderDate: (\n value: string | number | null | undefined,\n fallback: string,\n ) => ReactNode;\n renderTag: (\n tone: ReturnType<typeof resolveBadgeTone<Node>>,\n label: string,\n ) => ReactNode;\n renderBadgeRow: (items: readonly BackofficeBadgeItem[]) => ReactNode;\n },\n): {\n title: string;\n subtitle?: ReactNode;\n badges?: ReactNode;\n status?: ReactNode;\n items?: readonly ResolvedHeaderItem[];\n} => {\n const {\n tApp,\n t,\n resolveEntityHref,\n renderLink,\n renderDate,\n renderTag,\n renderBadgeRow,\n } = options;\n const resolvedTitle =\n header.titleValue?.(node, tApp) ?? resolveLabel(header.title, tApp);\n const rawNodeId =\n node != null &&\n typeof node === 'object' &&\n 'id' in node &&\n typeof node.id === 'string'\n ? node.id.trim()\n : null;\n const title =\n resolvedTitle.trim() === '' ||\n (rawNodeId != null && resolvedTitle.trim() === rawNodeId)\n ? resolveLabel(header.title, tApp)\n : resolvedTitle;\n\n let subtitleNode: ReactNode | undefined;\n if (header.subtitleItems != null && header.subtitleItems.length > 0) {\n const { subtitleItems } = header;\n const separator = header.subtitleSeparator ?? ' / ';\n const parts: ReactNode[] = [];\n subtitleItems.forEach((item, index) => {\n parts.push(\n createElement(\n 'span',\n { key: item.id },\n resolveInlineValue(item.value(node), {\n tApp,\n t,\n resolveEntityHref,\n renderLink,\n }),\n ),\n );\n if (index < subtitleItems.length - 1) {\n parts.push(createElement('span', { key: `${item.id}-sep` }, separator));\n }\n });\n subtitleNode = createElement('span', null, ...parts);\n } else {\n const subtitleValue =\n header.subtitleValue?.(node, tApp) ??\n (header.subtitle != null ? resolveLabel(header.subtitle, tApp) : null);\n subtitleNode =\n subtitleValue != null && subtitleValue.trim() !== ''\n ? subtitleValue\n : undefined;\n }\n\n const badgeNodes: ReactNode[] = [];\n header.badges?.forEach((badge, index) => {\n const label = resolveLabel(badge.label, tApp);\n const resolvedValue = resolveValueLabel(badge.value(node), tApp);\n const value = resolvedValue == null ? '' : String(resolvedValue);\n if (value.trim() === '') {\n return;\n }\n badgeNodes.push(\n renderTag(resolveBadgeTone(badge.tone, node), `${label}: ${value}`),\n );\n if (typeof badgeNodes[badgeNodes.length - 1] === 'object') {\n badgeNodes[badgeNodes.length - 1] = createElement(\n Fragment,\n { key: `${label}-${index}` },\n badgeNodes[badgeNodes.length - 1],\n );\n }\n });\n\n const status =\n header.status != null\n ? resolveHeaderStatus(header.status, node, tApp, {\n renderBadgeRow,\n renderTag,\n })\n : undefined;\n\n const items = header.meta?.map((meta, index) => {\n const label = resolveLabel(meta.label, tApp);\n return {\n id: `${label}-${index}`,\n label,\n value: resolveHeaderMeta(meta, node, {\n tApp,\n t,\n resolveEntityHref,\n renderDate,\n renderLink,\n }),\n };\n });\n\n return {\n title,\n subtitle: subtitleNode,\n badges:\n badgeNodes.length > 0\n ? createElement(Fragment, null, ...badgeNodes)\n : undefined,\n status,\n items,\n };\n};\n\nconst renderTimelinePayload = (payload: unknown): ReactNode | undefined => {\n if (payload == null) {\n return undefined;\n }\n if (\n typeof payload === 'string' ||\n typeof payload === 'number' ||\n typeof payload === 'boolean'\n ) {\n return String(payload);\n }\n\n try {\n return createElement('pre', null, JSON.stringify(payload, null, 2));\n } catch {\n const fallback =\n payload instanceof Error ? payload.message : '[unserializable payload]';\n return createElement('pre', null, fallback);\n }\n};\n\nconst resolveTechnicalVariant = (\n refKind: 'id' | 'slug' | 'path' | 'url' | 'hash' | 'external' | 'text',\n): TechnicalIdentifierVariant | null => {\n if (refKind === 'id' || refKind === 'hash' || refKind === 'external') {\n return refKind;\n }\n return null;\n};\n\nconst renderReferenceValue = (args: {\n value: BackofficeValueLabel;\n href?: string | null;\n refKind: 'id' | 'slug' | 'path' | 'url' | 'hash' | 'external' | 'text';\n copyValue?: string | null;\n tApp: TFunction;\n t: TFunction;\n renderLink: (href: string, label: ReactNode) => ReactNode;\n}): ReactNode => {\n const { value, href, refKind, copyValue, tApp, t, renderLink } = args;\n const resolvedValue = resolveValueLabel(value, tApp);\n const technicalVariant = resolveTechnicalVariant(refKind);\n if (technicalVariant != null) {\n const normalized = normalizeTechnicalIdentifier(resolvedValue);\n if (normalized == null) {\n return t('common.notAvailable');\n }\n return createElement(TechnicalIdentifierValue, {\n value: normalized,\n copyValue: copyValue ?? normalized,\n variant: technicalVariant,\n copyLabel: t('common.actions.copy'),\n });\n }\n if (href != null && href.trim() !== '' && !isEmptyText(resolvedValue)) {\n return renderLink(href, resolvedValue);\n }\n return resolvedValue ?? t('common.notAvailable');\n};\n\nexport const renderBlocks = <Node>(\n blocks: readonly BackofficeDetailBlockSpec<Node>[] | undefined,\n node: Node,\n options: {\n tApp: TFunction;\n t: TFunction;\n resolveEntityHref: (entityId: string, refId: string) => string | null;\n keyPrefix?: string;\n renderLink: (href: string, label: ReactNode) => ReactNode;\n renderDate: (\n value: string | number | Date | null | undefined,\n fallback: string,\n ) => ReactNode;\n renderTag: (tone: BackofficeTone, label: string) => ReactNode;\n renderMetricGroup: (args: {\n key: string;\n title: string;\n description?: string;\n density?: 'compact' | 'comfortable';\n items: readonly {\n id: string;\n label: string;\n value: ReactNode;\n hint?: ReactNode;\n tone?: BackofficeTone;\n copyValue?: string;\n }[];\n }) => ReactNode;\n renderTimeline: (args: {\n key: string;\n title: string;\n description?: string;\n events: readonly {\n id: string;\n label: string;\n timestamp?: ReactNode;\n description?: ReactNode;\n actor?: ReactNode;\n tone?: BackofficeTone;\n payload?: ReactNode;\n }[];\n }) => ReactNode;\n renderAuditTimeline: (args: {\n key: string;\n title: string;\n description?: string;\n events: readonly {\n id: string;\n title: ReactNode;\n time?: ReactNode;\n actor?: ReactNode;\n source?: ReactNode;\n }[];\n }) => ReactNode;\n renderRelations: (args: {\n key: string;\n title: string;\n description?: string;\n items: readonly {\n id: string;\n label: string;\n count?: ReactNode;\n href?: string;\n description?: ReactNode;\n tone?: BackofficeTone;\n }[];\n }) => ReactNode;\n renderContextStack: (args: {\n key: string;\n title: string;\n items: readonly {\n id: string;\n label: string;\n value: ReactNode | null | undefined;\n }[];\n }) => ReactNode;\n renderCustomSection: (\n key: string,\n title: string,\n child: ReactNode,\n ) => ReactNode;\n wrapCustomNode: (key: string, node: ReactNode) => ReactNode;\n resolveTableColumns: (\n columns: readonly BackofficeColumnSpec[],\n ) => readonly DataTableColumn<unknown>[];\n renderTable: (args: {\n key: string;\n title: string;\n description?: string;\n columns: readonly DataTableColumn<unknown>[];\n rows: readonly unknown[];\n }) => ReactNode;\n renderPayload: (args: {\n key: string;\n title: string;\n description?: string;\n content: unknown;\n format: BackofficePayloadFormat;\n }) => ReactNode;\n renderKeyValueListSection: (args: {\n key: string;\n title: string;\n description?: string;\n items: readonly { id: string; label: string; value: ReactNode }[];\n }) => ReactNode;\n },\n): ReactNode[] => {\n const { tApp, t, keyPrefix } = options;\n if (blocks == null || blocks.length === 0) {\n return [];\n }\n\n return blocks.map((block, index): ReactNode => {\n const key =\n keyPrefix != null\n ? `${keyPrefix}-${block.kind}-${index}`\n : `${block.kind}-${index}`;\n\n if (block.kind === 'custom') {\n const custom = block.render(node) as ReactNode;\n if (custom == null) {\n return null;\n }\n if (block.label != null) {\n return options.renderCustomSection(\n key,\n resolveLabel(block.label, tApp),\n custom,\n );\n }\n return options.wrapCustomNode(key, custom);\n }\n\n const title =\n 'title' in block\n ? resolveLabel(block.title, tApp)\n : resolveLabel(block.label, tApp);\n const description =\n block.description != null\n ? resolveLabel(block.description, tApp)\n : undefined;\n\n if (block.kind === 'summary') {\n return options.renderKeyValueListSection({\n key,\n title,\n description,\n items: block.items.map((item) => {\n const value = resolveValueLabel(item.value(node), tApp);\n const href = item.href?.(node);\n const tone = item.tone?.(node);\n let valueNode: ReactNode = value ?? t('common.notAvailable');\n if (href != null && href.trim() !== '' && !isEmptyText(value)) {\n valueNode = options.renderLink(href, value);\n } else if (tone != null && !isEmptyText(value)) {\n valueNode = options.renderTag(tone, String(value));\n }\n return {\n id: item.id,\n label: resolveLabel(item.label, tApp),\n value: valueNode,\n };\n }),\n });\n }\n\n if (block.kind === 'metrics') {\n return options.renderMetricGroup({\n key,\n title,\n description,\n density: block.density,\n items: block.items.map((item) => {\n const formattedValue = item.formattedValue?.(node);\n const value = resolveValueLabel(item.value(node), tApp);\n return {\n id: item.id,\n label: resolveLabel(item.label, tApp),\n value: formattedValue ?? value ?? t('common.notAvailable'),\n hint: resolveValueLabel(item.hint?.(node), tApp),\n tone: item.tone?.(node),\n copyValue: item.copyValue?.(node) ?? undefined,\n };\n }),\n });\n }\n\n if (block.kind === 'states') {\n return options.renderKeyValueListSection({\n key,\n title,\n description,\n items: block.states.map((state) => {\n const display = state.getDisplay(state.value(node), node);\n return {\n id: state.id,\n label: resolveLabel(state.label, tApp),\n value: options.renderTag(\n display.tone,\n String(\n resolveValueLabel(display.label, tApp) ??\n t('common.notAvailable'),\n ),\n ),\n };\n }),\n });\n }\n\n if (block.kind === 'context') {\n return options.renderContextStack({\n key,\n title,\n items: block.items.map((item) => {\n const value = resolveValueLabel(item.value(node), tApp);\n const href = item.href?.(node);\n return {\n id: item.id,\n label: resolveLabel(item.label, tApp),\n value:\n href != null && href.trim() !== '' && !isEmptyText(value)\n ? options.renderLink(href, value)\n : value,\n };\n }),\n });\n }\n\n if (block.kind === 'relationSummary') {\n return options.renderRelations({\n key,\n title,\n description,\n items: block.items.map((item) => {\n return {\n id: item.id,\n label: resolveLabel(item.label, tApp),\n count: item.count?.(node) ?? null,\n href: item.href?.(node) ?? undefined,\n description: resolveValueLabel(item.description?.(node), tApp),\n tone: item.tone?.(node),\n };\n }),\n });\n }\n\n if (block.kind === 'timeline') {\n return options.renderTimeline({\n key,\n title,\n description,\n events: block.events.map((event) => {\n const state = event.state?.(node);\n const stateLabel =\n state == null ? null : resolveValueLabel(state.label, tApp);\n const stateText = stateLabel == null ? null : String(stateLabel);\n return {\n id: event.id,\n label:\n stateText == null || stateText.trim() === ''\n ? resolveLabel(event.label, tApp)\n : `${resolveLabel(event.label, tApp)}: ${stateText}`,\n timestamp:\n event.timestamp == null\n ? undefined\n : options.renderDate(\n event.timestamp(node),\n t('common.notAvailable'),\n ),\n description: resolveValueLabel(event.description?.(node), tApp),\n actor: resolveValueLabel(event.actor?.(node), tApp),\n tone: state?.tone,\n payload: renderTimelinePayload(event.payload?.(node)),\n };\n }),\n });\n }\n\n if (block.kind === 'audit') {\n return options.renderAuditTimeline({\n key,\n title,\n description,\n events: block.items.map((item) => {\n const actor = resolveValueLabel(item.actor?.(node), tApp);\n const source = resolveValueLabel(item.source?.(node), tApp);\n return {\n id: item.id,\n title: resolveLabel(item.label, tApp),\n time: options.renderDate(\n item.timestamp?.(node),\n t('common.notAvailable'),\n ),\n actor: isEmptyText(actor) ? undefined : actor,\n source: isEmptyText(source) ? undefined : source,\n };\n }),\n });\n }\n\n if (block.kind === 'references') {\n return options.renderKeyValueListSection({\n key,\n title,\n description,\n items: block.references.map((reference) => {\n const href = reference.href?.(node);\n return {\n id: reference.id,\n label: resolveLabel(reference.label, tApp),\n value: renderReferenceValue({\n value: reference.value(node),\n href,\n refKind: reference.refKind ?? 'text',\n copyValue: reference.copyValue?.(node) ?? undefined,\n tApp,\n t,\n renderLink: options.renderLink,\n }),\n };\n }),\n });\n }\n\n if (block.kind === 'actionResult') {\n const items: { id: string; label: string; value: ReactNode }[] = [];\n const status = block.status?.(node);\n if (status != null) {\n items.push({\n id: `${block.id}-status`,\n label: t('detail.actionResult.status'),\n value: options.renderTag(\n status.tone,\n String(\n resolveValueLabel(status.label, tApp) ?? t('common.notAvailable'),\n ),\n ),\n });\n }\n const message = resolveValueLabel(block.message?.(node), tApp);\n if (!isEmptyText(message)) {\n items.push({\n id: `${block.id}-message`,\n label: t('detail.actionResult.message'),\n value: message,\n });\n }\n block.references?.forEach((reference) => {\n items.push({\n id: reference.id,\n label: resolveLabel(reference.label, tApp),\n value: renderReferenceValue({\n value: reference.value(node),\n href: reference.href?.(node),\n refKind: reference.refKind ?? 'text',\n copyValue: reference.copyValue?.(node) ?? undefined,\n tApp,\n t,\n renderLink: options.renderLink,\n }),\n });\n });\n return options.renderKeyValueListSection({\n key,\n title,\n description,\n items,\n });\n }\n\n if (block.kind === 'technicalFacts') {\n return options.renderKeyValueListSection({\n key,\n title,\n description,\n items: block.facts.map((fact) => {\n const value = resolveValueLabel(fact.value(node), tApp);\n const href = fact.href?.(node);\n const copyValue = fact.copyValue?.(node) ?? undefined;\n return {\n id: fact.id,\n label: resolveLabel(fact.label, tApp),\n value:\n copyValue != null && copyValue.trim() !== ''\n ? createElement(TechnicalIdentifierValue, {\n value: value ?? copyValue,\n copyValue,\n variant: 'external',\n copyLabel: t('common.actions.copy'),\n })\n : href != null && href.trim() !== '' && !isEmptyText(value)\n ? options.renderLink(href, value)\n : (value ?? t('common.notAvailable')),\n };\n }),\n });\n }\n\n if (block.kind === 'table') {\n return options.renderTable({\n key,\n title,\n description,\n columns: options.resolveTableColumns(block.columns),\n rows: block.rows(node) as readonly unknown[],\n });\n }\n\n return options.renderPayload({\n key,\n title,\n description,\n content: block.value(node),\n format: block.format ?? 'json',\n });\n });\n};\n"],"mappings":";;;;AAqEA,IAAa,KACX,GACA,GACA,MACoB;CACpB,QAAQ,GAAR;EACE,KAAK,SACH,OAAO,IACH;GAAE,MAAM;GAAW,OAAO,EAAE,oBAAoB;EAAE,IAClD;GAAE,MAAM;GAAW,OAAO,EAAE,mBAAmB;EAAE;EACvD,KAAK,cACH,OAAO,IACH;GACE,MAAM;GACN,OAAO,EAAE,0BAA0B;GACnC,UAAU;EACZ,IACA;GACE,MAAM;GACN,OAAO,EAAE,yBAAyB;GAClC,UAAU;EACZ;EACN,KAAK,WACH,OAAO,IACH;GACE,MAAM;GACN,OAAO,EAAE,uBAAuB;GAChC,UAAU;EACZ,IACA;GACE,MAAM;GACN,OAAO,EAAE,wBAAwB;GACjC,UAAU;EACZ;EACN,KAAK,WACH,OAAO,IACH;GACE,MAAM;GACN,OAAO,EAAE,sBAAsB;GAC/B,UAAU;EACZ,IACA;GACE,MAAM;GACN,OAAO,EAAE,kBAAkB;GAC3B,UAAU;EACZ;EACN,KAAK,aACH,OAAO,IACH;GACE,MAAM;GACN,OAAO,EAAE,2BAA2B;GACpC,UAAU;EACZ,IACA;GACE,MAAM;GACN,OAAO,EAAE,8BAA8B;GACvC,UAAU;EACZ;EACN,KAAK,UACH,OAAO,IACH;GACE,MAAM;GACN,OAAO,EAAE,qBAAqB;GAC9B,UAAU;EACZ,IACA;GACE,MAAM;GACN,OAAO,EAAE,uBAAuB;GAChC,UAAU;EACZ;EACN,KAAK,WACH,OAAO,IACH;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QAAQ,EAAU,KAAK,MAAM,KACtC,EAAc,GAA0B;MACtC,OAAO,KAAS;MAChB;MACA,SAAS;MACT,WAAW,EAAE,qBAAqB;KACpC,CAAC,IACD,KAAQ,QAAQ,EAAK,KAAK,MAAM,MAAM,CAAC,EAAY,CAAK,IACtD,EAAQ,WAAW,GAAM,CAAK,IAC7B,KAAS,EAAE,qBAAqB;IAC3C;GACF,CAAC;EACH,CAAC,IAGC,EAAM,SAAS,UACV,EAAQ,YAAY;GACzB;GACA;GACA;GACA,SAAS,EAAQ,oBAAoB,EAAM,OAAO;GAClD,MAAM,EAAM,KAAK,CAAI;EACvB,CAAC,IAGI,EAAQ,cAAc;GAC3B;GACA;GACA;GACA,SAAS,EAAM,MAAM,CAAI;GACzB,QAAQ,EAAM,UAAU;EAC1B,CAAC;CACH,CAAC;AACH"}
@@ -131,7 +131,7 @@ function H(a) {
131
131
  return e.groupId != null && q.set(t, e.groupId), t;
132
132
  }), _e = he.map((e) => {
133
133
  let t = e.routes.list, n = L(t, I), r = [], a = ({ match: t }) => {
134
- let n = String(t?.params.id ?? ""), r = typeof t?.params.pagePath == "string" ? t.params.pagePath : null, a = r == null ? e.defaultDetailPageId ?? "overview" : B(e, r);
134
+ let n = String(t?.params.id ?? ""), r = typeof t?.params.pagePath == "string" ? t.params.pagePath : null, a = r == null ? e.defaultDetailPageId : B(e, r);
135
135
  return /* @__PURE__ */ s(i, {
136
136
  entityManifest: e,
137
137
  id: n,
@@ -213,7 +213,7 @@ function H(a) {
213
213
  });
214
214
  K.set(i, e.id), r.push(i);
215
215
  }
216
- let o = (e.detailPages ?? []).map((t) => {
216
+ let o = e.detailPages.map((t) => {
217
217
  let n = V({
218
218
  path: "",
219
219
  resourcePage: te,
@@ -295,7 +295,7 @@ function H(a) {
295
295
  resourcePage: m,
296
296
  prepare: ({ variables: t }) => {
297
297
  let n = String(t.id ?? "").trim();
298
- return { redirectTo: n === "" ? null : e.routes.detailPage(n, e.defaultDetailPageId ?? "overview") };
298
+ return { redirectTo: n === "" ? null : e.routes.detailPage(n, e.defaultDetailPageId) };
299
299
  },
300
300
  render: ({ prepared: e }) => {
301
301
  let t = e.redirectTo ?? null;
@@ -337,7 +337,7 @@ function H(a) {
337
337
  suspenseBoundary: "segment",
338
338
  fallback: a,
339
339
  prepare: ({ variables: t }) => {
340
- let n = String(t.id ?? ""), r = typeof t.pagePath == "string" ? t.pagePath : null, i = r == null ? e.defaultDetailPageId ?? "overview" : B(e, r);
340
+ let n = String(t.id ?? ""), r = typeof t.pagePath == "string" ? t.pagePath : null, i = r == null ? e.defaultDetailPageId : B(e, r);
341
341
  return {
342
342
  entityId: e.id,
343
343
  entityManifest: e,
@@ -1 +1 @@
1
- {"version":3,"file":"createBackofficeRoutes.js","names":[],"sources":["../../../src/router/createBackofficeRoutes.tsx"],"sourcesContent":["/* eslint-disable no-ternary */\nimport {\n useContext,\n useEffect,\n type ComponentType,\n type JSX,\n type ReactNode,\n} from 'react';\nimport {\n getResourcePage,\n type ResourcePage,\n} from '@plumile/router/ResourcePage.js';\nimport RoutingContext from '@plumile/router/routing/RoutingContext.js';\nimport { r } from '@plumile/router/tools.js';\nimport {\n type AnyRoute,\n type Route,\n type RouteFallbackArgs,\n} from '@plumile/router/types.js';\nimport * as ReactRelay from 'react-relay';\nimport type { PreloadedQuery } from 'react-relay';\nimport type {\n Environment,\n GraphQLTaggedNode,\n OperationType,\n Variables,\n} from 'relay-runtime';\n\nimport { BACKOFFICE_LIST_DEFAULTS } from '@plumile/backoffice-core/constants.js';\nimport type {\n BackofficeDashboardConfig,\n BackofficeDetailPageManifestItem,\n BackofficeEntityManifestItem,\n BackofficeEntityManifestMap,\n I18nLabel,\n BackofficePreparedDetailFrameRoute,\n BackofficePreparedDetailLayoutDataRoute,\n BackofficePreparedDetailPageConfigRoute,\n BackofficePreparedDetailPageDataRoute,\n BackofficePreparedDetailShellRoute,\n BackofficePreparedDetailUnknownPageRoute,\n BackofficePreparedListDataRoute,\n BackofficePreparedListLayoutRoute,\n BackofficePreparedListShellRoute,\n BackofficePreparedToolConfigRoute,\n BackofficePreparedToolRoute,\n} from '@plumile/backoffice-core/types.js';\n\nimport type {\n BackofficeAuthConfig,\n BackofficeDashboardRegistration,\n BackofficeDashboardModule,\n BackofficeResolvedSidebarHubConfig,\n BackofficeSidebarConfig,\n} from '../provider/types.js';\nimport {\n buildEntityGroupLookup,\n resolveSidebarHubEntries,\n resolveSidebarGroups,\n} from '../components/backoffice/layout/sidebarUtils.js';\nimport type { BackofficeEntityRegistry } from '../provider/entityRegistry.js';\nimport { validateBackofficeDashboardRegistrations } from '../provider/dashboardRegistrations.js';\nimport { BackofficeEntityDetailManifestFallback } from '../pages/detail/BackofficeEntityDetailManifestFallback.js';\n\nconst { loadQuery, usePreloadedQuery } = ReactRelay;\n\nexport type CreateBackofficeRoutesInput = {\n basePath: string;\n entityManifest: BackofficeEntityManifestMap;\n entityRegistry: BackofficeEntityRegistry;\n sidebar?: BackofficeSidebarConfig;\n auth: BackofficeAuthConfig;\n dashboard?: BackofficeDashboardModule;\n dashboards?: readonly BackofficeDashboardRegistration[];\n toolsOperationPage?: ResourcePage | null;\n};\n\nexport type BackofficeRouterContext = {\n relayEnvironment: Environment;\n};\n\nexport const WrapperPageResource: ResourcePage | null = getResourcePage(\n 'WrapperPage',\n // eslint-disable-next-line arrow-body-style\n async () => ({\n default: (await import('@plumile/ui/pages/WrapperPage.js')).WrapperPage,\n }),\n);\n\nexport const BackofficeLayoutPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeLayoutPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeLayoutPage.js'),\n );\n\nexport const BackofficeEntityListPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityListPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityListPage.js'),\n );\n\nexport const BackofficeEntityListShellPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityListShellPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityListShellPage.js'),\n );\n\nexport const BackofficeEntityListDataPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityListDataPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityListDataPage.js'),\n );\n\nexport const BackofficeEntityDetailPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailPage.js'),\n );\n\nexport const BackofficeEntityDetailFramePageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailFramePage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailFramePage.js'),\n );\n\nexport const BackofficeEntityDetailLayoutPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailLayoutPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailLayoutPage.js'),\n );\n\nexport const BackofficeEntityDetailPageConfigPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailPageConfigPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailPageConfigPage.js'),\n );\n\nexport const BackofficeEntityDetailShellPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailShellPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailShellPage.js'),\n );\n\nexport const BackofficeEntityDetailUnknownPageRedirectResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailUnknownPageRedirect',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailUnknownPageRedirect.js'),\n );\n\nexport const BackofficeDashboardPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeDashboardPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeDashboardPage.js'),\n );\n\nexport const BackofficeDashboardShellPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeDashboardShellPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeDashboardShellPage.js'),\n );\n\nexport const BackofficeToolShellPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeToolShellPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeToolShellPage.js'),\n );\n\nexport const BackofficeHubPageResource: ResourcePage | null = getResourcePage(\n 'BackofficeHubPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeHubPage.js'),\n);\n\nexport const BackofficeLoginPageResource: ResourcePage | null = getResourcePage(\n 'BackofficeLoginPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeLoginPage.js'),\n);\n\nexport const BackofficePasswordResetRequestPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficePasswordResetRequestPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficePasswordResetRequestPage.js'),\n );\n\nexport const BackofficePasswordResetCompletePageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficePasswordResetCompletePage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficePasswordResetCompletePage.js'),\n );\n\nexport const BackofficeVerifyEmailPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeVerifyEmailPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeVerifyEmailPage.js'),\n );\n\nexport const BackofficeAcceptInvitationPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeAcceptInvitationPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeAcceptInvitationPage.js'),\n );\n\ntype PreparedLayout = {\n permissionsQuery: PreloadedQuery<OperationType> | null;\n authStatusQuery: PreloadedQuery<OperationType> | null;\n};\n\nexport type BackofficePreparedDashboardShellRoute = {\n dashboardId: string | null;\n label?: I18nLabel;\n};\n\nexport type BackofficePreparedDashboardRoute =\n BackofficePreparedDashboardShellRoute & {\n config: BackofficeDashboardConfig;\n };\n\ntype LayoutAuthStatus = {\n isLoggedIn?: boolean | null;\n me?: {\n id: string;\n firstName: string;\n lastName: string;\n email: string;\n initials: string;\n } | null;\n} | null;\n\ntype LayoutRouteComponent = ComponentType<{\n children: ReactNode;\n permissionsQuery?: GraphQLTaggedNode;\n prepared?: PreloadedQuery<OperationType> | null;\n authStatus?: LayoutAuthStatus;\n activeGroupId?: string | null;\n}>;\n\ntype LayoutRouteRenderProps = {\n children: ReactNode;\n Component: LayoutRouteComponent;\n preparedLayout: PreparedLayout | undefined;\n permissionsQuery: GraphQLTaggedNode | undefined;\n activeGroupId: string | null;\n};\n\nconst BackofficeHistoryRedirect = ({\n pathname,\n}: {\n pathname: string;\n}): null => {\n const router = useContext(RoutingContext);\n\n useEffect(() => {\n router?.history.set({\n pathname,\n });\n }, [pathname, router]);\n\n return null;\n};\n\nconst BackofficeLayoutRouteWithoutAuthStatus = ({\n children,\n Component,\n preparedLayout,\n permissionsQuery,\n activeGroupId,\n}: LayoutRouteRenderProps): JSX.Element => {\n return (\n <Component\n permissionsQuery={permissionsQuery}\n prepared={preparedLayout?.permissionsQuery ?? null}\n authStatus={null}\n activeGroupId={activeGroupId}\n >\n {children}\n </Component>\n );\n};\n\nconst BackofficeLayoutRouteWithAuthStatus = ({\n children,\n Component,\n preparedLayout,\n permissionsQuery,\n activeGroupId,\n authStatusQuery,\n authStatusPrepared,\n loginRedirectPath,\n}: LayoutRouteRenderProps & {\n authStatusQuery: GraphQLTaggedNode;\n authStatusPrepared: PreloadedQuery<OperationType>;\n loginRedirectPath: string;\n}): JSX.Element => {\n const data = usePreloadedQuery(authStatusQuery, authStatusPrepared);\n const authStatus = data as LayoutAuthStatus;\n\n if (authStatus?.isLoggedIn !== true) {\n return <BackofficeHistoryRedirect pathname={loginRedirectPath} />;\n }\n\n return (\n <Component\n permissionsQuery={permissionsQuery}\n prepared={preparedLayout?.permissionsQuery ?? null}\n authStatus={authStatus}\n activeGroupId={activeGroupId}\n >\n {children}\n </Component>\n );\n};\n\nexport type BackofficePreparedHubRoute = {\n hubId: string;\n hub: BackofficeResolvedSidebarHubConfig;\n};\n\nconst normalizeBaseSegment = (value: string): string => {\n const trimmed = value.trim();\n if (trimmed === '' || trimmed === '/') {\n return '';\n }\n return trimmed.replace(/^\\/+|\\/+$/g, '');\n};\n\nconst normalizePath = (value: string): string => {\n const trimmed = value.trim();\n if (trimmed === '') {\n return '/';\n }\n return `/${trimmed}`.replace(/\\/+/g, '/');\n};\n\nconst buildScopedPath = (baseSegment: string, path: string): string => {\n const normalizedPath = path.replace(/^\\/+|\\/+$/g, '');\n if (baseSegment === '') {\n return normalizedPath;\n }\n if (normalizedPath === '') {\n return baseSegment;\n }\n return `${baseSegment}/${normalizedPath}`;\n};\n\nconst buildScopedAbsolutePath = (baseSegment: string, path: string): string => {\n return normalizePath(buildScopedPath(baseSegment, path));\n};\n\nconst normalizePagePath = (value: string): string => {\n return value.trim().replace(/^\\/+|\\/+$/g, '');\n};\n\nconst buildRelativePath = (\n absolutePath: string,\n baseSegment: string,\n): string => {\n const normalized = normalizePath(absolutePath);\n const basePrefix = baseSegment === '' ? '' : `/${baseSegment}`;\n if (basePrefix !== '' && normalized.startsWith(basePrefix)) {\n return normalized.slice(basePrefix.length).replace(/^\\/+/, '');\n }\n return normalized.replace(/^\\/+/, '');\n};\n\nconst resolveActiveEntityIdFromRoute = (\n route: { routes: AnyRoute[] } | null,\n routeEntityIdMap: WeakMap<AnyRoute, string>,\n): string | null => {\n if (route?.routes == null) {\n return null;\n }\n for (let index = route.routes.length - 1; index >= 0; index -= 1) {\n const routeEntry = route.routes[index];\n if (routeEntry != null) {\n const entityId = routeEntityIdMap.get(routeEntry);\n if (entityId != null) {\n return entityId;\n }\n }\n }\n return null;\n};\n\nconst resolveDetailPageManifestByPath = (\n entityManifestItem: BackofficeEntityManifestItem,\n rawPagePath: string,\n): BackofficeDetailPageManifestItem | null => {\n const pagePath = normalizePagePath(rawPagePath);\n return (\n entityManifestItem.detailPages?.find((page) => {\n return normalizePagePath(page.pathSegment) === pagePath;\n }) ?? null\n );\n};\n\nconst resolveDetailPageIdForPath = (\n entityManifestItem: BackofficeEntityManifestItem,\n rawPagePath: string,\n): string => {\n return (\n resolveDetailPageManifestByPath(entityManifestItem, rawPagePath)?.id ??\n rawPagePath\n );\n};\n\nconst rBackoffice = r<BackofficeRouterContext>;\n\n/**\n * Creates backoffice routes based on the provided configuration\n */\nexport function createBackofficeRoutes(\n input: CreateBackofficeRoutesInput,\n): Route<BackofficeRouterContext, any>[] {\n const { basePath, entityManifest, entityRegistry, sidebar, auth, dashboard } =\n input;\n const dashboards = validateBackofficeDashboardRegistrations(input.dashboards);\n const baseSegment = normalizeBaseSegment(basePath);\n const loginPath = buildScopedPath(baseSegment, 'login');\n const passwordResetRequestPath = buildScopedPath(baseSegment, 'login/reset');\n const passwordResetCompletePath = buildScopedPath(\n baseSegment,\n 'login/reset/complete',\n );\n const verifyEmailPath = buildScopedPath(baseSegment, 'verify-email');\n const acceptInvitationPath = buildScopedPath(\n baseSegment,\n 'accept-invitation',\n );\n const loginRedirectPath = buildScopedAbsolutePath(baseSegment, 'login');\n const entities = entityManifest;\n const groups = resolveSidebarGroups(entities, sidebar);\n const hubEntries = resolveSidebarHubEntries(groups, sidebar);\n const entityGroupLookup = buildEntityGroupLookup(groups, sidebar);\n const entityIdToGroupId = new Map<string, string>();\n entityGroupLookup.forEach((value, entityId) => {\n entityIdToGroupId.set(entityId, value.groupId);\n });\n const routeEntityIdMap = new WeakMap<AnyRoute, string>();\n const routeGroupIdMap = new WeakMap<AnyRoute, string>();\n\n const permissionsQuery = sidebar?.permissionsQuery;\n const layoutPrepare = async ({\n context,\n }: {\n context: BackofficeRouterContext;\n }) => {\n const sessionAuth = await auth.session.load();\n const permissionsQueryRef =\n permissionsQuery != null\n ? loadQuery<OperationType>(\n context.relayEnvironment,\n permissionsQuery,\n {},\n )\n : null;\n const authStatusQueryRef =\n sessionAuth.authStatusQuery != null\n ? loadQuery<OperationType>(\n context.relayEnvironment,\n sessionAuth.authStatusQuery,\n {},\n { fetchPolicy: 'network-only' },\n )\n : null;\n return {\n permissionsQuery: permissionsQueryRef,\n authStatusQuery: authStatusQueryRef,\n };\n };\n\n const prepareRootDashboard =\n async (): Promise<BackofficePreparedDashboardRoute | null> => {\n if (dashboard == null) {\n return null;\n }\n const config = await dashboard.load();\n return {\n dashboardId: 'dashboard',\n config,\n };\n };\n const prepareRootDashboardShell =\n (): BackofficePreparedDashboardShellRoute | null => {\n if (dashboard == null) {\n return null;\n }\n return {\n dashboardId: 'dashboard',\n };\n };\n const renderDashboard = ({\n prepared,\n Component,\n }: {\n prepared: unknown;\n Component?: ComponentType<Record<string, unknown>> | null;\n }): JSX.Element | null => {\n if (Component == null) {\n return null;\n }\n const DashboardComponent = Component as ComponentType<{\n prepared?: unknown;\n }>;\n return <DashboardComponent prepared={prepared} />;\n };\n const renderDashboardShell = ({\n children: dashboardChildren,\n prepared,\n Component,\n }: {\n children: ReactNode;\n prepared: unknown;\n Component?: ComponentType<Record<string, unknown>> | null;\n }): JSX.Element | null => {\n if (Component == null) {\n return null;\n }\n const DashboardShellComponent = Component as ComponentType<{\n children?: ReactNode;\n prepared?: BackofficePreparedDashboardShellRoute | null;\n }>;\n return (\n <DashboardShellComponent\n prepared={prepared as BackofficePreparedDashboardShellRoute | null}\n >\n {dashboardChildren}\n </DashboardShellComponent>\n );\n };\n\n const dashboardConfigRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeDashboardPageResource,\n prepare: prepareRootDashboard,\n render: renderDashboard,\n });\n const dashboardRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeDashboardShellPageResource,\n prepare: prepareRootDashboardShell,\n render: renderDashboardShell,\n children: [dashboardConfigRoute],\n });\n const dashboardAliasConfigRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeDashboardPageResource,\n prepare: prepareRootDashboard,\n render: renderDashboard,\n });\n const dashboardAliasRoute = rBackoffice({\n path: 'dashboard',\n resourcePage: BackofficeDashboardShellPageResource,\n prepare: prepareRootDashboardShell,\n render: renderDashboardShell,\n children: [dashboardAliasConfigRoute],\n });\n const secondaryDashboardRoutes = dashboards.map((registration) => {\n const dashboardConfigChildRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeDashboardPageResource,\n prepare: async () => {\n const config = await registration.module.load();\n return {\n dashboardId: registration.id,\n label: registration.label,\n config,\n } satisfies BackofficePreparedDashboardRoute;\n },\n render: renderDashboard,\n });\n return rBackoffice({\n path: `dashboard/${registration.id}`,\n resourcePage: BackofficeDashboardShellPageResource,\n prepare: () => {\n return {\n dashboardId: registration.id,\n label: registration.label,\n } satisfies BackofficePreparedDashboardShellRoute;\n },\n render: renderDashboardShell,\n children: [dashboardConfigChildRoute],\n });\n });\n\n const listEntityEntries = Object.values(entityManifest).filter((entity) => {\n return entity.kind === 'list-detail';\n });\n\n const hubRoutes = hubEntries.map((entry) => {\n const hubRelative = buildRelativePath(entry.hub.href, baseSegment);\n const hubRoute = rBackoffice({\n path: hubRelative,\n resourcePage: BackofficeHubPageResource,\n prepare: () => {\n return {\n hubId: entry.hub.id,\n hub: entry.hub,\n } satisfies BackofficePreparedHubRoute;\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component prepared={prepared} />;\n },\n });\n if (entry.groupId != null) {\n routeGroupIdMap.set(hubRoute, entry.groupId);\n }\n return hubRoute;\n });\n\n const entityRoutes = listEntityEntries.map((entityManifestItem) => {\n const listPath = entityManifestItem.routes.list;\n const listRelative = buildRelativePath(listPath, baseSegment);\n const children: Route<any, any>[] = [];\n const renderDetailRouteFallback = ({\n match,\n }: RouteFallbackArgs<BackofficeRouterContext>): JSX.Element => {\n const rawId = String(match?.params.id ?? '');\n const rawPagePath =\n typeof match?.params.pagePath === 'string'\n ? match.params.pagePath\n : null;\n const pageId =\n rawPagePath == null\n ? (entityManifestItem.defaultDetailPageId ?? 'overview')\n : resolveDetailPageIdForPath(entityManifestItem, rawPagePath);\n return (\n <BackofficeEntityDetailManifestFallback\n entityManifest={entityManifestItem}\n id={rawId}\n pageId={pageId}\n pagePath={rawPagePath}\n />\n );\n };\n\n if (entityManifestItem.hasList) {\n const listDataRoute = rBackoffice({\n path: '',\n querySchema: entityManifestItem.listNavigation.querySchema,\n resourcePage: BackofficeEntityListDataPageResource,\n prepareSearchBehavior: 'path',\n prepare: async ({ context, filters, query }) => {\n const entityModule = await entityRegistry.loadListEntity(\n entityManifestItem.id,\n );\n const { config } = entityModule;\n const { list } = config;\n const { defaults: listDefaults } = entityManifestItem.listNavigation;\n const navigationQuery: { sort?: string } = {};\n if (typeof query.sort === 'string') {\n navigationQuery.sort = query.sort;\n }\n const navigationFilters = filters as Parameters<\n typeof entityManifestItem.listNavigation.decode\n >[0]['filters'];\n const state = entityManifestItem.listNavigation.decode({\n filters: navigationFilters,\n query: navigationQuery,\n });\n const { pageSize } = BACKOFFICE_LIST_DEFAULTS;\n const variablesBase = {\n where: state.where,\n sort: state.sort ?? listDefaults.sort,\n count: pageSize,\n cursor: null,\n };\n const variables = list.buildQueryVariables(variablesBase);\n const queryRef = loadQuery<OperationType>(\n context.relayEnvironment,\n list.query,\n variables,\n );\n const prepared: BackofficePreparedListDataRoute = {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n entityConfig: config,\n query: queryRef,\n };\n return prepared;\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute = prepared as BackofficePreparedListDataRoute;\n return <Component prepared={preparedRoute} />;\n },\n });\n routeEntityIdMap.set(listDataRoute, entityManifestItem.id);\n\n const listRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeEntityListPageResource,\n prepareSearchBehavior: 'path',\n prepare: async () => {\n const entityModule = await entityRegistry.loadListEntity(\n entityManifestItem.id,\n );\n const { config } = entityModule;\n const prepared: BackofficePreparedListLayoutRoute = {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n entityConfig: config,\n };\n return prepared;\n },\n render: ({ children: listChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute = prepared as BackofficePreparedListLayoutRoute;\n return (\n <Component\n entityManifest={preparedRoute.entityManifest}\n config={preparedRoute.entityConfig}\n prepared={preparedRoute}\n >\n {listChildren}\n </Component>\n );\n },\n children: [listDataRoute],\n });\n routeEntityIdMap.set(listRoute, entityManifestItem.id);\n\n const listShellRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeEntityListShellPageResource,\n prepareSearchBehavior: 'path',\n prepare: () => {\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n } satisfies BackofficePreparedListShellRoute;\n },\n render: ({ children: listShellChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute = prepared as BackofficePreparedListShellRoute;\n return (\n <Component\n entityManifest={preparedRoute.entityManifest}\n prepared={preparedRoute}\n >\n {listShellChildren}\n </Component>\n );\n },\n children: [listRoute],\n });\n routeEntityIdMap.set(listShellRoute, entityManifestItem.id);\n children.push(listShellRoute);\n }\n\n const detailPageRoutes = (entityManifestItem.detailPages ?? []).map(\n (pageManifest) => {\n const pageDataRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeEntityDetailPageResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: async ({ context, variables }) => {\n const rawId = String(variables.id ?? '');\n const pageModule = await entityRegistry.loadDetailPageEntity(\n entityManifestItem.id,\n pageManifest.id,\n );\n const pageBuildResult =\n pageModule.config.page.buildVariables != null\n ? pageModule.config.page.buildVariables({\n id: rawId,\n })\n : { variables: { id: rawId } };\n const pageQueryRef = loadQuery<OperationType>(\n context.relayEnvironment,\n pageModule.config.page.query,\n pageBuildResult.variables as Variables,\n );\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n detailId: pageBuildResult.detailId,\n id: rawId,\n pageConfig: pageModule.config,\n pageQuery: pageQueryRef,\n pageId: pageManifest.id,\n pagePath: pageManifest.pathSegment,\n } satisfies BackofficePreparedDetailPageDataRoute;\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute =\n prepared as BackofficePreparedDetailPageDataRoute;\n return <Component prepared={preparedRoute} />;\n },\n });\n routeEntityIdMap.set(pageDataRoute, entityManifestItem.id);\n\n const pageConfigRoute = rBackoffice({\n path: pageManifest.pathSegment,\n resourcePage: BackofficeEntityDetailPageConfigPageResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: async ({ variables }) => {\n const rawId = String(variables.id ?? '');\n const [pageModule, layoutModule] = await Promise.all([\n entityRegistry.loadDetailPageEntity(\n entityManifestItem.id,\n pageManifest.id,\n ),\n entityRegistry.loadDetailLayoutEntity(entityManifestItem.id),\n ]);\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n entityConfig: layoutModule.config,\n id: rawId,\n pageConfig: pageModule.config,\n pageId: pageManifest.id,\n pagePath: pageManifest.pathSegment,\n } satisfies BackofficePreparedDetailPageConfigRoute;\n },\n render: ({ children: pageChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute =\n prepared as BackofficePreparedDetailPageConfigRoute;\n return (\n <Component\n config={preparedRoute.entityConfig}\n prepared={preparedRoute}\n >\n {pageChildren}\n </Component>\n );\n },\n children: [pageDataRoute],\n });\n routeEntityIdMap.set(pageConfigRoute, entityManifestItem.id);\n return pageConfigRoute;\n },\n );\n\n const detailLayoutDataRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeEntityDetailLayoutPageResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: async ({ context, variables }) => {\n const entityModule = await entityRegistry.loadDetailLayoutEntity(\n entityManifestItem.id,\n );\n const { config } = entityModule;\n const rawId = String(variables.id ?? '');\n const layoutBuildResult =\n config.layoutPage.buildVariables != null\n ? config.layoutPage.buildVariables({\n id: rawId,\n })\n : { variables: { id: rawId } };\n const layoutQueryRef = loadQuery<OperationType>(\n context.relayEnvironment,\n config.layoutPage.query,\n layoutBuildResult.variables as Variables,\n );\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n entityConfig: config,\n layoutQuery: layoutQueryRef,\n id: rawId,\n } satisfies BackofficePreparedDetailLayoutDataRoute;\n },\n render: ({ children: detailChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute =\n prepared as BackofficePreparedDetailLayoutDataRoute;\n return (\n <Component\n entityManifest={preparedRoute.entityManifest}\n config={preparedRoute.entityConfig}\n prepared={preparedRoute}\n >\n {detailChildren}\n </Component>\n );\n },\n children: [\n rBackoffice({\n path: '',\n resourcePage: WrapperPageResource,\n prepare: ({ variables }) => {\n const rawId = String(variables.id ?? '').trim();\n return {\n redirectTo:\n rawId === ''\n ? null\n : entityManifestItem.routes.detailPage(\n rawId,\n entityManifestItem.defaultDetailPageId ?? 'overview',\n ),\n };\n },\n render: ({ prepared }) => {\n const redirectTo =\n (prepared as { redirectTo?: string | null }).redirectTo ?? null;\n if (redirectTo == null) {\n return null;\n }\n return <BackofficeHistoryRedirect pathname={redirectTo} />;\n },\n }),\n ...detailPageRoutes,\n rBackoffice({\n path: ':pagePath',\n resourcePage: BackofficeEntityDetailUnknownPageRedirectResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: async ({ variables }) => {\n const entityModule = await entityRegistry.loadDetailLayoutEntity(\n entityManifestItem.id,\n );\n const rawId = String(variables.id ?? '');\n const rawPagePath = String(variables.pagePath ?? '');\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n entityConfig: entityModule.config,\n id: rawId,\n pagePath: rawPagePath,\n } satisfies BackofficePreparedDetailUnknownPageRoute;\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedDetail =\n prepared as BackofficePreparedDetailUnknownPageRoute;\n return (\n <Component\n entityManifest={preparedDetail.entityManifest}\n config={preparedDetail.entityConfig}\n prepared={preparedDetail}\n />\n );\n },\n }),\n ],\n });\n routeEntityIdMap.set(detailLayoutDataRoute, entityManifestItem.id);\n\n const detailShellRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeEntityDetailShellPageResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: ({ variables }) => {\n const rawId = String(variables.id ?? '');\n const rawPagePath =\n typeof variables.pagePath === 'string' ? variables.pagePath : null;\n const pageId =\n rawPagePath == null\n ? (entityManifestItem.defaultDetailPageId ?? 'overview')\n : resolveDetailPageIdForPath(entityManifestItem, rawPagePath);\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n id: rawId,\n pageId,\n pagePath: rawPagePath,\n } satisfies BackofficePreparedDetailShellRoute;\n },\n render: ({ children: shellChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute = prepared as BackofficePreparedDetailShellRoute;\n return (\n <Component\n entityManifest={preparedRoute.entityManifest}\n prepared={preparedRoute}\n >\n {shellChildren}\n </Component>\n );\n },\n children: [detailLayoutDataRoute],\n });\n routeEntityIdMap.set(detailShellRoute, entityManifestItem.id);\n\n const detailFrameRoute = rBackoffice({\n path: ':id',\n resourcePage: BackofficeEntityDetailFramePageResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: ({ variables }) => {\n const rawId = String(variables.id ?? '');\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n id: rawId,\n } satisfies BackofficePreparedDetailFrameRoute;\n },\n render: ({ children: detailChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute = prepared as BackofficePreparedDetailFrameRoute;\n return (\n <Component\n entityManifest={preparedRoute.entityManifest}\n prepared={preparedRoute}\n >\n {detailChildren}\n </Component>\n );\n },\n children: [detailShellRoute],\n });\n routeEntityIdMap.set(detailFrameRoute, entityManifestItem.id);\n children.push(detailFrameRoute);\n\n return rBackoffice({\n path: listRelative,\n children,\n resourcePage: WrapperPageResource,\n suspenseBoundary: 'segment',\n });\n });\n\n const toolsRoutes = Object.values(entityManifest)\n .filter((entity) => {\n return entity.kind === 'tool';\n })\n .map((toolManifest) => {\n const toolRelative = buildRelativePath(\n toolManifest.routes.list,\n baseSegment,\n );\n const toolConfigRoute = rBackoffice({\n path: '',\n resourcePage: input.toolsOperationPage ?? null,\n prepare: async () => {\n const toolModule = await entityRegistry.loadToolEntity(\n toolManifest.id,\n );\n return {\n entityId: toolManifest.id,\n entityManifest: toolManifest,\n entityConfig: toolModule.config,\n } satisfies BackofficePreparedToolConfigRoute;\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedTool = prepared as BackofficePreparedToolConfigRoute;\n return (\n <Component\n entityManifest={preparedTool.entityManifest}\n operation={preparedTool.entityConfig.tool.operation}\n toolId={preparedTool.entityConfig.id}\n />\n );\n },\n });\n routeEntityIdMap.set(toolConfigRoute, toolManifest.id);\n\n const toolRoute = rBackoffice({\n path: toolRelative,\n resourcePage: BackofficeToolShellPageResource,\n prepare: () => {\n return {\n entityId: toolManifest.id,\n entityManifest: toolManifest,\n } satisfies BackofficePreparedToolRoute;\n },\n render: ({ children: toolChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedTool = prepared as BackofficePreparedToolRoute;\n return (\n <Component\n entityManifest={preparedTool.entityManifest}\n prepared={preparedTool}\n >\n {toolChildren}\n </Component>\n );\n },\n children: [toolConfigRoute],\n });\n routeEntityIdMap.set(toolRoute, toolManifest.id);\n return toolRoute;\n });\n\n const layoutRoute = rBackoffice({\n path: baseSegment,\n resourcePage: BackofficeLayoutPageResource,\n prepareSearchBehavior: 'path',\n suspenseBoundary: 'segment',\n prepare: layoutPrepare,\n render: ({ children, prepared, route, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedLayout = prepared as PreparedLayout | undefined;\n const activeEntityId = resolveActiveEntityIdFromRoute(\n route,\n routeEntityIdMap,\n );\n const activeGroupId =\n activeEntityId != null\n ? (entityIdToGroupId.get(activeEntityId) ?? null)\n : resolveActiveEntityIdFromRoute(route, routeGroupIdMap);\n const LayoutComponent = Component as LayoutRouteComponent;\n const authStatusQuery = auth.session.get()?.authStatusQuery ?? null;\n if (authStatusQuery != null && preparedLayout?.authStatusQuery != null) {\n return (\n <BackofficeLayoutRouteWithAuthStatus\n Component={LayoutComponent}\n preparedLayout={preparedLayout}\n permissionsQuery={sidebar?.permissionsQuery}\n activeGroupId={activeGroupId}\n authStatusQuery={authStatusQuery}\n authStatusPrepared={preparedLayout.authStatusQuery}\n loginRedirectPath={loginRedirectPath}\n >\n {children}\n </BackofficeLayoutRouteWithAuthStatus>\n );\n }\n return (\n <BackofficeLayoutRouteWithoutAuthStatus\n Component={LayoutComponent}\n preparedLayout={preparedLayout}\n permissionsQuery={sidebar?.permissionsQuery}\n activeGroupId={activeGroupId}\n >\n {children}\n </BackofficeLayoutRouteWithoutAuthStatus>\n );\n },\n children: [\n dashboardRoute,\n ...hubRoutes,\n ...entityRoutes,\n ...toolsRoutes,\n ...secondaryDashboardRoutes,\n dashboardAliasRoute,\n ],\n });\n\n const routes: Route<BackofficeRouterContext, any>[] = [\n rBackoffice({\n path: loginPath,\n resourcePage: BackofficeLoginPageResource,\n prepare: async ({ context }) => {\n const loginAuth = await auth.login.load();\n const queryRef = loadQuery<OperationType>(\n context.relayEnvironment,\n loginAuth.loginQuery,\n {},\n );\n return { query: queryRef };\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component prepared={prepared} />;\n },\n }),\n rBackoffice({\n path: passwordResetRequestPath,\n resourcePage: BackofficePasswordResetRequestPageResource,\n prepare: async () => {\n await auth.passwordResetRequest.load();\n return null;\n },\n render: ({ Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component />;\n },\n }),\n rBackoffice({\n path: passwordResetCompletePath,\n resourcePage: BackofficePasswordResetCompletePageResource,\n prepare: async () => {\n await auth.passwordResetComplete.load();\n return null;\n },\n render: ({ Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component />;\n },\n }),\n rBackoffice({\n path: verifyEmailPath,\n resourcePage: BackofficeVerifyEmailPageResource,\n prepare: async () => {\n await auth.verifyEmail.load();\n return null;\n },\n render: ({ Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component />;\n },\n }),\n ];\n\n if (auth.hasAcceptInvitation === true || auth.acceptInvitation != null) {\n routes.push(\n rBackoffice({\n path: acceptInvitationPath,\n resourcePage: BackofficeAcceptInvitationPageResource,\n prepare: async () => {\n await auth.acceptInvitation?.load();\n return null;\n },\n render: ({ Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component />;\n },\n }),\n );\n }\n\n routes.push(layoutRoute);\n\n return routes;\n}\n\nexport const __test = {\n normalizeBaseSegment,\n normalizePath,\n buildScopedPath,\n buildScopedAbsolutePath,\n buildRelativePath,\n resolveActiveEntityIdFromRoute,\n resolveDetailPageIdForPath,\n resolveDetailPageManifestByPath,\n validateBackofficeDashboardRegistrations,\n BackofficeLayoutRouteWithAuthStatus,\n} as const;\n\nexport default createBackofficeRoutes;\n"],"mappings":";;;;;;;;;;;AAgEA,IAAM,EAAE,WAAA,GAAW,mBAAA,MAAsB,GAiB5B,IAA2C,EACtD,eAEA,aAAa,EACX,UAAU,MAAM,OAAO,oCAAA,CAAqC,YAC9D,EACF,GAEa,IACX,EACE,wBAEA,YAAY,OAAO,mCACrB,GAEW,IACX,EACE,4BAEA,YAAY,OAAO,uCACrB,GAEW,IACX,EACE,iCAEA,YAAY,OAAO,4CACrB,GAEW,IACX,EACE,gCAEA,YAAY,OAAO,2CACrB,GAEW,KACX,EACE,8BAEA,YAAY,OAAO,yCACrB,GAEW,IACX,EACE,mCAEA,YAAY,OAAO,8CACrB,GAEW,IACX,EACE,oCAEA,YAAY,OAAO,+CACrB,GAEW,IACX,EACE,wCAEA,YAAY,OAAO,mDACrB,GAEW,IACX,EACE,mCAEA,YAAY,OAAO,8CACrB,GAEW,IACX,EACE,6CAEA,YAAY,OAAO,wDACrB,GAEW,IACX,EACE,2BAEA,YAAY,OAAO,sCACrB,GAEW,IACX,EACE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officeRoutes.js","names":[],"sources":["../../../src/router/createBackofficeRoutes.tsx"],"sourcesContent":["/* eslint-disable no-ternary */\nimport {\n useContext,\n useEffect,\n type ComponentType,\n type JSX,\n type ReactNode,\n} from 'react';\nimport {\n getResourcePage,\n type ResourcePage,\n} from '@plumile/router/ResourcePage.js';\nimport RoutingContext from '@plumile/router/routing/RoutingContext.js';\nimport { r } from '@plumile/router/tools.js';\nimport {\n type AnyRoute,\n type Route,\n type RouteFallbackArgs,\n} from '@plumile/router/types.js';\nimport * as ReactRelay from 'react-relay';\nimport type { PreloadedQuery } from 'react-relay';\nimport type {\n Environment,\n GraphQLTaggedNode,\n OperationType,\n Variables,\n} from 'relay-runtime';\n\nimport { BACKOFFICE_LIST_DEFAULTS } from '@plumile/backoffice-core/constants.js';\nimport type {\n BackofficeDashboardConfig,\n BackofficeDetailPageManifestItem,\n BackofficeEntityManifestItem,\n BackofficeEntityManifestMap,\n I18nLabel,\n BackofficePreparedDetailFrameRoute,\n BackofficePreparedDetailLayoutDataRoute,\n BackofficePreparedDetailPageConfigRoute,\n BackofficePreparedDetailPageDataRoute,\n BackofficePreparedDetailShellRoute,\n BackofficePreparedDetailUnknownPageRoute,\n BackofficePreparedListDataRoute,\n BackofficePreparedListLayoutRoute,\n BackofficePreparedListShellRoute,\n BackofficePreparedToolConfigRoute,\n BackofficePreparedToolRoute,\n} from '@plumile/backoffice-core/types.js';\n\nimport type {\n BackofficeAuthConfig,\n BackofficeDashboardRegistration,\n BackofficeDashboardModule,\n BackofficeResolvedSidebarHubConfig,\n BackofficeSidebarConfig,\n} from '../provider/types.js';\nimport {\n buildEntityGroupLookup,\n resolveSidebarHubEntries,\n resolveSidebarGroups,\n} from '../components/backoffice/layout/sidebarUtils.js';\nimport type { BackofficeEntityRegistry } from '../provider/entityRegistry.js';\nimport { validateBackofficeDashboardRegistrations } from '../provider/dashboardRegistrations.js';\nimport { BackofficeEntityDetailManifestFallback } from '../pages/detail/BackofficeEntityDetailManifestFallback.js';\n\nconst { loadQuery, usePreloadedQuery } = ReactRelay;\n\nexport type CreateBackofficeRoutesInput = {\n basePath: string;\n entityManifest: BackofficeEntityManifestMap;\n entityRegistry: BackofficeEntityRegistry;\n sidebar?: BackofficeSidebarConfig;\n auth: BackofficeAuthConfig;\n dashboard?: BackofficeDashboardModule;\n dashboards?: readonly BackofficeDashboardRegistration[];\n toolsOperationPage?: ResourcePage | null;\n};\n\nexport type BackofficeRouterContext = {\n relayEnvironment: Environment;\n};\n\nexport const WrapperPageResource: ResourcePage | null = getResourcePage(\n 'WrapperPage',\n // eslint-disable-next-line arrow-body-style\n async () => ({\n default: (await import('@plumile/ui/pages/WrapperPage.js')).WrapperPage,\n }),\n);\n\nexport const BackofficeLayoutPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeLayoutPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeLayoutPage.js'),\n );\n\nexport const BackofficeEntityListPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityListPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityListPage.js'),\n );\n\nexport const BackofficeEntityListShellPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityListShellPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityListShellPage.js'),\n );\n\nexport const BackofficeEntityListDataPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityListDataPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityListDataPage.js'),\n );\n\nexport const BackofficeEntityDetailPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailPage.js'),\n );\n\nexport const BackofficeEntityDetailFramePageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailFramePage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailFramePage.js'),\n );\n\nexport const BackofficeEntityDetailLayoutPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailLayoutPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailLayoutPage.js'),\n );\n\nexport const BackofficeEntityDetailPageConfigPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailPageConfigPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailPageConfigPage.js'),\n );\n\nexport const BackofficeEntityDetailShellPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailShellPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailShellPage.js'),\n );\n\nexport const BackofficeEntityDetailUnknownPageRedirectResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeEntityDetailUnknownPageRedirect',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeEntityDetailUnknownPageRedirect.js'),\n );\n\nexport const BackofficeDashboardPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeDashboardPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeDashboardPage.js'),\n );\n\nexport const BackofficeDashboardShellPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeDashboardShellPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeDashboardShellPage.js'),\n );\n\nexport const BackofficeToolShellPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeToolShellPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeToolShellPage.js'),\n );\n\nexport const BackofficeHubPageResource: ResourcePage | null = getResourcePage(\n 'BackofficeHubPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeHubPage.js'),\n);\n\nexport const BackofficeLoginPageResource: ResourcePage | null = getResourcePage(\n 'BackofficeLoginPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeLoginPage.js'),\n);\n\nexport const BackofficePasswordResetRequestPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficePasswordResetRequestPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficePasswordResetRequestPage.js'),\n );\n\nexport const BackofficePasswordResetCompletePageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficePasswordResetCompletePage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficePasswordResetCompletePage.js'),\n );\n\nexport const BackofficeVerifyEmailPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeVerifyEmailPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeVerifyEmailPage.js'),\n );\n\nexport const BackofficeAcceptInvitationPageResource: ResourcePage | null =\n getResourcePage(\n 'BackofficeAcceptInvitationPage',\n // eslint-disable-next-line arrow-body-style\n async () => import('../pages/BackofficeAcceptInvitationPage.js'),\n );\n\ntype PreparedLayout = {\n permissionsQuery: PreloadedQuery<OperationType> | null;\n authStatusQuery: PreloadedQuery<OperationType> | null;\n};\n\nexport type BackofficePreparedDashboardShellRoute = {\n dashboardId: string | null;\n label?: I18nLabel;\n};\n\nexport type BackofficePreparedDashboardRoute =\n BackofficePreparedDashboardShellRoute & {\n config: BackofficeDashboardConfig;\n };\n\ntype LayoutAuthStatus = {\n isLoggedIn?: boolean | null;\n me?: {\n id: string;\n firstName: string;\n lastName: string;\n email: string;\n initials: string;\n } | null;\n} | null;\n\ntype LayoutRouteComponent = ComponentType<{\n children: ReactNode;\n permissionsQuery?: GraphQLTaggedNode;\n prepared?: PreloadedQuery<OperationType> | null;\n authStatus?: LayoutAuthStatus;\n activeGroupId?: string | null;\n}>;\n\ntype LayoutRouteRenderProps = {\n children: ReactNode;\n Component: LayoutRouteComponent;\n preparedLayout: PreparedLayout | undefined;\n permissionsQuery: GraphQLTaggedNode | undefined;\n activeGroupId: string | null;\n};\n\nconst BackofficeHistoryRedirect = ({\n pathname,\n}: {\n pathname: string;\n}): null => {\n const router = useContext(RoutingContext);\n\n useEffect(() => {\n router?.history.set({\n pathname,\n });\n }, [pathname, router]);\n\n return null;\n};\n\nconst BackofficeLayoutRouteWithoutAuthStatus = ({\n children,\n Component,\n preparedLayout,\n permissionsQuery,\n activeGroupId,\n}: LayoutRouteRenderProps): JSX.Element => {\n return (\n <Component\n permissionsQuery={permissionsQuery}\n prepared={preparedLayout?.permissionsQuery ?? null}\n authStatus={null}\n activeGroupId={activeGroupId}\n >\n {children}\n </Component>\n );\n};\n\nconst BackofficeLayoutRouteWithAuthStatus = ({\n children,\n Component,\n preparedLayout,\n permissionsQuery,\n activeGroupId,\n authStatusQuery,\n authStatusPrepared,\n loginRedirectPath,\n}: LayoutRouteRenderProps & {\n authStatusQuery: GraphQLTaggedNode;\n authStatusPrepared: PreloadedQuery<OperationType>;\n loginRedirectPath: string;\n}): JSX.Element => {\n const data = usePreloadedQuery(authStatusQuery, authStatusPrepared);\n const authStatus = data as LayoutAuthStatus;\n\n if (authStatus?.isLoggedIn !== true) {\n return <BackofficeHistoryRedirect pathname={loginRedirectPath} />;\n }\n\n return (\n <Component\n permissionsQuery={permissionsQuery}\n prepared={preparedLayout?.permissionsQuery ?? null}\n authStatus={authStatus}\n activeGroupId={activeGroupId}\n >\n {children}\n </Component>\n );\n};\n\nexport type BackofficePreparedHubRoute = {\n hubId: string;\n hub: BackofficeResolvedSidebarHubConfig;\n};\n\nconst normalizeBaseSegment = (value: string): string => {\n const trimmed = value.trim();\n if (trimmed === '' || trimmed === '/') {\n return '';\n }\n return trimmed.replace(/^\\/+|\\/+$/g, '');\n};\n\nconst normalizePath = (value: string): string => {\n const trimmed = value.trim();\n if (trimmed === '') {\n return '/';\n }\n return `/${trimmed}`.replace(/\\/+/g, '/');\n};\n\nconst buildScopedPath = (baseSegment: string, path: string): string => {\n const normalizedPath = path.replace(/^\\/+|\\/+$/g, '');\n if (baseSegment === '') {\n return normalizedPath;\n }\n if (normalizedPath === '') {\n return baseSegment;\n }\n return `${baseSegment}/${normalizedPath}`;\n};\n\nconst buildScopedAbsolutePath = (baseSegment: string, path: string): string => {\n return normalizePath(buildScopedPath(baseSegment, path));\n};\n\nconst normalizePagePath = (value: string): string => {\n return value.trim().replace(/^\\/+|\\/+$/g, '');\n};\n\nconst buildRelativePath = (\n absolutePath: string,\n baseSegment: string,\n): string => {\n const normalized = normalizePath(absolutePath);\n const basePrefix = baseSegment === '' ? '' : `/${baseSegment}`;\n if (basePrefix !== '' && normalized.startsWith(basePrefix)) {\n return normalized.slice(basePrefix.length).replace(/^\\/+/, '');\n }\n return normalized.replace(/^\\/+/, '');\n};\n\nconst resolveActiveEntityIdFromRoute = (\n route: { routes: AnyRoute[] } | null,\n routeEntityIdMap: WeakMap<AnyRoute, string>,\n): string | null => {\n if (route?.routes == null) {\n return null;\n }\n for (let index = route.routes.length - 1; index >= 0; index -= 1) {\n const routeEntry = route.routes[index];\n if (routeEntry != null) {\n const entityId = routeEntityIdMap.get(routeEntry);\n if (entityId != null) {\n return entityId;\n }\n }\n }\n return null;\n};\n\nconst resolveDetailPageManifestByPath = (\n entityManifestItem: BackofficeEntityManifestItem,\n rawPagePath: string,\n): BackofficeDetailPageManifestItem | null => {\n const pagePath = normalizePagePath(rawPagePath);\n return (\n entityManifestItem.detailPages?.find((page) => {\n return normalizePagePath(page.pathSegment) === pagePath;\n }) ?? null\n );\n};\n\nconst resolveDetailPageIdForPath = (\n entityManifestItem: BackofficeEntityManifestItem,\n rawPagePath: string,\n): string => {\n return (\n resolveDetailPageManifestByPath(entityManifestItem, rawPagePath)?.id ??\n rawPagePath\n );\n};\n\nconst rBackoffice = r<BackofficeRouterContext>;\n\n/**\n * Creates backoffice routes based on the provided configuration\n */\nexport function createBackofficeRoutes(\n input: CreateBackofficeRoutesInput,\n): Route<BackofficeRouterContext, any>[] {\n const { basePath, entityManifest, entityRegistry, sidebar, auth, dashboard } =\n input;\n const dashboards = validateBackofficeDashboardRegistrations(input.dashboards);\n const baseSegment = normalizeBaseSegment(basePath);\n const loginPath = buildScopedPath(baseSegment, 'login');\n const passwordResetRequestPath = buildScopedPath(baseSegment, 'login/reset');\n const passwordResetCompletePath = buildScopedPath(\n baseSegment,\n 'login/reset/complete',\n );\n const verifyEmailPath = buildScopedPath(baseSegment, 'verify-email');\n const acceptInvitationPath = buildScopedPath(\n baseSegment,\n 'accept-invitation',\n );\n const loginRedirectPath = buildScopedAbsolutePath(baseSegment, 'login');\n const entities = entityManifest;\n const groups = resolveSidebarGroups(entities, sidebar);\n const hubEntries = resolveSidebarHubEntries(groups, sidebar);\n const entityGroupLookup = buildEntityGroupLookup(groups, sidebar);\n const entityIdToGroupId = new Map<string, string>();\n entityGroupLookup.forEach((value, entityId) => {\n entityIdToGroupId.set(entityId, value.groupId);\n });\n const routeEntityIdMap = new WeakMap<AnyRoute, string>();\n const routeGroupIdMap = new WeakMap<AnyRoute, string>();\n\n const permissionsQuery = sidebar?.permissionsQuery;\n const layoutPrepare = async ({\n context,\n }: {\n context: BackofficeRouterContext;\n }) => {\n const sessionAuth = await auth.session.load();\n const permissionsQueryRef =\n permissionsQuery != null\n ? loadQuery<OperationType>(\n context.relayEnvironment,\n permissionsQuery,\n {},\n )\n : null;\n const authStatusQueryRef =\n sessionAuth.authStatusQuery != null\n ? loadQuery<OperationType>(\n context.relayEnvironment,\n sessionAuth.authStatusQuery,\n {},\n { fetchPolicy: 'network-only' },\n )\n : null;\n return {\n permissionsQuery: permissionsQueryRef,\n authStatusQuery: authStatusQueryRef,\n };\n };\n\n const prepareRootDashboard =\n async (): Promise<BackofficePreparedDashboardRoute | null> => {\n if (dashboard == null) {\n return null;\n }\n const config = await dashboard.load();\n return {\n dashboardId: 'dashboard',\n config,\n };\n };\n const prepareRootDashboardShell =\n (): BackofficePreparedDashboardShellRoute | null => {\n if (dashboard == null) {\n return null;\n }\n return {\n dashboardId: 'dashboard',\n };\n };\n const renderDashboard = ({\n prepared,\n Component,\n }: {\n prepared: unknown;\n Component?: ComponentType<Record<string, unknown>> | null;\n }): JSX.Element | null => {\n if (Component == null) {\n return null;\n }\n const DashboardComponent = Component as ComponentType<{\n prepared?: unknown;\n }>;\n return <DashboardComponent prepared={prepared} />;\n };\n const renderDashboardShell = ({\n children: dashboardChildren,\n prepared,\n Component,\n }: {\n children: ReactNode;\n prepared: unknown;\n Component?: ComponentType<Record<string, unknown>> | null;\n }): JSX.Element | null => {\n if (Component == null) {\n return null;\n }\n const DashboardShellComponent = Component as ComponentType<{\n children?: ReactNode;\n prepared?: BackofficePreparedDashboardShellRoute | null;\n }>;\n return (\n <DashboardShellComponent\n prepared={prepared as BackofficePreparedDashboardShellRoute | null}\n >\n {dashboardChildren}\n </DashboardShellComponent>\n );\n };\n\n const dashboardConfigRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeDashboardPageResource,\n prepare: prepareRootDashboard,\n render: renderDashboard,\n });\n const dashboardRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeDashboardShellPageResource,\n prepare: prepareRootDashboardShell,\n render: renderDashboardShell,\n children: [dashboardConfigRoute],\n });\n const dashboardAliasConfigRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeDashboardPageResource,\n prepare: prepareRootDashboard,\n render: renderDashboard,\n });\n const dashboardAliasRoute = rBackoffice({\n path: 'dashboard',\n resourcePage: BackofficeDashboardShellPageResource,\n prepare: prepareRootDashboardShell,\n render: renderDashboardShell,\n children: [dashboardAliasConfigRoute],\n });\n const secondaryDashboardRoutes = dashboards.map((registration) => {\n const dashboardConfigChildRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeDashboardPageResource,\n prepare: async () => {\n const config = await registration.module.load();\n return {\n dashboardId: registration.id,\n label: registration.label,\n config,\n } satisfies BackofficePreparedDashboardRoute;\n },\n render: renderDashboard,\n });\n return rBackoffice({\n path: `dashboard/${registration.id}`,\n resourcePage: BackofficeDashboardShellPageResource,\n prepare: () => {\n return {\n dashboardId: registration.id,\n label: registration.label,\n } satisfies BackofficePreparedDashboardShellRoute;\n },\n render: renderDashboardShell,\n children: [dashboardConfigChildRoute],\n });\n });\n\n const listEntityEntries = Object.values(entityManifest).filter((entity) => {\n return entity.kind === 'list-detail';\n });\n\n const hubRoutes = hubEntries.map((entry) => {\n const hubRelative = buildRelativePath(entry.hub.href, baseSegment);\n const hubRoute = rBackoffice({\n path: hubRelative,\n resourcePage: BackofficeHubPageResource,\n prepare: () => {\n return {\n hubId: entry.hub.id,\n hub: entry.hub,\n } satisfies BackofficePreparedHubRoute;\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component prepared={prepared} />;\n },\n });\n if (entry.groupId != null) {\n routeGroupIdMap.set(hubRoute, entry.groupId);\n }\n return hubRoute;\n });\n\n const entityRoutes = listEntityEntries.map((entityManifestItem) => {\n const listPath = entityManifestItem.routes.list;\n const listRelative = buildRelativePath(listPath, baseSegment);\n const children: Route<any, any>[] = [];\n const renderDetailRouteFallback = ({\n match,\n }: RouteFallbackArgs<BackofficeRouterContext>): JSX.Element => {\n const rawId = String(match?.params.id ?? '');\n const rawPagePath =\n typeof match?.params.pagePath === 'string'\n ? match.params.pagePath\n : null;\n const pageId =\n rawPagePath == null\n ? entityManifestItem.defaultDetailPageId\n : resolveDetailPageIdForPath(entityManifestItem, rawPagePath);\n return (\n <BackofficeEntityDetailManifestFallback\n entityManifest={entityManifestItem}\n id={rawId}\n pageId={pageId}\n pagePath={rawPagePath}\n />\n );\n };\n\n if (entityManifestItem.hasList) {\n const listDataRoute = rBackoffice({\n path: '',\n querySchema: entityManifestItem.listNavigation.querySchema,\n resourcePage: BackofficeEntityListDataPageResource,\n prepareSearchBehavior: 'path',\n prepare: async ({ context, filters, query }) => {\n const entityModule = await entityRegistry.loadListEntity(\n entityManifestItem.id,\n );\n const { config } = entityModule;\n const { list } = config;\n const { defaults: listDefaults } = entityManifestItem.listNavigation;\n const navigationQuery: { sort?: string } = {};\n if (typeof query.sort === 'string') {\n navigationQuery.sort = query.sort;\n }\n const navigationFilters = filters as Parameters<\n typeof entityManifestItem.listNavigation.decode\n >[0]['filters'];\n const state = entityManifestItem.listNavigation.decode({\n filters: navigationFilters,\n query: navigationQuery,\n });\n const { pageSize } = BACKOFFICE_LIST_DEFAULTS;\n const variablesBase = {\n where: state.where,\n sort: state.sort ?? listDefaults.sort,\n count: pageSize,\n cursor: null,\n };\n const variables = list.buildQueryVariables(variablesBase);\n const queryRef = loadQuery<OperationType>(\n context.relayEnvironment,\n list.query,\n variables,\n );\n const prepared: BackofficePreparedListDataRoute = {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n entityConfig: config,\n query: queryRef,\n };\n return prepared;\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute = prepared as BackofficePreparedListDataRoute;\n return <Component prepared={preparedRoute} />;\n },\n });\n routeEntityIdMap.set(listDataRoute, entityManifestItem.id);\n\n const listRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeEntityListPageResource,\n prepareSearchBehavior: 'path',\n prepare: async () => {\n const entityModule = await entityRegistry.loadListEntity(\n entityManifestItem.id,\n );\n const { config } = entityModule;\n const prepared: BackofficePreparedListLayoutRoute = {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n entityConfig: config,\n };\n return prepared;\n },\n render: ({ children: listChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute = prepared as BackofficePreparedListLayoutRoute;\n return (\n <Component\n entityManifest={preparedRoute.entityManifest}\n config={preparedRoute.entityConfig}\n prepared={preparedRoute}\n >\n {listChildren}\n </Component>\n );\n },\n children: [listDataRoute],\n });\n routeEntityIdMap.set(listRoute, entityManifestItem.id);\n\n const listShellRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeEntityListShellPageResource,\n prepareSearchBehavior: 'path',\n prepare: () => {\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n } satisfies BackofficePreparedListShellRoute;\n },\n render: ({ children: listShellChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute = prepared as BackofficePreparedListShellRoute;\n return (\n <Component\n entityManifest={preparedRoute.entityManifest}\n prepared={preparedRoute}\n >\n {listShellChildren}\n </Component>\n );\n },\n children: [listRoute],\n });\n routeEntityIdMap.set(listShellRoute, entityManifestItem.id);\n children.push(listShellRoute);\n }\n\n const detailPageRoutes = entityManifestItem.detailPages.map(\n (pageManifest) => {\n const pageDataRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeEntityDetailPageResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: async ({ context, variables }) => {\n const rawId = String(variables.id ?? '');\n const pageModule = await entityRegistry.loadDetailPageEntity(\n entityManifestItem.id,\n pageManifest.id,\n );\n const pageBuildResult =\n pageModule.config.page.buildVariables != null\n ? pageModule.config.page.buildVariables({\n id: rawId,\n })\n : { variables: { id: rawId } };\n const pageQueryRef = loadQuery<OperationType>(\n context.relayEnvironment,\n pageModule.config.page.query,\n pageBuildResult.variables as Variables,\n );\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n detailId: pageBuildResult.detailId,\n id: rawId,\n pageConfig: pageModule.config,\n pageQuery: pageQueryRef,\n pageId: pageManifest.id,\n pagePath: pageManifest.pathSegment,\n } satisfies BackofficePreparedDetailPageDataRoute;\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute =\n prepared as BackofficePreparedDetailPageDataRoute;\n return <Component prepared={preparedRoute} />;\n },\n });\n routeEntityIdMap.set(pageDataRoute, entityManifestItem.id);\n\n const pageConfigRoute = rBackoffice({\n path: pageManifest.pathSegment,\n resourcePage: BackofficeEntityDetailPageConfigPageResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: async ({ variables }) => {\n const rawId = String(variables.id ?? '');\n const [pageModule, layoutModule] = await Promise.all([\n entityRegistry.loadDetailPageEntity(\n entityManifestItem.id,\n pageManifest.id,\n ),\n entityRegistry.loadDetailLayoutEntity(entityManifestItem.id),\n ]);\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n entityConfig: layoutModule.config,\n id: rawId,\n pageConfig: pageModule.config,\n pageId: pageManifest.id,\n pagePath: pageManifest.pathSegment,\n } satisfies BackofficePreparedDetailPageConfigRoute;\n },\n render: ({ children: pageChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute =\n prepared as BackofficePreparedDetailPageConfigRoute;\n return (\n <Component\n config={preparedRoute.entityConfig}\n prepared={preparedRoute}\n >\n {pageChildren}\n </Component>\n );\n },\n children: [pageDataRoute],\n });\n routeEntityIdMap.set(pageConfigRoute, entityManifestItem.id);\n return pageConfigRoute;\n },\n );\n\n const detailLayoutDataRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeEntityDetailLayoutPageResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: async ({ context, variables }) => {\n const entityModule = await entityRegistry.loadDetailLayoutEntity(\n entityManifestItem.id,\n );\n const { config } = entityModule;\n const rawId = String(variables.id ?? '');\n const layoutBuildResult =\n config.layoutPage.buildVariables != null\n ? config.layoutPage.buildVariables({\n id: rawId,\n })\n : { variables: { id: rawId } };\n const layoutQueryRef = loadQuery<OperationType>(\n context.relayEnvironment,\n config.layoutPage.query,\n layoutBuildResult.variables as Variables,\n );\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n entityConfig: config,\n layoutQuery: layoutQueryRef,\n id: rawId,\n } satisfies BackofficePreparedDetailLayoutDataRoute;\n },\n render: ({ children: detailChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute =\n prepared as BackofficePreparedDetailLayoutDataRoute;\n return (\n <Component\n entityManifest={preparedRoute.entityManifest}\n config={preparedRoute.entityConfig}\n prepared={preparedRoute}\n >\n {detailChildren}\n </Component>\n );\n },\n children: [\n rBackoffice({\n path: '',\n resourcePage: WrapperPageResource,\n prepare: ({ variables }) => {\n const rawId = String(variables.id ?? '').trim();\n return {\n redirectTo:\n rawId === ''\n ? null\n : entityManifestItem.routes.detailPage(\n rawId,\n entityManifestItem.defaultDetailPageId,\n ),\n };\n },\n render: ({ prepared }) => {\n const redirectTo =\n (prepared as { redirectTo?: string | null }).redirectTo ?? null;\n if (redirectTo == null) {\n return null;\n }\n return <BackofficeHistoryRedirect pathname={redirectTo} />;\n },\n }),\n ...detailPageRoutes,\n rBackoffice({\n path: ':pagePath',\n resourcePage: BackofficeEntityDetailUnknownPageRedirectResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: async ({ variables }) => {\n const entityModule = await entityRegistry.loadDetailLayoutEntity(\n entityManifestItem.id,\n );\n const rawId = String(variables.id ?? '');\n const rawPagePath = String(variables.pagePath ?? '');\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n entityConfig: entityModule.config,\n id: rawId,\n pagePath: rawPagePath,\n } satisfies BackofficePreparedDetailUnknownPageRoute;\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedDetail =\n prepared as BackofficePreparedDetailUnknownPageRoute;\n return (\n <Component\n entityManifest={preparedDetail.entityManifest}\n config={preparedDetail.entityConfig}\n prepared={preparedDetail}\n />\n );\n },\n }),\n ],\n });\n routeEntityIdMap.set(detailLayoutDataRoute, entityManifestItem.id);\n\n const detailShellRoute = rBackoffice({\n path: '',\n resourcePage: BackofficeEntityDetailShellPageResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: ({ variables }) => {\n const rawId = String(variables.id ?? '');\n const rawPagePath =\n typeof variables.pagePath === 'string' ? variables.pagePath : null;\n const pageId =\n rawPagePath == null\n ? entityManifestItem.defaultDetailPageId\n : resolveDetailPageIdForPath(entityManifestItem, rawPagePath);\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n id: rawId,\n pageId,\n pagePath: rawPagePath,\n } satisfies BackofficePreparedDetailShellRoute;\n },\n render: ({ children: shellChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute = prepared as BackofficePreparedDetailShellRoute;\n return (\n <Component\n entityManifest={preparedRoute.entityManifest}\n prepared={preparedRoute}\n >\n {shellChildren}\n </Component>\n );\n },\n children: [detailLayoutDataRoute],\n });\n routeEntityIdMap.set(detailShellRoute, entityManifestItem.id);\n\n const detailFrameRoute = rBackoffice({\n path: ':id',\n resourcePage: BackofficeEntityDetailFramePageResource,\n suspenseBoundary: 'segment',\n fallback: renderDetailRouteFallback,\n prepare: ({ variables }) => {\n const rawId = String(variables.id ?? '');\n return {\n entityId: entityManifestItem.id,\n entityManifest: entityManifestItem,\n id: rawId,\n } satisfies BackofficePreparedDetailFrameRoute;\n },\n render: ({ children: detailChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedRoute = prepared as BackofficePreparedDetailFrameRoute;\n return (\n <Component\n entityManifest={preparedRoute.entityManifest}\n prepared={preparedRoute}\n >\n {detailChildren}\n </Component>\n );\n },\n children: [detailShellRoute],\n });\n routeEntityIdMap.set(detailFrameRoute, entityManifestItem.id);\n children.push(detailFrameRoute);\n\n return rBackoffice({\n path: listRelative,\n children,\n resourcePage: WrapperPageResource,\n suspenseBoundary: 'segment',\n });\n });\n\n const toolsRoutes = Object.values(entityManifest)\n .filter((entity) => {\n return entity.kind === 'tool';\n })\n .map((toolManifest) => {\n const toolRelative = buildRelativePath(\n toolManifest.routes.list,\n baseSegment,\n );\n const toolConfigRoute = rBackoffice({\n path: '',\n resourcePage: input.toolsOperationPage ?? null,\n prepare: async () => {\n const toolModule = await entityRegistry.loadToolEntity(\n toolManifest.id,\n );\n return {\n entityId: toolManifest.id,\n entityManifest: toolManifest,\n entityConfig: toolModule.config,\n } satisfies BackofficePreparedToolConfigRoute;\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedTool = prepared as BackofficePreparedToolConfigRoute;\n return (\n <Component\n entityManifest={preparedTool.entityManifest}\n operation={preparedTool.entityConfig.tool.operation}\n toolId={preparedTool.entityConfig.id}\n />\n );\n },\n });\n routeEntityIdMap.set(toolConfigRoute, toolManifest.id);\n\n const toolRoute = rBackoffice({\n path: toolRelative,\n resourcePage: BackofficeToolShellPageResource,\n prepare: () => {\n return {\n entityId: toolManifest.id,\n entityManifest: toolManifest,\n } satisfies BackofficePreparedToolRoute;\n },\n render: ({ children: toolChildren, prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedTool = prepared as BackofficePreparedToolRoute;\n return (\n <Component\n entityManifest={preparedTool.entityManifest}\n prepared={preparedTool}\n >\n {toolChildren}\n </Component>\n );\n },\n children: [toolConfigRoute],\n });\n routeEntityIdMap.set(toolRoute, toolManifest.id);\n return toolRoute;\n });\n\n const layoutRoute = rBackoffice({\n path: baseSegment,\n resourcePage: BackofficeLayoutPageResource,\n prepareSearchBehavior: 'path',\n suspenseBoundary: 'segment',\n prepare: layoutPrepare,\n render: ({ children, prepared, route, Component }) => {\n if (Component == null) {\n return null;\n }\n const preparedLayout = prepared as PreparedLayout | undefined;\n const activeEntityId = resolveActiveEntityIdFromRoute(\n route,\n routeEntityIdMap,\n );\n const activeGroupId =\n activeEntityId != null\n ? (entityIdToGroupId.get(activeEntityId) ?? null)\n : resolveActiveEntityIdFromRoute(route, routeGroupIdMap);\n const LayoutComponent = Component as LayoutRouteComponent;\n const authStatusQuery = auth.session.get()?.authStatusQuery ?? null;\n if (authStatusQuery != null && preparedLayout?.authStatusQuery != null) {\n return (\n <BackofficeLayoutRouteWithAuthStatus\n Component={LayoutComponent}\n preparedLayout={preparedLayout}\n permissionsQuery={sidebar?.permissionsQuery}\n activeGroupId={activeGroupId}\n authStatusQuery={authStatusQuery}\n authStatusPrepared={preparedLayout.authStatusQuery}\n loginRedirectPath={loginRedirectPath}\n >\n {children}\n </BackofficeLayoutRouteWithAuthStatus>\n );\n }\n return (\n <BackofficeLayoutRouteWithoutAuthStatus\n Component={LayoutComponent}\n preparedLayout={preparedLayout}\n permissionsQuery={sidebar?.permissionsQuery}\n activeGroupId={activeGroupId}\n >\n {children}\n </BackofficeLayoutRouteWithoutAuthStatus>\n );\n },\n children: [\n dashboardRoute,\n ...hubRoutes,\n ...entityRoutes,\n ...toolsRoutes,\n ...secondaryDashboardRoutes,\n dashboardAliasRoute,\n ],\n });\n\n const routes: Route<BackofficeRouterContext, any>[] = [\n rBackoffice({\n path: loginPath,\n resourcePage: BackofficeLoginPageResource,\n prepare: async ({ context }) => {\n const loginAuth = await auth.login.load();\n const queryRef = loadQuery<OperationType>(\n context.relayEnvironment,\n loginAuth.loginQuery,\n {},\n );\n return { query: queryRef };\n },\n render: ({ prepared, Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component prepared={prepared} />;\n },\n }),\n rBackoffice({\n path: passwordResetRequestPath,\n resourcePage: BackofficePasswordResetRequestPageResource,\n prepare: async () => {\n await auth.passwordResetRequest.load();\n return null;\n },\n render: ({ Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component />;\n },\n }),\n rBackoffice({\n path: passwordResetCompletePath,\n resourcePage: BackofficePasswordResetCompletePageResource,\n prepare: async () => {\n await auth.passwordResetComplete.load();\n return null;\n },\n render: ({ Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component />;\n },\n }),\n rBackoffice({\n path: verifyEmailPath,\n resourcePage: BackofficeVerifyEmailPageResource,\n prepare: async () => {\n await auth.verifyEmail.load();\n return null;\n },\n render: ({ Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component />;\n },\n }),\n ];\n\n if (auth.hasAcceptInvitation === true || auth.acceptInvitation != null) {\n routes.push(\n rBackoffice({\n path: acceptInvitationPath,\n resourcePage: BackofficeAcceptInvitationPageResource,\n prepare: async () => {\n await auth.acceptInvitation?.load();\n return null;\n },\n render: ({ Component }) => {\n if (Component == null) {\n return null;\n }\n return <Component />;\n },\n }),\n );\n }\n\n routes.push(layoutRoute);\n\n return routes;\n}\n\nexport const __test = {\n normalizeBaseSegment,\n normalizePath,\n buildScopedPath,\n buildScopedAbsolutePath,\n buildRelativePath,\n resolveActiveEntityIdFromRoute,\n resolveDetailPageIdForPath,\n resolveDetailPageManifestByPath,\n validateBackofficeDashboardRegistrations,\n BackofficeLayoutRouteWithAuthStatus,\n} as const;\n\nexport default createBackofficeRoutes;\n"],"mappings":";;;;;;;;;;;AAgEA,IAAM,EAAE,WAAA,GAAW,mBAAA,MAAsB,GAiB5B,IAA2C,EACtD,eAEA,aAAa,EACX,UAAU,MAAM,OAAO,oCAAA,CAAqC,YAC9D,EACF,GAEa,IACX,EACE,wBAEA,YAAY,OAAO,mCACrB,GAEW,IACX,EACE,4BAEA,YAAY,OAAO,uCACrB,GAEW,IACX,EACE,iCAEA,YAAY,OAAO,4CACrB,GAEW,IACX,EACE,gCAEA,YAAY,OAAO,2CACrB,GAEW,KACX,EACE,8BAEA,YAAY,OAAO,yCACrB,GAEW,IACX,EACE,mCAEA,YAAY,OAAO,8CACrB,GAEW,IACX,EACE,oCAEA,YAAY,OAAO,+CACrB,GAEW,IACX,EACE,wCAEA,YAAY,OAAO,mDACrB,GAEW,IACX,EACE,mCAEA,YAAY,OAAO,8CACrB,GAEW,IACX,EACE,6CAEA,YAAY,OAAO,wDACrB,GAEW,IACX,EACE,2BAEA,YAAY,OAAO,sCACrB,GAEW,IACX,EACE,gCAEA,YAAY,OAAO,2CACrB,GAEW,IACX,EACE,2BAEA,YAAY,OAAO,sCACrB,GAEW,IAAiD,EAC5D,qBAEA,YAAY,OAAO,gCACrB,GAEa,KAAmD,EAC9D,uBAEA,YAAY,OAAO,kCACrB,GAEa,KACX,EACE,sCAEA,YAAY,OAAO,iDACrB,GAEW,KACX,EACE,uCAEA,YAAY,OAAO,kDACrB,GAEW,IACX,EACE,6BAEA,YAAY,OAAO,wCACrB,GAEW,IACX,EACE,kCAEA,YAAY,OAAO,6CACrB,GA4CI,KAA6B,EACjC,kBAGU;CACV,IAAM,IAAS,EAAW,CAAc;CAQxC,OANA,QAAgB;EACd,GAAQ,QAAQ,IAAI,EAClB,YACF,CAAC;CACH,GAAG,CAAC,GAAU,CAAM,CAAC,GAEd;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AAA;EAEvB,CAAC;EACD,EAAY;GACV,MAAM;GACN,cAAc;GACd,SAAS,aACP,MAAM,EAAK,sBAAsB,KAAK,GAC/B;GAET,SAAS,EAAE,mBACL,KAAa,OACR,OAEF,kBAAC,GAAD,CAAY,CAAA;EAEvB,CAAC;EACD,EAAY;GACV,MAAM;GACN,cAAc;GACd,SAAS,aACP,MAAM,EAAK,YAAY,KAAK,GACrB;GAET,SAAS,EAAE,mBACL,KAAa,OACR,OAEF,kBAAC,GAAD,CAAY,CAAA;EAEvB,CAAC;CACH;CAuBA,QArBI,EAAK,wBAAwB,MAAQ,EAAK,oBAAoB,SAChE,EAAO,KACL,EAAY;EACV,MAAM;EACN,cAAc;EACd,SAAS,aACP,MAAM,EAAK,kBAAkB,KAAK,GAC3B;EAET,SAAS,EAAE,mBACL,KAAa,OACR,OAEF,kBAAC,GAAD,CAAY,CAAA;CAEvB,CAAC,CACH,GAGF,EAAO,KAAK,EAAW,GAEhB;AACT;AAEA,IAAa,IAAS;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plumile/backoffice-react",
3
- "version": "0.1.198",
3
+ "version": "0.1.199",
4
4
  "description": "React provider and pages for Kronex backoffice",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -170,7 +170,7 @@
170
170
  "npm": ">=8.0.0"
171
171
  },
172
172
  "dependencies": {
173
- "graphql-ws": "6.2.0",
173
+ "graphql-ws": "6.2.1",
174
174
  "i18next": "^26.3.6",
175
175
  "i18next-browser-languagedetector": "8.2.1",
176
176
  "react-i18next": "^17.0.11",
@@ -179,14 +179,14 @@
179
179
  "tslib": "^2.8.1"
180
180
  },
181
181
  "devDependencies": {
182
- "@plumile/auth": "^0.1.198",
183
- "@plumile/backoffice-core": "^0.1.198",
184
- "@plumile/filter-query": "^0.1.198",
185
- "@plumile/relay": "^0.1.198",
186
- "@plumile/router": "^0.1.198",
187
- "@plumile/ui": "^0.1.198",
188
- "@types/react": "19.2.17",
189
- "@types/react-dom": "19.2.3",
182
+ "@plumile/auth": "^0.1.199",
183
+ "@plumile/backoffice-core": "^0.1.199",
184
+ "@plumile/filter-query": "^0.1.199",
185
+ "@plumile/relay": "^0.1.199",
186
+ "@plumile/router": "^0.1.199",
187
+ "@plumile/ui": "^0.1.199",
188
+ "@types/react": "19.2.18",
189
+ "@types/react-dom": "19.2.4",
190
190
  "@types/relay-runtime": "20.1.1",
191
191
  "@typescript/native": "npm:typescript@7.0.2",
192
192
  "i18next": "26.3.6",
@@ -197,12 +197,12 @@
197
197
  "rimraf": "6.1.3"
198
198
  },
199
199
  "peerDependencies": {
200
- "@plumile/auth": "^0.1.194",
201
- "@plumile/backoffice-core": "^0.1.194",
202
- "@plumile/filter-query": "^0.1.194",
203
- "@plumile/relay": "^0.1.194",
204
- "@plumile/router": "^0.1.194",
205
- "@plumile/ui": "^0.1.194",
200
+ "@plumile/auth": "^0.1.198",
201
+ "@plumile/backoffice-core": "^0.1.198",
202
+ "@plumile/filter-query": "^0.1.198",
203
+ "@plumile/relay": "^0.1.198",
204
+ "@plumile/router": "^0.1.198",
205
+ "@plumile/ui": "^0.1.198",
206
206
  "i18next": "^26.3.6",
207
207
  "react": "^19.2.8",
208
208
  "react-dom": "^19.2.8",