@open-mercato/core 0.4.5-develop-7f44fcf045 → 0.4.5-develop-8f98466993

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.
Files changed (110) hide show
  1. package/dist/generated/entities/customer_deal/index.js +4 -0
  2. package/dist/generated/entities/customer_deal/index.js.map +2 -2
  3. package/dist/generated/entities/customer_pipeline/index.js +17 -0
  4. package/dist/generated/entities/customer_pipeline/index.js.map +7 -0
  5. package/dist/generated/entities/customer_pipeline_stage/index.js +19 -0
  6. package/dist/generated/entities/customer_pipeline_stage/index.js.map +7 -0
  7. package/dist/generated/entities.ids.generated.js +2 -0
  8. package/dist/generated/entities.ids.generated.js.map +2 -2
  9. package/dist/generated/entity-fields-registry.js +4 -0
  10. package/dist/generated/entity-fields-registry.js.map +2 -2
  11. package/dist/modules/currencies/api/currencies/route.js +6 -0
  12. package/dist/modules/currencies/api/currencies/route.js.map +2 -2
  13. package/dist/modules/currencies/api/exchange-rates/route.js +5 -1
  14. package/dist/modules/currencies/api/exchange-rates/route.js.map +2 -2
  15. package/dist/modules/currencies/commands/currencies.js +5 -4
  16. package/dist/modules/currencies/commands/currencies.js.map +2 -2
  17. package/dist/modules/currencies/commands/exchange-rates.js +5 -4
  18. package/dist/modules/currencies/commands/exchange-rates.js.map +2 -2
  19. package/dist/modules/customers/acl.js +2 -0
  20. package/dist/modules/customers/acl.js.map +2 -2
  21. package/dist/modules/customers/api/deals/[id]/route.js +4 -0
  22. package/dist/modules/customers/api/deals/[id]/route.js.map +2 -2
  23. package/dist/modules/customers/api/deals/route.js +12 -0
  24. package/dist/modules/customers/api/deals/route.js.map +2 -2
  25. package/dist/modules/customers/api/dictionaries/[kind]/route.js +20 -1
  26. package/dist/modules/customers/api/dictionaries/[kind]/route.js.map +2 -2
  27. package/dist/modules/customers/api/pipeline-stages/reorder/route.js +69 -0
  28. package/dist/modules/customers/api/pipeline-stages/reorder/route.js.map +7 -0
  29. package/dist/modules/customers/api/pipeline-stages/route.js +275 -0
  30. package/dist/modules/customers/api/pipeline-stages/route.js.map +7 -0
  31. package/dist/modules/customers/api/pipelines/route.js +245 -0
  32. package/dist/modules/customers/api/pipelines/route.js.map +7 -0
  33. package/dist/modules/customers/backend/config/customers/page.js +2 -0
  34. package/dist/modules/customers/backend/config/customers/page.js.map +2 -2
  35. package/dist/modules/customers/backend/config/customers/pipeline-stages/page.js +439 -0
  36. package/dist/modules/customers/backend/config/customers/pipeline-stages/page.js.map +7 -0
  37. package/dist/modules/customers/backend/config/customers/pipeline-stages/page.meta.js +17 -0
  38. package/dist/modules/customers/backend/config/customers/pipeline-stages/page.meta.js.map +7 -0
  39. package/dist/modules/customers/backend/customers/deals/[id]/page.js +19 -1
  40. package/dist/modules/customers/backend/customers/deals/[id]/page.js.map +2 -2
  41. package/dist/modules/customers/backend/customers/deals/page.js +35 -1
  42. package/dist/modules/customers/backend/customers/deals/page.js.map +2 -2
  43. package/dist/modules/customers/backend/customers/deals/pipeline/page.js +102 -74
  44. package/dist/modules/customers/backend/customers/deals/pipeline/page.js.map +2 -2
  45. package/dist/modules/customers/cli.js +28 -2
  46. package/dist/modules/customers/cli.js.map +2 -2
  47. package/dist/modules/customers/commands/deals.js +34 -2
  48. package/dist/modules/customers/commands/deals.js.map +2 -2
  49. package/dist/modules/customers/commands/index.js +2 -0
  50. package/dist/modules/customers/commands/index.js.map +2 -2
  51. package/dist/modules/customers/commands/pipeline-stages.js +126 -0
  52. package/dist/modules/customers/commands/pipeline-stages.js.map +7 -0
  53. package/dist/modules/customers/commands/pipelines.js +87 -0
  54. package/dist/modules/customers/commands/pipelines.js.map +7 -0
  55. package/dist/modules/customers/components/DictionarySettings.js +0 -5
  56. package/dist/modules/customers/components/DictionarySettings.js.map +2 -2
  57. package/dist/modules/customers/components/PipelineSettings.js +474 -0
  58. package/dist/modules/customers/components/PipelineSettings.js.map +7 -0
  59. package/dist/modules/customers/components/detail/DealForm.js +84 -12
  60. package/dist/modules/customers/components/detail/DealForm.js.map +2 -2
  61. package/dist/modules/customers/data/entities.js +78 -0
  62. package/dist/modules/customers/data/entities.js.map +2 -2
  63. package/dist/modules/customers/data/validators.js +44 -0
  64. package/dist/modules/customers/data/validators.js.map +2 -2
  65. package/dist/modules/customers/migrations/Migration20260218191730.js +77 -0
  66. package/dist/modules/customers/migrations/Migration20260218191730.js.map +7 -0
  67. package/dist/modules/customers/setup.js +7 -3
  68. package/dist/modules/customers/setup.js.map +2 -2
  69. package/dist/modules/workflows/migrations/Migration20260222205305.js +14 -0
  70. package/dist/modules/workflows/migrations/Migration20260222205305.js.map +7 -0
  71. package/generated/entities/customer_deal/index.ts +2 -0
  72. package/generated/entities/customer_pipeline/index.ts +7 -0
  73. package/generated/entities/customer_pipeline_stage/index.ts +8 -0
  74. package/generated/entities.ids.generated.ts +2 -0
  75. package/generated/entity-fields-registry.ts +4 -0
  76. package/package.json +2 -2
  77. package/src/modules/currencies/api/currencies/route.ts +6 -0
  78. package/src/modules/currencies/api/exchange-rates/route.ts +5 -1
  79. package/src/modules/currencies/commands/currencies.ts +5 -4
  80. package/src/modules/currencies/commands/exchange-rates.ts +5 -4
  81. package/src/modules/customers/acl.ts +2 -0
  82. package/src/modules/customers/api/deals/[id]/route.ts +4 -0
  83. package/src/modules/customers/api/deals/route.ts +12 -0
  84. package/src/modules/customers/api/dictionaries/[kind]/route.ts +21 -1
  85. package/src/modules/customers/api/pipeline-stages/reorder/route.ts +71 -0
  86. package/src/modules/customers/api/pipeline-stages/route.ts +296 -0
  87. package/src/modules/customers/api/pipelines/route.ts +261 -0
  88. package/src/modules/customers/backend/config/customers/page.tsx +2 -0
  89. package/src/modules/customers/backend/config/customers/pipeline-stages/page.meta.ts +13 -0
  90. package/src/modules/customers/backend/config/customers/pipeline-stages/page.tsx +512 -0
  91. package/src/modules/customers/backend/customers/deals/[id]/page.tsx +21 -1
  92. package/src/modules/customers/backend/customers/deals/page.tsx +33 -1
  93. package/src/modules/customers/backend/customers/deals/pipeline/page.tsx +119 -79
  94. package/src/modules/customers/cli.ts +29 -1
  95. package/src/modules/customers/commands/deals.ts +44 -1
  96. package/src/modules/customers/commands/index.ts +2 -0
  97. package/src/modules/customers/commands/pipeline-stages.ts +156 -0
  98. package/src/modules/customers/commands/pipelines.ts +105 -0
  99. package/src/modules/customers/components/DictionarySettings.tsx +0 -5
  100. package/src/modules/customers/components/PipelineSettings.tsx +570 -0
  101. package/src/modules/customers/components/detail/DealForm.tsx +89 -11
  102. package/src/modules/customers/data/entities.ts +64 -0
  103. package/src/modules/customers/data/validators.ts +57 -0
  104. package/src/modules/customers/i18n/de.json +4 -0
  105. package/src/modules/customers/i18n/en.json +4 -0
  106. package/src/modules/customers/i18n/es.json +4 -0
  107. package/src/modules/customers/i18n/pl.json +5 -1
  108. package/src/modules/customers/migrations/Migration20260218191730.ts +84 -0
  109. package/src/modules/customers/setup.ts +5 -1
  110. package/src/modules/workflows/migrations/Migration20260222205305.ts +13 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/modules/customers/backend/customers/deals/%5Bid%5D/page.tsx"],
4
- "sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport Link from 'next/link'\nimport { useRouter } from 'next/navigation'\nimport { Pencil, MousePointerClick } from 'lucide-react'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { FormHeader } from '@open-mercato/ui/backend/forms'\nimport { VersionHistoryAction } from '@open-mercato/ui/backend/version-history'\nimport { SendObjectMessageDialog } from '@open-mercato/ui/backend/messages'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { apiCallOrThrow, readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { NotesSection, type SectionAction } from '@open-mercato/ui/backend/detail'\nimport { ActivitiesSection } from '../../../../components/detail/ActivitiesSection'\nimport { DealForm, type DealFormSubmitPayload } from '../../../../components/detail/DealForm'\nimport { useCustomerDictionary } from '../../../../components/detail/hooks/useCustomerDictionary'\nimport type { CustomerDictionaryMap } from '../../../../lib/dictionaries'\nimport { createTranslatorWithFallback } from '@open-mercato/shared/lib/i18n/translate'\nimport { renderDictionaryColor, renderDictionaryIcon } from '@open-mercato/core/modules/dictionaries/components/dictionaryAppearance'\nimport { ICON_SUGGESTIONS } from '../../../../lib/dictionaries'\nimport { createCustomerNotesAdapter } from '../../../../components/detail/notesAdapter'\nimport { readMarkdownPreferenceCookie, writeMarkdownPreferenceCookie } from '../../../../lib/markdownPreference'\n\ntype DealAssociation = {\n id: string\n label: string\n subtitle: string | null\n kind: 'person' | 'company'\n}\n\ntype DealDetailPayload = {\n deal: {\n id: string\n title: string\n description: string | null\n status: string | null\n pipelineStage: string | null\n valueAmount: string | null\n valueCurrency: string | null\n probability: number | null\n expectedCloseAt: string | null\n ownerUserId: string | null\n source: string | null\n organizationId: string | null\n tenantId: string | null\n createdAt: string\n updatedAt: string\n }\n people: DealAssociation[]\n companies: DealAssociation[]\n customFields: Record<string, unknown>\n viewer?: {\n userId: string | null\n name?: string | null\n email?: string | null\n } | null\n}\n\nconst CRUD_FOCUSABLE_SELECTOR =\n '[data-crud-focus-target], input:not([type=\"hidden\"]):not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex=\"-1\"])'\n\nfunction formatCurrency(amount: string | null, currency: string | null): string | null {\n if (!amount) return null\n const value = Number(amount)\n if (!Number.isFinite(value)) return currency ? `${amount} ${currency}` : amount\n if (!currency) return value.toLocaleString()\n try {\n return new Intl.NumberFormat(undefined, { style: 'currency', currency }).format(value)\n } catch {\n return `${value.toLocaleString()} ${currency}`\n }\n}\n\nfunction formatDate(value: string | null, fallback: string): string {\n if (!value) return fallback\n const date = new Date(value)\n if (Number.isNaN(date.getTime())) return fallback\n return date.toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' })\n}\n\nfunction resolveDictionaryLabel(\n value: string | null | undefined,\n map: CustomerDictionaryMap | null | undefined,\n): string | null {\n if (!value) return null\n const entry = map?.[value]\n if (entry && entry.label && entry.label.length) return entry.label\n return value\n}\n\nexport default function DealDetailPage({ params }: { params?: { id?: string } }) {\n const t = useT()\n const { confirm, ConfirmDialogElement } = useConfirmDialog()\n const detailTranslator = React.useMemo(() => createTranslatorWithFallback(t), [t])\n const notesAdapter = React.useMemo(() => createCustomerNotesAdapter(detailTranslator), [detailTranslator])\n const router = useRouter()\n const id = params?.id ?? ''\n const scopeVersion = useOrganizationScopeVersion()\n const statusDictionaryQuery = useCustomerDictionary('deal-statuses', scopeVersion)\n const pipelineDictionaryQuery = useCustomerDictionary('pipeline-stages', scopeVersion)\n const statusDictionaryMap = statusDictionaryQuery.data?.map ?? null\n const pipelineDictionaryMap = pipelineDictionaryQuery.data?.map ?? null\n const [data, setData] = React.useState<DealDetailPayload | null>(null)\n const [isLoading, setIsLoading] = React.useState(true)\n const [error, setError] = React.useState<string | null>(null)\n const [isSaving, setIsSaving] = React.useState(false)\n const [isDeleting, setIsDeleting] = React.useState(false)\n const [reloadToken, setReloadToken] = React.useState(0)\n const [activeTab, setActiveTab] = React.useState<'notes' | 'activities'>('notes')\n const [sectionAction, setSectionAction] = React.useState<SectionAction | null>(null)\n const handleNotesLoadingChange = React.useCallback(() => {}, [])\n const handleActivitiesLoadingChange = React.useCallback(() => {}, [])\n const focusDealField = React.useCallback(\n (fieldId: 'title' | 'personIds' | 'companyIds') => {\n if (typeof window === 'undefined' || typeof document === 'undefined') return\n const focusOnce = () => {\n const container = document.querySelector<HTMLElement>(`[data-crud-field-id=\"${fieldId}\"]`)\n if (!container) return false\n const target =\n container.querySelector<HTMLElement>(CRUD_FOCUSABLE_SELECTOR) ?? container\n if (!target || typeof target.focus !== 'function') return false\n if (typeof container.scrollIntoView === 'function') {\n container.scrollIntoView({ behavior: 'smooth', block: 'center' })\n }\n target.focus()\n if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) {\n try {\n target.select()\n } catch {}\n }\n return true\n }\n\n const schedule = () => {\n const focused = focusOnce()\n if (focused) return\n window.setTimeout(() => {\n focusOnce()\n }, 60)\n }\n\n if (typeof window.requestAnimationFrame === 'function') {\n window.requestAnimationFrame(schedule)\n } else {\n schedule()\n }\n },\n [],\n )\n const dealSettingsRef = React.useRef<HTMLDivElement | null>(null)\n const scrollToDealSettings = React.useCallback(() => {\n if (typeof window === 'undefined') return\n if (dealSettingsRef.current && typeof dealSettingsRef.current.scrollIntoView === 'function') {\n dealSettingsRef.current.scrollIntoView({ behavior: 'smooth', block: 'start' })\n }\n window.setTimeout(() => {\n focusDealField('title')\n }, 160)\n }, [focusDealField])\n\n React.useEffect(() => {\n if (!id) {\n setError(t('customers.deals.detail.missingId', 'Deal id is required.'))\n setIsLoading(false)\n return\n }\n let cancelled = false\n async function loadDeal() {\n setIsLoading(true)\n setError(null)\n try {\n const payload = await readApiResultOrThrow<DealDetailPayload>(\n `/api/customers/deals/${encodeURIComponent(id)}`,\n undefined,\n { errorMessage: t('customers.deals.detail.loadError', 'Failed to load deal.') },\n )\n if (cancelled) return\n setData(payload as DealDetailPayload)\n } catch (err) {\n if (cancelled) return\n const message =\n err instanceof Error && err.message\n ? err.message\n : t('customers.deals.detail.loadError', 'Failed to load deal.')\n setError(message)\n setData(null)\n } finally {\n if (!cancelled) setIsLoading(false)\n }\n }\n loadDeal().catch(() => {})\n return () => {\n cancelled = true\n }\n }, [id, reloadToken, t])\n\n const handleFormSubmit = React.useCallback(\n async ({ base, custom }: DealFormSubmitPayload) => {\n if (!data || isSaving) return\n setIsSaving(true)\n try {\n const payload: Record<string, unknown> = {\n id: data.deal.id,\n title: base.title,\n status: base.status ?? undefined,\n pipelineStage: base.pipelineStage ?? undefined,\n valueAmount: typeof base.valueAmount === 'number' ? base.valueAmount : undefined,\n valueCurrency: base.valueCurrency ?? undefined,\n probability: typeof base.probability === 'number' ? base.probability : undefined,\n expectedCloseAt: base.expectedCloseAt ?? undefined,\n description: base.description ?? undefined,\n personIds: base.personIds && base.personIds.length ? base.personIds : undefined,\n companyIds: base.companyIds && base.companyIds.length ? base.companyIds : undefined,\n }\n if (Object.keys(custom).length) payload.customFields = custom\n\n await apiCallOrThrow(\n '/api/customers/deals',\n {\n method: 'PUT',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(payload),\n },\n { errorMessage: t('customers.deals.detail.saveError', 'Failed to update deal.') },\n )\n flash(t('customers.deals.detail.saveSuccess', 'Deal updated.'), 'success')\n setReloadToken((token) => token + 1)\n } catch (err) {\n const message =\n err instanceof Error && err.message\n ? err.message\n : t('customers.deals.detail.saveError', 'Failed to update deal.')\n flash(message, 'error')\n throw err instanceof Error ? err : new Error(message)\n } finally {\n setIsSaving(false)\n }\n },\n [data, isSaving, t],\n )\n\n const handleDelete = React.useCallback(async () => {\n if (!data || isDeleting) return\n const confirmed = await confirm({\n title: t(\n 'customers.deals.detail.deleteConfirm',\n 'Delete this deal? This action cannot be undone.',\n ),\n variant: 'destructive',\n })\n if (!confirmed) return\n\n setIsDeleting(true)\n try {\n await apiCallOrThrow(\n '/api/customers/deals',\n {\n method: 'DELETE',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ id: data.deal.id }),\n },\n { errorMessage: t('customers.deals.detail.deleteError', 'Failed to delete deal.') },\n )\n flash(t('customers.deals.detail.deleteSuccess', 'Deal deleted.'), 'success')\n router.push('/backend/customers/deals')\n } catch (err) {\n const message =\n err instanceof Error && err.message\n ? err.message\n : t('customers.deals.detail.deleteError', 'Failed to delete deal.')\n flash(message, 'error')\n } finally {\n setIsDeleting(false)\n }\n }, [confirm, data, isDeleting, router, t])\n\n React.useEffect(() => {\n setSectionAction(null)\n }, [activeTab])\n\n const handleSectionAction = React.useCallback(() => {\n if (!sectionAction || sectionAction.disabled) return\n sectionAction.onClick()\n }, [sectionAction])\n\n const dealOptions = React.useMemo(\n () =>\n data\n ? [\n {\n id: data.deal.id,\n label:\n data.deal.title && data.deal.title.length\n ? data.deal.title\n : t('customers.deals.detail.untitled', 'Untitled deal'),\n },\n ]\n : [],\n [data, t],\n )\n\n const entityOptions = React.useMemo(() => {\n if (!data) return []\n const entries: { id: string; label: string }[] = []\n data.people.forEach((person) => {\n if (!person.id) return\n const suffix = person.subtitle ? ` \u00B7 ${person.subtitle}` : ''\n entries.push({ id: person.id, label: `${person.label}${suffix}` })\n })\n data.companies.forEach((company) => {\n if (!company.id) return\n const suffix = company.subtitle ? ` \u00B7 ${company.subtitle}` : ''\n entries.push({ id: company.id, label: `${company.label}${suffix}` })\n })\n return entries\n }, [data])\n\n const defaultEntityId = React.useMemo(() => {\n if (entityOptions.length) return entityOptions[0].id\n return null\n }, [entityOptions])\n\n const tabs = React.useMemo(\n () => [\n { id: 'notes' as const, label: t('customers.deals.detail.tabs.notes', 'Notes') },\n { id: 'activities' as const, label: t('customers.deals.detail.tabs.activities', 'Activities') },\n ],\n [t],\n )\n\n if (isLoading) {\n return (\n <Page>\n <PageBody>\n <div className=\"flex h-[50vh] flex-col items-center justify-center gap-2 text-muted-foreground\">\n <Spinner className=\"h-6 w-6\" />\n <span>{t('customers.deals.detail.loading', 'Loading deal\u2026')}</span>\n </div>\n </PageBody>\n </Page>\n )\n }\n\n if (error || !data) {\n return (\n <Page>\n <PageBody>\n <div className=\"flex h-[50vh] flex-col items-center justify-center gap-3 text-muted-foreground\">\n <p>{error || t('customers.deals.detail.notFound', 'Deal not found.')}</p>\n <Button variant=\"outline\" asChild>\n <Link href=\"/backend/customers/deals\">\n {t('customers.deals.detail.backToList', 'Back to deals')}\n </Link>\n </Button>\n </div>\n </PageBody>\n </Page>\n )\n }\n\n const probabilityLabel = data.deal.probability !== null && data.deal.probability !== undefined\n ? `${data.deal.probability}%`\n : t('customers.deals.detail.noValue', 'Not provided')\n const valueLabel =\n formatCurrency(data.deal.valueAmount, data.deal.valueCurrency) ??\n t('customers.deals.detail.noValue', 'Not provided')\n const expectedCloseLabel = formatDate(data.deal.expectedCloseAt, t('customers.deals.detail.noValue', 'Not provided'))\n const statusLabel =\n resolveDictionaryLabel(data.deal.status, statusDictionaryMap) ??\n t('customers.deals.detail.noStatus', 'No status')\n const pipelineLabel = resolveDictionaryLabel(data.deal.pipelineStage, pipelineDictionaryMap)\n\n const peopleSummaryLabel =\n data.people.length === 1\n ? t('customers.deals.detail.peopleSummaryOne')\n : t('customers.deals.detail.peopleSummaryMany', undefined, { count: data.people.length })\n const companiesSummaryLabel =\n data.companies.length === 1\n ? t('customers.deals.detail.companiesSummaryOne')\n : t('customers.deals.detail.companiesSummaryMany', undefined, { count: data.companies.length })\n\n const viewer = data.viewer ?? null\n\n return (\n <Page>\n <PageBody>\n <div className=\"flex flex-col gap-6\">\n <FormHeader\n mode=\"detail\"\n backHref=\"/backend/customers/deals\"\n backLabel={t('customers.deals.detail.backToList', 'Back to deals')}\n utilityActions={(\n <>\n <SendObjectMessageDialog\n object={{\n entityModule: 'customers',\n entityType: 'deal',\n entityId: data.deal.id,\n sourceEntityType: 'customers.deal',\n sourceEntityId: data.deal.id,\n }}\n defaultValues={{\n sourceEntityType: 'customers.deal',\n sourceEntityId: data.deal.id,\n }}\n />\n <VersionHistoryAction\n config={{ resourceKind: 'customers.deal', resourceId: data.deal.id }}\n t={t}\n />\n </>\n )}\n title={\n <div className=\"flex flex-wrap items-center gap-2\">\n <span>{data.deal.title || t('customers.deals.detail.untitled', 'Untitled deal')}</span>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"gap-1 text-muted-foreground hover:text-foreground\"\n onClick={scrollToDealSettings}\n >\n <Pencil className=\"h-4 w-4\" aria-hidden />\n <MousePointerClick className=\"h-4 w-4\" aria-hidden />\n <span>{t('customers.deals.detail.goToSettings', 'Edit deal details')}</span>\n </Button>\n </div>\n }\n subtitle={t('customers.deals.detail.summary', undefined, {\n status: statusLabel,\n pipeline: pipelineLabel ?? t('customers.deals.detail.noPipeline', 'No pipeline'),\n })}\n onDelete={handleDelete}\n isDeleting={isDeleting}\n deleteLabel={t('ui.actions.delete', 'Delete')}\n />\n <div className=\"grid gap-6 lg:grid-cols-[minmax(0,2fr),minmax(0,1.1fr)]\">\n <div className=\"space-y-6\">\n <div className=\"rounded-lg border bg-card p-4\">\n <h2 className=\"mb-4 text-sm font-semibold uppercase text-muted-foreground\">\n {t('customers.deals.detail.highlights', 'Highlights')}\n </h2>\n <div className=\"grid gap-4 sm:grid-cols-2\">\n <div>\n <p className=\"text-xs font-medium uppercase text-muted-foreground\">\n {t('customers.deals.detail.fields.value', 'Deal value')}\n </p>\n <p className=\"text-base font-semibold text-foreground\">{valueLabel}</p>\n </div>\n <div>\n <p className=\"text-xs font-medium uppercase text-muted-foreground\">\n {t('customers.deals.detail.fields.probability', 'Probability')}\n </p>\n <p className=\"text-base font-semibold text-foreground\">{probabilityLabel}</p>\n </div>\n <div>\n <p className=\"text-xs font-medium uppercase text-muted-foreground\">\n {t('customers.deals.detail.fields.pipeline', 'Pipeline stage')}\n </p>\n <p className=\"text-base text-foreground\">\n {pipelineLabel ?? t('customers.deals.detail.noValue', 'Not provided')}\n </p>\n </div>\n <div>\n <p className=\"text-xs font-medium uppercase text-muted-foreground\">\n {t('customers.deals.detail.fields.expectedClose', 'Expected close')}\n </p>\n <p className=\"text-base text-foreground\">{expectedCloseLabel}</p>\n </div>\n </div>\n </div>\n\n <div className=\"rounded-lg border bg-card p-4\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div className=\"flex gap-2\">\n {tabs.map((tab) => (\n <Button\n key={tab.id}\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => setActiveTab(tab.id)}\n className={`h-auto rounded-none border-b-2 px-0 py-1 ${\n activeTab === tab.id\n ? 'border-primary text-foreground'\n : 'border-transparent text-muted-foreground hover:text-foreground hover:bg-transparent'\n }`}\n >\n {tab.label}\n </Button>\n ))}\n </div>\n {sectionAction ? (\n <Button\n type=\"button\"\n size=\"sm\"\n disabled={sectionAction.disabled}\n onClick={handleSectionAction}\n >\n {sectionAction.icon ?? null}\n {sectionAction.label}\n </Button>\n ) : null}\n </div>\n {activeTab === 'notes' ? (\n <NotesSection\n entityId={null}\n dealId={data.deal.id}\n dealOptions={dealOptions}\n entityOptions={entityOptions}\n emptyLabel={t('customers.deals.detail.notesEmpty', 'No notes yet.')}\n viewerUserId={viewer?.userId ?? null}\n viewerName={viewer?.name ?? null}\n viewerEmail={viewer?.email ?? null}\n addActionLabel={t('customers.deals.detail.notesAdd', 'Add note')}\n emptyState={{\n title: t('customers.deals.detail.notesEmptyTitle', 'Keep everyone in the loop'),\n actionLabel: t('customers.deals.detail.notesEmptyAction', 'Add a note'),\n }}\n onActionChange={setSectionAction}\n translator={detailTranslator}\n onLoadingChange={handleNotesLoadingChange}\n dataAdapter={notesAdapter}\n renderIcon={renderDictionaryIcon}\n renderColor={renderDictionaryColor}\n iconSuggestions={ICON_SUGGESTIONS}\n readMarkdownPreference={readMarkdownPreferenceCookie}\n writeMarkdownPreference={writeMarkdownPreferenceCookie}\n />\n ) : null}\n {activeTab === 'activities' ? (\n <ActivitiesSection\n entityId={null}\n dealId={data.deal.id}\n dealOptions={dealOptions}\n entityOptions={entityOptions}\n defaultEntityId={defaultEntityId ?? undefined}\n addActionLabel={t('customers.deals.detail.activitiesAdd', 'Log activity')}\n emptyState={{\n title: t('customers.deals.detail.activitiesEmptyTitle', 'No activities yet'),\n actionLabel: t('customers.deals.detail.activitiesEmptyAction', 'Add an activity'),\n }}\n onActionChange={setSectionAction}\n onLoadingChange={handleActivitiesLoadingChange}\n />\n ) : null}\n </div>\n\n <div className=\"grid gap-4 md:grid-cols-2\">\n <div className=\"rounded-lg border bg-card p-4\">\n <div className=\"mb-3 space-y-1\">\n <h3 className=\"text-sm font-semibold text-foreground\">\n {t('customers.deals.detail.peopleSection', 'People')}\n </h3>\n <p className=\"text-xs text-muted-foreground\">\n {peopleSummaryLabel}\n </p>\n </div>\n {data.people.length ? (\n <ul className=\"space-y-2 text-sm\">\n {data.people.map((person) => (\n <li key={person.id} className=\"flex flex-col gap-1\">\n <Link href={`/backend/customers/people/${encodeURIComponent(person.id)}`} className=\"font-medium text-foreground hover:underline\">\n {person.label}\n </Link>\n <span className=\"text-xs text-muted-foreground\">\n {person.subtitle ?? t('customers.deals.detail.peopleNoDetails', 'No additional details')}\n </span>\n </li>\n ))}\n </ul>\n ) : (\n <p className=\"text-sm text-muted-foreground\">\n {t('customers.deals.detail.noPeople', 'No people linked to this deal yet.')}\n </p>\n )}\n </div>\n <div className=\"rounded-lg border bg-card p-4\">\n <div className=\"mb-3 space-y-1\">\n <h3 className=\"text-sm font-semibold text-foreground\">\n {t('customers.deals.detail.companiesSection', 'Companies')}\n </h3>\n <p className=\"text-xs text-muted-foreground\">\n {companiesSummaryLabel}\n </p>\n </div>\n {data.companies.length ? (\n <ul className=\"space-y-2 text-sm\">\n {data.companies.map((company) => (\n <li key={company.id} className=\"flex flex-col gap-1\">\n <Link href={`/backend/customers/companies/${encodeURIComponent(company.id)}`} className=\"font-medium text-foreground hover:underline\">\n {company.label}\n </Link>\n <span className=\"text-xs text-muted-foreground\">\n {company.subtitle ?? t('customers.deals.detail.companiesNoDetails', 'No additional details')}\n </span>\n </li>\n ))}\n </ul>\n ) : (\n <p className=\"text-sm text-muted-foreground\">\n {t('customers.deals.detail.noCompanies', 'No companies linked to this deal yet.')}\n </p>\n )}\n </div>\n </div>\n </div>\n\n <div className=\"space-y-6\">\n <div\n ref={dealSettingsRef}\n id=\"deal-settings\"\n className=\"rounded-lg border bg-card p-4\"\n >\n <h2 className=\"mb-4 text-sm font-semibold uppercase text-muted-foreground\">\n {t('customers.deals.detail.formTitle', 'Deal settings')}\n </h2>\n <DealForm\n key={data.deal.updatedAt}\n mode=\"edit\"\n initialValues={{\n id: data.deal.id,\n title: data.deal.title ?? '',\n status: data.deal.status ?? '',\n pipelineStage: data.deal.pipelineStage ?? '',\n valueAmount: data.deal.valueAmount ? Number(data.deal.valueAmount) : null,\n valueCurrency: data.deal.valueCurrency ?? undefined,\n probability: data.deal.probability ?? null,\n expectedCloseAt: data.deal.expectedCloseAt ?? null,\n description: data.deal.description ?? '',\n personIds: data.people.map((person) => person.id),\n companyIds: data.companies.map((company) => company.id),\n people: data.people.map((person) => ({ id: person.id, label: person.label })),\n companies: data.companies.map((company) => ({ id: company.id, label: company.label })),\n ...Object.fromEntries(\n Object.entries(data.customFields)\n .filter(([key]) => key.startsWith('cf_'))\n .map(([key, value]) => [key, value]),\n ),\n }}\n onSubmit={handleFormSubmit}\n onCancel={() => setReloadToken((token) => token + 1)}\n onDelete={handleDelete}\n isSubmitting={isSaving || isDeleting}\n />\n </div>\n </div>\n </div>\n </div>\n </PageBody>\n {ConfirmDialogElement}\n </Page>\n )\n}\n"],
5
- "mappings": ";AAmVU,SA0DI,UAzDF,KADF;AAjVV,YAAY,WAAW;AACvB,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,QAAQ,yBAAyB;AAC1C,SAAS,MAAM,gBAAgB;AAC/B,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,4BAA4B;AACrC,SAAS,+BAA+B;AACxC,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,gBAAgB,4BAA4B;AACrD,SAAS,YAAY;AACrB,SAAS,mCAAmC;AAC5C,SAAS,wBAAwB;AACjC,SAAS,oBAAwC;AACjD,SAAS,yBAAyB;AAClC,SAAS,gBAA4C;AACrD,SAAS,6BAA6B;AAEtC,SAAS,oCAAoC;AAC7C,SAAS,uBAAuB,4BAA4B;AAC5D,SAAS,wBAAwB;AACjC,SAAS,kCAAkC;AAC3C,SAAS,8BAA8B,qCAAqC;AAqC5E,MAAM,0BACJ;AAEF,SAAS,eAAe,QAAuB,UAAwC;AACrF,MAAI,CAAC,OAAQ,QAAO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AAK,KAAK,SAAS;AAAA,oBAC1B,QAAQ,KAAK,KAAK,UAAU;AAAA,oBAC5B,eAAe,KAAK,KAAK,iBAAiB;AAAA,oBAC1C,aAAa,KAAK,KAAK,cAAc,OAAO,KAAK,KAAK,WAAW,IAAI;AAAA,oBACrE,eAAe,KAAK,KAAK,iBAAiB;AAAA,oBAC1C,aAAa,KAAK,KAAK,eAAe;AAAA,oBACtC,iBAAiB,KAAK,KAAK,mBAAmB;AAAA,oBAC9C,aAAa,KAAK,KAAK,eAAe;AAAA,oBACtC,WAAW,KAAK,OAAO,IAAI,CAAC,WAAW,OAAO,EAAE;AAAA,oBAChD,YAAY,KAAK,UAAU,IAAI,CAAC,YAAY,QAAQ,EAAE;AAAA,oBACtD,QAAQ,KAAK,OAAO,IAAI,CAAC,YAAY,EAAE,IAAI,OAAO,IAAI,OAAO,OAAO,MAAM,EAAE;AAAA,oBAC5E,WAAW,KAAK,UAAU,IAAI,CAAC,aAAa,EAAE,IAAI,QAAQ,IAAI,OAAO,QAAQ,MAAM,EAAE;AAAA,oBACrF,GAAG,OAAO;AAAA,sBACR,OAAO,QAAQ,KAAK,YAAY,EAC7B,OAAO,CAAC,CAAC,GAAG,MAAM,IAAI,WAAW,KAAK,CAAC,EACvC,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,KAAK,CAAC;AAAA,oBACvC;AAAA,kBACF;AAAA,kBACA,UAAU;AAAA,kBACV,UAAU,MAAM,eAAe,CAAC,UAAU,QAAQ,CAAC;AAAA,kBACnD,UAAU;AAAA,kBACV,cAAc,YAAY;AAAA;AAAA,gBAzBrB,KAAK,KAAK;AAAA,cA0BjB;AAAA;AAAA;AAAA,QACF,GACF;AAAA,SACF;AAAA,OACF,GACF;AAAA,IACC;AAAA,KACH;AAEJ;",
4
+ "sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport Link from 'next/link'\nimport { useRouter } from 'next/navigation'\nimport { Pencil, MousePointerClick } from 'lucide-react'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { FormHeader } from '@open-mercato/ui/backend/forms'\nimport { VersionHistoryAction } from '@open-mercato/ui/backend/version-history'\nimport { SendObjectMessageDialog } from '@open-mercato/ui/backend/messages'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { apiCallOrThrow, readApiResultOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { useOrganizationScopeVersion } from '@open-mercato/shared/lib/frontend/useOrganizationScope'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { NotesSection, type SectionAction } from '@open-mercato/ui/backend/detail'\nimport { ActivitiesSection } from '../../../../components/detail/ActivitiesSection'\nimport { DealForm, type DealFormSubmitPayload } from '../../../../components/detail/DealForm'\nimport { useCustomerDictionary } from '../../../../components/detail/hooks/useCustomerDictionary'\nimport type { CustomerDictionaryMap } from '../../../../lib/dictionaries'\nimport { createTranslatorWithFallback } from '@open-mercato/shared/lib/i18n/translate'\nimport { renderDictionaryColor, renderDictionaryIcon } from '@open-mercato/core/modules/dictionaries/components/dictionaryAppearance'\nimport { ICON_SUGGESTIONS } from '../../../../lib/dictionaries'\nimport { createCustomerNotesAdapter } from '../../../../components/detail/notesAdapter'\nimport { readMarkdownPreferenceCookie, writeMarkdownPreferenceCookie } from '../../../../lib/markdownPreference'\n\ntype DealAssociation = {\n id: string\n label: string\n subtitle: string | null\n kind: 'person' | 'company'\n}\n\ntype DealDetailPayload = {\n deal: {\n id: string\n title: string\n description: string | null\n status: string | null\n pipelineStage: string | null\n pipelineId: string | null\n pipelineStageId: string | null\n valueAmount: string | null\n valueCurrency: string | null\n probability: number | null\n expectedCloseAt: string | null\n ownerUserId: string | null\n source: string | null\n organizationId: string | null\n tenantId: string | null\n createdAt: string\n updatedAt: string\n }\n people: DealAssociation[]\n companies: DealAssociation[]\n customFields: Record<string, unknown>\n viewer?: {\n userId: string | null\n name?: string | null\n email?: string | null\n } | null\n}\n\nconst CRUD_FOCUSABLE_SELECTOR =\n '[data-crud-focus-target], input:not([type=\"hidden\"]):not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex=\"-1\"])'\n\nfunction formatCurrency(amount: string | null, currency: string | null): string | null {\n if (!amount) return null\n const value = Number(amount)\n if (!Number.isFinite(value)) return currency ? `${amount} ${currency}` : amount\n if (!currency) return value.toLocaleString()\n try {\n return new Intl.NumberFormat(undefined, { style: 'currency', currency }).format(value)\n } catch {\n return `${value.toLocaleString()} ${currency}`\n }\n}\n\nfunction formatDate(value: string | null, fallback: string): string {\n if (!value) return fallback\n const date = new Date(value)\n if (Number.isNaN(date.getTime())) return fallback\n return date.toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' })\n}\n\nfunction resolveDictionaryLabel(\n value: string | null | undefined,\n map: CustomerDictionaryMap | null | undefined,\n): string | null {\n if (!value) return null\n const entry = map?.[value]\n if (entry && entry.label && entry.label.length) return entry.label\n return value\n}\n\nexport default function DealDetailPage({ params }: { params?: { id?: string } }) {\n const t = useT()\n const { confirm, ConfirmDialogElement } = useConfirmDialog()\n const detailTranslator = React.useMemo(() => createTranslatorWithFallback(t), [t])\n const notesAdapter = React.useMemo(() => createCustomerNotesAdapter(detailTranslator), [detailTranslator])\n const router = useRouter()\n const id = params?.id ?? ''\n const scopeVersion = useOrganizationScopeVersion()\n const statusDictionaryQuery = useCustomerDictionary('deal-statuses', scopeVersion)\n const pipelineDictionaryQuery = useCustomerDictionary('pipeline-stages', scopeVersion)\n const statusDictionaryMap = statusDictionaryQuery.data?.map ?? null\n const pipelineDictionaryMap = pipelineDictionaryQuery.data?.map ?? null\n const [data, setData] = React.useState<DealDetailPayload | null>(null)\n const [isLoading, setIsLoading] = React.useState(true)\n const [error, setError] = React.useState<string | null>(null)\n const [isSaving, setIsSaving] = React.useState(false)\n const [isDeleting, setIsDeleting] = React.useState(false)\n const [reloadToken, setReloadToken] = React.useState(0)\n const [activeTab, setActiveTab] = React.useState<'notes' | 'activities'>('notes')\n const [sectionAction, setSectionAction] = React.useState<SectionAction | null>(null)\n const handleNotesLoadingChange = React.useCallback(() => {}, [])\n const handleActivitiesLoadingChange = React.useCallback(() => {}, [])\n const focusDealField = React.useCallback(\n (fieldId: 'title' | 'personIds' | 'companyIds') => {\n if (typeof window === 'undefined' || typeof document === 'undefined') return\n const focusOnce = () => {\n const container = document.querySelector<HTMLElement>(`[data-crud-field-id=\"${fieldId}\"]`)\n if (!container) return false\n const target =\n container.querySelector<HTMLElement>(CRUD_FOCUSABLE_SELECTOR) ?? container\n if (!target || typeof target.focus !== 'function') return false\n if (typeof container.scrollIntoView === 'function') {\n container.scrollIntoView({ behavior: 'smooth', block: 'center' })\n }\n target.focus()\n if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) {\n try {\n target.select()\n } catch {}\n }\n return true\n }\n\n const schedule = () => {\n const focused = focusOnce()\n if (focused) return\n window.setTimeout(() => {\n focusOnce()\n }, 60)\n }\n\n if (typeof window.requestAnimationFrame === 'function') {\n window.requestAnimationFrame(schedule)\n } else {\n schedule()\n }\n },\n [],\n )\n const dealSettingsRef = React.useRef<HTMLDivElement | null>(null)\n const scrollToDealSettings = React.useCallback(() => {\n if (typeof window === 'undefined') return\n if (dealSettingsRef.current && typeof dealSettingsRef.current.scrollIntoView === 'function') {\n dealSettingsRef.current.scrollIntoView({ behavior: 'smooth', block: 'start' })\n }\n window.setTimeout(() => {\n focusDealField('title')\n }, 160)\n }, [focusDealField])\n\n React.useEffect(() => {\n if (!id) {\n setError(t('customers.deals.detail.missingId', 'Deal id is required.'))\n setIsLoading(false)\n return\n }\n let cancelled = false\n async function loadDeal() {\n setIsLoading(true)\n setError(null)\n try {\n const payload = await readApiResultOrThrow<DealDetailPayload>(\n `/api/customers/deals/${encodeURIComponent(id)}`,\n undefined,\n { errorMessage: t('customers.deals.detail.loadError', 'Failed to load deal.') },\n )\n if (cancelled) return\n setData(payload as DealDetailPayload)\n } catch (err) {\n if (cancelled) return\n const message =\n err instanceof Error && err.message\n ? err.message\n : t('customers.deals.detail.loadError', 'Failed to load deal.')\n setError(message)\n setData(null)\n } finally {\n if (!cancelled) setIsLoading(false)\n }\n }\n loadDeal().catch(() => {})\n return () => {\n cancelled = true\n }\n }, [id, reloadToken, t])\n\n const handleFormSubmit = React.useCallback(\n async ({ base, custom }: DealFormSubmitPayload) => {\n if (!data || isSaving) return\n setIsSaving(true)\n try {\n const payload: Record<string, unknown> = {\n id: data.deal.id,\n title: base.title,\n status: base.status ?? undefined,\n pipelineStage: base.pipelineStage ?? undefined,\n pipelineId: base.pipelineId ?? undefined,\n pipelineStageId: base.pipelineStageId ?? undefined,\n valueAmount: typeof base.valueAmount === 'number' ? base.valueAmount : undefined,\n valueCurrency: base.valueCurrency ?? undefined,\n probability: typeof base.probability === 'number' ? base.probability : undefined,\n expectedCloseAt: base.expectedCloseAt ?? undefined,\n description: base.description ?? undefined,\n personIds: base.personIds && base.personIds.length ? base.personIds : undefined,\n companyIds: base.companyIds && base.companyIds.length ? base.companyIds : undefined,\n }\n if (Object.keys(custom).length) payload.customFields = custom\n\n await apiCallOrThrow(\n '/api/customers/deals',\n {\n method: 'PUT',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify(payload),\n },\n { errorMessage: t('customers.deals.detail.saveError', 'Failed to update deal.') },\n )\n flash(t('customers.deals.detail.saveSuccess', 'Deal updated.'), 'success')\n setReloadToken((token) => token + 1)\n } catch (err) {\n const message =\n err instanceof Error && err.message\n ? err.message\n : t('customers.deals.detail.saveError', 'Failed to update deal.')\n flash(message, 'error')\n throw err instanceof Error ? err : new Error(message)\n } finally {\n setIsSaving(false)\n }\n },\n [data, isSaving, t],\n )\n\n const handleDelete = React.useCallback(async () => {\n if (!data || isDeleting) return\n const confirmed = await confirm({\n title: t(\n 'customers.deals.detail.deleteConfirm',\n 'Delete this deal? This action cannot be undone.',\n ),\n variant: 'destructive',\n })\n if (!confirmed) return\n\n setIsDeleting(true)\n try {\n await apiCallOrThrow(\n '/api/customers/deals',\n {\n method: 'DELETE',\n headers: { 'content-type': 'application/json' },\n body: JSON.stringify({ id: data.deal.id }),\n },\n { errorMessage: t('customers.deals.detail.deleteError', 'Failed to delete deal.') },\n )\n flash(t('customers.deals.detail.deleteSuccess', 'Deal deleted.'), 'success')\n router.push('/backend/customers/deals')\n } catch (err) {\n const message =\n err instanceof Error && err.message\n ? err.message\n : t('customers.deals.detail.deleteError', 'Failed to delete deal.')\n flash(message, 'error')\n } finally {\n setIsDeleting(false)\n }\n }, [confirm, data, isDeleting, router, t])\n\n React.useEffect(() => {\n setSectionAction(null)\n }, [activeTab])\n\n const handleSectionAction = React.useCallback(() => {\n if (!sectionAction || sectionAction.disabled) return\n sectionAction.onClick()\n }, [sectionAction])\n\n const dealOptions = React.useMemo(\n () =>\n data\n ? [\n {\n id: data.deal.id,\n label:\n data.deal.title && data.deal.title.length\n ? data.deal.title\n : t('customers.deals.detail.untitled', 'Untitled deal'),\n },\n ]\n : [],\n [data, t],\n )\n\n const entityOptions = React.useMemo(() => {\n if (!data) return []\n const entries: { id: string; label: string }[] = []\n data.people.forEach((person) => {\n if (!person.id) return\n const suffix = person.subtitle ? ` \u00B7 ${person.subtitle}` : ''\n entries.push({ id: person.id, label: `${person.label}${suffix}` })\n })\n data.companies.forEach((company) => {\n if (!company.id) return\n const suffix = company.subtitle ? ` \u00B7 ${company.subtitle}` : ''\n entries.push({ id: company.id, label: `${company.label}${suffix}` })\n })\n return entries\n }, [data])\n\n const defaultEntityId = React.useMemo(() => {\n if (entityOptions.length) return entityOptions[0].id\n return null\n }, [entityOptions])\n\n const tabs = React.useMemo(\n () => [\n { id: 'notes' as const, label: t('customers.deals.detail.tabs.notes', 'Notes') },\n { id: 'activities' as const, label: t('customers.deals.detail.tabs.activities', 'Activities') },\n ],\n [t],\n )\n\n if (isLoading) {\n return (\n <Page>\n <PageBody>\n <div className=\"flex h-[50vh] flex-col items-center justify-center gap-2 text-muted-foreground\">\n <Spinner className=\"h-6 w-6\" />\n <span>{t('customers.deals.detail.loading', 'Loading deal\u2026')}</span>\n </div>\n </PageBody>\n </Page>\n )\n }\n\n if (error || !data) {\n return (\n <Page>\n <PageBody>\n <div className=\"flex h-[50vh] flex-col items-center justify-center gap-3 text-muted-foreground\">\n <p>{error || t('customers.deals.detail.notFound', 'Deal not found.')}</p>\n <Button variant=\"outline\" asChild>\n <Link href=\"/backend/customers/deals\">\n {t('customers.deals.detail.backToList', 'Back to deals')}\n </Link>\n </Button>\n </div>\n </PageBody>\n </Page>\n )\n }\n\n const probabilityLabel = data.deal.probability !== null && data.deal.probability !== undefined\n ? `${data.deal.probability}%`\n : t('customers.deals.detail.noValue', 'Not provided')\n const valueLabel =\n formatCurrency(data.deal.valueAmount, data.deal.valueCurrency) ??\n t('customers.deals.detail.noValue', 'Not provided')\n const expectedCloseLabel = formatDate(data.deal.expectedCloseAt, t('customers.deals.detail.noValue', 'Not provided'))\n const statusLabel =\n resolveDictionaryLabel(data.deal.status, statusDictionaryMap) ??\n t('customers.deals.detail.noStatus', 'No status')\n const statusDictEntry = data.deal.status ? statusDictionaryMap?.[data.deal.status] ?? null : null\n const pipelineLabel = resolveDictionaryLabel(data.deal.pipelineStage, pipelineDictionaryMap)\n const pipelineDictEntry = data.deal.pipelineStage ? pipelineDictionaryMap?.[data.deal.pipelineStage] ?? null : null\n\n const peopleSummaryLabel =\n data.people.length === 1\n ? t('customers.deals.detail.peopleSummaryOne')\n : t('customers.deals.detail.peopleSummaryMany', undefined, { count: data.people.length })\n const companiesSummaryLabel =\n data.companies.length === 1\n ? t('customers.deals.detail.companiesSummaryOne')\n : t('customers.deals.detail.companiesSummaryMany', undefined, { count: data.companies.length })\n\n const viewer = data.viewer ?? null\n\n return (\n <Page>\n <PageBody>\n <div className=\"flex flex-col gap-6\">\n <FormHeader\n mode=\"detail\"\n backHref=\"/backend/customers/deals\"\n backLabel={t('customers.deals.detail.backToList', 'Back to deals')}\n utilityActions={(\n <>\n <SendObjectMessageDialog\n object={{\n entityModule: 'customers',\n entityType: 'deal',\n entityId: data.deal.id,\n sourceEntityType: 'customers.deal',\n sourceEntityId: data.deal.id,\n }}\n defaultValues={{\n sourceEntityType: 'customers.deal',\n sourceEntityId: data.deal.id,\n }}\n />\n <VersionHistoryAction\n config={{ resourceKind: 'customers.deal', resourceId: data.deal.id }}\n t={t}\n />\n </>\n )}\n title={\n <div className=\"flex flex-wrap items-center gap-2\">\n <span>{data.deal.title || t('customers.deals.detail.untitled', 'Untitled deal')}</span>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n className=\"gap-1 text-muted-foreground hover:text-foreground\"\n onClick={scrollToDealSettings}\n >\n <Pencil className=\"h-4 w-4\" aria-hidden />\n <MousePointerClick className=\"h-4 w-4\" aria-hidden />\n <span>{t('customers.deals.detail.goToSettings', 'Edit deal details')}</span>\n </Button>\n </div>\n }\n subtitle={t('customers.deals.detail.summary', undefined, {\n status: statusLabel,\n pipeline: pipelineLabel ?? t('customers.deals.detail.noPipeline', 'No pipeline'),\n })}\n onDelete={handleDelete}\n isDeleting={isDeleting}\n deleteLabel={t('ui.actions.delete', 'Delete')}\n />\n <div className=\"grid gap-6 lg:grid-cols-[minmax(0,2fr),minmax(0,1.1fr)]\">\n <div className=\"space-y-6\">\n <div className=\"rounded-lg border bg-card p-4\">\n <h2 className=\"mb-4 text-sm font-semibold uppercase text-muted-foreground\">\n {t('customers.deals.detail.highlights', 'Highlights')}\n </h2>\n <div className=\"grid gap-4 sm:grid-cols-2\">\n <div>\n <p className=\"text-xs font-medium uppercase text-muted-foreground\">\n {t('customers.deals.detail.fields.value', 'Deal value')}\n </p>\n <p className=\"text-base font-semibold text-foreground\">{valueLabel}</p>\n </div>\n <div>\n <p className=\"text-xs font-medium uppercase text-muted-foreground\">\n {t('customers.deals.detail.fields.probability', 'Probability')}\n </p>\n <p className=\"text-base font-semibold text-foreground\">{probabilityLabel}</p>\n </div>\n <div>\n <p className=\"text-xs font-medium uppercase text-muted-foreground\">\n {t('customers.deals.detail.fields.status', 'Status')}\n </p>\n <p className=\"text-base text-foreground flex items-center gap-2\">\n {statusDictEntry?.color ? renderDictionaryColor(statusDictEntry.color) : null}\n {statusDictEntry?.icon ? renderDictionaryIcon(statusDictEntry.icon) : null}\n {statusLabel}\n </p>\n </div>\n <div>\n <p className=\"text-xs font-medium uppercase text-muted-foreground\">\n {t('customers.deals.detail.fields.pipeline', 'Pipeline stage')}\n </p>\n <p className=\"text-base text-foreground flex items-center gap-2\">\n {pipelineDictEntry?.color ? renderDictionaryColor(pipelineDictEntry.color) : null}\n {pipelineDictEntry?.icon ? renderDictionaryIcon(pipelineDictEntry.icon) : null}\n {pipelineLabel ?? t('customers.deals.detail.noValue', 'Not provided')}\n </p>\n </div>\n <div>\n <p className=\"text-xs font-medium uppercase text-muted-foreground\">\n {t('customers.deals.detail.fields.expectedClose', 'Expected close')}\n </p>\n <p className=\"text-base text-foreground\">{expectedCloseLabel}</p>\n </div>\n </div>\n </div>\n\n <div className=\"rounded-lg border bg-card p-4\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div className=\"flex gap-2\">\n {tabs.map((tab) => (\n <Button\n key={tab.id}\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => setActiveTab(tab.id)}\n className={`h-auto rounded-none border-b-2 px-0 py-1 ${\n activeTab === tab.id\n ? 'border-primary text-foreground'\n : 'border-transparent text-muted-foreground hover:text-foreground hover:bg-transparent'\n }`}\n >\n {tab.label}\n </Button>\n ))}\n </div>\n {sectionAction ? (\n <Button\n type=\"button\"\n size=\"sm\"\n disabled={sectionAction.disabled}\n onClick={handleSectionAction}\n >\n {sectionAction.icon ?? null}\n {sectionAction.label}\n </Button>\n ) : null}\n </div>\n {activeTab === 'notes' ? (\n <NotesSection\n entityId={null}\n dealId={data.deal.id}\n dealOptions={dealOptions}\n entityOptions={entityOptions}\n emptyLabel={t('customers.deals.detail.notesEmpty', 'No notes yet.')}\n viewerUserId={viewer?.userId ?? null}\n viewerName={viewer?.name ?? null}\n viewerEmail={viewer?.email ?? null}\n addActionLabel={t('customers.deals.detail.notesAdd', 'Add note')}\n emptyState={{\n title: t('customers.deals.detail.notesEmptyTitle', 'Keep everyone in the loop'),\n actionLabel: t('customers.deals.detail.notesEmptyAction', 'Add a note'),\n }}\n onActionChange={setSectionAction}\n translator={detailTranslator}\n onLoadingChange={handleNotesLoadingChange}\n dataAdapter={notesAdapter}\n renderIcon={renderDictionaryIcon}\n renderColor={renderDictionaryColor}\n iconSuggestions={ICON_SUGGESTIONS}\n readMarkdownPreference={readMarkdownPreferenceCookie}\n writeMarkdownPreference={writeMarkdownPreferenceCookie}\n />\n ) : null}\n {activeTab === 'activities' ? (\n <ActivitiesSection\n entityId={null}\n dealId={data.deal.id}\n dealOptions={dealOptions}\n entityOptions={entityOptions}\n defaultEntityId={defaultEntityId ?? undefined}\n addActionLabel={t('customers.deals.detail.activitiesAdd', 'Log activity')}\n emptyState={{\n title: t('customers.deals.detail.activitiesEmptyTitle', 'No activities yet'),\n actionLabel: t('customers.deals.detail.activitiesEmptyAction', 'Add an activity'),\n }}\n onActionChange={setSectionAction}\n onLoadingChange={handleActivitiesLoadingChange}\n />\n ) : null}\n </div>\n\n <div className=\"grid gap-4 md:grid-cols-2\">\n <div className=\"rounded-lg border bg-card p-4\">\n <div className=\"mb-3 space-y-1\">\n <h3 className=\"text-sm font-semibold text-foreground\">\n {t('customers.deals.detail.peopleSection', 'People')}\n </h3>\n <p className=\"text-xs text-muted-foreground\">\n {peopleSummaryLabel}\n </p>\n </div>\n {data.people.length ? (\n <ul className=\"space-y-2 text-sm\">\n {data.people.map((person) => (\n <li key={person.id} className=\"flex flex-col gap-1\">\n <Link href={`/backend/customers/people/${encodeURIComponent(person.id)}`} className=\"font-medium text-foreground hover:underline\">\n {person.label}\n </Link>\n <span className=\"text-xs text-muted-foreground\">\n {person.subtitle ?? t('customers.deals.detail.peopleNoDetails', 'No additional details')}\n </span>\n </li>\n ))}\n </ul>\n ) : (\n <p className=\"text-sm text-muted-foreground\">\n {t('customers.deals.detail.noPeople', 'No people linked to this deal yet.')}\n </p>\n )}\n </div>\n <div className=\"rounded-lg border bg-card p-4\">\n <div className=\"mb-3 space-y-1\">\n <h3 className=\"text-sm font-semibold text-foreground\">\n {t('customers.deals.detail.companiesSection', 'Companies')}\n </h3>\n <p className=\"text-xs text-muted-foreground\">\n {companiesSummaryLabel}\n </p>\n </div>\n {data.companies.length ? (\n <ul className=\"space-y-2 text-sm\">\n {data.companies.map((company) => (\n <li key={company.id} className=\"flex flex-col gap-1\">\n <Link href={`/backend/customers/companies/${encodeURIComponent(company.id)}`} className=\"font-medium text-foreground hover:underline\">\n {company.label}\n </Link>\n <span className=\"text-xs text-muted-foreground\">\n {company.subtitle ?? t('customers.deals.detail.companiesNoDetails', 'No additional details')}\n </span>\n </li>\n ))}\n </ul>\n ) : (\n <p className=\"text-sm text-muted-foreground\">\n {t('customers.deals.detail.noCompanies', 'No companies linked to this deal yet.')}\n </p>\n )}\n </div>\n </div>\n </div>\n\n <div className=\"space-y-6\">\n <div\n ref={dealSettingsRef}\n id=\"deal-settings\"\n className=\"rounded-lg border bg-card p-4\"\n >\n <h2 className=\"mb-4 text-sm font-semibold uppercase text-muted-foreground\">\n {t('customers.deals.detail.formTitle', 'Deal settings')}\n </h2>\n <DealForm\n key={data.deal.updatedAt}\n mode=\"edit\"\n initialValues={{\n id: data.deal.id,\n title: data.deal.title ?? '',\n status: data.deal.status ?? '',\n pipelineStage: data.deal.pipelineStage ?? '',\n pipelineId: data.deal.pipelineId ?? '',\n pipelineStageId: data.deal.pipelineStageId ?? '',\n valueAmount: data.deal.valueAmount ? Number(data.deal.valueAmount) : null,\n valueCurrency: data.deal.valueCurrency ?? undefined,\n probability: data.deal.probability ?? null,\n expectedCloseAt: data.deal.expectedCloseAt ?? null,\n description: data.deal.description ?? '',\n personIds: data.people.map((person) => person.id),\n companyIds: data.companies.map((company) => company.id),\n people: data.people.map((person) => ({ id: person.id, label: person.label })),\n companies: data.companies.map((company) => ({ id: company.id, label: company.label })),\n ...Object.fromEntries(\n Object.entries(data.customFields)\n .filter(([key]) => key.startsWith('cf_'))\n .map(([key, value]) => [key, value]),\n ),\n }}\n onSubmit={handleFormSubmit}\n onCancel={() => setReloadToken((token) => token + 1)}\n onDelete={handleDelete}\n isSubmitting={isSaving || isDeleting}\n />\n </div>\n </div>\n </div>\n </div>\n </PageBody>\n {ConfirmDialogElement}\n </Page>\n )\n}\n"],
5
+ "mappings": ";AAuVU,SA4DI,UA3DF,KADF;AArVV,YAAY,WAAW;AACvB,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,QAAQ,yBAAyB;AAC1C,SAAS,MAAM,gBAAgB;AAC/B,SAAS,cAAc;AACvB,SAAS,kBAAkB;AAC3B,SAAS,4BAA4B;AACrC,SAAS,+BAA+B;AACxC,SAAS,eAAe;AACxB,SAAS,aAAa;AACtB,SAAS,gBAAgB,4BAA4B;AACrD,SAAS,YAAY;AACrB,SAAS,mCAAmC;AAC5C,SAAS,wBAAwB;AACjC,SAAS,oBAAwC;AACjD,SAAS,yBAAyB;AAClC,SAAS,gBAA4C;AACrD,SAAS,6BAA6B;AAEtC,SAAS,oCAAoC;AAC7C,SAAS,uBAAuB,4BAA4B;AAC5D,SAAS,wBAAwB;AACjC,SAAS,kCAAkC;AAC3C,SAAS,8BAA8B,qCAAqC;AAuC5E,MAAM,0BACJ;AAEF,SAAS,eAAe,QAAuB,UAAwC;AACrF,MAAI,CAAC,OAAQ,QAAO;AACpB,QAAM,QAAQ,OAAO,MAAM;AAC3B,MAAI,CAAC,OAAO,SAAS,KAAK,EAAG,QAAO,WAAW,GAAG,MAAM,IAAI,QAAQ,KAAK;AACzE,MAAI,CAAC,SAAU,QAAO,MAAM,eAAe;AAC3C,MAAI;AACF,WAAO,IAAI,KAAK,aAA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,GAAG,MAAM,IAAI,WAAW,KAAK,CAAC,EACvC,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,KAAK,CAAC;AAAA,oBACvC;AAAA,kBACF;AAAA,kBACA,UAAU;AAAA,kBACV,UAAU,MAAM,eAAe,CAAC,UAAU,QAAQ,CAAC;AAAA,kBACnD,UAAU;AAAA,kBACV,cAAc,YAAY;AAAA;AAAA,gBA3BrB,KAAK,KAAK;AAAA,cA4BjB;AAAA;AAAA;AAAA,QACF,GACF;AAAA,SACF;AAAA,OACF,GACF;AAAA,IACC;AAAA,KACH;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -355,6 +355,7 @@ function CustomersDealsPage() {
355
355
  "deal-statuses": {},
356
356
  "pipeline-stages": {}
357
357
  });
358
+ const [pipelineNames, setPipelineNames] = React.useState({});
358
359
  const fetchDictionaryEntries = React.useCallback(
359
360
  async (kind) => {
360
361
  try {
@@ -378,6 +379,27 @@ function CustomersDealsPage() {
378
379
  cancelled = true;
379
380
  };
380
381
  }, [fetchDictionaryEntries, reloadToken]);
382
+ React.useEffect(() => {
383
+ let cancelled = false;
384
+ async function loadPipelines() {
385
+ try {
386
+ const call = await apiCall("/api/customers/pipelines");
387
+ if (cancelled || !call.ok) return;
388
+ const items = Array.isArray(call.result?.items) ? call.result.items : [];
389
+ const map = {};
390
+ items.forEach((p) => {
391
+ if (p.id && p.name) map[p.id] = p.name;
392
+ });
393
+ setPipelineNames(map);
394
+ } catch {
395
+ }
396
+ }
397
+ loadPipelines().catch(() => {
398
+ });
399
+ return () => {
400
+ cancelled = true;
401
+ };
402
+ }, [reloadToken, scopeVersion]);
381
403
  React.useEffect(() => {
382
404
  peopleCacheRef.current.clear();
383
405
  companiesCacheRef.current.clear();
@@ -674,6 +696,14 @@ function CustomersDealsPage() {
674
696
  header: t("customers.deals.list.columns.pipelineStage"),
675
697
  cell: ({ row }) => renderDictionaryCell("pipeline-stages", row.original.pipelineStage)
676
698
  },
699
+ {
700
+ accessorKey: "pipelineId",
701
+ header: t("customers.deals.list.columns.pipeline", "Pipeline"),
702
+ cell: ({ row }) => {
703
+ const name = row.original.pipelineId ? pipelineNames[row.original.pipelineId] : null;
704
+ return name ? /* @__PURE__ */ jsx("span", { className: "text-sm", children: name }) : noValue;
705
+ }
706
+ },
677
707
  {
678
708
  accessorKey: "valueAmount",
679
709
  header: t("customers.deals.list.columns.value"),
@@ -712,7 +742,7 @@ function CustomersDealsPage() {
712
742
  },
713
743
  ...customColumns
714
744
  ];
715
- }, [customFieldDefs, dictionaryMaps, t]);
745
+ }, [customFieldDefs, dictionaryMaps, pipelineNames, t]);
716
746
  return /* @__PURE__ */ jsxs(Page, { children: [
717
747
  /* @__PURE__ */ jsx(PageBody, { children: /* @__PURE__ */ jsx(
718
748
  DataTable,
@@ -790,6 +820,8 @@ function mapDeal(item) {
790
820
  const title = typeof item.title === "string" ? item.title : "";
791
821
  const status = typeof item.status === "string" ? item.status : null;
792
822
  const pipelineStage = typeof item.pipeline_stage === "string" ? item.pipeline_stage : null;
823
+ const pipelineStageId = typeof item.pipeline_stage_id === "string" ? item.pipeline_stage_id : null;
824
+ const pipelineId = typeof item.pipeline_id === "string" ? item.pipeline_id : null;
793
825
  const valueAmountRaw = item.value_amount;
794
826
  const valueAmount = typeof valueAmountRaw === "number" ? valueAmountRaw : typeof valueAmountRaw === "string" && valueAmountRaw.trim() ? Number(valueAmountRaw) : null;
795
827
  const valueCurrency = typeof item.value_currency === "string" && item.value_currency.trim().length ? item.value_currency.trim().toUpperCase() : null;
@@ -824,6 +856,8 @@ function mapDeal(item) {
824
856
  title,
825
857
  status,
826
858
  pipelineStage,
859
+ pipelineStageId,
860
+ pipelineId,
827
861
  valueAmount,
828
862
  valueCurrency,
829
863
  probability,