@open-mercato/core 0.6.7-develop.6725.1.07a748cfc2 → 0.6.7-develop.6726.1.983ae8a07e

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-mercato/core",
3
- "version": "0.6.7-develop.6725.1.07a748cfc2",
3
+ "version": "0.6.7-develop.6726.1.983ae8a07e",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -254,16 +254,16 @@
254
254
  "zod": "^4.4.3"
255
255
  },
256
256
  "peerDependencies": {
257
- "@open-mercato/ai-assistant": "0.6.7-develop.6725.1.07a748cfc2",
258
- "@open-mercato/shared": "0.6.7-develop.6725.1.07a748cfc2",
259
- "@open-mercato/ui": "0.6.7-develop.6725.1.07a748cfc2",
257
+ "@open-mercato/ai-assistant": "0.6.7-develop.6726.1.983ae8a07e",
258
+ "@open-mercato/shared": "0.6.7-develop.6726.1.983ae8a07e",
259
+ "@open-mercato/ui": "0.6.7-develop.6726.1.983ae8a07e",
260
260
  "react": "^19.0.0",
261
261
  "react-dom": "^19.0.0"
262
262
  },
263
263
  "devDependencies": {
264
- "@open-mercato/ai-assistant": "0.6.7-develop.6725.1.07a748cfc2",
265
- "@open-mercato/shared": "0.6.7-develop.6725.1.07a748cfc2",
266
- "@open-mercato/ui": "0.6.7-develop.6725.1.07a748cfc2",
264
+ "@open-mercato/ai-assistant": "0.6.7-develop.6726.1.983ae8a07e",
265
+ "@open-mercato/shared": "0.6.7-develop.6726.1.983ae8a07e",
266
+ "@open-mercato/ui": "0.6.7-develop.6726.1.983ae8a07e",
267
267
  "@testing-library/dom": "^10.4.1",
268
268
  "@testing-library/jest-dom": "^6.9.1",
269
269
  "@testing-library/react": "^16.3.1",
@@ -18,6 +18,7 @@ import { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuarde
18
18
  import { flash } from '@open-mercato/ui/backend/FlashMessages'
19
19
  import { useT } from '@open-mercato/shared/lib/i18n/context'
20
20
  import { translateWithFallback } from '@open-mercato/shared/lib/i18n/translate'
21
+ import { registerComponent } from '@open-mercato/shared/modules/widgets/component-registry'
21
22
 
22
23
  // Deal status values written by the kanban flow. These intentionally do NOT include 'closed'
23
24
  // because the rest of the app only persists 'loose' for lost deals (see StatusFilterPopover
@@ -56,7 +57,18 @@ export type QuickDealCompanyOption = {
56
57
  label: string
57
58
  }
58
59
 
59
- type QuickDealDialogProps = {
60
+ /**
61
+ * Registered component id for the kanban quick-add dialog. Downstream apps can
62
+ * target it from `widgets/components.ts` to replace/wrap the dialog or to
63
+ * transform its props — e.g. `defaultProbability: null` so quick-create stops
64
+ * seeding a probability that overrides pipeline automation (#4329).
65
+ */
66
+ export const QUICK_DEAL_DIALOG_COMPONENT_ID = 'dialog:customers.deals.quickDeal'
67
+
68
+ /** Probability seeded into the quick-add form when the host passes no override. */
69
+ export const DEFAULT_QUICK_DEAL_PROBABILITY = 25
70
+
71
+ export type QuickDealDialogProps = {
60
72
  open: boolean
61
73
  context: QuickDealContext | null
62
74
  onClose: () => void
@@ -64,6 +76,13 @@ type QuickDealDialogProps = {
64
76
  currentUserId?: string
65
77
  currentUserLabel?: string
66
78
  companies?: QuickDealCompanyOption[]
79
+ /**
80
+ * Probability pre-filled in the collapsed "More details" group. `null` leaves
81
+ * the field empty, so quick-create sends no `probability` at all and whatever
82
+ * the pipeline/automation derives for the target stage stands. Defaults to
83
+ * `DEFAULT_QUICK_DEAL_PROBABILITY` to preserve the historic behavior.
84
+ */
85
+ defaultProbability?: number | null
67
86
  /**
68
87
  * Tenant currency list. When omitted (e.g. dictionary not yet loaded), we render a
69
88
  * conservative fallback so the dialog still works end-to-end. The default selection is
@@ -94,6 +113,7 @@ export function QuickDealDialog({
94
113
  currentUserLabel,
95
114
  companies = [],
96
115
  currencies,
116
+ defaultProbability = DEFAULT_QUICK_DEAL_PROBABILITY,
97
117
  }: QuickDealDialogProps): React.ReactElement | null {
98
118
  const t = useT()
99
119
  // Re-mount CrudForm whenever the dialog opens so cleared state is consistently fresh.
@@ -157,11 +177,11 @@ export function QuickDealDialog({
157
177
  valueCurrency: defaultCurrencyCode,
158
178
  companyId: '',
159
179
  status: 'open',
160
- probability: 25,
180
+ probability: defaultProbability,
161
181
  expectedCloseAt: '',
162
182
  description: '',
163
183
  }),
164
- [defaultCurrencyCode],
184
+ [defaultCurrencyCode, defaultProbability],
165
185
  )
166
186
 
167
187
  const fields = React.useMemo<CrudField[]>(
@@ -405,4 +425,16 @@ export function QuickDealDialog({
405
425
  )
406
426
  }
407
427
 
428
+ // Register so downstream apps can reach the dialog from `widgets/components.ts`
429
+ // (replace / wrap / propsTransform) instead of forking the whole kanban page
430
+ // just to change a default (#4329).
431
+ registerComponent<QuickDealDialogProps>({
432
+ id: QUICK_DEAL_DIALOG_COMPONENT_ID,
433
+ component: QuickDealDialog,
434
+ metadata: {
435
+ module: 'customers',
436
+ description: 'Kanban quick-add deal dialog (pipeline board "+ deal").',
437
+ },
438
+ })
439
+
408
440
  export default QuickDealDialog
@@ -64,9 +64,11 @@ import { CurrencyFilterPopover } from './components/CurrencyFilterPopover'
64
64
  import { AddStageLane } from './components/AddStageLane'
65
65
  import type { DealCardData } from './components/DealCard'
66
66
  import {
67
- QuickDealDialog,
67
+ QuickDealDialog as DefaultQuickDealDialog,
68
+ QUICK_DEAL_DIALOG_COMPONENT_ID,
68
69
  type QuickDealContext,
69
70
  type QuickDealCompanyOption,
71
+ type QuickDealDialogProps,
70
72
  } from './components/QuickDealDialog'
71
73
  import { AddStageDialog, type AddStageContext } from './components/AddStageDialog'
72
74
  import { StatusFilterPopover } from './components/StatusFilterPopover'
@@ -80,6 +82,7 @@ import {
80
82
  type ActivityComposerContext,
81
83
  } from './components/ActivityComposerDialog'
82
84
  import { BulkActionsBar } from './components/BulkActionsBar'
85
+ import { useRegisteredComponent } from '@open-mercato/ui/backend/injection/useRegisteredComponent'
83
86
  import { ChangeStageDialog } from './components/ChangeStageDialog'
84
87
  import { ChangeOwnerDialog } from './components/ChangeOwnerDialog'
85
88
  import { buildCrudExportUrl, deleteCrud } from '@open-mercato/ui/backend/utils/crud'
@@ -410,6 +413,12 @@ function sortDeals(deals: DealCardData[], option: SortOption): DealCardData[] {
410
413
 
411
414
  export default function DealsKanbanPage(): React.ReactElement {
412
415
  const t = useT()
416
+ // Resolved through the component registry so downstream apps can replace,
417
+ // wrap, or props-transform the quick-add dialog without forking this page.
418
+ const QuickDealDialog = useRegisteredComponent<QuickDealDialogProps>(
419
+ QUICK_DEAL_DIALOG_COMPONENT_ID,
420
+ DefaultQuickDealDialog,
421
+ )
413
422
  const router = useRouter()
414
423
  const scopeVersion = useOrganizationScopeVersion()
415
424
  const queryClient = useQueryClient()