@knkcs/importhub-ui 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +5 -4
- package/dist/{importhub-client-Wrb4s3lw.js → importhub-client-BzOVIXA4.js} +16 -7
- package/dist/importhub-client-BzOVIXA4.js.map +1 -0
- package/dist/index.d.ts +298 -5
- package/dist/index.js +1781 -1411
- package/dist/index.js.map +1 -1
- package/dist/mapping-editor.d.ts +96 -1
- package/dist/mapping-editor.js +1 -1
- package/dist/{mapping-page-BTEJR0-z.js → mapping-page-Bl2rA1SR.js} +301 -291
- package/dist/mapping-page-Bl2rA1SR.js.map +1 -0
- package/dist/testing.d.ts +100 -2
- package/dist/testing.js +580 -481
- package/dist/testing.js.map +1 -1
- package/package.json +1 -1
- package/dist/importhub-client-Wrb4s3lw.js.map +0 -1
- package/dist/mapping-page-BTEJR0-z.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mapping-page-BTEJR0-z.js","sources":["../src/i18n/resources.ts","../src/common/host.tsx","../src/common/query-keys.ts","../src/common/query-state.tsx","../src/common/configuration-tabs.tsx","../src/common/delete-dialog.tsx","../src/common/release-state.tsx","../src/common/use-can-configure.ts","../src/common/validity.tsx","../src/common/cut-release-dialog.tsx","../src/common/use-configuration-release.tsx","../src/common/blueprint-names.ts","../src/screens/history/revision-comparison.tsx","../src/screens/history/revision-labels.ts","../src/screens/history/configuration-history.tsx","../src/screens/mappings/mapping-reasons.ts","../src/screens/mappings/move-release-dialog.tsx","../src/screens/mappings/mapping-page.tsx"],"sourcesContent":["import de from \"./de.json\";\nimport en from \"./en.json\";\n\n/**\n * The i18next namespace every string in this package is looked up under. A\n * host merges `i18nResources` and lists this constant among its namespaces\n * (knkcms/core ADR 0005), never the literal, so a rename fails the host's\n * compile rather than rendering raw keys.\n */\nexport const IMPORTHUB_UI_NS = \"importhub-ui\";\n\n/** The package's bundled translations, keyed by language, then by namespace. */\nexport const i18nResources = {\n\ten: { [IMPORTHUB_UI_NS]: en },\n\tde: { [IMPORTHUB_UI_NS]: de },\n};\n","// importhub-ui's host contract: what a host decides that anker's own host\n// contract (@knkcs/anker/host) does not cover.\n//\n// anker's covers the page frame, the rail and identity: a screen reports its\n// title, breadcrumbs and actions, and reads the viewer and the active\n// workspace from `useHostIdentity()`, which the host provides once. What is\n// left is importhub's own: where the host mounts each section, for the links\n// a screen draws itself, and where a Change Set lives in contenthub, which\n// only the host knows (ADR 0005, amended: the contract has no seams only core\n// needed). Navigation a screen *asks* for (open an Import, start one) goes\n// through that screen's callbacks, since only the host knows its router.\nimport { createContext, type ReactNode, useContext } from \"react\";\n\n/**\n * importhub's sections: Imports, the host's own work, and the configuration\n * an admin manages (CONTEXT.md, \"Configuration\").\n */\nexport type ImporthubSection = \"imports\" | \"profiles\" | \"mappings\" | \"entitySets\" | \"processors\";\n\n/** Every section, in the order a host lists them. */\nexport const IMPORTHUB_SECTIONS: readonly ImporthubSection[] = [\n\t\"imports\",\n\t\"profiles\",\n\t\"mappings\",\n\t\"entitySets\",\n\t\"processors\",\n];\n\n/**\n * Where the host mounts each section's index. An item of a section (one\n * Import Profile, Mapping or Entity Set) lives under it, at\n * `<index>/<id>` (`itemPath`), so a host mounts one route per section and its\n * items, and the screens link to both without asking.\n */\nexport type ImporthubPaths = Record<ImporthubSection, string>;\n\n/** Where an item of a section lives: its index's path, then its id. */\nexport function itemPath(paths: ImporthubPaths, section: ImporthubSection, id: string): string {\n\treturn `${paths[section].replace(/\\/$/, \"\")}/${encodeURIComponent(id)}`;\n}\n\n/** A Blueprint, as a Mapping's target is picked and named. */\nexport interface ImporthubBlueprint {\n\tid: string;\n\tname: string;\n}\n\n/** A Blueprint Release, as a Mapping pins it: `label` names it, such as \"Release 3\". */\nexport interface ImporthubBlueprintRelease {\n\tid: string;\n\tlabel: string;\n}\n\n/**\n * One field of a Blueprint Release's field tree, as the Mapping editor shows\n * it (importhub.v1.BlueprintField).\n */\nexport interface ImporthubBlueprintField {\n\t/** Its accessor among its siblings. */\n\taccessor: string;\n\t/** Its accessors from the top joined by `.`: how a Mapping names it. */\n\tpath: string;\n\t/** Its fieldkit field type, such as `text`, `date` or `fieldset`. */\n\tfieldType: string;\n\t/** Its label for a person; \"\" when the Release gives none. */\n\tlabel: string;\n\t/** A fieldset's or a virtual table's fields, nested. */\n\tchildren: ImporthubBlueprintField[];\n}\n\n/** A Blueprint Release with its field tree, as the Mapping editor reads it. */\nexport interface ImporthubBlueprintReleaseTree {\n\tid: string;\n\tblueprintId: string;\n\t/** The name it was cut with, such as `2026-10`. */\n\tname: string;\n\t/** Its field tree, in the Release's order. */\n\tfields: ImporthubBlueprintField[];\n\t/** Its Release Spec fields, which Release Spec sources and Version Match read. */\n\treleaseSpecFields: ImporthubBlueprintField[];\n}\n\n/**\n * Where the screens find Blueprints and their Releases, which live in\n * blueprinthub, not importhub: importhub stores only their ids. A host that\n * reaches blueprinthub (core does) answers from it; one that does not leaves\n * `ImporthubHost.blueprints` out, and the Mapping screens then take and show\n * the two as labelled ids, the technical detail anker's id rule allows.\n */\nexport interface ImporthubBlueprints {\n\t/** The workspace's Blueprints a Mapping may target, by name. */\n\tlistBlueprints(): Promise<ImporthubBlueprint[]>;\n\t/** A Blueprint's Releases, newest first. */\n\tlistReleases(blueprintId: string): Promise<ImporthubBlueprintRelease[]>;\n\t/**\n\t * A Release with its field tree, for the Mapping editor\n\t * (edit-a-mapping-in-the-structured-editor:AC1). Optional, so a host\n\t * written before the editor still type-checks; without it the editor\n\t * lists only the fields the Mapping maps, and says why.\n\t */\n\tgetRelease?(releaseId: string): Promise<ImporthubBlueprintReleaseTree>;\n}\n\nexport interface ImporthubHost {\n\t/** Where the host mounts each section's index, for breadcrumbs and links. */\n\tpaths: ImporthubPaths;\n\t/**\n\t * The address of a Change Set in contenthub, which an Import's page links\n\t * out to (follow-an-import:AC5). null when the host has no contenthub to\n\t * link to: the screen then shows no link rather than a broken one.\n\t */\n\tchangeSetHref: (changeSetId: string) => string | null;\n\t/**\n\t * Whether the viewer may change configuration: importhub's `admin`\n\t * (ADR 0010), which only the host's session knows. Unset, the screens\n\t * show configuration read-only, as to a `viewer`; either way importhub\n\t * authorizes every write itself, so this hides actions and guards\n\t * nothing.\n\t */\n\tcanConfigure?: boolean;\n\t/**\n\t * Whether the viewer may start and cancel Imports: importhub's\n\t * `importer` (ADR 0010), which `admin` implies. Unset, the screens offer\n\t * neither, as to a `viewer` (follow-an-import:AC8); importhub authorizes\n\t * every Start and Cancel itself, so this hides actions and guards nothing.\n\t */\n\tcanImport?: boolean;\n\t/** Where Blueprints and their Releases are found; see ImporthubBlueprints. */\n\tblueprints?: ImporthubBlueprints;\n}\n\n/**\n * The Standalone App's paths: Imports at the top, the configuration under\n * `/settings/<item>`, one page per item (odon's integration guide, \"Sidebar\n * layout\").\n */\nexport const STANDALONE_IMPORTHUB_PATHS: ImporthubPaths = {\n\timports: \"/imports\",\n\tprofiles: \"/settings/import-profiles\",\n\tmappings: \"/settings/mappings\",\n\tentitySets: \"/settings/entity-sets\",\n\tprocessors: \"/settings/processors\",\n};\n\nconst DEFAULT_HOST: ImporthubHost = {\n\tpaths: STANDALONE_IMPORTHUB_PATHS,\n\tchangeSetHref: () => null,\n};\n\nconst HostContext = createContext<ImporthubHost>(DEFAULT_HOST);\n\nexport interface ImporthubHostProviderProps {\n\thost: ImporthubHost;\n\tchildren: ReactNode;\n}\n\n/** Provides the host's decisions to every importhub screen beneath it. */\nexport function ImporthubHostProvider({ host, children }: ImporthubHostProviderProps) {\n\treturn <HostContext.Provider value={host}>{children}</HostContext.Provider>;\n}\n\n/**\n * The host's decisions; outside a provider, the Standalone App's paths and\n * no Change Set links.\n */\nexport function useImporthubHost(): ImporthubHost {\n\treturn useContext(HostContext);\n}\n","// Every query key starts with the active workspace, from the host's identity.\n// A host that switches workspace without remounting (an embedding solution's\n// picker, say) then reads the new workspace's data rather than the old one's\n// cache (use-the-importhub-standalone-app:AC3), and two workspaces' answers\n// never share an entry.\nimport type { ConfigurationKind } from \"../client/importhub-client\";\n\nexport const importhubKeys = {\n\tall: (workspaceId: string) => [\"importhub\", workspaceId] as const,\n\timportProfiles: (workspaceId: string) =>\n\t\t[...importhubKeys.all(workspaceId), \"importProfiles\"] as const,\n\timportProfile: (workspaceId: string, id: string) =>\n\t\t[...importhubKeys.importProfiles(workspaceId), id] as const,\n\tprocessors: (workspaceId: string) => [...importhubKeys.all(workspaceId), \"processors\"] as const,\n\tmappings: (workspaceId: string) => [...importhubKeys.all(workspaceId), \"mappings\"] as const,\n\tmapping: (workspaceId: string, id: string) =>\n\t\t[...importhubKeys.mappings(workspaceId), id] as const,\n\tmappingImportProfiles: (workspaceId: string, id: string) =>\n\t\t[...importhubKeys.mapping(workspaceId, id), \"importProfiles\"] as const,\n\tentitySets: (workspaceId: string) => [...importhubKeys.all(workspaceId), \"entitySets\"] as const,\n\tentitySet: (workspaceId: string, id: string) =>\n\t\t[...importhubKeys.entitySets(workspaceId), id] as const,\n\timports: (workspaceId: string) => [...importhubKeys.all(workspaceId), \"imports\"] as const,\n\timport: (workspaceId: string, id: string) => [...importhubKeys.imports(workspaceId), id] as const,\n\t/** An Import's Item Problems under a filter, one entry per filter. */\n\titemProblems: (workspaceId: string, id: string, mappingId: string, sourceKeyQuery: string) =>\n\t\t[...importhubKeys.import(workspaceId, id), \"itemProblems\", mappingId, sourceKeyQuery] as const,\n\t/** The workspace's importhub API keys. */\n\tapiKeys: (workspaceId: string) => [...importhubKeys.all(workspaceId), \"apiKeys\"] as const,\n\tblueprints: (workspaceId: string) => [...importhubKeys.all(workspaceId), \"blueprints\"] as const,\n\tblueprintReleases: (workspaceId: string, blueprintId: string) =>\n\t\t[...importhubKeys.blueprints(workspaceId), blueprintId, \"releases\"] as const,\n\t/** A Blueprint Release with its field tree; a Release never changes once cut. */\n\tblueprintRelease: (workspaceId: string, releaseId: string) =>\n\t\t[...importhubKeys.blueprints(workspaceId), \"release\", releaseId] as const,\n\t/** One configuration of a kind, as its page reads it. */\n\tconfiguration: (workspaceId: string, kind: ConfigurationKind, id: string) =>\n\t\tkind === \"importProfile\"\n\t\t\t? importhubKeys.importProfile(workspaceId, id)\n\t\t\t: kind === \"mapping\"\n\t\t\t\t? importhubKeys.mapping(workspaceId, id)\n\t\t\t\t: importhubKeys.entitySet(workspaceId, id),\n\t/** Every list of a kind, so one change refreshes them all. */\n\tconfigurations: (workspaceId: string, kind: ConfigurationKind) =>\n\t\tkind === \"importProfile\"\n\t\t\t? importhubKeys.importProfiles(workspaceId)\n\t\t\t: kind === \"mapping\"\n\t\t\t\t? importhubKeys.mappings(workspaceId)\n\t\t\t\t: importhubKeys.entitySets(workspaceId),\n\thistory: (workspaceId: string, kind: ConfigurationKind, id: string) =>\n\t\t[...importhubKeys.configuration(workspaceId, kind, id), \"history\"] as const,\n\tcomparison: (\n\t\tworkspaceId: string,\n\t\tkind: ConfigurationKind,\n\t\tid: string,\n\t\tfromRevisionId: string,\n\t\ttoRevisionId: string,\n\t) =>\n\t\t[\n\t\t\t...importhubKeys.configuration(workspaceId, kind, id),\n\t\t\t\"comparison\",\n\t\t\tfromRevisionId,\n\t\t\ttoRevisionId,\n\t\t] as const,\n};\n","import { EmptyState } from \"@knkcs/anker/atoms\";\nimport { Box, Center, Spinner } from \"@knkcs/anker/primitives\";\nimport { CircleAlert } from \"lucide-react\";\nimport { useTranslation } from \"react-i18next\";\nimport { IMPORTHUB_UI_NS } from \"../i18n/resources\";\n\n/** A page body while its data loads. */\nexport function Loading() {\n\tconst { t } = useTranslation(IMPORTHUB_UI_NS);\n\treturn (\n\t\t<Center py=\"12\">\n\t\t\t<Spinner aria-label={t(\"startPage.loading\")} />\n\t\t</Center>\n\t);\n}\n\n/** A page body whose data could not be read. */\nexport function LoadFailed() {\n\tconst { t } = useTranslation(IMPORTHUB_UI_NS);\n\treturn (\n\t\t<Box px=\"8\" py=\"6\">\n\t\t\t<EmptyState icon={<CircleAlert size={32} aria-hidden />} header={t(\"startPage.error\")} />\n\t\t</Box>\n\t);\n}\n","import { Tabs } from \"@knkcs/anker/primitives\";\nimport type { ReactNode } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { useSearchParams } from \"react-router\";\nimport { IMPORTHUB_UI_NS } from \"../i18n/resources\";\n\n/**\n * A configuration page's tabs: its settings, its history (ADR 0016), and\n * between them whatever tabs the page adds (the Mapping editor's).\n */\nexport type ConfigurationTab = \"settings\" | \"history\" | (string & {});\n\n/** A tab a page adds between Settings and History. */\nexport interface ExtraTab {\n\tvalue: string;\n\tlabel: string;\n}\n\n/**\n * The open tab of a configuration page, kept in the address (`?tab=history`)\n * as blueprinthub's Blueprint page keeps its own, so a host's back button and\n * a shared link land on the same tab; and the tab strip for the template's\n * `tabs`, which holds only the list: the page renders the open tab's body\n * alone, so only one tab is ever mounted (anker's `usePageActions` rule).\n * An address naming a tab the page does not have opens Settings.\n */\nexport function useConfigurationTab(\n\textra: readonly ExtraTab[] = [],\n): [ConfigurationTab, ReactNode] {\n\tconst { t } = useTranslation(IMPORTHUB_UI_NS);\n\tconst [params, setParams] = useSearchParams();\n\tconst known = new Set([\"history\", ...extra.map((e) => e.value)]);\n\tconst asked = params.get(\"tab\") ?? \"\";\n\tconst tab: ConfigurationTab = known.has(asked) ? asked : \"settings\";\n\tconst select = (next: string) => {\n\t\tconst updated = new URLSearchParams(params);\n\t\tif (next !== \"settings\") updated.set(\"tab\", next);\n\t\telse updated.delete(\"tab\");\n\t\tsetParams(updated, { replace: true });\n\t};\n\tconst strip = (\n\t\t<Tabs.Root value={tab} onValueChange={(e) => select(e.value)}>\n\t\t\t<Tabs.List>\n\t\t\t\t<Tabs.Trigger value=\"settings\">{t(\"tabs.settings\")}</Tabs.Trigger>\n\t\t\t\t{extra.map((e) => (\n\t\t\t\t\t<Tabs.Trigger key={e.value} value={e.value}>\n\t\t\t\t\t\t{e.label}\n\t\t\t\t\t</Tabs.Trigger>\n\t\t\t\t))}\n\t\t\t\t<Tabs.Trigger value=\"history\">{t(\"tabs.history\")}</Tabs.Trigger>\n\t\t\t</Tabs.List>\n\t\t</Tabs.Root>\n\t);\n\treturn [tab, strip];\n}\n","import { Button } from \"@knkcs/anker/atoms\";\nimport { Modal } from \"@knkcs/anker/components\";\nimport { Alert, HStack, Link, List, Stack, Text } from \"@knkcs/anker/primitives\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport { useEffect } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Link as RouterLink } from \"react-router\";\nimport { ConfigurationInUseError } from \"../client/importhub-client\";\nimport { IMPORTHUB_UI_NS } from \"../i18n/resources\";\nimport { itemPath, useImporthubHost } from \"./host\";\n\nexport interface DeleteDialogProps {\n\topen: boolean;\n\tonClose: () => void;\n\t/** The dialog's header, naming what is deleted. */\n\ttitle: string;\n\t/** What deleting it means. */\n\tmessage: string;\n\t/** Deletes it; a ConfigurationInUseError keeps the dialog open, naming the Profiles. */\n\tonDelete: () => Promise<void>;\n\t/** It is gone. */\n\tonDeleted: () => void;\n}\n\n/**\n * Confirms a delete, and shows why importhub refused one: the Import\n * Profiles that still include the Mapping or name the Entity Set\n * (manage-mappings:AC4, manage-entity-sets:AC3), each a link to its page.\n * Always mounted and driven by `open`, as anker's Modal rule says.\n */\nexport function DeleteDialog({\n\topen,\n\tonClose,\n\ttitle,\n\tmessage,\n\tonDelete,\n\tonDeleted,\n}: DeleteDialogProps) {\n\tconst { t } = useTranslation(IMPORTHUB_UI_NS);\n\tconst { paths } = useImporthubHost();\n\tconst del = useMutation({ mutationFn: onDelete, onSuccess: onDeleted });\n\tconst { reset } = del;\n\t// A fresh session each time it opens, so last time's refusal is gone.\n\tuseEffect(() => {\n\t\tif (open) reset();\n\t}, [open, reset]);\n\tconst refusal = del.error instanceof ConfigurationInUseError ? del.error : null;\n\treturn (\n\t\t<Modal\n\t\t\topen={open}\n\t\t\tonClose={onClose}\n\t\t\theader={title}\n\t\t\tlazyMount\n\t\t\tunmountOnExit\n\t\t\tfooter={\n\t\t\t\t<HStack gap=\"2\">\n\t\t\t\t\t<Button variant=\"outline\" onClick={onClose}>\n\t\t\t\t\t\t{t(\"common.cancel\")}\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"solid\"\n\t\t\t\t\t\tcolorPalette=\"red\"\n\t\t\t\t\t\tloading={del.isPending}\n\t\t\t\t\t\tdisabled={refusal !== null}\n\t\t\t\t\t\tonClick={() => del.mutate()}\n\t\t\t\t\t>\n\t\t\t\t\t\t{t(\"common.delete\")}\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t}\n\t\t>\n\t\t\t<Stack gap=\"4\">\n\t\t\t\t<Text>{message}</Text>\n\t\t\t\t{refusal ? (\n\t\t\t\t\t<Alert status=\"error\" colorPalette=\"danger\" title={t(\"delete.inUse\")}>\n\t\t\t\t\t\t<List.Root ps=\"4\">\n\t\t\t\t\t\t\t{refusal.importProfiles.map((p) => (\n\t\t\t\t\t\t\t\t<List.Item key={p.id}>\n\t\t\t\t\t\t\t\t\t<Link asChild>\n\t\t\t\t\t\t\t\t\t\t<RouterLink to={itemPath(paths, \"profiles\", p.id)}>{p.name}</RouterLink>\n\t\t\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t\t\t</List.Item>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</List.Root>\n\t\t\t\t\t</Alert>\n\t\t\t\t) : del.isError ? (\n\t\t\t\t\t<Alert status=\"error\" colorPalette=\"danger\" title={t(\"delete.failed\")} />\n\t\t\t\t) : null}\n\t\t\t</Stack>\n\t\t</Modal>\n\t);\n}\n","import { StatusBadge } from \"@knkcs/anker/atoms\";\nimport { useTranslation } from \"react-i18next\";\nimport type { ConfigurationState } from \"../client/importhub-client\";\nimport { IMPORTHUB_UI_NS } from \"../i18n/resources\";\n\n/**\n * Where a configuration's draft stands against its latest Release\n * (release-a-configuration:AC1): a draft that differs is what the next cut\n * would release, and what no real Import runs yet (ADR 0016), so it is the\n * one state that needs attention.\n */\nexport function ReleaseStateBadge({ state }: { state: ConfigurationState }) {\n\tconst { t } = useTranslation(IMPORTHUB_UI_NS);\n\tif (!state.latestRelease) {\n\t\treturn <StatusBadge tone=\"warning\" label={t(\"release.state.none\")} />;\n\t}\n\tconst number = state.latestRelease.number;\n\treturn state.draftDiffersFromRelease ? (\n\t\t<StatusBadge tone=\"warning\" label={t(\"release.state.differs\", { number })} />\n\t) : (\n\t\t<StatusBadge tone=\"success\" label={t(\"release.state.current\", { number })} />\n\t);\n}\n","import { useImporthubHost } from \"./host\";\n\n/**\n * Whether to offer the viewer configuration's edit actions: the host's\n * `canConfigure`, read-only when it says nothing (control-who-may-import:AC1).\n */\nexport function useCanConfigure(): boolean {\n\treturn useImporthubHost().canConfigure ?? false;\n}\n","import type { StatusBadgeTone } from \"@knkcs/anker/atoms\";\nimport { StatusBadgeCell } from \"@knkcs/anker/components\";\nimport { Alert, List } from \"@knkcs/anker/primitives\";\nimport type { TFunction } from \"i18next\";\nimport { useTranslation } from \"react-i18next\";\nimport type { ConfigurationState, Validity } from \"../client/importhub-client\";\nimport { IMPORTHUB_UI_NS } from \"../i18n/resources\";\n\n/**\n * Why a configuration is invalid, on its page (manage-import-profiles:AC6,\n * CONTEXT.md \"Configuration\"): one line per reason, as importhub words it.\n * Nothing while it is valid.\n */\nexport function ValidityAlert({ validity }: { validity: Validity }) {\n\tconst { t } = useTranslation(IMPORTHUB_UI_NS);\n\tif (validity.valid) return null;\n\treturn (\n\t\t<Alert status=\"error\" colorPalette=\"danger\" title={t(\"validity.invalidTitle\")}>\n\t\t\t<List.Root ps=\"4\">\n\t\t\t\t{validity.reasons.map((r) => (\n\t\t\t\t\t<List.Item key={`${r.code}:${r.path}:${r.message}`}>{r.message}</List.Item>\n\t\t\t\t))}\n\t\t\t</List.Root>\n\t\t</Alert>\n\t);\n}\n\nconst TONES = (t: TFunction): Record<string, StatusBadgeTone> => ({\n\t[t(\"validity.valid\")]: \"success\",\n\t[t(\"validity.invalid\")]: \"danger\",\n});\n\n/**\n * A list's validity column: Valid, or Invalid with its reasons beneath, so\n * the list says what to fix without opening each one.\n */\nexport function ValidityCell({ validity }: { validity: Validity }) {\n\tconst { t } = useTranslation(IMPORTHUB_UI_NS);\n\treturn (\n\t\t<StatusBadgeCell\n\t\t\tvalue={validity.valid ? t(\"validity.valid\") : t(\"validity.invalid\")}\n\t\t\ttoneMap={TONES(t)}\n\t\t\tdetail={validity.valid ? null : validity.reasons.map((r) => r.message).join(\" \")}\n\t\t/>\n\t);\n}\n\n/** \"Release 3\", or that there is none yet. */\nexport function releaseLabel(state: ConfigurationState, t: TFunction): string {\n\treturn state.latestRelease\n\t\t? t(\"release.number\", { number: state.latestRelease.number })\n\t\t: t(\"release.none\");\n}\n","import { Button } from \"@knkcs/anker/atoms\";\nimport { Modal } from \"@knkcs/anker/components\";\nimport { useHostIdentity } from \"@knkcs/anker/host\";\nimport { Alert, HStack, Link, List, Stack, Text } from \"@knkcs/anker/primitives\";\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { useEffect } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Link as RouterLink } from \"react-router\";\nimport {\n\ttype ConfigurationKind,\n\ttype ConfigurationState,\n\ttype CutReleaseResult,\n\ttype ImporthubClient,\n\tReleaseRefusedError,\n\ttype Validity,\n} from \"../client/importhub-client\";\nimport { IMPORTHUB_UI_NS } from \"../i18n/resources\";\nimport { itemPath, useImporthubHost } from \"./host\";\nimport { importhubKeys } from \"./query-keys\";\nimport { ValidityAlert } from \"./validity\";\n\nexport interface CutReleaseDialogProps {\n\topen: boolean;\n\tonClose: () => void;\n\tclient: ImporthubClient;\n\tkind: ConfigurationKind;\n\t/** The configuration whose draft is released, as its page last read it. */\n\tid: string;\n\tvalidity: Validity;\n\tstate: ConfigurationState;\n\t/** The page holds unsaved edits, which a cut does not release. */\n\tunsaved: boolean;\n\t/** The Release is cut. */\n\tonCut: (result: CutReleaseResult) => void;\n}\n\n/**\n * Confirms cutting a Configuration Release from the saved draft\n * (release-a-configuration:AC3), after blueprinthub's cut dialog. An invalid\n * draft is not offered for release: the dialog lists why instead, as\n * importhub would refuse it, and it lists importhub's own reasons when the\n * cut is refused anyway (somebody saved in between). A Mapping's cut names\n * the Import Profiles that take the Release at their next Import before it\n * is confirmed (AC4). Always mounted and driven by `open`, as anker's Modal\n * rule says.\n */\nexport function CutReleaseDialog({\n\topen,\n\tonClose,\n\tclient,\n\tkind,\n\tid,\n\tvalidity,\n\tstate,\n\tunsaved,\n\tonCut,\n}: CutReleaseDialogProps) {\n\tconst { t } = useTranslation(IMPORTHUB_UI_NS);\n\tconst { workspaceId } = useHostIdentity();\n\tconst queryClient = useQueryClient();\n\tconst cut = useMutation({\n\t\tmutationFn: () => client.cutRelease(kind, id, state.draftRevisionId),\n\t\tonSuccess: onCut,\n\t\t// A refusal means the page's draft is not importhub's (somebody saved\n\t\t// in between, or its validity changed): read it again, so the next\n\t\t// opening shows where it stands and cuts the draft that is there.\n\t\tonError: () =>\n\t\t\tvoid queryClient.invalidateQueries({\n\t\t\t\tqueryKey: importhubKeys.configuration(workspaceId, kind, id),\n\t\t\t}),\n\t});\n\tconst { reset } = cut;\n\t// A fresh session each time it opens, so last time's refusal is gone.\n\tuseEffect(() => {\n\t\tif (open) reset();\n\t}, [open, reset]);\n\t// Read when the dialog opens, not with the page: who takes the Release\n\t// is what matters at the moment of the cut.\n\tconst profiles = useQuery({\n\t\tqueryKey: importhubKeys.mappingImportProfiles(workspaceId, id),\n\t\tqueryFn: () => client.listMappingImportProfiles(id),\n\t\tenabled: open && kind === \"mapping\",\n\t});\n\n\tconst next = (state.latestRelease?.number ?? 0) + 1;\n\tconst unchanged = state.latestRelease !== undefined && !state.draftDiffersFromRelease;\n\tconst offered = validity.valid && !unchanged;\n\tconst refusal = cut.error instanceof ReleaseRefusedError ? cut.error : null;\n\n\treturn (\n\t\t<Modal\n\t\t\topen={open}\n\t\t\tonClose={onClose}\n\t\t\theader={t(\"cut.title\")}\n\t\t\tlazyMount\n\t\t\tunmountOnExit\n\t\t\tfooter={\n\t\t\t\t<HStack gap=\"2\">\n\t\t\t\t\t<Button variant=\"outline\" onClick={onClose}>\n\t\t\t\t\t\t{offered ? t(\"common.cancel\") : t(\"common.close\")}\n\t\t\t\t\t</Button>\n\t\t\t\t\t{offered ? (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"solid\"\n\t\t\t\t\t\t\tloading={cut.isPending}\n\t\t\t\t\t\t\tdisabled={refusal !== null}\n\t\t\t\t\t\t\tonClick={() => cut.mutate()}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{t(\"cut.confirm\")}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) : null}\n\t\t\t\t</HStack>\n\t\t\t}\n\t\t>\n\t\t\t<Stack gap=\"4\">\n\t\t\t\t{!validity.valid ? (\n\t\t\t\t\t<ValidityAlert validity={validity} />\n\t\t\t\t) : unchanged ? (\n\t\t\t\t\t<Alert\n\t\t\t\t\t\tstatus=\"info\"\n\t\t\t\t\t\tcolorPalette=\"info\"\n\t\t\t\t\t\ttitle={t(\"cut.unchanged\", { number: state.latestRelease?.number })}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Text>{t(\"cut.message\", { number: next })}</Text>\n\t\t\t\t\t\t{unsaved ? (\n\t\t\t\t\t\t\t<Alert status=\"warning\" colorPalette=\"warning\" title={t(\"cut.unsaved\")} />\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t{kind === \"mapping\" ? <TakingProfiles query={profiles} /> : null}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t\t{/* Once the page reads the refused draft again, its reasons above say it. */}\n\t\t\t\t{refusal && validity.valid ? (\n\t\t\t\t\t<Alert status=\"error\" colorPalette=\"danger\" title={t(\"cut.refused\")}>\n\t\t\t\t\t\t{refusal.validity && !refusal.validity.valid ? (\n\t\t\t\t\t\t\t<List.Root ps=\"4\">\n\t\t\t\t\t\t\t\t{refusal.validity.reasons.map((r) => (\n\t\t\t\t\t\t\t\t\t<List.Item key={`${r.code}:${r.path}:${r.message}`}>{r.message}</List.Item>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</List.Root>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\trefusal.message\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Alert>\n\t\t\t\t) : cut.isError && !refusal ? (\n\t\t\t\t\t<Alert status=\"error\" colorPalette=\"danger\" title={t(\"cut.failed\")} />\n\t\t\t\t) : null}\n\t\t\t</Stack>\n\t\t</Modal>\n\t);\n}\n\n/** The Import Profiles that include the Mapping, each a link to its page. */\nfunction TakingProfiles({\n\tquery,\n}: {\n\tquery: { isError: boolean; data?: { id: string; name: string }[] };\n}) {\n\tconst { t } = useTranslation(IMPORTHUB_UI_NS);\n\tconst { paths } = useImporthubHost();\n\tif (query.isError) return <Text color=\"fg.muted\">{t(\"startPage.error\")}</Text>;\n\tif (!query.data) return <Text color=\"fg.muted\">{t(\"startPage.loading\")}</Text>;\n\tif (query.data.length === 0) return <Text>{t(\"cut.noProfiles\")}</Text>;\n\treturn (\n\t\t<Stack gap=\"2\">\n\t\t\t<Text>{t(\"cut.profilesIntro\")}</Text>\n\t\t\t<List.Root ps=\"4\" aria-label={t(\"cut.profiles\")}>\n\t\t\t\t{query.data.map((p) => (\n\t\t\t\t\t<List.Item key={p.id}>\n\t\t\t\t\t\t<Link asChild>\n\t\t\t\t\t\t\t<RouterLink to={itemPath(paths, \"profiles\", p.id)}>{p.name}</RouterLink>\n\t\t\t\t\t\t</Link>\n\t\t\t\t\t</List.Item>\n\t\t\t\t))}\n\t\t\t</List.Root>\n\t\t</Stack>\n\t);\n}\n","import { ContextRail } from \"@knkcs/anker/components\";\nimport { useHostIdentity } from \"@knkcs/anker/host\";\nimport { Alert } from \"@knkcs/anker/primitives\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { Tag } from \"lucide-react\";\nimport { type ReactNode, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport type {\n\tConfigurationKind,\n\tConfigurationState,\n\tImporthubClient,\n\tValidity,\n} from \"../client/importhub-client\";\nimport { IMPORTHUB_UI_NS } from \"../i18n/resources\";\nimport { CutReleaseDialog } from \"./cut-release-dialog\";\nimport { importhubKeys } from \"./query-keys\";\n\nexport interface ConfigurationReleaseOptions {\n\tclient: ImporthubClient;\n\tkind: ConfigurationKind;\n\tid: string;\n\tvalidity: Validity;\n\tstate: ConfigurationState;\n\t/** The page holds unsaved edits. */\n\tunsaved: boolean;\n}\n\nexport interface ConfigurationRelease {\n\t/** The rail's Cut Release, for the Actions section (anker ADR 0004). */\n\trailAction: ReactNode;\n\t/** The dialog it opens, which the screen renders: the rail renders outside it. */\n\tdialog: ReactNode;\n\t/** Says a Release was cut, once it was; null before. */\n\tnotice: ReactNode;\n}\n\n/**\n * Cut Release, as each configuration page offers it: a rail action that\n * sets this screen's state, the dialog that state opens, and the notice of\n * the Release cut. A cut refreshes the configuration (its state, its\n * history), its kind's lists, and for a Mapping the Profiles, whose\n * validity counts the Mappings they include.\n */\nexport function useConfigurationRelease({\n\tclient,\n\tkind,\n\tid,\n\tvalidity,\n\tstate,\n\tunsaved,\n}: ConfigurationReleaseOptions): ConfigurationRelease {\n\tconst { t } = useTranslation(IMPORTHUB_UI_NS);\n\tconst { workspaceId } = useHostIdentity();\n\tconst queryClient = useQueryClient();\n\tconst [open, setOpen] = useState(false);\n\tconst [cut, setCut] = useState<number | null>(null);\n\treturn {\n\t\trailAction: (\n\t\t\t<ContextRail.IconButton\n\t\t\t\tlabel={t(\"cut.action\")}\n\t\t\t\ticon={<Tag size={16} />}\n\t\t\t\tonClick={() => {\n\t\t\t\t\tsetCut(null);\n\t\t\t\t\tsetOpen(true);\n\t\t\t\t}}\n\t\t\t/>\n\t\t),\n\t\tdialog: (\n\t\t\t<CutReleaseDialog\n\t\t\t\topen={open}\n\t\t\t\tonClose={() => setOpen(false)}\n\t\t\t\tclient={client}\n\t\t\t\tkind={kind}\n\t\t\t\tid={id}\n\t\t\t\tvalidity={validity}\n\t\t\t\tstate={state}\n\t\t\t\tunsaved={unsaved}\n\t\t\t\tonCut={(result) => {\n\t\t\t\t\tsetOpen(false);\n\t\t\t\t\tsetCut(result.release.number);\n\t\t\t\t\tvoid queryClient.invalidateQueries({\n\t\t\t\t\t\tqueryKey: importhubKeys.configuration(workspaceId, kind, id),\n\t\t\t\t\t});\n\t\t\t\t\tvoid queryClient.invalidateQueries({\n\t\t\t\t\t\tqueryKey: importhubKeys.configurations(workspaceId, kind),\n\t\t\t\t\t});\n\t\t\t\t\tif (kind === \"mapping\") {\n\t\t\t\t\t\tvoid queryClient.invalidateQueries({\n\t\t\t\t\t\t\tqueryKey: importhubKeys.importProfiles(workspaceId),\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t/>\n\t\t),\n\t\tnotice:\n\t\t\tcut === null ? null : (\n\t\t\t\t<Alert status=\"success\" colorPalette=\"success\" title={t(\"cut.done\", { number: cut })}>\n\t\t\t\t\t{t(\"cut.doneBody\")}\n\t\t\t\t</Alert>\n\t\t\t),\n\t};\n}\n","import { useHostIdentity } from \"@knkcs/anker/host\";\nimport { useQueries, useQuery } from \"@tanstack/react-query\";\nimport { useMemo } from \"react\";\nimport { useImporthubHost } from \"./host\";\nimport { importhubKeys } from \"./query-keys\";\n\nexport interface BlueprintNames {\n\t/** Whether the host can name Blueprints at all (ImporthubHost.blueprints). */\n\tavailable: boolean;\n\t/** A Blueprint's name; undefined while unknown. */\n\tblueprintName: (blueprintId: string) => string | undefined;\n\t/** A Release's label, such as \"Release 3\"; undefined while unknown. */\n\treleaseLabel: (blueprintId: string, releaseId: string) => string | undefined;\n}\n\n/**\n * Names the Blueprints and Releases Mappings target, through the host's\n * lookup: importhub holds only their ids, and an id never labels a thing\n * (anker's rule). Without a lookup, `available` is false and the screens\n * show the ids as the labelled technical detail they are.\n */\nexport function useBlueprintNames(blueprintIds: readonly string[]): BlueprintNames {\n\tconst { blueprints } = useImporthubHost();\n\tconst { workspaceId } = useHostIdentity();\n\tconst unique = [...new Set(blueprintIds.filter(Boolean))].sort();\n\tconst list = useQuery({\n\t\tqueryKey: importhubKeys.blueprints(workspaceId),\n\t\tqueryFn: () => blueprints?.listBlueprints() ?? Promise.resolve([]),\n\t\tenabled: blueprints !== undefined,\n\t});\n\tconst releases = useQueries({\n\t\tqueries: unique.map((blueprintId) => ({\n\t\t\tqueryKey: importhubKeys.blueprintReleases(workspaceId, blueprintId),\n\t\t\tqueryFn: () => blueprints?.listReleases(blueprintId) ?? Promise.resolve([]),\n\t\t\tenabled: blueprints !== undefined,\n\t\t})),\n\t});\n\t// One object per answer, not per render: a list's columns are memoised on\n\t// it, and new columns remount every cell.\n\tconst releaseData = releases.map((r) => r.data);\n\tconst releasesKey = releases.map((r) => r.dataUpdatedAt).join();\n\tconst uniqueKey = unique.join();\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: keyed on the answers' timestamps\n\treturn useMemo(\n\t\t() => ({\n\t\t\tavailable: blueprints !== undefined,\n\t\t\tblueprintName: (id: string) => list.data?.find((b) => b.id === id)?.name,\n\t\t\treleaseLabel: (blueprintId: string, releaseId: string) =>\n\t\t\t\treleaseData[unique.indexOf(blueprintId)]?.find((r) => r.id === releaseId)?.label,\n\t\t}),\n\t\t[blueprints, list.data, releasesKey, uniqueKey],\n\t);\n}\n","import { StatusBadge, type StatusBadgeTone } from \"@knkcs/anker/atoms\";\nimport { Card } from \"@knkcs/anker/components\";\nimport { useHostIdentity } from \"@knkcs/anker/host\";\nimport { Alert, Box, Code, Stack, Table, Text } from \"@knkcs/anker/primitives\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useTranslation } from \"react-i18next\";\nimport type {\n\tConfigurationKind,\n\tFieldComparisonStatus,\n\tImporthubClient,\n} from \"../../client/importhub-client\";\nimport { useBlueprintNames } from \"../../common/blueprint-names\";\nimport { importhubKeys } from \"../../common/query-keys\";\nimport { IMPORTHUB_UI_NS } from \"../../i18n/resources\";\n\nexport interface RevisionComparisonProps {\n\tclient: ImporthubClient;\n\tkind: ConfigurationKind;\n\tid: string;\n\t/** The older Revision, on the left. */\n\tfromRevisionId: string;\n\t/** The newer Revision, on the right. */\n\ttoRevisionId: string;\n\t/** What a person calls a Revision (revision-labels.ts). */\n\tlabelOf: (revisionId: string) => string;\n}\n\nconst TONE: Record<FieldComparisonStatus, StatusBadgeTone> = {\n\tunchanged: \"neutral\",\n\tadded: \"success\",\n\tremoved: \"danger\",\n\tchanged: \"warning\",\n};\n\n// The compared fields a page names, by importhub's key for them, to the\n// label the page gives the field. A field not here (a Mapping's settings the\n// structured editor owns) is named by its key, the technical detail it is.\nconst FIELD_LABELS: Record<string, string> = {\n\tname: \"fields.name\",\n\tdescription: \"fields.description\",\n\tentities: \"entitySets.entities\",\n\tentity_set_id: \"profiles.entitySet\",\n\tpreprocessors: \"profiles.preprocessors\",\n\tmapping_ids: \"profiles.mappings\",\n\tpost_processors: \"profiles.postProcessors\",\n\tauto_publish: \"profiles.autoPublish\",\n\tdelete_source_file_on_success: \"profiles.deleteOnSuccess\",\n\tblueprint_id: \"mappings.blueprint\",\n\tblueprint_release_id: \"mappings.release\",\n\telement_selector: \"mappings.elementSelector\",\n};\n\n// The same fields' labels where their values are ids the host cannot name.\nconst ID_LABELS: Record<string, string> = {\n\tblueprint_id: \"mappings.blueprintId\",\n\tblueprint_release_id: \"mappings.releaseId\",\n};\n\n/**\n * Two Revisions of one configuration side by side\n * (release-a-configuration:AC6): one row per field, how it differs, and its\n * value in each. A changed field comes first; an unchanged one is still\n * shown, so either side reads whole. Values that name other configuration\n * or Blueprints show their names, not their ids.\n */\nexport function RevisionComparison({\n\tclient,\n\tkind,\n\tid,\n\tfromRevisionId,\n\ttoRevisionId,\n\tlabelOf,\n}: RevisionComparisonProps) {\n\tconst { t } = useTranslation(IMPORTHUB_UI_NS);\n\tconst { workspaceId } = useHostIdentity();\n\tconst query = useQuery({\n\t\tqueryKey: importhubKeys.comparison(workspaceId, kind, id, fromRevisionId, toRevisionId),\n\t\tqueryFn: () => client.compareRevisions(kind, id, fromRevisionId, toRevisionId),\n\t});\n\tconst { format, blueprintIdsOnly } = useValueFormat(client, kind, query.data);\n\t// Where the host cannot name Blueprints, a Mapping's Blueprint and Release\n\t// are shown as the ids they are, labelled as ids (anker: an id never\n\t// labels a thing), as the Mapping's page shows them.\n\tconst labelKeyOf = (field: string) =>\n\t\tblueprintIdsOnly && field in ID_LABELS ? ID_LABELS[field] : FIELD_LABELS[field];\n\tconst fields = [...(query.data?.fields ?? [])].sort(\n\t\t(a, b) => Number(a.status === \"unchanged\") - Number(b.status === \"unchanged\"),\n\t);\n\tconst differing = fields.filter((f) => f.status !== \"unchanged\").length;\n\tconst from = labelOf(fromRevisionId);\n\tconst to = labelOf(toRevisionId);\n\n\treturn (\n\t\t<Box as=\"section\" aria-label={t(\"compare.title\")}>\n\t\t\t<Card title={t(\"compare.title\")}>\n\t\t\t\t<Stack gap=\"3\">\n\t\t\t\t\t<Text>{t(\"compare.between\", { from, to })}</Text>\n\t\t\t\t\t{query.isError ? (\n\t\t\t\t\t\t<Alert status=\"error\" colorPalette=\"danger\" title={t(\"startPage.error\")} />\n\t\t\t\t\t) : null}\n\t\t\t\t\t{!query.data ? (\n\t\t\t\t\t\tquery.isError ? null : (\n\t\t\t\t\t\t\t<Text color=\"fg.muted\">{t(\"startPage.loading\")}</Text>\n\t\t\t\t\t\t)\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<Text color=\"fg.muted\">\n\t\t\t\t\t\t\t\t{differing === 0 ? t(\"compare.same\") : t(\"compare.differing\", { count: differing })}\n\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t<Table.Root size=\"sm\">\n\t\t\t\t\t\t\t\t<Table.Header>\n\t\t\t\t\t\t\t\t\t<Table.Row>\n\t\t\t\t\t\t\t\t\t\t<Table.ColumnHeader>{t(\"compare.field\")}</Table.ColumnHeader>\n\t\t\t\t\t\t\t\t\t\t<Table.ColumnHeader>{from}</Table.ColumnHeader>\n\t\t\t\t\t\t\t\t\t\t<Table.ColumnHeader>{to}</Table.ColumnHeader>\n\t\t\t\t\t\t\t\t\t</Table.Row>\n\t\t\t\t\t\t\t\t</Table.Header>\n\t\t\t\t\t\t\t\t<Table.Body>\n\t\t\t\t\t\t\t\t\t{fields.map((f) => (\n\t\t\t\t\t\t\t\t\t\t<Table.Row key={f.field} verticalAlign=\"top\">\n\t\t\t\t\t\t\t\t\t\t\t<Table.Cell as=\"th\" scope=\"row\" fontWeight=\"normal\">\n\t\t\t\t\t\t\t\t\t\t\t\t<Stack gap=\"1\" align=\"start\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Text fontWeight=\"medium\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{labelKeyOf(f.field) ? t(labelKeyOf(f.field) as string) : f.field}\n\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<StatusBadge\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ttone={TONE[f.status]}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel={t(`compare.status.${f.status}`)}\n\t\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t\t\t\t</Table.Cell>\n\t\t\t\t\t\t\t\t\t\t\t<Table.Cell>\n\t\t\t\t\t\t\t\t\t\t\t\t<Value text={format(f.field, \"from\")} />\n\t\t\t\t\t\t\t\t\t\t\t</Table.Cell>\n\t\t\t\t\t\t\t\t\t\t\t<Table.Cell>\n\t\t\t\t\t\t\t\t\t\t\t\t<Value text={format(f.field, \"to\")} />\n\t\t\t\t\t\t\t\t\t\t\t</Table.Cell>\n\t\t\t\t\t\t\t\t\t\t</Table.Row>\n\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</Table.Body>\n\t\t\t\t\t\t\t</Table.Root>\n\t\t\t\t\t\t</>\n\t\t\t\t\t)}\n\t\t\t\t</Stack>\n\t\t\t</Card>\n\t\t</Box>\n\t);\n}\n\ntype Shown = { plain: string } | { json: string } | { code: string } | null;\n\n/** One side's value: a line of text, an id, or structured settings as JSON. */\nfunction Value({ text }: { text: Shown }) {\n\tconst { t } = useTranslation(IMPORTHUB_UI_NS);\n\tif (text === null) return <Text color=\"fg.muted\">{t(\"compare.absent\")}</Text>;\n\tif (\"plain\" in text) return <Text whiteSpace=\"pre-wrap\">{text.plain}</Text>;\n\tif (\"code\" in text) return <Code>{text.code}</Code>;\n\treturn (\n\t\t<Code display=\"block\" whiteSpace=\"pre-wrap\" p=\"2\">\n\t\t\t{text.json}\n\t\t</Code>\n\t);\n}\n\ntype Side = \"from\" | \"to\";\n\n/**\n * How a compared value is shown: a Profile's Mappings and Entity Set by\n * name, a Mapping's Blueprint and Release by name where the host can name\n * them, text as it is, a switch as yes or no, and anything else as JSON.\n */\nfunction useValueFormat(\n\tclient: ImporthubClient,\n\tkind: ConfigurationKind,\n\tdata:\n\t\t| { from: { content: Record<string, unknown> }; to: { content: Record<string, unknown> } }\n\t\t| undefined,\n) {\n\tconst { t } = useTranslation(IMPORTHUB_UI_NS);\n\tconst { workspaceId } = useHostIdentity();\n\tconst isProfile = kind === \"importProfile\";\n\tconst mappings = useQuery({\n\t\tqueryKey: importhubKeys.mappings(workspaceId),\n\t\tqueryFn: () => client.listMappings(),\n\t\tenabled: isProfile,\n\t});\n\tconst entitySets = useQuery({\n\t\tqueryKey: importhubKeys.entitySets(workspaceId),\n\t\tqueryFn: () => client.listEntitySets(),\n\t\tenabled: isProfile,\n\t});\n\tconst blueprintIds =\n\t\tkind === \"mapping\" && data\n\t\t\t? [data.from.content.blueprint_id, data.to.content.blueprint_id].map((b) => String(b ?? \"\"))\n\t\t\t: [];\n\tconst names = useBlueprintNames(blueprintIds);\n\n\tconst blueprintIdsOnly = kind === \"mapping\" && !names.available;\n\tconst format = (field: string, side: Side): Shown => {\n\t\tconst content = data?.[side].content ?? {};\n\t\tconst value = content[field];\n\t\tif (value === undefined || value === null) return null;\n\t\tif (isProfile && field === \"mapping_ids\" && Array.isArray(value)) {\n\t\t\tif (value.length === 0) return { plain: t(\"profiles.noMappings\") };\n\t\t\treturn {\n\t\t\t\tplain: value\n\t\t\t\t\t.map(\n\t\t\t\t\t\t(m) =>\n\t\t\t\t\t\t\tmappings.data?.find((x) => x.id === m)?.content.name ?? t(\"profiles.missingMapping\"),\n\t\t\t\t\t)\n\t\t\t\t\t.join(\"\\n\"),\n\t\t\t};\n\t\t}\n\t\tif (isProfile && field === \"entity_set_id\") {\n\t\t\tif (value === \"\") return { plain: t(\"profiles.noEntitySet\") };\n\t\t\treturn {\n\t\t\t\tplain:\n\t\t\t\t\tentitySets.data?.find((e) => e.id === value)?.content.name ??\n\t\t\t\t\tt(\"compare.missingEntitySet\"),\n\t\t\t};\n\t\t}\n\t\tif (blueprintIdsOnly && field in ID_LABELS) {\n\t\t\treturn value === \"\" ? { plain: \"—\" } : { code: String(value) };\n\t\t}\n\t\tif (kind === \"mapping\" && names.available && field === \"blueprint_id\") {\n\t\t\treturn { plain: names.blueprintName(String(value)) ?? \"…\" };\n\t\t}\n\t\tif (kind === \"mapping\" && names.available && field === \"blueprint_release_id\") {\n\t\t\tconst blueprintId = String(content.blueprint_id ?? \"\");\n\t\t\treturn { plain: names.releaseLabel(blueprintId, String(value)) ?? \"…\" };\n\t\t}\n\t\tif (typeof value === \"string\") return { plain: value === \"\" ? \"—\" : value };\n\t\tif (typeof value === \"boolean\") return { plain: value ? t(\"compare.yes\") : t(\"compare.no\") };\n\t\tif (typeof value === \"number\") return { plain: String(value) };\n\t\treturn { json: JSON.stringify(value, null, 2) };\n\t};\n\treturn { format, blueprintIdsOnly };\n}\n","import { useMemo } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport type {\n\tConfigurationReleaseRecord,\n\tConfigurationRevision,\n} from \"../../client/importhub-client\";\nimport { IMPORTHUB_UI_NS } from \"../../i18n/resources\";\n\n/**\n * When a Revision was saved, to the minute, in the viewer's time zone: a\n * history needs the time as well as the day, and the numeric form reads the\n * same in English and German. DateCell's template, and `time()`'s format.\n */\nexport const SAVED_AT_FORMAT = \"YYYY-MM-DD HH:mm\";\n\nconst pad = (n: number) => String(n).padStart(2, \"0\");\n\n/** An ISO timestamp as SAVED_AT_FORMAT writes it, in local time. */\nexport function formatSavedAt(iso: string): string {\n\tconst d = new Date(iso);\n\tif (Number.isNaN(d.getTime())) return \"\";\n\treturn `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}`;\n}\n\nexport interface RevisionLabels {\n\t/**\n\t * What a person calls a Revision: \"Draft\", \"Release 2\", or the time it\n\t * was saved. A Revision's id never labels it (anker's rule).\n\t */\n\tof: (revisionId: string) => string;\n\t/** An ISO timestamp, written as the history writes times. */\n\ttime: (iso: string) => string;\n}\n\n/** The names of a history's Revisions, from what its pages hold. */\nexport function useRevisionLabels(\n\trevisions: readonly ConfigurationRevision[],\n\treleases: readonly ConfigurationReleaseRecord[],\n\tdraftRevisionId: string,\n): RevisionLabels {\n\tconst { t } = useTranslation(IMPORTHUB_UI_NS);\n\treturn useMemo(\n\t\t() => ({\n\t\t\tof: (revisionId: string) => {\n\t\t\t\tif (revisionId === draftRevisionId) return t(\"history.draft\");\n\t\t\t\t// The latest Release cut from it, when there are several.\n\t\t\t\tconst release = releases.find((r) => r.revisionId === revisionId);\n\t\t\t\tif (release) return t(\"release.number\", { number: release.number });\n\t\t\t\tconst revision = revisions.find((r) => r.id === revisionId);\n\t\t\t\treturn revision\n\t\t\t\t\t? t(\"history.revisionOf\", { time: formatSavedAt(revision.savedAt) })\n\t\t\t\t\t: t(\"history.earlierRevision\");\n\t\t\t},\n\t\t\ttime: formatSavedAt,\n\t\t}),\n\t\t[t, revisions, releases, draftRevisionId],\n\t);\n}\n","import { Button, EmptyState } from \"@knkcs/anker/atoms\";\nimport {\n\tActionCell,\n\tDataTable,\n\tDateCell,\n\tIdentityCell,\n\tModal,\n\tStatusBadgeCell,\n\tTruncatedTextCell,\n} from \"@knkcs/anker/components\";\nimport { useHostIdentity } from \"@knkcs/anker/host\";\nimport { Alert, Box, HStack, Stack, Text } from \"@knkcs/anker/primitives\";\nimport { useInfiniteQuery, useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport type { ColumnDef, RowSelectionState, Updater } from \"@tanstack/react-table\";\nimport { History, RotateCcw } from \"lucide-react\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport type {\n\tConfigurationKind,\n\tConfigurationReleaseRecord,\n\tConfigurationRevision,\n\tImporthubClient,\n} from \"../../client/importhub-client\";\nimport { importhubKeys } from \"../../common/query-keys\";\nimport { useCanConfigure } from \"../../common/use-can-configure\";\nimport { ValidityCell } from \"../../common/validity\";\nimport { IMPORTHUB_UI_NS } from \"../../i18n/resources\";\nimport { RevisionComparison } from \"./revision-comparison\";\nimport { SAVED_AT_FORMAT, useRevisionLabels } from \"./revision-labels\";\n\nexport interface ConfigurationHistoryProps {\n\tclient: ImporthubClient;\n\tkind: ConfigurationKind;\n\t/** The Import Profile's, Mapping's or Entity Set's id. */\n\tid: string;\n\t/** The draft as the page last read it: a restore builds on it. */\n\tdraftRevisionId: string;\n\t/**\n\t * A restore saved a new draft: the page reads it again, and drops edits\n\t * it holds on the old one.\n\t */\n\tonRestored?: () => void | Promise<void>;\n}\n\ntype RevisionRow = ConfigurationRevision & Record<string, unknown>;\n\n/**\n * A configuration's history (release-a-configuration:AC6, AC7): every\n * Revision, newest first, with who saved it and when, the Releases cut from\n * it with who cut them and when, and whether it was valid. Choosing two\n * compares them side by side; an admin restores an older one as a new draft.\n * A panel, not a page: the configuration's page renders it as its History\n * tab, and a host may place it elsewhere. The table reaches both edges, as\n * anker's flush tab bodies do.\n */\nexport function ConfigurationHistory({\n\tclient,\n\tkind,\n\tid,\n\tdraftRevisionId,\n\tonRestored,\n}: ConfigurationHistoryProps) {\n\tconst { t } = useTranslation(IMPORTHUB_UI_NS);\n\tconst { workspaceId, members } = useHostIdentity();\n\tconst canRestore = useCanConfigure();\n\tconst history = useInfiniteQuery({\n\t\tqueryKey: importhubKeys.history(workspaceId, kind, id),\n\t\tqueryFn: ({ pageParam }) => client.listHistory(kind, id, pageParam),\n\t\tinitialPageParam: \"\",\n\t\tgetNextPageParam: (last) => last.nextPageToken || undefined,\n\t});\n\tconst rows = useMemo(\n\t\t() => (history.data?.pages ?? []).flatMap((p) => p.revisions) as RevisionRow[],\n\t\t[history.data],\n\t);\n\tconst releases = useMemo(() => history.data?.pages[0]?.releases ?? [], [history.data]);\n\tconst labels = useRevisionLabels(rows, releases, draftRevisionId);\n\tconst [restoring, setRestoring] = useState<ConfigurationRevision | null>(null);\n\n\t// At most two, the latest two chosen: a third choice replaces the older\n\t// choice, as blueprinthub's Revisions tab does.\n\tconst [chosen, setChosen] = useState<string[]>([]);\n\tconst selection = useMemo<RowSelectionState>(\n\t\t() => Object.fromEntries(chosen.map((r) => [r, true])),\n\t\t[chosen],\n\t);\n\t// From the state itself rather than this render's: a checkbox may hold on\n\t// to the handler it was first given.\n\tconst choose = (updater: Updater<RowSelectionState>) =>\n\t\tsetChosen((current) => {\n\t\t\tconst was = Object.fromEntries(current.map((r) => [r, true]));\n\t\t\tconst next = typeof updater === \"function\" ? updater(was) : updater;\n\t\t\tconst ids = Object.keys(next).filter((r) => next[r]);\n\t\t\tconst kept = current.filter((r) => ids.includes(r));\n\t\t\tconst added = ids.filter((r) => !current.includes(r));\n\t\t\treturn [...kept, ...added].slice(-2);\n\t\t});\n\t// The older of the two on the left, so the comparison reads as history does.\n\tconst pair =\n\t\tchosen.length === 2\n\t\t\t? [...chosen].sort(\n\t\t\t\t\t(x, y) => rows.findIndex((r) => r.id === y) - rows.findIndex((r) => r.id === x),\n\t\t\t\t)\n\t\t\t: null;\n\n\tconst columns = useMemo<ColumnDef<RevisionRow, unknown>[]>(() => {\n\t\tconst releasesOf = (revisionId: string) =>\n\t\t\treleases.filter((r: ConfigurationReleaseRecord) => r.revisionId === revisionId);\n\t\tconst nameOf = (userId: string) =>\n\t\t\tmembers.byId(userId)?.displayName ?? t(\"history.unknownPerson\");\n\t\treturn [\n\t\t\t{\n\t\t\t\tid: \"revision\",\n\t\t\t\theader: t(\"history.columns.revision\"),\n\t\t\t\tenableSorting: false,\n\t\t\t\tcell: ({ row }) => (\n\t\t\t\t\t<TruncatedTextCell\n\t\t\t\t\t\tvalue={row.original.id === draftRevisionId ? t(\"history.draft\") : t(\"history.revision\")}\n\t\t\t\t\t\tsubText={\n\t\t\t\t\t\t\trow.original.restoredFromRevisionId\n\t\t\t\t\t\t\t\t? t(\"history.restoredFrom\", {\n\t\t\t\t\t\t\t\t\t\trevision: labels.of(row.original.restoredFromRevisionId),\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"release\",\n\t\t\t\theader: t(\"history.columns.release\"),\n\t\t\t\tenableSorting: false,\n\t\t\t\tcell: ({ row }) => {\n\t\t\t\t\tconst cut = releasesOf(row.original.id);\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<StatusBadgeCell\n\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\tcut.length > 0\n\t\t\t\t\t\t\t\t\t? cut.map((r) => t(\"release.number\", { number: r.number })).join(\", \")\n\t\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfallbackTone=\"success\"\n\t\t\t\t\t\t\tdetailColor=\"fg.muted\"\n\t\t\t\t\t\t\tdetail={\n\t\t\t\t\t\t\t\tcut.length > 0\n\t\t\t\t\t\t\t\t\t? cut\n\t\t\t\t\t\t\t\t\t\t\t.map((r) =>\n\t\t\t\t\t\t\t\t\t\t\t\tt(\"history.cutBy\", {\n\t\t\t\t\t\t\t\t\t\t\t\t\tname: nameOf(r.releasedBy),\n\t\t\t\t\t\t\t\t\t\t\t\t\ttime: labels.time(r.releasedAt),\n\t\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t.join(\" \")\n\t\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"savedBy\",\n\t\t\t\theader: t(\"history.columns.savedBy\"),\n\t\t\t\tenableSorting: false,\n\t\t\t\tcell: ({ row }) => <IdentityCell name={nameOf(row.original.savedBy)} />,\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"savedAt\",\n\t\t\t\theader: t(\"history.columns.savedAt\"),\n\t\t\t\tenableSorting: false,\n\t\t\t\tsize: 140,\n\t\t\t\tcell: ({ row }) => <DateCell value={row.original.savedAt} format={SAVED_AT_FORMAT} />,\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"validity\",\n\t\t\t\theader: t(\"validity.column\"),\n\t\t\t\tenableSorting: false,\n\t\t\t\tcell: ({ row }) => <ValidityCell validity={row.original.validity} />,\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"actions\",\n\t\t\t\theader: \"\",\n\t\t\t\tenableSorting: false,\n\t\t\t\tminSize: 60,\n\t\t\t\tcell: ({ row }) =>\n\t\t\t\t\tcanRestore && row.original.id !== draftRevisionId ? (\n\t\t\t\t\t\t<ActionCell\n\t\t\t\t\t\t\tactions={[\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ticon: RotateCcw,\n\t\t\t\t\t\t\t\t\tlabel: t(\"history.restore\"),\n\t\t\t\t\t\t\t\t\tonClick: () => setRestoring(row.original),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t]}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : null,\n\t\t\t},\n\t\t];\n\t}, [t, members, releases, labels, draftRevisionId, canRestore]);\n\n\t// Every Release comes with the first page, its Revision maybe only with a\n\t// later one: those Releases are named here until their row is loaded.\n\tconst nameOf = (userId: string) =>\n\t\tmembers.byId(userId)?.displayName ?? t(\"history.unknownPerson\");\n\tconst unloaded = releases.filter((r) => !rows.some((row) => row.id === r.revisionId));\n\n\treturn (\n\t\t<>\n\t\t\t<Box px=\"8\" py=\"4\">\n\t\t\t\t<Stack gap=\"1\">\n\t\t\t\t\t<Text color=\"fg.muted\">{t(\"history.hint\")}</Text>\n\t\t\t\t\t{history.hasNextPage\n\t\t\t\t\t\t? unloaded.map((r) => (\n\t\t\t\t\t\t\t\t<Text key={r.id} color=\"fg.muted\">\n\t\t\t\t\t\t\t\t\t{t(\"history.olderRelease\", {\n\t\t\t\t\t\t\t\t\t\trelease: t(\"release.number\", { number: r.number }),\n\t\t\t\t\t\t\t\t\t\tname: nameOf(r.releasedBy),\n\t\t\t\t\t\t\t\t\t\ttime: labels.time(r.releasedAt),\n\t\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t))\n\t\t\t\t\t\t: null}\n\t\t\t\t</Stack>\n\t\t\t</Box>\n\t\t\t{history.isError ? (\n\t\t\t\t<Box px=\"8\" pb=\"4\">\n\t\t\t\t\t<Alert status=\"error\" colorPalette=\"danger\" title={t(\"startPage.error\")} />\n\t\t\t\t</Box>\n\t\t\t) : null}\n\t\t\t<DataTable\n\t\t\t\tcolumns={columns}\n\t\t\t\tdata={rows}\n\t\t\t\tloading={history.isLoading}\n\t\t\t\tselectable\n\t\t\t\trowSelection={selection}\n\t\t\t\tonRowSelectionChange={choose}\n\t\t\t\tgetRowId={(r) => r.id}\n\t\t\t\temptyState={<EmptyState icon={<History size={32} />} header={t(\"history.none\")} />}\n\t\t\t/>\n\t\t\t{history.hasNextPage || pair ? (\n\t\t\t\t<Box px=\"8\" py=\"6\">\n\t\t\t\t\t<Stack gap=\"4\">\n\t\t\t\t\t\t{history.hasNextPage ? (\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\t\t\talignSelf=\"center\"\n\t\t\t\t\t\t\t\tloading={history.isFetchingNextPage}\n\t\t\t\t\t\t\t\tonClick={() => void history.fetchNextPage()}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{t(\"history.loadMore\")}\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t{pair ? (\n\t\t\t\t\t\t\t<RevisionComparison\n\t\t\t\t\t\t\t\tclient={client}\n\t\t\t\t\t\t\t\tkind={kind}\n\t\t\t\t\t\t\t\tid={id}\n\t\t\t\t\t\t\t\tfromRevisionId={pair[0] as string}\n\t\t\t\t\t\t\t\ttoRevisionId={pair[1] as string}\n\t\t\t\t\t\t\t\tlabelOf={labels.of}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t</Stack>\n\t\t\t\t</Box>\n\t\t\t) : null}\n\t\t\t<RestoreDialog\n\t\t\t\trevision={restoring}\n\t\t\t\tlabel={restoring ? labels.of(restoring.id) : \"\"}\n\t\t\t\tonClose={() => setRestoring(null)}\n\t\t\t\tonRestore={(revision) => client.restoreRevision(kind, id, revision.id, draftRevisionId)}\n\t\t\t\tonRestored={() => {\n\t\t\t\t\tsetChosen([]);\n\t\t\t\t\t// The restore is saved; a page that cannot read it back now\n\t\t\t\t\t// reads it with the invalidation that follows.\n\t\t\t\t\tvoid Promise.resolve(onRestored?.()).catch(() => {});\n\t\t\t\t}}\n\t\t\t\tkind={kind}\n\t\t\t\tid={id}\n\t\t\t/>\n\t\t</>\n\t);\n}\n\n/**\n * Confirms restoring an older Revision as a new draft (AC7). The Release\n * stays as it is: a restore is a save, released only by a cut.\n */\nfunction RestoreDialog({\n\trevision,\n\tlabel,\n\tonClose,\n\tonRestore,\n\tonRestored,\n\tkind,\n\tid,\n}: {\n\trevision: ConfigurationRevision | null;\n\tlabel: string;\n\tonClose: () => void;\n\tonRestore: (revision: ConfigurationRevision) => Promise<void>;\n\tonRestored: () => void;\n\tkind: ConfigurationKind;\n\tid: string;\n}) {\n\tconst { t } = useTranslation(IMPORTHUB_UI_NS);\n\tconst { workspaceId } = useHostIdentity();\n\tconst queryClient = useQueryClient();\n\tconst open = revision !== null;\n\t// Latched, so the content doesn't go blank while the modal animates out.\n\tconst [shown, setShown] = useState({ revision, label });\n\tif (revision && revision !== shown.revision) setShown({ revision, label });\n\tconst restore = useMutation({\n\t\tmutationFn: onRestore,\n\t\tonSuccess: () => {\n\t\t\tonRestored();\n\t\t\t// The configuration's key is its history's and comparisons' prefix.\n\t\t\tvoid queryClient.invalidateQueries({\n\t\t\t\tqueryKey: importhubKeys.configuration(workspaceId, kind, id),\n\t\t\t});\n\t\t\tvoid queryClient.invalidateQueries({\n\t\t\t\tqueryKey: importhubKeys.configurations(workspaceId, kind),\n\t\t\t});\n\t\t\tonClose();\n\t\t},\n\t});\n\tconst { reset } = restore;\n\tuseEffect(() => {\n\t\tif (open) reset();\n\t}, [open, reset]);\n\treturn (\n\t\t<Modal\n\t\t\topen={open}\n\t\t\tonClose={onClose}\n\t\t\theader={t(\"history.restoreTitle\", { revision: shown.label })}\n\t\t\tlazyMount\n\t\t\tunmountOnExit\n\t\t\tfooter={\n\t\t\t\t<HStack gap=\"2\">\n\t\t\t\t\t<Button variant=\"outline\" onClick={onClose}>\n\t\t\t\t\t\t{t(\"common.cancel\")}\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"solid\"\n\t\t\t\t\t\tloading={restore.isPending}\n\t\t\t\t\t\tonClick={() => shown.revision && restore.mutate(shown.revision)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{t(\"history.restoreConfirm\")}\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t}\n\t\t>\n\t\t\t<Stack gap=\"4\">\n\t\t\t\t<Text>{t(\"history.restoreMessage\")}</Text>\n\t\t\t\t{restore.isError ? (\n\t\t\t\t\t<Alert status=\"error\" colorPalette=\"danger\" title={t(\"history.restoreFailed\")}>\n\t\t\t\t\t\t{restore.error.message}\n\t\t\t\t\t</Alert>\n\t\t\t\t) : null}\n\t\t\t</Stack>\n\t\t</Modal>\n\t);\n}\n","// Where a Mapping's validity reasons belong in its form.\n//\n// importhub names each reason's place as a JSON Pointer into the content\n// (importhub.v1.ValidityReason.path): the proto's field names for the\n// Mapping's own settings (`/source_key/extract_pattern`), xmlmapper's JSON\n// keys inside a field mapping (`/fields/2/refIdExtractPattern`). The form\n// holds the content in its JSON shape, camelCase, so each token is turned\n// into its camelCase key and the tokens joined by `.`: the name a form\n// field is registered under (`sourceKey.extractPattern`, `fields.2.selector`).\nimport type { ValidityReason } from \"../../client/importhub-client\";\n\nconst camel = (token: string) => token.replace(/_([a-z0-9])/g, (_, c: string) => c.toUpperCase());\n\n/** The form name a reason's path points at; \"\" for the Mapping as a whole. */\nexport function reasonFieldName(path: string): string {\n\tif (!path || path === \"/\") return \"\";\n\treturn path\n\t\t.replace(/^\\//, \"\")\n\t\t.split(\"/\")\n\t\t.map((token) => camel(token.replace(/~1/g, \"/\").replace(/~0/g, \"~\")))\n\t\t.join(\".\");\n}\n\n/** The reasons by the form name they point at, each name's messages joined. */\nexport function reasonsByFieldName(reasons: readonly ValidityReason[]): Map<string, string> {\n\tconst out = new Map<string, string>();\n\tfor (const r of reasons) {\n\t\tconst name = reasonFieldName(r.path);\n\t\tif (!name) continue;\n\t\tconst before = out.get(name);\n\t\tout.set(name, before ? `${before} ${r.message}` : r.message);\n\t}\n\treturn out;\n}\n","import { Button } from \"@knkcs/anker/atoms\";\nimport { Modal } from \"@knkcs/anker/components\";\nimport { BaseSelectField, InputField } from \"@knkcs/anker/forms\";\nimport { useHostIdentity } from \"@knkcs/anker/host\";\nimport { Alert, Code, HStack, List, Stack, Text } from \"@knkcs/anker/primitives\";\nimport { useMutation, useQuery } from \"@tanstack/react-query\";\nimport { useEffect } from \"react\";\nimport { FormProvider, useForm, useWatch } from \"react-hook-form\";\nimport { useTranslation } from \"react-i18next\";\nimport type {\n\tBlueprintReleaseCheck,\n\tImporthubClient,\n\tMapping,\n} from \"../../client/importhub-client\";\nimport { useImporthubHost } from \"../../common/host\";\nimport { importhubKeys } from \"../../common/query-keys\";\nimport { IMPORTHUB_UI_NS } from \"../../i18n/resources\";\n\nexport interface MoveReleaseDialogProps {\n\topen: boolean;\n\tonClose: () => void;\n\tclient: ImporthubClient;\n\tmapping: Mapping;\n\t/** Saves the Mapping on the checked Release; resolves once saved. */\n\tonMove: (blueprintReleaseId: string) => Promise<unknown>;\n}\n\ntype Values = { blueprintReleaseId: string | null };\n\n/**\n * Moves a Mapping to another Release of its Blueprint (manage-mappings:AC5):\n * the admin picks the Release, importhub checks the draft against it, and\n * the dialog lists every mapped field path, and Release Spec field, the\n * Release no longer has, before anything is saved. Move saves only a Release\n * that was checked, and is offered only once it was.\n */\nexport function MoveReleaseDialog({\n\topen,\n\tonClose,\n\tclient,\n\tmapping,\n\tonMove,\n}: MoveReleaseDialogProps) {\n\tconst { t } = useTranslation(IMPORTHUB_UI_NS);\n\tconst form = useForm<Values>({ defaultValues: { blueprintReleaseId: null } });\n\tconst releaseId = useWatch({ control: form.control, name: \"blueprintReleaseId\" }) ?? \"\";\n\tconst check = useMutation({\n\t\tmutationFn: (id: string) => client.checkMappingBlueprintRelease(mapping.id, id),\n\t});\n\tconst move = useMutation({ mutationFn: onMove, onSuccess: onClose });\n\tconst { reset } = form;\n\tconst { reset: resetCheck } = check;\n\tconst { reset: resetMove } = move;\n\tuseEffect(() => {\n\t\tif (open) {\n\t\t\treset({ blueprintReleaseId: null });\n\t\t\tresetCheck();\n\t\t\tresetMove();\n\t\t}\n\t}, [open, reset, resetCheck, resetMove]);\n\t// A report is for the Release it was asked about; another choice asks again.\n\tconst checkedId = check.variables;\n\tconst report = check.data && checkedId === releaseId ? check.data : null;\n\tuseEffect(() => {\n\t\tif (checkedId !== undefined && checkedId !== releaseId) resetCheck();\n\t}, [checkedId, releaseId, resetCheck]);\n\n\treturn (\n\t\t<Modal\n\t\t\topen={open}\n\t\t\tonClose={onClose}\n\t\t\theader={t(\"mappings.moveTitle\")}\n\t\t\tlazyMount\n\t\t\tunmountOnExit\n\t\t\tfooter={\n\t\t\t\t<HStack gap=\"2\">\n\t\t\t\t\t<Button variant=\"outline\" onClick={onClose}>\n\t\t\t\t\t\t{t(\"common.cancel\")}\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\tdisabled={!releaseId || releaseId === mapping.content.blueprintReleaseId}\n\t\t\t\t\t\tloading={check.isPending}\n\t\t\t\t\t\tonClick={() => check.mutate(releaseId)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{t(\"mappings.check\")}\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"solid\"\n\t\t\t\t\t\tdisabled={!report}\n\t\t\t\t\t\tloading={move.isPending}\n\t\t\t\t\t\tonClick={() => move.mutate(releaseId)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{t(\"mappings.moveConfirm\")}\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t}\n\t\t>\n\t\t\t<FormProvider {...form}>\n\t\t\t\t<Stack gap=\"4\">\n\t\t\t\t\t<ReleaseField mapping={mapping} />\n\t\t\t\t\t{check.isError ? (\n\t\t\t\t\t\t<Alert status=\"error\" colorPalette=\"danger\" title={t(\"mappings.checkFailed\")}>\n\t\t\t\t\t\t\t{check.error.message}\n\t\t\t\t\t\t</Alert>\n\t\t\t\t\t) : null}\n\t\t\t\t\t{report ? <CheckReport report={report} /> : null}\n\t\t\t\t\t{move.isError ? (\n\t\t\t\t\t\t<Alert status=\"error\" colorPalette=\"danger\" title={t(\"save.failed\")}>\n\t\t\t\t\t\t\t{move.error.message}\n\t\t\t\t\t\t</Alert>\n\t\t\t\t\t) : null}\n\t\t\t\t</Stack>\n\t\t\t</FormProvider>\n\t\t</Modal>\n\t);\n}\n\nfunction ReleaseField({ mapping }: { mapping: Mapping }) {\n\tconst { t } = useTranslation(IMPORTHUB_UI_NS);\n\tconst { blueprints } = useImporthubHost();\n\tconst { workspaceId } = useHostIdentity();\n\tconst releases = useQuery({\n\t\tqueryKey: importhubKeys.blueprintReleases(workspaceId, mapping.content.blueprintId),\n\t\tqueryFn: () => blueprints?.listReleases(mapping.content.blueprintId) ?? Promise.resolve([]),\n\t\tenabled: blueprints !== undefined,\n\t});\n\tif (!blueprints) {\n\t\treturn (\n\t\t\t<InputField<Values> name=\"blueprintReleaseId\" label={t(\"mappings.newReleaseId\")} required />\n\t\t);\n\t}\n\treturn (\n\t\t<BaseSelectField<Values>\n\t\t\tname=\"blueprintReleaseId\"\n\t\t\tlabel={t(\"mappings.newRelease\")}\n\t\t\trequired\n\t\t\toptions={(releases.data ?? [])\n\t\t\t\t.filter((r) => r.id !== mapping.content.blueprintReleaseId)\n\t\t\t\t.map((r) => ({ id: r.id, label: r.label }))}\n\t\t/>\n\t);\n}\n\nfunction CheckReport({ report }: { report: BlueprintReleaseCheck }) {\n\tconst { t } = useTranslation(IMPORTHUB_UI_NS);\n\tconst lost = report.missingFieldPaths.length + report.missingReleaseSpecFields.length;\n\tif (lost === 0) {\n\t\treturn <Alert status=\"success\" colorPalette=\"success\" title={t(\"mappings.nothingLost\")} />;\n\t}\n\treturn (\n\t\t<Alert status=\"warning\" colorPalette=\"warning\" title={t(\"mappings.lost\", { count: lost })}>\n\t\t\t<Stack gap=\"2\">\n\t\t\t\t{report.missingFieldPaths.length > 0 ? (\n\t\t\t\t\t<LostList label={t(\"mappings.lostFields\")} paths={report.missingFieldPaths} />\n\t\t\t\t) : null}\n\t\t\t\t{report.missingReleaseSpecFields.length > 0 ? (\n\t\t\t\t\t<LostList label={t(\"mappings.lostReleaseSpec\")} paths={report.missingReleaseSpecFields} />\n\t\t\t\t) : null}\n\t\t\t</Stack>\n\t\t</Alert>\n\t);\n}\n\nfunction LostList({ label, paths }: { label: string; paths: string[] }) {\n\treturn (\n\t\t<Stack gap=\"1\">\n\t\t\t<Text fontWeight=\"medium\">{label}</Text>\n\t\t\t<List.Root ps=\"4\" aria-label={label}>\n\t\t\t\t{paths.map((p) => (\n\t\t\t\t\t<List.Item key={p}>\n\t\t\t\t\t\t<Code>{p}</Code>\n\t\t\t\t\t</List.Item>\n\t\t\t\t))}\n\t\t\t</List.Root>\n\t\t</Stack>\n\t);\n}\n","import { Button, StatusBadge } from \"@knkcs/anker/atoms\";\nimport { Card, ContextRail } from \"@knkcs/anker/components\";\nimport { InputField, TextareaField } from \"@knkcs/anker/forms\";\nimport { useHostIdentity } from \"@knkcs/anker/host\";\nimport { Alert, Box, Code, HStack, Link, List, Stack, Text } from \"@knkcs/anker/primitives\";\nimport { DetailPageTemplate, usePageRail } from \"@knkcs/anker/templates\";\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { ArrowRightLeft, Trash2 } from \"lucide-react\";\nimport {\n\tcreateContext,\n\ttype ReactNode,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseState,\n} from \"react\";\nimport { type FieldValues, FormProvider, useForm } from \"react-hook-form\";\nimport { useTranslation } from \"react-i18next\";\nimport { Link as RouterLink } from \"react-router\";\nimport type {\n\tImporthubClient,\n\tMapping,\n\tMappingContent,\n\tValidityReason,\n} from \"../../client/importhub-client\";\nimport { useBlueprintNames } from \"../../common/blueprint-names\";\nimport { type ExtraTab, useConfigurationTab } from \"../../common/configuration-tabs\";\nimport { DeleteDialog } from \"../../common/delete-dialog\";\nimport { itemPath, useImporthubHost } from \"../../common/host\";\nimport { importhubKeys } from \"../../common/query-keys\";\nimport { LoadFailed, Loading } from \"../../common/query-state\";\nimport { ReleaseStateBadge } from \"../../common/release-state\";\nimport { useCanConfigure } from \"../../common/use-can-configure\";\nimport { useConfigurationRelease } from \"../../common/use-configuration-release\";\nimport { ValidityAlert } from \"../../common/validity\";\nimport { IMPORTHUB_UI_NS } from \"../../i18n/resources\";\nimport { ConfigurationHistory } from \"../history/configuration-history\";\nimport { reasonsByFieldName } from \"./mapping-reasons\";\nimport { MoveReleaseDialog } from \"./move-release-dialog\";\n\n/**\n * The tabs the Mapping editor adds to a Mapping's page, and how it renders\n * each. The editor lives behind its own subpath (`./mapping-editor`) so the\n * root bundle never carries it; this page knows it only through this slot.\n */\nexport interface MappingEditorSlot {\n\ttabs: readonly ExtraTab[];\n\t/**\n\t * The open editor tab's body, inside the page's form (the whole Mapping\n\t * content, `useFormContext`). `notices` are the page's alerts (release\n\t * state, validity, a failed save), for the body to place: a tab pads\n\t * itself, so it puts them inside its own padding.\n\t */\n\trender: (tab: string, notices: ReactNode) => ReactNode;\n}\n\n/** What a Mapping editor tab reads of the page. */\nexport interface MappingPageContext {\n\tmapping: Mapping;\n\t/** Whether the viewer may change it: `admin`. */\n\tcanConfigure: boolean;\n\t/** The draft's validity reasons, now (`current_validity`). */\n\treasons: readonly ValidityReason[];\n}\n\nconst PageContext = createContext<MappingPageContext | null>(null);\n\n/** The Mapping page around an editor tab; throws outside one. */\nexport function useMappingPage(): MappingPageContext {\n\tconst ctx = useContext(PageContext);\n\tif (!ctx) throw new Error(\"useMappingPage outside a Mapping's page\");\n\treturn ctx;\n}\n\n/**\n * The form holds the whole content in its JSON shape, so a setting no form\n * field covers (a key set in Advanced (JSON), one a later importhub adds)\n * travels through every save untouched (edit-a-mapping-in-the-structured-\n * editor:AC3). The form's values are typed loosely: field mappings are\n * xmlmapper's open objects, named by index paths (`fields.2.selector`).\n */\nexport type MappingFormValues = FieldValues;\n\nconst valuesOf = (c: MappingContent): MappingFormValues => structuredClone(c);\n\n/**\n * Settings whose being unset means something of its own: an unset Version\n * Match compares each element with Main's head, an unset extract separator\n * is `-`. Merely opening the tab that edits one registers its inputs, which\n * would save `{}` or `\"\"` and so set it; a save keeps it unset unless the\n * admin filled it in, or it was set before.\n */\nconst UNSET_MEANS_SOMETHING = [\n\t[\"versionMatch\"],\n\t[\"validityPeriod\"],\n\t[\"collectionRouting\"],\n\t[\"sourceKey\", \"extractSeparator\"],\n] as const;\n\nconst isBlank = (v: unknown) =>\n\tv === \"\" ||\n\t(v !== null && typeof v === \"object\" && !Array.isArray(v) && Object.keys(v).length === 0);\n\n/**\n * What a save sends: the values without the `undefined`s that registering a\n * form field on an unset key leaves behind, which are not JSON, and without\n * a blank setting the content it was edited from (`base`) left unset.\n */\nexport function contentOf(values: MappingFormValues, base?: MappingContent): MappingContent {\n\tconst out = JSON.parse(JSON.stringify(values)) as Record<string, unknown>;\n\tfor (const path of UNSET_MEANS_SOMETHING) {\n\t\tconst parentPath = path.slice(0, -1);\n\t\tconst key = path[path.length - 1] as string;\n\t\tconst parent = parentPath.reduce<Record<string, unknown> | undefined>(\n\t\t\t(o, k) => o?.[k] as Record<string, unknown> | undefined,\n\t\t\tout,\n\t\t);\n\t\tconst before = parentPath.reduce<Record<string, unknown> | undefined>(\n\t\t\t(o, k) => o?.[k] as Record<string, unknown> | undefined,\n\t\t\tbase as Record<string, unknown> | undefined,\n\t\t);\n\t\tif (parent && key in parent && isBlank(parent[key]) && !(before && key in before)) {\n\t\t\tdelete parent[key];\n\t\t}\n\t}\n\treturn out as MappingContent;\n}\n\n/** One Mapping, read, then shown as its page. */\nexport function MappingScreen({\n\tclient,\n\tid,\n\tonDeleted,\n\teditor,\n}: {\n\tclient: ImporthubClient;\n\tid: string;\n\tonDeleted: () => void;\n\teditor?: MappingEditorSlot;\n}) {\n\tconst { t } = useTranslation(IMPORTHUB_UI_NS);\n\tconst { workspaceId } = useHostIdentity();\n\tconst query = useQuery({\n\t\tqueryKey: importhubKeys.mapping(workspaceId, id),\n\t\tqueryFn: () => client.getMapping(id),\n\t});\n\tif (query.isError || !query.data) {\n\t\treturn (\n\t\t\t<DetailPageTemplate title={t(\"section.mappings.title\")}>\n\t\t\t\t{query.isError ? <LoadFailed /> : <Loading />}\n\t\t\t</DetailPageTemplate>\n\t\t);\n\t}\n\treturn <MappingPage client={client} mapping={query.data} onDeleted={onDeleted} editor={editor} />;\n}\n\n/**\n * One Mapping (manage-mappings:AC2): its name, what it selects and its\n * Source Key, the Blueprint Release it pins with the move to another one\n * (AC5), the Import Profiles that include it (AC3), and why it is invalid,\n * each reason also at the field it concerns. An admin saves with the\n * header's Save and deletes from the rail, which importhub refuses while a\n * Profile includes it, naming them (AC4). It shows whether its draft differs\n * from its latest Release; an admin cuts a Release from the rail, seeing the\n * Profiles that take it first, and its History tab lists, compares and\n * restores its Revisions (release-a-configuration). With the Mapping editor\n * (`editor`), its tabs sit between Settings and History, on the same form\n * and the same Save (anker ADR 0004).\n */\nfunction MappingPage({\n\tclient,\n\tmapping,\n\tonDeleted,\n\teditor,\n}: {\n\tclient: ImporthubClient;\n\tmapping: Mapping;\n\tonDeleted: () => void;\n\teditor?: MappingEditorSlot;\n}) {\n\tconst { t } = useTranslation(IMPORTHUB_UI_NS);\n\tconst { workspaceId } = useHostIdentity();\n\tconst { paths } = useImporthubHost();\n\tconst canConfigure = useCanConfigure();\n\tconst queryClient = useQueryClient();\n\tconst [deleting, setDeleting] = useState(false);\n\tconst [moving, setMoving] = useState(false);\n\tconst names = useBlueprintNames([mapping.content.blueprintId]);\n\tconst profiles = useQuery({\n\t\tqueryKey: importhubKeys.mappingImportProfiles(workspaceId, mapping.id),\n\t\tqueryFn: () => client.listMappingImportProfiles(mapping.id),\n\t});\n\n\tconst form = useForm<MappingFormValues>({ defaultValues: valuesOf(mapping.content) });\n\tconst { reset, formState, setError } = form;\n\t// Each reason at the field it concerns (manage-mappings:AC6). A reset\n\t// clears errors, so they are set again after each one; and an edit that\n\t// moves field mappings about leaves them where they were until the next\n\t// save answers with fresh ones.\n\tconst showReasons = useCallback(() => {\n\t\tfor (const [name, message] of reasonsByFieldName(mapping.validity.reasons)) {\n\t\t\tsetError(name, { type: \"importhub\", message });\n\t\t}\n\t}, [mapping, setError]);\n\tuseEffect(() => {\n\t\tif (!formState.isDirty) reset(valuesOf(mapping.content));\n\t\tshowReasons();\n\t}, [mapping, reset, formState.isDirty, showReasons]);\n\n\tconst saved = (m: Mapping) => {\n\t\tqueryClient.setQueryData(importhubKeys.mapping(workspaceId, m.id), m);\n\t\treset(valuesOf(m.content));\n\t\tvoid queryClient.invalidateQueries({ queryKey: importhubKeys.mappings(workspaceId) });\n\t\t// An included Mapping's validity is part of each Profile's.\n\t\tvoid queryClient.invalidateQueries({ queryKey: importhubKeys.importProfiles(workspaceId) });\n\t};\n\tconst save = useMutation({\n\t\tmutationFn: (content: MappingContent) =>\n\t\t\tclient.updateMapping(mapping.id, content, mapping.state.draftRevisionId),\n\t\tonSuccess: saved,\n\t\t// Nothing was saved: the draft's reasons still hold.\n\t\tonError: showReasons,\n\t});\n\tconst onSave = () => {\n\t\t// The reasons set above are importhub's, not rules the form checks:\n\t\t// left in place, they would stop the submit they are meant to answer.\n\t\tform.clearErrors();\n\t\tvoid form.handleSubmit((values) => save.mutate(contentOf(values, mapping.content)))();\n\t};\n\tconst [tab, tabs] = useConfigurationTab(editor?.tabs);\n\tconst releasing = useConfigurationRelease({\n\t\tclient,\n\t\tkind: \"mapping\",\n\t\tid: mapping.id,\n\t\tvalidity: mapping.validity,\n\t\tstate: mapping.state,\n\t\tunsaved: formState.isDirty,\n\t});\n\n\tusePageRail(\n\t\tcanConfigure ? (\n\t\t\t<ContextRail storageKey=\"importhub.mapping.rail\">\n\t\t\t\t<ContextRail.Header title={t(\"rail.title\")} />\n\t\t\t\t<ContextRail.Section id=\"actions\" label={t(\"rail.actions\")}>\n\t\t\t\t\t{releasing.railAction}\n\t\t\t\t\t<ContextRail.IconButton\n\t\t\t\t\t\tlabel={t(\"mappings.delete\")}\n\t\t\t\t\t\ticon={<Trash2 size={16} />}\n\t\t\t\t\t\ttone=\"outline-red\"\n\t\t\t\t\t\tonClick={() => setDeleting(true)}\n\t\t\t\t\t/>\n\t\t\t\t</ContextRail.Section>\n\t\t\t</ContextRail>\n\t\t) : null,\n\t);\n\n\tconst blueprintName = names.blueprintName(mapping.content.blueprintId);\n\tconst release = names.releaseLabel(\n\t\tmapping.content.blueprintId,\n\t\tmapping.content.blueprintReleaseId,\n\t);\n\tconst fieldCount = mapping.content.fields?.length ?? 0;\n\tconst notices = (\n\t\t<>\n\t\t\t{releasing.notice}\n\t\t\t<ValidityAlert validity={mapping.validity} />\n\t\t\t{save.isError ? (\n\t\t\t\t<Alert status=\"error\" colorPalette=\"danger\" title={t(\"save.failed\")}>\n\t\t\t\t\t{save.error.message}\n\t\t\t\t</Alert>\n\t\t\t) : null}\n\t\t</>\n\t);\n\tconst pageContext = useMemo(\n\t\t() => ({ mapping, canConfigure, reasons: mapping.validity.reasons }),\n\t\t[mapping, canConfigure],\n\t);\n\tconst editorTab = editor?.tabs.some((e) => e.value === tab) ? tab : null;\n\n\treturn (\n\t\t<DetailPageTemplate\n\t\t\ttitle={mapping.content.name}\n\t\t\tbreadcrumbs={[{ label: t(\"section.mappings.title\"), to: paths.mappings }]}\n\t\t\tbadges={\n\t\t\t\t<HStack gap=\"2\">\n\t\t\t\t\t<StatusBadge\n\t\t\t\t\t\ttone={mapping.validity.valid ? \"success\" : \"danger\"}\n\t\t\t\t\t\tlabel={mapping.validity.valid ? t(\"validity.valid\") : t(\"validity.invalid\")}\n\t\t\t\t\t/>\n\t\t\t\t\t<ReleaseStateBadge state={mapping.state} />\n\t\t\t\t</HStack>\n\t\t\t}\n\t\t\ttabs={tabs}\n\t\t\tactions={\n\t\t\t\tcanConfigure ? (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"solid\"\n\t\t\t\t\t\tdisabled={!formState.isDirty}\n\t\t\t\t\t\tloading={save.isPending}\n\t\t\t\t\t\tonClick={onSave}\n\t\t\t\t\t>\n\t\t\t\t\t\t{t(\"common.save\")}\n\t\t\t\t\t</Button>\n\t\t\t\t) : undefined\n\t\t\t}\n\t\t>\n\t\t\t{tab === \"history\" ? (\n\t\t\t\t<ConfigurationHistory\n\t\t\t\t\tclient={client}\n\t\t\t\t\tkind=\"mapping\"\n\t\t\t\t\tid={mapping.id}\n\t\t\t\t\tdraftRevisionId={mapping.state.draftRevisionId}\n\t\t\t\t\tonRestored={async () => {\n\t\t\t\t\t\t// The restored draft replaces what the form holds.\n\t\t\t\t\t\tsaved(await client.getMapping(mapping.id));\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<PageContext.Provider value={pageContext}>\n\t\t\t\t\t<FormProvider {...form}>\n\t\t\t\t\t\t<form\n\t\t\t\t\t\t\tonSubmit={(e) => {\n\t\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\t\tif (canConfigure) onSave();\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{editor && editorTab ? (\n\t\t\t\t\t\t\t\teditor.render(editorTab, notices)\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Box px=\"8\" py=\"6\">\n\t\t\t\t\t\t\t\t\t<Stack gap=\"4\">\n\t\t\t\t\t\t\t\t\t\t{notices}\n\t\t\t\t\t\t\t\t\t\t<Card title={t(\"mappings.general\")}>\n\t\t\t\t\t\t\t\t\t\t\t<Stack gap=\"4\">\n\t\t\t\t\t\t\t\t\t\t\t\t<InputField<MappingFormValues>\n\t\t\t\t\t\t\t\t\t\t\t\t\tname=\"name\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel={t(\"fields.name\")}\n\t\t\t\t\t\t\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\t\t\t\t\t\t\tdisabled={!canConfigure}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t<TextareaField<MappingFormValues>\n\t\t\t\t\t\t\t\t\t\t\t\t\tname=\"description\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel={t(\"fields.description\")}\n\t\t\t\t\t\t\t\t\t\t\t\t\tdisabled={!canConfigure}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t<InputField<MappingFormValues>\n\t\t\t\t\t\t\t\t\t\t\t\t\tname=\"elementSelector\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel={t(\"mappings.elementSelector\")}\n\t\t\t\t\t\t\t\t\t\t\t\t\thelperText={t(\"mappings.elementSelectorHelp\")}\n\t\t\t\t\t\t\t\t\t\t\t\t\tdisabled={!canConfigure}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t<InputField<MappingFormValues>\n\t\t\t\t\t\t\t\t\t\t\t\t\tname=\"sourceKey.selector\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel={t(\"mappings.sourceKeySelector\")}\n\t\t\t\t\t\t\t\t\t\t\t\t\tdisabled={!canConfigure}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t<InputField<MappingFormValues>\n\t\t\t\t\t\t\t\t\t\t\t\t\tname=\"sourceKey.template\"\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel={t(\"mappings.sourceKeyTemplate\")}\n\t\t\t\t\t\t\t\t\t\t\t\t\thelperText={t(\"mappings.sourceKeyTemplateHelp\")}\n\t\t\t\t\t\t\t\t\t\t\t\t\tdisabled={!canConfigure}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t\t{editor ? null : (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Text color=\"fg.muted\" fontSize=\"sm\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t{t(\"mappings.fieldCount\", { count: fieldCount })}\n\t\t\t\t\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t\t\t</Card>\n\t\t\t\t\t\t\t\t\t\t<Card title={t(\"mappings.target\")}>\n\t\t\t\t\t\t\t\t\t\t\t<Stack gap=\"3\">\n\t\t\t\t\t\t\t\t\t\t\t\t{names.available ? (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Fact label={t(\"mappings.blueprint\")}>{blueprintName ?? \"…\"}</Fact>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Fact label={t(\"mappings.release\")}>{release ?? \"…\"}</Fact>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Fact label={t(\"mappings.blueprintId\")}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Code>{mapping.content.blueprintId}</Code>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Fact>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Fact label={t(\"mappings.releaseId\")}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Code>{mapping.content.blueprintReleaseId}</Code>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Fact>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t\t{canConfigure ? (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Box>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Button variant=\"outline\" size=\"sm\" onClick={() => setMoving(true)}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<ArrowRightLeft size={14} aria-hidden />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{t(\"mappings.move\")}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</Box>\n\t\t\t\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t\t\t</Card>\n\t\t\t\t\t\t\t\t\t\t<Card title={t(\"mappings.includedBy\")}>\n\t\t\t\t\t\t\t\t\t\t\t{profiles.isError ? (\n\t\t\t\t\t\t\t\t\t\t\t\t<Text color=\"fg.muted\">{t(\"startPage.error\")}</Text>\n\t\t\t\t\t\t\t\t\t\t\t) : !profiles.data ? (\n\t\t\t\t\t\t\t\t\t\t\t\t<Text color=\"fg.muted\">{t(\"startPage.loading\")}</Text>\n\t\t\t\t\t\t\t\t\t\t\t) : profiles.data.length === 0 ? (\n\t\t\t\t\t\t\t\t\t\t\t\t<Text color=\"fg.muted\">{t(\"mappings.noProfiles\")}</Text>\n\t\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t\t<List.Root ps=\"4\" aria-label={t(\"mappings.includedBy\")}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{profiles.data.map((p) => (\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<List.Item key={p.id}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<Link asChild>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<RouterLink to={itemPath(paths, \"profiles\", p.id)}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{p.name}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</RouterLink>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</Link>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</List.Item>\n\t\t\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t\t\t</List.Root>\n\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t</Card>\n\t\t\t\t\t\t\t\t\t</Stack>\n\t\t\t\t\t\t\t\t</Box>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</form>\n\t\t\t\t\t</FormProvider>\n\t\t\t\t</PageContext.Provider>\n\t\t\t)}\n\t\t\t{releasing.dialog}\n\t\t\t<MoveReleaseDialog\n\t\t\t\topen={moving}\n\t\t\t\tonClose={() => setMoving(false)}\n\t\t\t\tclient={client}\n\t\t\t\tmapping={mapping}\n\t\t\t\tonMove={async (blueprintReleaseId) => {\n\t\t\t\t\t// The move carries the page's unsaved edits too: it is one save.\n\t\t\t\t\tconst content = {\n\t\t\t\t\t\t...contentOf(form.getValues(), mapping.content),\n\t\t\t\t\t\tblueprintReleaseId,\n\t\t\t\t\t};\n\t\t\t\t\tsaved(await client.updateMapping(mapping.id, content, mapping.state.draftRevisionId));\n\t\t\t\t}}\n\t\t\t/>\n\t\t\t<DeleteDialog\n\t\t\t\topen={deleting}\n\t\t\t\tonClose={() => setDeleting(false)}\n\t\t\t\ttitle={t(\"mappings.deleteTitle\", { name: mapping.content.name })}\n\t\t\t\tmessage={t(\"mappings.deleteMessage\")}\n\t\t\t\tonDelete={() => client.deleteMapping(mapping.id)}\n\t\t\t\tonDeleted={() => {\n\t\t\t\t\tsetDeleting(false);\n\t\t\t\t\tqueryClient.removeQueries({ queryKey: importhubKeys.mapping(workspaceId, mapping.id) });\n\t\t\t\t\tvoid queryClient.invalidateQueries({ queryKey: importhubKeys.mappings(workspaceId) });\n\t\t\t\t\tonDeleted();\n\t\t\t\t}}\n\t\t\t/>\n\t\t</DetailPageTemplate>\n\t);\n}\n\n/** A labelled fact, its label muted beside it; the Mapping Test's cards use it too. */\nexport function Fact({ label, children }: { label: string; children: ReactNode }) {\n\treturn (\n\t\t<HStack gap=\"4\" align=\"baseline\">\n\t\t\t<Text color=\"fg.muted\" minW=\"40\">\n\t\t\t\t{label}\n\t\t\t</Text>\n\t\t\t<Box>{children}</Box>\n\t\t</HStack>\n\t);\n}\n"],"names":["IMPORTHUB_UI_NS","i18nResources","en","de","IMPORTHUB_SECTIONS","itemPath","paths","section","id","STANDALONE_IMPORTHUB_PATHS","DEFAULT_HOST","HostContext","createContext","ImporthubHostProvider","host","children","useImporthubHost","useContext","importhubKeys","workspaceId","mappingId","sourceKeyQuery","blueprintId","releaseId","kind","fromRevisionId","toRevisionId","Loading","t","useTranslation","jsx","Center","Spinner","LoadFailed","Box","EmptyState","CircleAlert","useConfigurationTab","extra","params","setParams","useSearchParams","known","e","asked","tab","select","next","updated","strip","Tabs","jsxs","DeleteDialog","open","onClose","title","message","onDelete","onDeleted","del","useMutation","reset","useEffect","refusal","ConfigurationInUseError","Modal","HStack","Button","Stack","Text","Alert","List","p","Link","RouterLink","ReleaseStateBadge","state","StatusBadge","number","useCanConfigure","ValidityAlert","validity","r","TONES","ValidityCell","StatusBadgeCell","releaseLabel","CutReleaseDialog","client","unsaved","onCut","useHostIdentity","queryClient","useQueryClient","cut","profiles","useQuery","unchanged","offered","ReleaseRefusedError","Fragment","TakingProfiles","query","useConfigurationRelease","setOpen","useState","setCut","ContextRail","Tag","result","useBlueprintNames","blueprintIds","blueprints","unique","list","releases","useQueries","releaseData","releasesKey","uniqueKey","useMemo","b","TONE","FIELD_LABELS","ID_LABELS","RevisionComparison","labelOf","format","blueprintIdsOnly","useValueFormat","labelKeyOf","field","fields","a","differing","from","to","Card","Table","Value","text","Code","data","isProfile","mappings","entitySets","names","side","content","value","m","x","SAVED_AT_FORMAT","pad","n","formatSavedAt","iso","d","useRevisionLabels","revisions","draftRevisionId","revisionId","release","revision","ConfigurationHistory","onRestored","members","canRestore","history","useInfiniteQuery","pageParam","last","rows","labels","restoring","setRestoring","chosen","setChosen","selection","choose","updater","current","was","ids","kept","added","pair","y","columns","releasesOf","nameOf","userId","row","TruncatedTextCell","IdentityCell","DateCell","ActionCell","RotateCcw","unloaded","DataTable","History","RestoreDialog","label","onRestore","shown","setShown","restore","camel","token","_","c","reasonFieldName","path","reasonsByFieldName","reasons","out","name","before","MoveReleaseDialog","mapping","onMove","form","useForm","useWatch","check","move","resetCheck","resetMove","checkedId","report","FormProvider","ReleaseField","CheckReport","BaseSelectField","InputField","lost","LostList","PageContext","useMappingPage","ctx","valuesOf","UNSET_MEANS_SOMETHING","isBlank","v","contentOf","values","base","parentPath","key","parent","o","k","MappingScreen","editor","DetailPageTemplate","MappingPage","canConfigure","deleting","setDeleting","moving","setMoving","formState","setError","showReasons","useCallback","saved","save","onSave","tabs","releasing","usePageRail","Trash2","blueprintName","fieldCount","notices","pageContext","editorTab","TextareaField","Fact","ArrowRightLeft","blueprintReleaseId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GASaA,IAAkB,gBAGlBC,KAAgB;AAAA,EAC5B,IAAI,EAAE,CAACD,CAAe,GAAGE,GAAA;AAAA,EACzB,IAAI,EAAE,CAACF,CAAe,GAAGG,GAAA;AAC1B,GCKaC,KAAkD;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAWO,SAASC,GAASC,GAAuBC,GAA2BC,GAAoB;AAC9F,SAAO,GAAGF,EAAMC,CAAO,EAAE,QAAQ,OAAO,EAAE,CAAC,IAAI,mBAAmBC,CAAE,CAAC;AACtE;AAiGO,MAAMC,KAA6C;AAAA,EACzD,SAAS;AAAA,EACT,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,YAAY;AACb,GAEMC,KAA8B;AAAA,EACnC,OAAOD;AAAA,EACP,eAAe,MAAM;AACtB,GAEME,KAAcC,GAA6BF,EAAY;AAQtD,SAASG,GAAsB,EAAE,MAAAC,GAAM,UAAAC,KAAwC;AACrF,2BAAQJ,GAAY,UAAZ,EAAqB,OAAOG,GAAO,UAAAC,GAAS;AACrD;AAMO,SAASC,IAAkC;AACjD,SAAOC,GAAWN,EAAW;AAC9B;AChKO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