@masterteam/work-center 0.0.83 → 0.0.85

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"masterteam-work-center-work-center-process-preview-qG9T9HoP.mjs","sources":["../../../../packages/masterteam/work-center/src/lib/work-center-item-modal/work-center-process-preview/work-center-process-preview.rows.ts","../../../../packages/masterteam/work-center/src/lib/work-center-item-modal/work-center-process-preview/work-center-process-preview.status.ts","../../../../packages/masterteam/work-center/src/lib/work-center-item-modal/work-center-process-preview/work-center-process-preview.ts","../../../../packages/masterteam/work-center/src/lib/work-center-item-modal/work-center-process-preview/work-center-process-preview.html"],"sourcesContent":["/**\r\n * Approval-history row projection for the process preview.\r\n *\r\n * The runtime stores one `step` record per *target user*, so a group step\r\n * fans out into one record per member, and every workflow attempt (return →\r\n * resubmit) creates a fresh fan-out for the same step schema. The table shows\r\n * one row per attempt: sibling member records collapse, but separate attempts\r\n * — and the completed history they carry — are preserved.\r\n */\r\n\r\nexport interface ProcessPreviewStepTarget {\r\n type?: 'Unknown' | 'User' | 'Group' | 'Role' | 'Level' | string;\r\n groupKey?: string | null;\r\n displayName?: unknown;\r\n group?: { id?: number | string; name?: unknown } | null;\r\n}\r\n\r\nexport interface ProcessPreviewStep {\r\n stepId?: number | string;\r\n stepSchemaId?: number | string;\r\n stepName?: unknown;\r\n status?: unknown;\r\n isActive?: boolean;\r\n isCurrent?: boolean;\r\n targetUser?: Record<string, unknown> | null;\r\n actionUserInfo?: Record<string, unknown> | null;\r\n createdAt?: string | null;\r\n actionDate?: string | null;\r\n target?: ProcessPreviewStepTarget | null;\r\n}\r\n\r\nexport interface ApprovalRowModel {\r\n stepName: string;\r\n status: unknown;\r\n /** `text` renders the group name, `user` renders the acting/assigned user. */\r\n user: { kind: 'text'; value: string } | { kind: 'user'; value: unknown };\r\n createdAt: string;\r\n actionDate: string;\r\n}\r\n\r\nexport interface BuildApprovalRowsOptions {\r\n /** Step ids the process is currently sitting on, when `isCurrent` is absent. */\r\n currentStepIds?: Array<number | string> | null;\r\n resolveDisplayName: (value: unknown) => string;\r\n}\r\n\r\nconst PENDING = 'pending';\r\nconst TERMINATED = 'terminated';\r\n\r\n/** Statuses whose actor is not the assigned group/role, so the actor wins. */\r\nconst ACTOR_OVERRIDES_TARGET = new Set([TERMINATED]);\r\n\r\nexport function buildApprovalRows(\r\n steps: readonly ProcessPreviewStep[],\r\n options: BuildApprovalRowsOptions,\r\n): ApprovalRowModel[] {\r\n const { resolveDisplayName } = options;\r\n const currentIds = new Set(\r\n (options.currentStepIds ?? []).map((id) => String(id)),\r\n );\r\n const rows: ApprovalRowModel[] = [];\r\n\r\n for (const run of splitIntoRuns(steps)) {\r\n const groupName = resolveGroupName(run[0].target, resolveDisplayName);\r\n\r\n if (groupName) {\r\n rows.push(buildGroupRow(run, groupName, currentIds, resolveDisplayName));\r\n continue;\r\n }\r\n\r\n // Non-group targets keep one row per record, minus the pending siblings\r\n // that were superseded when another member of the same fan-out acted.\r\n const runHasAction = run.some(hasAction);\r\n for (const step of run) {\r\n if (\r\n runHasAction &&\r\n run.length > 1 &&\r\n isSupersededPending(step, currentIds)\r\n ) {\r\n continue;\r\n }\r\n\r\n rows.push({\r\n stepName: resolveStepName(step, resolveDisplayName),\r\n status: step.status,\r\n user: {\r\n kind: 'user',\r\n value: step.actionUserInfo ?? step.targetUser ?? null,\r\n },\r\n createdAt: step.createdAt ?? '',\r\n actionDate: step.actionDate ?? '',\r\n });\r\n }\r\n }\r\n\r\n return rows;\r\n}\r\n\r\nfunction buildGroupRow(\r\n run: readonly ProcessPreviewStep[],\r\n groupName: string,\r\n currentIds: Set<string>,\r\n resolveDisplayName: (value: unknown) => string,\r\n): ApprovalRowModel {\r\n const pendingOnGroup = run.find((step) => isCurrent(step, currentIds));\r\n // While the attempt is open the row belongs to the group as a whole; once it\r\n // closes, the record that carries the outcome represents it.\r\n const repr = pendingOnGroup ?? resolveOutcome(run);\r\n const actor = repr.actionUserInfo;\r\n const showActor =\r\n !pendingOnGroup && !!actor && ACTOR_OVERRIDES_TARGET.has(statusKey(repr));\r\n\r\n return {\r\n stepName: resolveStepName(repr, resolveDisplayName),\r\n status: repr.status,\r\n user: showActor\r\n ? { kind: 'user', value: actor }\r\n : { kind: 'text', value: groupName },\r\n createdAt: run[0].createdAt ?? '',\r\n actionDate: pendingOnGroup ? '' : (repr.actionDate ?? ''),\r\n };\r\n}\r\n\r\n/**\r\n * Consecutive records sharing a step schema + target belong to the same\r\n * attempt. The API orders steps by creation, so a later attempt on the same\r\n * step is always separated by the records that sent the request back.\r\n */\r\nfunction splitIntoRuns(\r\n steps: readonly ProcessPreviewStep[],\r\n): ProcessPreviewStep[][] {\r\n const runs: ProcessPreviewStep[][] = [];\r\n let currentKey: string | null = null;\r\n\r\n for (const step of steps) {\r\n const key = runKey(step);\r\n if (key !== currentKey || runs.length === 0) {\r\n runs.push([step]);\r\n currentKey = key;\r\n continue;\r\n }\r\n runs[runs.length - 1].push(step);\r\n }\r\n\r\n return runs;\r\n}\r\n\r\nfunction runKey(step: ProcessPreviewStep): string {\r\n return `${step.stepSchemaId ?? ''}|${step.target?.groupKey ?? ''}`;\r\n}\r\n\r\n/** The record holding the attempt's outcome (Returned/Rejected/Terminated…). */\r\nfunction resolveOutcome(\r\n run: readonly ProcessPreviewStep[],\r\n): ProcessPreviewStep {\r\n for (let index = run.length - 1; index >= 0; index -= 1) {\r\n const step = run[index];\r\n if (statusKey(step) !== PENDING && statusKey(step) !== '') {\r\n return step;\r\n }\r\n }\r\n\r\n return findLast(run, hasAction) ?? run[run.length - 1];\r\n}\r\n\r\nfunction isCurrent(step: ProcessPreviewStep, currentIds: Set<string>): boolean {\r\n if (typeof step.isCurrent === 'boolean') {\r\n return step.isCurrent;\r\n }\r\n if (currentIds.size > 0) {\r\n return currentIds.has(String(step.stepId ?? ''));\r\n }\r\n return step.isActive !== false && statusKey(step) === PENDING;\r\n}\r\n\r\n/** A pending record left behind after a sibling acted — never actionable. */\r\nfunction isSupersededPending(\r\n step: ProcessPreviewStep,\r\n currentIds: Set<string>,\r\n): boolean {\r\n return (\r\n statusKey(step) === PENDING &&\r\n !hasAction(step) &&\r\n !isCurrent(step, currentIds)\r\n );\r\n}\r\n\r\nfunction hasAction(step: ProcessPreviewStep): boolean {\r\n if (step.actionUserInfo) {\r\n return true;\r\n }\r\n const key = statusKey(step);\r\n return key !== '' && key !== PENDING;\r\n}\r\n\r\n/** Status comes off the lookup key, never the localized display text. */\r\nexport function statusKey(step: ProcessPreviewStep): string {\r\n const status = step.status;\r\n if (typeof status === 'string') {\r\n return status.trim().toLowerCase();\r\n }\r\n if (status && typeof status === 'object') {\r\n const key = (status as Record<string, unknown>)['key'];\r\n if (typeof key === 'string') {\r\n return key.trim().toLowerCase();\r\n }\r\n }\r\n return '';\r\n}\r\n\r\nfunction resolveStepName(\r\n step: ProcessPreviewStep,\r\n resolveDisplayName: (value: unknown) => string,\r\n): string {\r\n return resolveDisplayName(step.stepName) || String(step.stepId ?? '--');\r\n}\r\n\r\nfunction resolveGroupName(\r\n target: ProcessPreviewStepTarget | null | undefined,\r\n resolveDisplayName: (value: unknown) => string,\r\n): string {\r\n if (!target || target.type !== 'Group' || !target.group) {\r\n return '';\r\n }\r\n return (\r\n resolveDisplayName(target.displayName) ||\r\n resolveDisplayName(target.group.name)\r\n );\r\n}\r\n\r\nfunction findLast<T>(\r\n items: readonly T[],\r\n predicate: (item: T) => boolean,\r\n): T | undefined {\r\n for (let index = items.length - 1; index >= 0; index -= 1) {\r\n if (predicate(items[index])) {\r\n return items[index];\r\n }\r\n }\r\n return undefined;\r\n}\r\n","/**\r\n * Status projection for the process-preview diagram.\r\n *\r\n * The schema view colors every step by where it stands in the run — the icon\r\n * and subtitle already say what *kind* of step it is, so color is free to\r\n * carry progress. One color per state, reusing the workflow badge tones from\r\n * `@masterteam/structure-builder`.\r\n *\r\n * The runtime stores one `step` record per target user, so a group step fans\r\n * out into several records and every attempt (return → resubmit) creates a\r\n * fresh fan-out. A schema node shows the state of its *latest* attempt.\r\n */\r\n\r\nimport {\r\n ProcessPreviewStep,\r\n statusKey,\r\n} from './work-center-process-preview.rows';\r\n\r\nexport type ProcessStepVisualStatus =\r\n | 'approved'\r\n | 'current'\r\n | 'noAction'\r\n | 'notStarted'\r\n | 'rejected'\r\n | 'resubmitted'\r\n | 'returned'\r\n | 'terminated';\r\n\r\nexport interface ProcessStepStatusView {\r\n status: ProcessStepVisualStatus;\r\n /** Backend status text, empty when the step has no runtime record yet. */\r\n label: string;\r\n}\r\n\r\n/** Node accent color per state — every outcome gets its own hue. */\r\nexport const PROCESS_STEP_STATUS_COLORS: Record<\r\n ProcessStepVisualStatus,\r\n string\r\n> = {\r\n approved: '#059669', // green — approved\r\n current: '#d97706', // amber — running right now\r\n noAction: '#0891b2', // cyan — closed without a decision from this target\r\n notStarted: '#2563eb', // blue — not reached yet\r\n rejected: '#dc2626', // red — rejected\r\n resubmitted: '#7c3aed', // violet — sent back, then pushed forward again\r\n returned: '#6b7280', // gray — sent back\r\n terminated: '#334155', // slate — the run was killed outright\r\n};\r\n\r\n/**\r\n * `NodeBadgeTone` per state, so the pill matches the node color. The tones the\r\n * structure-builder names cover the original five; the rest use `accent`, which\r\n * has no tone rule of its own and therefore inherits the node color exactly.\r\n */\r\nexport const PROCESS_STEP_STATUS_BADGE_TONES: Record<\r\n ProcessStepVisualStatus,\r\n string\r\n> = {\r\n approved: 'final',\r\n current: 'current',\r\n noAction: 'accent',\r\n notStarted: 'initial',\r\n rejected: 'closed',\r\n resubmitted: 'accent',\r\n returned: 'neutral',\r\n terminated: 'accent',\r\n};\r\n\r\nconst PENDING = 'pending';\r\n\r\nconst CURRENT_VIEW: ProcessStepStatusView = { status: 'current', label: '' };\r\nconst NOT_STARTED_VIEW: ProcessStepStatusView = {\r\n status: 'notStarted',\r\n label: '',\r\n};\r\n\r\n/**\r\n * Decided status keys → visual state. A decided status that isn't listed reads\r\n * as `noAction` — it closed, but not by a decision we can name, so the color\r\n * must not claim one. The badge still shows the backend's own wording.\r\n */\r\nconst DECIDED_STATUS_STATES: Record<string, ProcessStepVisualStatus> = {\r\n approved: 'approved',\r\n noaction: 'noAction',\r\n rejected: 'rejected',\r\n resubmitted: 'resubmitted',\r\n returned: 'returned',\r\n terminated: 'terminated',\r\n};\r\n\r\nconst UNCLASSIFIED_DECIDED_STATE: ProcessStepVisualStatus = 'noAction';\r\n\r\n/**\r\n * Inside one attempt the strongest outcome represents the step, so a group\r\n * fan-out where one member rejected reads as rejected while the siblings who\r\n * never acted read as `noAction`.\r\n */\r\nconst OUTCOME_PRECEDENCE: readonly ProcessStepVisualStatus[] = [\r\n 'terminated',\r\n 'rejected',\r\n 'returned',\r\n 'resubmitted',\r\n 'approved',\r\n 'noAction',\r\n];\r\n\r\nexport interface BuildSchemaStepStatusesOptions {\r\n /** Schema-step ids the process is sitting on right now. */\r\n currentSchemaIds?: Array<number | string> | null;\r\n resolveDisplayName: (value: unknown) => string;\r\n}\r\n\r\n/**\r\n * Maps every schema-step id the runtime has touched to its visual state.\r\n * Steps missing from the result were never reached — render them as\r\n * {@link NOT_STARTED_VIEW}.\r\n */\r\nexport function buildSchemaStepStatuses(\r\n steps: readonly ProcessPreviewStep[],\r\n options: BuildSchemaStepStatusesOptions,\r\n): Map<string, ProcessStepStatusView> {\r\n const currentIds = new Set(\r\n (options.currentSchemaIds ?? []).map((id) => String(id)),\r\n );\r\n const views = new Map<string, ProcessStepStatusView>();\r\n\r\n // Later attempts overwrite earlier ones, so the last run on a step wins.\r\n for (const run of splitBySchemaStep(steps)) {\r\n const schemaId = String(run[0].stepSchemaId ?? '');\r\n if (!schemaId) {\r\n continue;\r\n }\r\n views.set(schemaId, resolveRunStatus(run, currentIds, options));\r\n }\r\n\r\n // A step can be current before any record closes — the flag always wins.\r\n for (const id of currentIds) {\r\n views.set(id, CURRENT_VIEW);\r\n }\r\n\r\n return views;\r\n}\r\n\r\n/**\r\n * Reads a state straight off a schema step's own `status`, for schemas that\r\n * carry it without a matching runtime record.\r\n */\r\nexport function resolveStatusView(\r\n status: unknown,\r\n resolveDisplayName: (value: unknown) => string,\r\n): ProcessStepStatusView {\r\n const key = normalizeStatusKey(status);\r\n if (key === '' || key === PENDING) {\r\n return NOT_STARTED_VIEW;\r\n }\r\n\r\n return {\r\n status: DECIDED_STATUS_STATES[key] ?? UNCLASSIFIED_DECIDED_STATE,\r\n label: resolveStatusLabel(status, resolveDisplayName),\r\n };\r\n}\r\n\r\nfunction resolveRunStatus(\r\n run: readonly ProcessPreviewStep[],\r\n currentIds: Set<string>,\r\n options: BuildSchemaStepStatusesOptions,\r\n): ProcessStepStatusView {\r\n if (\r\n currentIds.has(String(run[0].stepSchemaId ?? '')) ||\r\n run.some((step) => step.isCurrent === true)\r\n ) {\r\n return CURRENT_VIEW;\r\n }\r\n\r\n const decided = run\r\n .map((step) => ({ step, state: decidedState(step) }))\r\n .filter(\r\n (\r\n entry,\r\n ): entry is {\r\n step: ProcessPreviewStep;\r\n state: ProcessStepVisualStatus;\r\n } => entry.state !== null,\r\n );\r\n\r\n if (decided.length === 0) {\r\n return NOT_STARTED_VIEW;\r\n }\r\n\r\n const outcome =\r\n OUTCOME_PRECEDENCE.map((state) =>\r\n decided.find((entry) => entry.state === state),\r\n ).find((entry) => !!entry) ?? decided[decided.length - 1];\r\n\r\n return {\r\n status: outcome.state,\r\n label: resolveStatusLabel(outcome.step.status, options.resolveDisplayName),\r\n };\r\n}\r\n\r\nfunction decidedState(\r\n step: ProcessPreviewStep,\r\n): ProcessStepVisualStatus | null {\r\n const key = statusKey(step);\r\n if (key === '' || key === PENDING) {\r\n return null;\r\n }\r\n return DECIDED_STATUS_STATES[key] ?? UNCLASSIFIED_DECIDED_STATE;\r\n}\r\n\r\n/**\r\n * Consecutive records sharing a schema step belong to the same attempt. The\r\n * API orders steps by creation, so a later attempt is always separated by the\r\n * records that sent the request back.\r\n */\r\nfunction splitBySchemaStep(\r\n steps: readonly ProcessPreviewStep[],\r\n): ProcessPreviewStep[][] {\r\n const runs: ProcessPreviewStep[][] = [];\r\n let currentKey: string | null = null;\r\n\r\n for (const step of steps) {\r\n const key = String(step.stepSchemaId ?? '');\r\n if (key !== currentKey || runs.length === 0) {\r\n runs.push([step]);\r\n currentKey = key;\r\n continue;\r\n }\r\n runs[runs.length - 1].push(step);\r\n }\r\n\r\n return runs;\r\n}\r\n\r\n/** Status comes off the lookup key, never the localized display text. */\r\nfunction normalizeStatusKey(status: unknown): string {\r\n if (typeof status === 'string') {\r\n return status.trim().toLowerCase();\r\n }\r\n if (status && typeof status === 'object') {\r\n const key = (status as Record<string, unknown>)['key'];\r\n if (typeof key === 'string') {\r\n return key.trim().toLowerCase();\r\n }\r\n }\r\n return '';\r\n}\r\n\r\nfunction resolveStatusLabel(\r\n status: unknown,\r\n resolveDisplayName: (value: unknown) => string,\r\n): string {\r\n return typeof status === 'string' ? status : resolveDisplayName(status);\r\n}\r\n","import { CommonModule } from '@angular/common';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport {\r\n Component,\r\n OnDestroy,\r\n computed,\r\n effect,\r\n inject,\r\n input,\r\n signal,\r\n untracked,\r\n} from '@angular/core';\r\nimport { TranslocoService } from '@jsverse/transloco';\r\nimport { EntityData } from '@masterteam/components/entities';\r\nimport { Table } from '@masterteam/components/table';\r\nimport {\r\n Connection,\r\n Node,\r\n StructureBuilder,\r\n} from '@masterteam/structure-builder';\r\nimport { Subscription } from 'rxjs';\r\n\r\nimport { ApiEnvelope } from '../../../store/work-center/work-center.model';\r\nimport {\r\n ProcessPreviewStep,\r\n buildApprovalRows,\r\n} from './work-center-process-preview.rows';\r\nimport {\r\n PROCESS_STEP_STATUS_BADGE_TONES,\r\n PROCESS_STEP_STATUS_COLORS,\r\n buildSchemaStepStatuses,\r\n resolveStatusView,\r\n} from './work-center-process-preview.status';\r\n\r\ninterface ProcessPreviewSchemaStep {\r\n id: number | string;\r\n name?: unknown;\r\n type?: 'UserInput' | 'AppAction' | 'ApprovalCommit' | string;\r\n isInitial?: boolean;\r\n isFinal?: boolean;\r\n isSystem?: boolean;\r\n isLocked?: boolean;\r\n systemKind?: string;\r\n status?: string;\r\n}\r\n\r\ninterface ProcessPreviewSchemaConnection {\r\n id?: number | string;\r\n source: number | string;\r\n target: number | string;\r\n state?: 'idle' | 'active' | 'success' | 'error';\r\n}\r\n\r\ninterface ProcessPreviewData {\r\n steps?: ProcessPreviewStep[];\r\n schema?: {\r\n stepsSchema?: ProcessPreviewSchemaStep[];\r\n connections?: ProcessPreviewSchemaConnection[];\r\n } | null;\r\n /** Schema-step ids the process is currently sitting on (active steps). */\r\n currentStepSchemaIds?: Array<number | string> | null;\r\n currentStepIds?: Array<number | string> | null;\r\n}\r\n\r\n@Component({\r\n selector: 'mt-work-center-process-preview',\r\n standalone: true,\r\n imports: [CommonModule, Table, StructureBuilder],\r\n templateUrl: './work-center-process-preview.html',\r\n styles: [\r\n `\r\n :host ::ng-deep .wc-process-preview-schema .wf-detail-row {\r\n align-items: center;\r\n }\r\n `,\r\n ],\r\n})\r\nexport class WorkCenterProcessPreview implements OnDestroy {\r\n private readonly http = inject(HttpClient);\r\n private readonly transloco = inject(TranslocoService);\r\n private loadSub?: Subscription;\r\n\r\n readonly requestId = input<number | null | undefined>(null);\r\n readonly view = input<'approvals' | 'schema'>('approvals');\r\n\r\n protected readonly approvalColumns = computed(() => [\r\n {\r\n key: 'stepName',\r\n label: this.transloco.translate('workCenter.preview.name'),\r\n },\r\n {\r\n key: 'status',\r\n label: this.transloco.translate('workCenter.preview.status'),\r\n type: 'entity' as const,\r\n },\r\n {\r\n key: 'user',\r\n label: this.transloco.translate('workCenter.preview.userOrGroup'),\r\n type: 'entity' as const,\r\n },\r\n {\r\n key: 'createdAt',\r\n label: this.transloco.translate('workCenter.preview.initiationDate'),\r\n type: 'entity' as const,\r\n },\r\n {\r\n key: 'actionDate',\r\n label: this.transloco.translate('workCenter.preview.actionDate'),\r\n type: 'entity' as const,\r\n },\r\n ]);\r\n protected readonly loading = signal(false);\r\n protected readonly error = signal<string | null>(null);\r\n protected readonly preview = signal<ProcessPreviewData | null>(null);\r\n protected readonly canRenderPreview = computed(\r\n () => (this.requestId() ?? 0) > 0,\r\n );\r\n protected readonly approvalRows = computed(() => {\r\n const preview = this.preview();\r\n const rows = buildApprovalRows(preview?.steps ?? [], {\r\n currentStepIds: preview?.currentStepIds,\r\n resolveDisplayName: (value) => this.resolveDisplayName(value),\r\n });\r\n\r\n return rows.map((row) => ({\r\n stepName: row.stepName,\r\n status: buildEntity('Status', 'Status', row.status),\r\n user:\r\n row.user.kind === 'text'\r\n ? buildEntity('User', 'Text', row.user.value)\r\n : buildEntity('User', 'User', row.user.value as any),\r\n createdAt: buildEntity('Initiation Date', 'DateTime', row.createdAt),\r\n actionDate: buildEntity('Action Date', 'DateTime', row.actionDate),\r\n }));\r\n });\r\n protected readonly hasApprovals = computed(\r\n () => this.approvalRows().length > 0,\r\n );\r\n protected readonly schemaNodes = computed<Node[]>(() => {\r\n const preview = this.preview();\r\n const steps = preview?.schema?.stepsSchema ?? [];\r\n const connections = preview?.schema?.connections ?? [];\r\n const sourceIds = new Set(connections.map((c) => String(c.source)));\r\n // Where each step stands in the run — the color of a node is its state,\r\n // not its type (the icon and subtitle already carry the type).\r\n const statusViews = buildSchemaStepStatuses(preview?.steps ?? [], {\r\n currentSchemaIds: preview?.currentStepSchemaIds,\r\n resolveDisplayName: (value) => this.resolveDisplayName(value),\r\n });\r\n return steps.map((step) => {\r\n const isAppAction = step.type === 'AppAction';\r\n const isApprovalCommit =\r\n step.type === 'ApprovalCommit' || step.systemKind === 'ApprovalCommit';\r\n // Treat a step as final if explicitly flagged or if it has no outgoing\r\n // connection — the latter catches schemas where `isFinal` isn't set.\r\n const isFinal =\r\n !isApprovalCommit &&\r\n (step.isFinal === true || !sourceIds.has(String(step.id)));\r\n const stepStatus =\r\n statusViews.get(String(step.id)) ??\r\n resolveStatusView(step.status, (value) =>\r\n this.resolveDisplayName(value),\r\n );\r\n const isCurrent = stepStatus.status === 'current';\r\n return {\r\n id: String(step.id),\r\n name: isFinal\r\n ? this.transloco.translate('workCenter.preview.end')\r\n : this.resolveDisplayName(step.name) || String(step.id),\r\n color: PROCESS_STEP_STATUS_COLORS[stepStatus.status],\r\n icon: isApprovalCommit\r\n ? 'general.check-verified-01'\r\n : isAppAction\r\n ? 'general.zap'\r\n : isFinal\r\n ? 'map.flag-04'\r\n : step.isInitial\r\n ? 'map.flag-04'\r\n : 'file.clipboard-check',\r\n subtitle: isApprovalCommit\r\n ? this.transloco.translate(\r\n 'workCenter.preview.approvalCommitSubtitle',\r\n )\r\n : step.isInitial\r\n ? this.transloco.translate('workCenter.preview.start')\r\n : isFinal\r\n ? this.transloco.translate('workCenter.preview.end')\r\n : isAppAction\r\n ? this.transloco.translate('workCenter.preview.appAction')\r\n : this.transloco.translate('workCenter.preview.formStep'),\r\n // The badge names the state the color stands for, preferring the\r\n // backend's own wording. The current step keeps the built-in\r\n // \"Current\" pill instead of a second badge.\r\n badge: isCurrent\r\n ? null\r\n : stepStatus.label ||\r\n this.transloco.translate(\r\n `workCenter.preview.stepStatus.${stepStatus.status}`,\r\n ),\r\n // Semantic color for the badge — every step state renders with the\r\n // same pill and is told apart by color alone.\r\n badgeTone: PROCESS_STEP_STATUS_BADGE_TONES[stepStatus.status],\r\n status: step.status ?? null,\r\n style: isAppAction || isApprovalCommit ? 'icon' : 'detail',\r\n current: isCurrent,\r\n };\r\n });\r\n });\r\n protected readonly schemaConnections = computed<Connection[]>(() =>\r\n (this.preview()?.schema?.connections ?? []).map((connection, index) => ({\r\n id: String(\r\n connection.id ?? `${connection.source}-${connection.target}-${index}`,\r\n ),\r\n from: String(connection.source),\r\n to: String(connection.target),\r\n state: connection.state,\r\n })),\r\n );\r\n protected readonly hasSchema = computed(() => this.schemaNodes().length > 0);\r\n protected readonly previewNodeFields = {\r\n id: 'id',\r\n name: 'name',\r\n icon: 'icon',\r\n color: 'color',\r\n subtitle: 'subtitle',\r\n badge: 'badge',\r\n badgeTone: 'badgeTone',\r\n status: 'status',\r\n style: 'style',\r\n current: 'current',\r\n };\r\n\r\n constructor() {\r\n effect(() => {\r\n const requestId = this.requestId() ?? 0;\r\n\r\n if (requestId > 0) {\r\n untracked(() => this.loadPreview(requestId));\r\n return;\r\n }\r\n\r\n this.loadSub?.unsubscribe();\r\n this.loading.set(false);\r\n this.error.set(null);\r\n this.preview.set(null);\r\n });\r\n }\r\n\r\n ngOnDestroy(): void {\r\n this.loadSub?.unsubscribe();\r\n }\r\n\r\n private resolveDisplayName(name: unknown): string {\r\n if (typeof name === 'string') {\r\n return name;\r\n }\r\n\r\n if (typeof name === 'number' || typeof name === 'boolean') {\r\n return String(name);\r\n }\r\n\r\n if (!name || typeof name !== 'object') {\r\n return '';\r\n }\r\n\r\n const map = name as Record<string, unknown>;\r\n const locale = this.transloco.getActiveLang();\r\n const candidates = [map['display'], map[locale], map['en'], map['ar']];\r\n for (const candidate of candidates) {\r\n if (typeof candidate === 'string' && candidate) {\r\n return candidate;\r\n }\r\n if (typeof candidate === 'number' || typeof candidate === 'boolean') {\r\n return String(candidate);\r\n }\r\n }\r\n\r\n const fallback = Object.values(map).find(\r\n (value) => typeof value === 'string' && value,\r\n );\r\n return typeof fallback === 'string' ? fallback : '';\r\n }\r\n\r\n private loadPreview(requestId: number): void {\r\n this.loadSub?.unsubscribe();\r\n this.loading.set(true);\r\n this.error.set(null);\r\n\r\n this.loadSub = this.http\r\n .get<ApiEnvelope<ProcessPreviewData>>(`processes/${requestId}/preview`)\r\n .subscribe({\r\n next: (response) => {\r\n this.loading.set(false);\r\n this.preview.set(response.data ?? null);\r\n },\r\n error: (error) => {\r\n this.loading.set(false);\r\n this.preview.set(null);\r\n this.error.set(\r\n error?.error?.message ??\r\n error?.message ??\r\n this.transloco.translate('workCenter.preview.loadFailed'),\r\n );\r\n },\r\n });\r\n }\r\n}\r\n\r\nfunction buildEntity(\r\n name: string,\r\n viewType: 'User' | 'DateTime' | 'Text' | 'Status',\r\n value: unknown,\r\n): EntityData {\r\n return {\r\n name,\r\n viewType,\r\n value: (value as any) ?? '',\r\n configuration: {\r\n hideName: true,\r\n },\r\n };\r\n}\r\n","@if (!canRenderPreview()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n Process preview is not available for this item yet.\r\n </p>\r\n </div>\r\n} @else if (loading()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"text-sm text-surface-500\">Loading process preview...</p>\r\n </div>\r\n} @else if (error()) {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-red-300 bg-red-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-red-600\">{{ error() }}</p>\r\n </div>\r\n} @else {\r\n @if (view() === \"schema\") {\r\n @if (hasSchema()) {\r\n <div class=\"wc-process-preview-schema h-[70vh] overflow-hidden\">\r\n <mt-structure-builder\r\n class=\"h-full\"\r\n [layoutDirection]=\"'LR'\"\r\n [readonly]=\"true\"\r\n [structureMode]=\"'workflow'\"\r\n [nodeFields]=\"previewNodeFields\"\r\n [nodes]=\"schemaNodes()\"\r\n [connections]=\"schemaConnections()\"\r\n />\r\n </div>\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n Process steps are not available for this item yet.\r\n </p>\r\n </div>\r\n }\r\n } @else if (hasApprovals()) {\r\n <div class=\"max-h-[70vh] overflow-y-auto\">\r\n <mt-table\r\n noCard\r\n [data]=\"approvalRows()\"\r\n [columns]=\"approvalColumns()\"\r\n storageKey=\"work-center-process-preview-table\"\r\n [showFilters]=\"false\"\r\n [generalSearch]=\"false\"\r\n [clickableRows]=\"false\"\r\n />\r\n </div>\r\n } @else {\r\n <div\r\n class=\"flex min-h-[22rem] items-center justify-center rounded-lg border border-dashed border-surface-300 bg-surface-50 p-6\"\r\n >\r\n <p class=\"max-w-md text-center text-sm text-surface-500\">\r\n Process approvals data is not available for this item yet.\r\n </p>\r\n </div>\r\n }\r\n}\r\n"],"names":["PENDING"],"mappings":";;;;;;;;AAAA;;;;;;;;AAQG;AAsCH,MAAMA,SAAO,GAAG,SAAS;AACzB,MAAM,UAAU,GAAG,YAAY;AAE/B;AACA,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC;AAE9C,SAAU,iBAAiB,CAC/B,KAAoC,EACpC,OAAiC,EAAA;AAEjC,IAAA,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAAO;IACtC,MAAM,UAAU,GAAG,IAAI,GAAG,CACxB,CAAC,OAAO,CAAC,cAAc,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,CAAC,CAAC,CACvD;IACD,MAAM,IAAI,GAAuB,EAAE;IAEnC,KAAK,MAAM,GAAG,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE;AACtC,QAAA,MAAM,SAAS,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,kBAAkB,CAAC;QAErE,IAAI,SAAS,EAAE;AACb,YAAA,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,kBAAkB,CAAC,CAAC;YACxE;QACF;;;QAIA,MAAM,YAAY,GAAG,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC;AACxC,QAAA,KAAK,MAAM,IAAI,IAAI,GAAG,EAAE;AACtB,YAAA,IACE,YAAY;gBACZ,GAAG,CAAC,MAAM,GAAG,CAAC;AACd,gBAAA,mBAAmB,CAAC,IAAI,EAAE,UAAU,C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