@open-mercato/core 0.6.7-develop.6828.1.ab1620a63e → 0.6.7-develop.6834.1.e76f4b8cbc

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 (132) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/modules/attachments/fields/attachment.js +1 -1
  3. package/dist/modules/attachments/fields/attachment.js.map +2 -2
  4. package/dist/modules/auth/components/UserConsentsPanel.js +9 -9
  5. package/dist/modules/auth/components/UserConsentsPanel.js.map +2 -2
  6. package/dist/modules/auth/frontend/reset.js +2 -2
  7. package/dist/modules/auth/frontend/reset.js.map +2 -2
  8. package/dist/modules/business_rules/components/ActionRow.js +1 -1
  9. package/dist/modules/business_rules/components/ActionRow.js.map +1 -1
  10. package/dist/modules/business_rules/components/ConditionRow.js +8 -4
  11. package/dist/modules/business_rules/components/ConditionRow.js.map +2 -2
  12. package/dist/modules/catalog/backend/catalog/products/[id]/page.js +4 -4
  13. package/dist/modules/catalog/backend/catalog/products/[id]/page.js.map +2 -2
  14. package/dist/modules/catalog/backend/catalog/products/create/page.js +5 -5
  15. package/dist/modules/catalog/backend/catalog/products/create/page.js.map +2 -2
  16. package/dist/modules/catalog/components/PriceKindSettings.js +3 -3
  17. package/dist/modules/catalog/components/PriceKindSettings.js.map +2 -2
  18. package/dist/modules/catalog/components/products/ProductCategorizeSection.js +3 -3
  19. package/dist/modules/catalog/components/products/ProductCategorizeSection.js.map +2 -2
  20. package/dist/modules/catalog/components/products/ProductMediaManager.js +1 -1
  21. package/dist/modules/catalog/components/products/ProductMediaManager.js.map +2 -2
  22. package/dist/modules/catalog/components/products/VariantBuilder.js +5 -5
  23. package/dist/modules/catalog/components/products/VariantBuilder.js.map +2 -2
  24. package/dist/modules/communication_channels/backend/profile/communication-channels/page.js +1 -1
  25. package/dist/modules/communication_channels/backend/profile/communication-channels/page.js.map +2 -2
  26. package/dist/modules/customers/components/detail/ConfirmDealLostDialog.js +1 -1
  27. package/dist/modules/customers/components/detail/ConfirmDealLostDialog.js.map +1 -1
  28. package/dist/modules/dashboards/api/widgets/data/schema.js +26 -17
  29. package/dist/modules/dashboards/api/widgets/data/schema.js.map +2 -2
  30. package/dist/modules/design_system/gallery/entries/detail.js +8 -8
  31. package/dist/modules/design_system/gallery/entries/detail.js.map +1 -1
  32. package/dist/modules/design_system/gallery/entries/overlays.js +2 -2
  33. package/dist/modules/design_system/gallery/entries/overlays.js.map +2 -2
  34. package/dist/modules/design_system/gallery/entries/scaffolding.js +8 -8
  35. package/dist/modules/design_system/gallery/entries/scaffolding.js.map +1 -1
  36. package/dist/modules/dictionaries/components/DictionaryEntrySelect.js +1 -1
  37. package/dist/modules/dictionaries/components/DictionaryEntrySelect.js.map +2 -2
  38. package/dist/modules/inbox_ops/backend/inbox-ops/log/page.js +6 -6
  39. package/dist/modules/inbox_ops/backend/inbox-ops/log/page.js.map +2 -2
  40. package/dist/modules/inbox_ops/components/proposals/EditActionDialog.js +3 -3
  41. package/dist/modules/inbox_ops/components/proposals/EditActionDialog.js.map +2 -2
  42. package/dist/modules/messages/components/message-detail/panels/dialogs.js +1 -1
  43. package/dist/modules/messages/components/message-detail/panels/dialogs.js.map +1 -1
  44. package/dist/modules/planner/components/AvailabilityRulesEditor.js +4 -4
  45. package/dist/modules/planner/components/AvailabilityRulesEditor.js.map +2 -2
  46. package/dist/modules/shipping_carriers/lib/shipment-wizard/components/PackageEditor.js +1 -1
  47. package/dist/modules/shipping_carriers/lib/shipment-wizard/components/PackageEditor.js.map +1 -1
  48. package/dist/modules/wms/components/backend/ReleaseReservationDialog.js +1 -1
  49. package/dist/modules/wms/components/backend/ReleaseReservationDialog.js.map +1 -1
  50. package/dist/modules/workflows/backend/definitions/page.js +1 -1
  51. package/dist/modules/workflows/backend/definitions/page.js.map +2 -2
  52. package/dist/modules/workflows/backend/definitions/visual-editor/page.js +1 -1
  53. package/dist/modules/workflows/backend/definitions/visual-editor/page.js.map +2 -2
  54. package/dist/modules/workflows/backend/instances/page.js +8 -8
  55. package/dist/modules/workflows/backend/instances/page.js.map +2 -2
  56. package/dist/modules/workflows/backend/tasks/page.js +6 -6
  57. package/dist/modules/workflows/backend/tasks/page.js.map +2 -2
  58. package/dist/modules/workflows/components/ActivitiesEditor.js +2 -2
  59. package/dist/modules/workflows/components/ActivitiesEditor.js.map +2 -2
  60. package/dist/modules/workflows/components/BusinessRulesSelector.js +1 -1
  61. package/dist/modules/workflows/components/BusinessRulesSelector.js.map +2 -2
  62. package/dist/modules/workflows/components/DefinitionTriggersEditor.js +2 -2
  63. package/dist/modules/workflows/components/DefinitionTriggersEditor.js.map +2 -2
  64. package/dist/modules/workflows/components/EdgeEditDialogCrudForm.js +1 -2
  65. package/dist/modules/workflows/components/EdgeEditDialogCrudForm.js.map +2 -2
  66. package/dist/modules/workflows/components/NodeEditDialogCrudForm.js +1 -2
  67. package/dist/modules/workflows/components/NodeEditDialogCrudForm.js.map +2 -2
  68. package/dist/modules/workflows/components/StepsEditor.js +2 -2
  69. package/dist/modules/workflows/components/StepsEditor.js.map +2 -2
  70. package/dist/modules/workflows/components/TransitionsEditor.js +3 -3
  71. package/dist/modules/workflows/components/TransitionsEditor.js.map +2 -2
  72. package/dist/modules/workflows/components/WorkflowLegend.js +1 -1
  73. package/dist/modules/workflows/components/WorkflowLegend.js.map +2 -2
  74. package/dist/modules/workflows/components/WorkflowSelector.js +1 -1
  75. package/dist/modules/workflows/components/WorkflowSelector.js.map +2 -2
  76. package/dist/modules/workflows/components/fields/BusinessRuleConditionsEditor.js +1 -1
  77. package/dist/modules/workflows/components/fields/BusinessRuleConditionsEditor.js.map +2 -2
  78. package/dist/modules/workflows/components/fields/FormFieldArrayEditor.js +1 -1
  79. package/dist/modules/workflows/components/fields/FormFieldArrayEditor.js.map +2 -2
  80. package/dist/modules/workflows/components/fields/MappingArrayEditor.js +1 -1
  81. package/dist/modules/workflows/components/fields/MappingArrayEditor.js.map +2 -2
  82. package/dist/modules/workflows/components/fields/StartPreConditionsEditor.js +1 -1
  83. package/dist/modules/workflows/components/fields/StartPreConditionsEditor.js.map +2 -2
  84. package/dist/modules/workflows/components/fields/WorkflowSelectorField.js +4 -4
  85. package/dist/modules/workflows/components/fields/WorkflowSelectorField.js.map +2 -2
  86. package/package.json +7 -7
  87. package/src/modules/attachments/fields/attachment.tsx +1 -1
  88. package/src/modules/auth/components/UserConsentsPanel.tsx +9 -9
  89. package/src/modules/auth/frontend/reset.tsx +2 -2
  90. package/src/modules/business_rules/components/ActionRow.tsx +1 -1
  91. package/src/modules/business_rules/components/ConditionRow.tsx +9 -6
  92. package/src/modules/catalog/backend/catalog/products/[id]/page.tsx +4 -4
  93. package/src/modules/catalog/backend/catalog/products/create/page.tsx +5 -5
  94. package/src/modules/catalog/components/PriceKindSettings.tsx +3 -3
  95. package/src/modules/catalog/components/products/ProductCategorizeSection.tsx +3 -3
  96. package/src/modules/catalog/components/products/ProductMediaManager.tsx +1 -1
  97. package/src/modules/catalog/components/products/VariantBuilder.tsx +5 -5
  98. package/src/modules/communication_channels/backend/profile/communication-channels/page.tsx +1 -1
  99. package/src/modules/customers/components/detail/ConfirmDealLostDialog.tsx +1 -1
  100. package/src/modules/dashboards/api/widgets/data/schema.ts +48 -19
  101. package/src/modules/design_system/gallery/entries/detail.tsx +8 -8
  102. package/src/modules/design_system/gallery/entries/overlays.tsx +2 -2
  103. package/src/modules/design_system/gallery/entries/scaffolding.tsx +8 -8
  104. package/src/modules/design_system/i18n/de.json +12 -0
  105. package/src/modules/design_system/i18n/en.json +12 -0
  106. package/src/modules/design_system/i18n/es.json +12 -0
  107. package/src/modules/design_system/i18n/pl.json +12 -0
  108. package/src/modules/dictionaries/components/DictionaryEntrySelect.tsx +1 -1
  109. package/src/modules/inbox_ops/backend/inbox-ops/log/page.tsx +6 -6
  110. package/src/modules/inbox_ops/components/proposals/EditActionDialog.tsx +3 -3
  111. package/src/modules/messages/components/message-detail/panels/dialogs.tsx +1 -1
  112. package/src/modules/planner/components/AvailabilityRulesEditor.tsx +4 -4
  113. package/src/modules/shipping_carriers/lib/shipment-wizard/components/PackageEditor.tsx +1 -1
  114. package/src/modules/wms/components/backend/ReleaseReservationDialog.tsx +1 -1
  115. package/src/modules/workflows/backend/definitions/page.tsx +1 -1
  116. package/src/modules/workflows/backend/definitions/visual-editor/page.tsx +1 -1
  117. package/src/modules/workflows/backend/instances/page.tsx +8 -8
  118. package/src/modules/workflows/backend/tasks/page.tsx +6 -6
  119. package/src/modules/workflows/components/ActivitiesEditor.tsx +2 -2
  120. package/src/modules/workflows/components/BusinessRulesSelector.tsx +1 -1
  121. package/src/modules/workflows/components/DefinitionTriggersEditor.tsx +2 -2
  122. package/src/modules/workflows/components/EdgeEditDialogCrudForm.tsx +1 -2
  123. package/src/modules/workflows/components/NodeEditDialogCrudForm.tsx +1 -2
  124. package/src/modules/workflows/components/StepsEditor.tsx +2 -2
  125. package/src/modules/workflows/components/TransitionsEditor.tsx +3 -3
  126. package/src/modules/workflows/components/WorkflowLegend.tsx +1 -1
  127. package/src/modules/workflows/components/WorkflowSelector.tsx +1 -1
  128. package/src/modules/workflows/components/fields/BusinessRuleConditionsEditor.tsx +1 -1
  129. package/src/modules/workflows/components/fields/FormFieldArrayEditor.tsx +1 -1
  130. package/src/modules/workflows/components/fields/MappingArrayEditor.tsx +1 -1
  131. package/src/modules/workflows/components/fields/StartPreConditionsEditor.tsx +1 -1
  132. package/src/modules/workflows/components/fields/WorkflowSelectorField.tsx +4 -4
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/modules/workflows/components/WorkflowLegend.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport { Check, Play, Pause, Circle } from 'lucide-react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\n\nexport function WorkflowLegend() {\n const t = useT()\n\n return (\n <div className=\"space-y-6\">\n <div>\n <h3 className=\"text-xs font-semibold text-foreground mb-3\">\n {t('workflows.legend.statusTitle')}\n </h3>\n <div className=\"space-y-2\">\n <div className=\"flex items-center gap-2\">\n <div className=\"flex-shrink-0 w-4 h-4 rounded-full bg-emerald-100 flex items-center justify-center\">\n <Check className=\"w-3 h-3 text-emerald-600\" />\n </div>\n <span className=\"text-xs text-muted-foreground\">{t('workflows.legend.status.completed')}</span>\n </div>\n <div className=\"flex items-center gap-2\">\n <div className=\"flex-shrink-0 w-4 h-4 rounded-full bg-blue-100 flex items-center justify-center\">\n <Play className=\"w-3 h-3 text-blue-600\" />\n </div>\n <span className=\"text-xs text-muted-foreground\">{t('workflows.legend.status.inProgress')}</span>\n </div>\n <div className=\"flex items-center gap-2\">\n <div className=\"flex-shrink-0 w-4 h-4 rounded-full bg-yellow-100 flex items-center justify-center\">\n <Pause className=\"w-3 h-3 text-yellow-600\" />\n </div>\n <span className=\"text-xs text-muted-foreground\">{t('workflows.legend.status.pending')}</span>\n </div>\n <div className=\"flex items-center gap-2\">\n <div className=\"flex-shrink-0 w-4 h-4 rounded-full bg-muted flex items-center justify-center\">\n <Circle className=\"w-3 h-3 text-muted-foreground\" />\n </div>\n <span className=\"text-xs text-muted-foreground\">{t('workflows.legend.status.notStarted')}</span>\n </div>\n </div>\n </div>\n\n <div>\n <h3 className=\"text-xs font-semibold text-foreground mb-3\">\n {t('workflows.legend.edgeStatesTitle')}\n </h3>\n <div className=\"space-y-2\">\n <div className=\"flex items-center gap-2\">\n <div className=\"flex-shrink-0 w-8 h-0.5 bg-emerald-500\"></div>\n <span className=\"text-xs text-muted-foreground\">{t('workflows.legend.edgeState.completed')}</span>\n </div>\n <div className=\"flex items-center gap-2\">\n <div className=\"flex-shrink-0 w-8 h-0.5 bg-muted-foreground\" style={{ backgroundImage: 'repeating-linear-gradient(to right, currentColor 0, currentColor 4px, transparent 4px, transparent 8px)' }}></div>\n <span className=\"text-xs text-muted-foreground\">{t('workflows.legend.edgeState.pending')}</span>\n </div>\n </div>\n </div>\n </div>\n )\n}\n"],
5
- "mappings": ";AAWQ,cAIE,YAJF;AATR,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AAAA,8BAAC,SAAI,WAAU,+CAA8C,OAAO,EAAE,iBAAiB,0GAA0G,GAAG;AAAA,UACpM,oBAAC,UAAK,WAAU,iCAAiC,YAAE,oCAAoC,GAAE;AAAA,WAC3F;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAEJ;",
4
+ "sourcesContent": ["'use client'\n\nimport { Check, Play, Pause, Circle } from 'lucide-react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\n\nexport function WorkflowLegend() {\n const t = useT()\n\n return (\n <div className=\"space-y-6\">\n <div>\n <h3 className=\"text-xs font-semibold text-foreground mb-3\">\n {t('workflows.legend.statusTitle')}\n </h3>\n <div className=\"space-y-2\">\n <div className=\"flex items-center gap-2\">\n <div className=\"flex-shrink-0 w-4 h-4 rounded-full bg-emerald-100 flex items-center justify-center\">\n <Check className=\"w-3 h-3 text-emerald-600\" />\n </div>\n <span className=\"text-xs text-muted-foreground\">{t('workflows.legend.status.completed')}</span>\n </div>\n <div className=\"flex items-center gap-2\">\n <div className=\"flex-shrink-0 w-4 h-4 rounded-full bg-blue-100 flex items-center justify-center\">\n <Play className=\"w-3 h-3 text-blue-600\" />\n </div>\n <span className=\"text-xs text-muted-foreground\">{t('workflows.legend.status.inProgress')}</span>\n </div>\n <div className=\"flex items-center gap-2\">\n <div className=\"flex-shrink-0 w-4 h-4 rounded-full bg-yellow-100 flex items-center justify-center\">\n <Pause className=\"w-3 h-3 text-yellow-600\" />\n </div>\n <span className=\"text-xs text-muted-foreground\">{t('workflows.legend.status.pending')}</span>\n </div>\n <div className=\"flex items-center gap-2\">\n <div className=\"flex-shrink-0 w-4 h-4 rounded-full bg-muted flex items-center justify-center\">\n <Circle className=\"w-3 h-3 text-muted-foreground\" />\n </div>\n <span className=\"text-xs text-muted-foreground\">{t('workflows.legend.status.notStarted')}</span>\n </div>\n </div>\n </div>\n\n <div>\n <h3 className=\"text-xs font-semibold text-foreground mb-3\">\n {t('workflows.legend.edgeStatesTitle')}\n </h3>\n <div className=\"space-y-2\">\n <div className=\"flex items-center gap-2\">\n <div className=\"flex-shrink-0 w-8 h-0.5 bg-status-success-solid\"></div>\n <span className=\"text-xs text-muted-foreground\">{t('workflows.legend.edgeState.completed')}</span>\n </div>\n <div className=\"flex items-center gap-2\">\n <div className=\"flex-shrink-0 w-8 h-0.5 bg-muted-foreground\" style={{ backgroundImage: 'repeating-linear-gradient(to right, currentColor 0, currentColor 4px, transparent 4px, transparent 8px)' }}></div>\n <span className=\"text-xs text-muted-foreground\">{t('workflows.legend.edgeState.pending')}</span>\n </div>\n </div>\n </div>\n </div>\n )\n}\n"],
5
+ "mappings": ";AAWQ,cAIE,YAJF;AATR,SAAS,OAAO,MAAM,OAAO,cAAc;AAC3C,SAAS,YAAY;AAEd,SAAS,iBAAiB;AAC/B,QAAM,IAAI,KAAK;AAEf,SACE,qBAAC,SAAI,WAAU,aACb;AAAA,yBAAC,SACC;AAAA,0BAAC,QAAG,WAAU,8CACX,YAAE,8BAA8B,GACnC;AAAA,MACA,qBAAC,SAAI,WAAU,aACb;AAAA,6BAAC,SAAI,WAAU,2BACb;AAAA,8BAAC,SAAI,WAAU,sFACb,8BAAC,SAAM,WAAU,4BAA2B,GAC9C;AAAA,UACA,oBAAC,UAAK,WAAU,iCAAiC,YAAE,mCAAmC,GAAE;AAAA,WAC1F;AAAA,QACA,qBAAC,SAAI,WAAU,2BACb;AAAA,8BAAC,SAAI,WAAU,mFACb,8BAAC,QAAK,WAAU,yBAAwB,GAC1C;AAAA,UACA,oBAAC,UAAK,WAAU,iCAAiC,YAAE,oCAAoC,GAAE;AAAA,WAC3F;AAAA,QACA,qBAAC,SAAI,WAAU,2BACb;AAAA,8BAAC,SAAI,WAAU,qFACb,8BAAC,SAAM,WAAU,2BAA0B,GAC7C;AAAA,UACA,oBAAC,UAAK,WAAU,iCAAiC,YAAE,iCAAiC,GAAE;AAAA,WACxF;AAAA,QACA,qBAAC,SAAI,WAAU,2BACb;AAAA,8BAAC,SAAI,WAAU,gFACb,8BAAC,UAAO,WAAU,iCAAgC,GACpD;AAAA,UACA,oBAAC,UAAK,WAAU,iCAAiC,YAAE,oCAAoC,GAAE;AAAA,WAC3F;AAAA,SACF;AAAA,OACF;AAAA,IAEA,qBAAC,SACC;AAAA,0BAAC,QAAG,WAAU,8CACX,YAAE,kCAAkC,GACvC;AAAA,MACA,qBAAC,SAAI,WAAU,aACb;AAAA,6BAAC,SAAI,WAAU,2BACb;AAAA,8BAAC,SAAI,WAAU,mDAAkD;AAAA,UACjE,oBAAC,UAAK,WAAU,iCAAiC,YAAE,sCAAsC,GAAE;AAAA,WAC7F;AAAA,QACA,qBAAC,SAAI,WAAU,2BACb;AAAA,8BAAC,SAAI,WAAU,+CAA8C,OAAO,EAAE,iBAAiB,0GAA0G,GAAG;AAAA,UACpM,oBAAC,UAAK,WAAU,iCAAiC,YAAE,oCAAoC,GAAE;AAAA,WAC3F;AAAA,SACF;AAAA,OACF;AAAA,KACF;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -152,7 +152,7 @@ function WorkflowSelector({
152
152
  "v",
153
153
  workflow.version
154
154
  ] }),
155
- workflow.enabled ? /* @__PURE__ */ jsx(Badge, { variant: "default", className: "bg-emerald-500 text-xs", children: "Enabled" }) : /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: "Disabled" })
155
+ workflow.enabled ? /* @__PURE__ */ jsx(Badge, { variant: "default", className: "bg-status-success-solid text-status-success-solid-foreground text-xs", children: "Enabled" }) : /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: "Disabled" })
156
156
  ] }),
157
157
  workflow.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground line-clamp-2", children: workflow.description })
158
158
  ]
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/modules/workflows/components/WorkflowSelector.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport { useState, useEffect } from 'react'\nimport { apiFetch } from '@open-mercato/ui/backend/utils/api'\nimport { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from '@open-mercato/ui/primitives/dialog'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { Plus, Loader2, AlertCircle, Workflow } from 'lucide-react'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('workflows')\n\nexport interface WorkflowDefinition {\n id: string\n workflowId: string\n workflowName: string\n description: string | null\n version: number\n enabled: boolean\n createdAt: string\n updatedAt: string\n}\n\nexport interface WorkflowSelectorProps {\n /** Whether the dialog is open */\n isOpen: boolean\n\n /** Callback when dialog is closed */\n onClose: () => void\n\n /** Callback when a workflow is selected */\n onSelect: (workflowId: string, workflow: WorkflowDefinition) => void\n\n /** Array of workflow IDs to exclude from the list (already selected) */\n excludeWorkflowIds?: string[]\n\n /** Dialog title */\n title?: string\n\n /** Dialog description */\n description?: string\n\n /** Whether to show only enabled workflows */\n onlyEnabled?: boolean\n\n /** Custom empty state message */\n emptyMessage?: string\n\n /** Custom search placeholder */\n searchPlaceholder?: string\n}\n\n/**\n * WorkflowSelector - Reusable dialog for searching and selecting workflow definitions\n *\n * Features:\n * - Search/filter workflows by name, ID, description\n * - Display workflow details (version, enabled status, description)\n * - Exclude already-selected workflows\n * - Loading and error states\n * - Responsive grid layout\n */\nexport function WorkflowSelector({\n isOpen,\n onClose,\n onSelect,\n excludeWorkflowIds = [],\n title = 'Select Workflow',\n description = 'Choose a workflow to invoke as a sub-workflow',\n onlyEnabled = true,\n emptyMessage,\n searchPlaceholder = 'Search by workflow ID, name, or description...',\n}: WorkflowSelectorProps) {\n const [workflows, setWorkflows] = useState<WorkflowDefinition[]>([])\n const [loading, setLoading] = useState(false)\n const [error, setError] = useState<string | null>(null)\n const [searchQuery, setSearchQuery] = useState('')\n\n // Fetch workflows on mount\n useEffect(() => {\n if (isOpen) {\n fetchWorkflows()\n }\n }, [isOpen])\n\n const fetchWorkflows = async () => {\n setLoading(true)\n setError(null)\n try {\n // Build query params\n const params = new URLSearchParams()\n params.set('limit', '50') // Reasonable limit for selector\n\n if (onlyEnabled) {\n params.set('enabled', 'true')\n }\n\n const url = `/api/workflows/definitions?${params.toString()}`\n const response = await apiFetch(url)\n\n if (response.ok) {\n const result = await response.json()\n setWorkflows(result.data || [])\n } else {\n let errorMessage = `Failed to load workflows (${response.status})`\n try {\n const errorData = await response.json()\n if (errorData.error) {\n errorMessage = errorData.error\n }\n } catch {\n // Use default error message\n }\n logger.error('Failed to fetch workflows', {\n url,\n status: response.status,\n message: errorMessage,\n })\n setError(errorMessage)\n }\n } catch (err) {\n logger.error('Failed to fetch workflows', { err })\n const errorMessage = err instanceof Error ? err.message : 'Network error loading workflows'\n setError(errorMessage)\n } finally {\n setLoading(false)\n }\n }\n\n // Filter workflows based on search query and exclusions\n const getFilteredWorkflows = (): WorkflowDefinition[] => {\n return workflows\n .filter(wf => !excludeWorkflowIds.includes(wf.workflowId))\n .filter(wf => {\n if (!searchQuery) return true\n const query = searchQuery.toLowerCase()\n return (\n wf.workflowName.toLowerCase().includes(query) ||\n wf.workflowId.toLowerCase().includes(query) ||\n wf.description?.toLowerCase().includes(query)\n )\n })\n }\n\n const handleSelect = (workflow: WorkflowDefinition) => {\n onSelect(workflow.workflowId, workflow)\n setSearchQuery('') // Clear search on select\n }\n\n const handleClose = () => {\n setSearchQuery('')\n onClose()\n }\n\n const filteredWorkflows = getFilteredWorkflows()\n\n return (\n <Dialog open={isOpen} onOpenChange={handleClose}>\n <DialogContent className=\"sm:max-w-4xl max-h-[85vh] flex flex-col\">\n <DialogHeader>\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n\n {/* Search Input */}\n <div className=\"px-6\">\n <Input\n type=\"text\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n placeholder={searchPlaceholder}\n autoFocus\n disabled={loading}\n />\n </div>\n\n {/* Workflows List */}\n <div className=\"flex-1 overflow-y-auto px-6 py-4 min-h-[400px]\">\n {loading ? (\n <div className=\"flex flex-col items-center justify-center py-12\">\n <Loader2 className=\"h-12 w-12 animate-spin text-primary mb-4\" />\n <p className=\"text-muted-foreground text-sm\">Loading workflows...</p>\n </div>\n ) : error ? (\n <div className=\"flex flex-col items-center justify-center py-12\">\n <AlertCircle className=\"h-16 w-16 text-destructive mb-4\" />\n <p className=\"text-destructive text-sm font-medium mb-2\">{error}</p>\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={fetchWorkflows}\n >\n Retry\n </Button>\n </div>\n ) : filteredWorkflows.length === 0 ? (\n <div className=\"flex flex-col items-center justify-center py-12\">\n <Workflow className=\"w-16 h-16 text-muted mb-4\" />\n <p className=\"text-muted-foreground text-sm mb-2\">\n {emptyMessage || (\n searchQuery\n ? 'No workflows found matching your search'\n : workflows.length === 0\n ? 'No workflows exist yet'\n : 'All workflows have already been excluded'\n )}\n </p>\n <p className=\"text-muted-foreground text-xs mb-3\">\n {workflows.length === 0\n ? 'Create workflows in the Workflow Definitions page first'\n : searchQuery\n ? `Showing 0 of ${workflows.length} total workflows`\n : `${workflows.length} workflows already excluded`\n }\n </p>\n {searchQuery && (\n <Button\n variant=\"link\"\n size=\"sm\"\n onClick={() => setSearchQuery('')}\n >\n Clear search\n </Button>\n )}\n </div>\n ) : (\n <>\n <div className=\"mb-3 text-sm text-muted-foreground\">\n {filteredWorkflows.length} workflow{filteredWorkflows.length !== 1 ? 's' : ''} available\n </div>\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-3\">\n {filteredWorkflows.map((workflow) => (\n <button\n key={workflow.id}\n onClick={() => handleSelect(workflow)}\n className=\"text-left p-4 border-2 border-border rounded-lg hover:border-primary hover:bg-accent transition-all group\"\n >\n <div className=\"flex items-start justify-between mb-2\">\n <div className=\"flex-1 min-w-0\">\n <h4 className=\"text-sm font-semibold group-hover:text-primary truncate\">\n {workflow.workflowName}\n </h4>\n <p className=\"text-xs text-muted-foreground font-mono mt-0.5 truncate\">\n {workflow.workflowId}\n </p>\n </div>\n <Plus className=\"size-5 text-muted-foreground group-hover:text-primary transition-colors flex-shrink-0 ml-2\" />\n </div>\n\n <div className=\"flex items-center gap-2 mb-2 flex-wrap\">\n <Badge variant=\"secondary\" className=\"text-xs\">\n v{workflow.version}\n </Badge>\n {workflow.enabled ? (\n <Badge variant=\"default\" className=\"bg-emerald-500 text-xs\">\n Enabled\n </Badge>\n ) : (\n <Badge variant=\"secondary\" className=\"text-xs\">\n Disabled\n </Badge>\n )}\n </div>\n\n {workflow.description && (\n <p className=\"text-xs text-muted-foreground line-clamp-2\">\n {workflow.description}\n </p>\n )}\n </button>\n ))}\n </div>\n </>\n )}\n </div>\n\n <DialogFooter>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={handleClose}\n >\n Cancel\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n )\n}\n"],
5
- "mappings": ";AAgKQ,SAmEI,UAlEF,KADF;AA9JR,SAAS,UAAU,iBAAiB;AACpC,SAAS,gBAAgB;AACzB,SAAS,QAAQ,eAAe,cAAc,aAAa,mBAAmB,oBAAoB;AAClG,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,MAAM,SAAS,aAAa,gBAAgB;AACrD,SAAS,oBAAoB;AAE7B,MAAM,SAAS,aAAa,WAAW;AAoDhC,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA,qBAAqB,CAAC;AAAA,EACtB,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,cAAc;AAAA,EACd;AAAA,EACA,oBAAoB;AACtB,GAA0B;AACxB,QAAM,CAAC,WAAW,YAAY,IAAI,SAA+B,CAAC,CAAC;AACnE,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,KAAK;AAC5C,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAwB,IAAI;AACtD,QAAM,CA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;AAAA;AAAA,QACC,MAAK;AAAA,QACL,SAAQ;AAAA,QACR,SAAS;AAAA,QACV;AAAA;AAAA,IAED,GACF;AAAA,KACF,GACF;AAEJ;",
4
+ "sourcesContent": ["'use client'\n\nimport { useState, useEffect } from 'react'\nimport { apiFetch } from '@open-mercato/ui/backend/utils/api'\nimport { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from '@open-mercato/ui/primitives/dialog'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { Plus, Loader2, AlertCircle, Workflow } from 'lucide-react'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('workflows')\n\nexport interface WorkflowDefinition {\n id: string\n workflowId: string\n workflowName: string\n description: string | null\n version: number\n enabled: boolean\n createdAt: string\n updatedAt: string\n}\n\nexport interface WorkflowSelectorProps {\n /** Whether the dialog is open */\n isOpen: boolean\n\n /** Callback when dialog is closed */\n onClose: () => void\n\n /** Callback when a workflow is selected */\n onSelect: (workflowId: string, workflow: WorkflowDefinition) => void\n\n /** Array of workflow IDs to exclude from the list (already selected) */\n excludeWorkflowIds?: string[]\n\n /** Dialog title */\n title?: string\n\n /** Dialog description */\n description?: string\n\n /** Whether to show only enabled workflows */\n onlyEnabled?: boolean\n\n /** Custom empty state message */\n emptyMessage?: string\n\n /** Custom search placeholder */\n searchPlaceholder?: string\n}\n\n/**\n * WorkflowSelector - Reusable dialog for searching and selecting workflow definitions\n *\n * Features:\n * - Search/filter workflows by name, ID, description\n * - Display workflow details (version, enabled status, description)\n * - Exclude already-selected workflows\n * - Loading and error states\n * - Responsive grid layout\n */\nexport function WorkflowSelector({\n isOpen,\n onClose,\n onSelect,\n excludeWorkflowIds = [],\n title = 'Select Workflow',\n description = 'Choose a workflow to invoke as a sub-workflow',\n onlyEnabled = true,\n emptyMessage,\n searchPlaceholder = 'Search by workflow ID, name, or description...',\n}: WorkflowSelectorProps) {\n const [workflows, setWorkflows] = useState<WorkflowDefinition[]>([])\n const [loading, setLoading] = useState(false)\n const [error, setError] = useState<string | null>(null)\n const [searchQuery, setSearchQuery] = useState('')\n\n // Fetch workflows on mount\n useEffect(() => {\n if (isOpen) {\n fetchWorkflows()\n }\n }, [isOpen])\n\n const fetchWorkflows = async () => {\n setLoading(true)\n setError(null)\n try {\n // Build query params\n const params = new URLSearchParams()\n params.set('limit', '50') // Reasonable limit for selector\n\n if (onlyEnabled) {\n params.set('enabled', 'true')\n }\n\n const url = `/api/workflows/definitions?${params.toString()}`\n const response = await apiFetch(url)\n\n if (response.ok) {\n const result = await response.json()\n setWorkflows(result.data || [])\n } else {\n let errorMessage = `Failed to load workflows (${response.status})`\n try {\n const errorData = await response.json()\n if (errorData.error) {\n errorMessage = errorData.error\n }\n } catch {\n // Use default error message\n }\n logger.error('Failed to fetch workflows', {\n url,\n status: response.status,\n message: errorMessage,\n })\n setError(errorMessage)\n }\n } catch (err) {\n logger.error('Failed to fetch workflows', { err })\n const errorMessage = err instanceof Error ? err.message : 'Network error loading workflows'\n setError(errorMessage)\n } finally {\n setLoading(false)\n }\n }\n\n // Filter workflows based on search query and exclusions\n const getFilteredWorkflows = (): WorkflowDefinition[] => {\n return workflows\n .filter(wf => !excludeWorkflowIds.includes(wf.workflowId))\n .filter(wf => {\n if (!searchQuery) return true\n const query = searchQuery.toLowerCase()\n return (\n wf.workflowName.toLowerCase().includes(query) ||\n wf.workflowId.toLowerCase().includes(query) ||\n wf.description?.toLowerCase().includes(query)\n )\n })\n }\n\n const handleSelect = (workflow: WorkflowDefinition) => {\n onSelect(workflow.workflowId, workflow)\n setSearchQuery('') // Clear search on select\n }\n\n const handleClose = () => {\n setSearchQuery('')\n onClose()\n }\n\n const filteredWorkflows = getFilteredWorkflows()\n\n return (\n <Dialog open={isOpen} onOpenChange={handleClose}>\n <DialogContent className=\"sm:max-w-4xl max-h-[85vh] flex flex-col\">\n <DialogHeader>\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n\n {/* Search Input */}\n <div className=\"px-6\">\n <Input\n type=\"text\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n placeholder={searchPlaceholder}\n autoFocus\n disabled={loading}\n />\n </div>\n\n {/* Workflows List */}\n <div className=\"flex-1 overflow-y-auto px-6 py-4 min-h-[400px]\">\n {loading ? (\n <div className=\"flex flex-col items-center justify-center py-12\">\n <Loader2 className=\"h-12 w-12 animate-spin text-primary mb-4\" />\n <p className=\"text-muted-foreground text-sm\">Loading workflows...</p>\n </div>\n ) : error ? (\n <div className=\"flex flex-col items-center justify-center py-12\">\n <AlertCircle className=\"h-16 w-16 text-destructive mb-4\" />\n <p className=\"text-destructive text-sm font-medium mb-2\">{error}</p>\n <Button\n variant=\"outline\"\n size=\"sm\"\n onClick={fetchWorkflows}\n >\n Retry\n </Button>\n </div>\n ) : filteredWorkflows.length === 0 ? (\n <div className=\"flex flex-col items-center justify-center py-12\">\n <Workflow className=\"w-16 h-16 text-muted mb-4\" />\n <p className=\"text-muted-foreground text-sm mb-2\">\n {emptyMessage || (\n searchQuery\n ? 'No workflows found matching your search'\n : workflows.length === 0\n ? 'No workflows exist yet'\n : 'All workflows have already been excluded'\n )}\n </p>\n <p className=\"text-muted-foreground text-xs mb-3\">\n {workflows.length === 0\n ? 'Create workflows in the Workflow Definitions page first'\n : searchQuery\n ? `Showing 0 of ${workflows.length} total workflows`\n : `${workflows.length} workflows already excluded`\n }\n </p>\n {searchQuery && (\n <Button\n variant=\"link\"\n size=\"sm\"\n onClick={() => setSearchQuery('')}\n >\n Clear search\n </Button>\n )}\n </div>\n ) : (\n <>\n <div className=\"mb-3 text-sm text-muted-foreground\">\n {filteredWorkflows.length} workflow{filteredWorkflows.length !== 1 ? 's' : ''} available\n </div>\n <div className=\"grid grid-cols-1 md:grid-cols-2 gap-3\">\n {filteredWorkflows.map((workflow) => (\n <button\n key={workflow.id}\n onClick={() => handleSelect(workflow)}\n className=\"text-left p-4 border-2 border-border rounded-lg hover:border-primary hover:bg-accent transition-all group\"\n >\n <div className=\"flex items-start justify-between mb-2\">\n <div className=\"flex-1 min-w-0\">\n <h4 className=\"text-sm font-semibold group-hover:text-primary truncate\">\n {workflow.workflowName}\n </h4>\n <p className=\"text-xs text-muted-foreground font-mono mt-0.5 truncate\">\n {workflow.workflowId}\n </p>\n </div>\n <Plus className=\"size-5 text-muted-foreground group-hover:text-primary transition-colors flex-shrink-0 ml-2\" />\n </div>\n\n <div className=\"flex items-center gap-2 mb-2 flex-wrap\">\n <Badge variant=\"secondary\" className=\"text-xs\">\n v{workflow.version}\n </Badge>\n {workflow.enabled ? (\n <Badge variant=\"default\" className=\"bg-status-success-solid text-status-success-solid-foreground text-xs\">\n Enabled\n </Badge>\n ) : (\n <Badge variant=\"secondary\" className=\"text-xs\">\n Disabled\n </Badge>\n )}\n </div>\n\n {workflow.description && (\n <p className=\"text-xs text-muted-foreground line-clamp-2\">\n {workflow.description}\n </p>\n )}\n </button>\n ))}\n </div>\n </>\n )}\n </div>\n\n <DialogFooter>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={handleClose}\n >\n Cancel\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n )\n}\n"],
5
+ "mappings": ";AAgKQ,SAmEI,UAlEF,KADF;AA9JR,SAAS,UAAU,iBAAiB;AACpC,SAAS,gBAAgB;AACzB,SAAS,QAAQ,eAAe,cAAc,aAAa,mBAAmB,oBAAoB;AAClG,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,MAAM,SAAS,aAAa,gBAAgB;AACrD,SAAS,oBAAoB;AAE7B,MAAM,SAAS,aAAa,WAAW;AAoDhC,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA,qBAAqB,CAAC;AAAA,EACtB,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,cAAc;AA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,aAAY,WAAU,WAAU,sBAE/C;AAAA,eAEJ;AAAA,YAEC,SAAS,eACR,oBAAC,OAAE,WAAU,8CACV,mBAAS,aACZ;AAAA;AAAA;AAAA,QAlCG,SAAS;AAAA,MAoChB,CACD,GACH;AAAA,OACF,GAEJ;AAAA,IAEA,oBAAC,gBACC;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACL,SAAQ;AAAA,QACR,SAAS;AAAA,QACV;AAAA;AAAA,IAED,GACF;AAAA,KACF,GACF;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -178,7 +178,7 @@ function BusinessRuleConditionsEditor({
178
178
  size: "sm",
179
179
  disabled,
180
180
  className: "ml-2 flex-shrink-0",
181
- children: /* @__PURE__ */ jsx(Trash2, { className: "size-4 text-red-600" })
181
+ children: /* @__PURE__ */ jsx(Trash2, { className: "size-4 text-destructive" })
182
182
  }
183
183
  ),
184
184
  title: t("workflows.fieldEditors.businessRuleConditions.removeCondition"),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/modules/workflows/components/fields/BusinessRuleConditionsEditor.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport { useState, useEffect } from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { Plus, Trash2, AlertCircle } from 'lucide-react'\nimport type { CrudCustomFieldRenderProps } from '@open-mercato/ui/backend/CrudForm'\nimport { BusinessRulesSelector, type BusinessRule } from '../BusinessRulesSelector'\nimport { apiFetch } from '@open-mercato/ui/backend/utils/api'\nimport { EmptyState } from '@open-mercato/ui/backend/EmptyState'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { SwitchField } from '@open-mercato/ui/primitives/switch-field'\nimport { ConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('workflows')\n\n/**\n * Condition definition structure (supports legacy string format and new object format)\n */\nexport type TransitionCondition = string | { ruleId: string; required: boolean }\n\ninterface BusinessRuleConditionsEditorProps extends CrudCustomFieldRenderProps {\n value: TransitionCondition[]\n filterEntityType?: string\n filterRuleType?: string\n}\n\ninterface ConditionWithDetails {\n ruleId: string\n required: boolean\n ruleName?: string\n ruleType?: string\n loading?: boolean\n error?: boolean\n}\n\n/**\n * Normalize legacy string format to object format\n */\nfunction normalizeCondition(raw: TransitionCondition): { ruleId: string; required: boolean } {\n if (typeof raw === 'string') {\n return { ruleId: raw, required: true }\n }\n return raw\n}\n\n/**\n * BusinessRuleConditionsEditor - Custom field component for managing pre/post business rule conditions\n *\n * Integrates with BusinessRulesSelector modal to add/remove conditions.\n * Fetches and displays rule names for selected rule IDs.\n * Supports both legacy string format and new object format with required flag.\n *\n * Used by EdgeEditDialog (pre-conditions and post-conditions)\n */\nexport function BusinessRuleConditionsEditor({\n id,\n value = [],\n setValue,\n disabled,\n filterEntityType,\n filterRuleType,\n}: BusinessRuleConditionsEditorProps) {\n const t = useT()\n const [isModalOpen, setIsModalOpen] = useState(false)\n const [conditionsWithDetails, setConditionsWithDetails] = useState<ConditionWithDetails[]>([])\n\n const conditions = Array.isArray(value) ? value : []\n\n // Fetch rule details when conditions change\n useEffect(() => {\n const normalized = conditions.map(normalizeCondition)\n const withDetails: ConditionWithDetails[] = normalized.map((c) => ({\n ...c,\n loading: true,\n }))\n setConditionsWithDetails(withDetails)\n\n // Fetch details for each rule\n normalized.forEach((condition, index) => {\n fetchRuleDetails(condition.ruleId, index)\n })\n }, [JSON.stringify(conditions.map(normalizeCondition))])\n\n const fetchRuleDetails = async (ruleId: string, index: number) => {\n try {\n const params = new URLSearchParams({ ruleId, pageSize: '1' })\n const response = await apiFetch(`/api/business_rules/rules?${params.toString()}`)\n\n if (response.ok) {\n const data = await response.json()\n const rule = data.items?.[0] as BusinessRule | undefined\n\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: rule?.ruleName || ruleId,\n ruleType: rule?.ruleType,\n loading: false,\n error: !rule,\n }\n }\n return updated\n })\n } else {\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: ruleId,\n loading: false,\n error: true,\n }\n }\n return updated\n })\n }\n } catch (err) {\n logger.error('Failed to fetch rule details', { ruleId, err })\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: ruleId,\n loading: false,\n error: true,\n }\n }\n return updated\n })\n }\n }\n\n const addCondition = (ruleId: string, _rule: BusinessRule) => {\n const newCondition: TransitionCondition = { ruleId, required: true }\n setValue([...conditions, newCondition])\n setIsModalOpen(false)\n }\n\n const removeCondition = (index: number) => {\n const newConditions = conditions.filter((_, i) => i !== index)\n setValue(newConditions)\n }\n\n const toggleRequired = (index: number) => {\n const normalized = normalizeCondition(conditions[index])\n const updated = [...conditions]\n updated[index] = {\n ruleId: normalized.ruleId,\n required: !normalized.required,\n }\n setValue(updated)\n }\n\n const getExcludedRuleIds = (): string[] => {\n return conditions.map((c) => normalizeCondition(c).ruleId)\n }\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex items-center justify-end\">\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={() => setIsModalOpen(true)}\n disabled={disabled}\n >\n <Plus className=\"size-3 mr-1\" />\n {t('workflows.fieldEditors.businessRuleConditions.addRule')}\n </Button>\n </div>\n\n {conditions.length === 0 ? (\n <EmptyState\n title={t('workflows.fieldEditors.businessRuleConditions.emptyTitle')}\n description={t('workflows.fieldEditors.businessRuleConditions.emptyDescription')}\n action={{ label: t('workflows.fieldEditors.businessRuleConditions.addRule'), onClick: () => setIsModalOpen(true), disabled }}\n />\n ) : (\n <div className=\"space-y-2\">\n {conditionsWithDetails.map((condition, index) => {\n const normalized = normalizeCondition(conditions[index])\n return (\n <div key={index} className=\"border border-gray-200 rounded-lg bg-white p-4\">\n <div className=\"flex items-start justify-between\">\n <div className=\"flex-1 min-w-0 space-y-2\">\n {/* Rule Name/ID */}\n <div className=\"flex items-center gap-2\">\n {condition.loading ? (\n <>\n <Spinner size=\"sm\" />\n <span className=\"text-sm text-muted-foreground\">{t('workflows.common.loadingDetails')}</span>\n </>\n ) : condition.error ? (\n <>\n <AlertCircle className=\"size-4 text-amber-600\" />\n <div>\n <span className=\"text-sm font-semibold text-foreground\">{condition.ruleId}</span>\n <p className=\"text-xs text-amber-600\">{t('workflows.common.ruleNotFound')}</p>\n </div>\n </>\n ) : (\n <div>\n <span className=\"text-sm font-semibold text-foreground\">{condition.ruleName}</span>\n {condition.ruleType && (\n <Badge variant=\"secondary\" className=\"text-xs ml-2\">\n {condition.ruleType}\n </Badge>\n )}\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n ID: <code className=\"bg-muted px-1 rounded font-mono\">{condition.ruleId}</code>\n </p>\n </div>\n )}\n </div>\n\n {/* Required Toggle */}\n <SwitchField\n id={`${id}-${index}-required`}\n label={t('workflows.fieldEditors.businessRuleConditions.requiredLabel')}\n flip\n checked={normalized.required}\n onCheckedChange={() => toggleRequired(index)}\n disabled={disabled}\n />\n </div>\n\n {/* Delete Button */}\n <ConfirmDialog\n trigger={\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n disabled={disabled}\n className=\"ml-2 flex-shrink-0\"\n >\n <Trash2 className=\"size-4 text-red-600\" />\n </Button>\n }\n title={t('workflows.fieldEditors.businessRuleConditions.removeCondition')}\n text={t('workflows.fieldEditors.businessRuleConditions.confirmRemove')}\n variant=\"destructive\"\n onConfirm={() => removeCondition(index)}\n />\n </div>\n </div>\n )\n })}\n </div>\n )}\n\n {/* Business Rules Selector Modal */}\n <BusinessRulesSelector\n isOpen={isModalOpen}\n onClose={() => setIsModalOpen(false)}\n onSelect={addCondition}\n excludeRuleIds={getExcludedRuleIds()}\n title={t('workflows.fieldEditors.businessRuleConditions.selectBusinessRule')}\n description={t('workflows.fieldEditors.businessRuleConditions.selectBusinessRuleDescription')}\n filterEntityType={filterEntityType}\n filterRuleType={filterRuleType}\n onlyEnabled={true}\n />\n </div>\n )\n}\n"],
5
- "mappings": ";AAuKQ,SA4BgB,UAtBd,KANF;AArKR,SAAS,UAAU,iBAAiB;AACpC,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,MAAM,QAAQ,mBAAmB;AAE1C,SAAS,6BAAgD;AACzD,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAE7B,MAAM,SAAS,aAAa,WAAW;AAyBvC,SAAS,mBAAmB,KAAiE;AAC3F,MAAI,OAAO,QAAQ,UAAU;AAC3B,WAAO,EAAE,QAAQ,KAAK,UAAU,KAAK;AAAA,EACvC;AACA,SAAO;AACT;AAWO,SAAS,6BAA6B;AAAA,EAC3C;AAAA,EACA,QAAQ,CAAC;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAsC;AACpC,QAAM,IAAI,KAAK;AACf,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,KAAK;AACpD,QAAM,CAAC,uBAAuB,wBAAwB,IAAI,SAAiC,CAAC,CAAC;AAE7F,QAAM,aAAa,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC;AAGnD,YAAU,MAAM;AACd,UAAM,aAAa,WAAW,IAAI,kBAAkB;AACpD,UAAM,cAAsC,WAAW,IAAI,CAAC,OAAO;AAAA,MACjE,GAAG;AAAA,MACH,SAAS;AAAA,IACX,EAAE;AACF,6BAAyB,WAAW;AAGpC,eAAW,QAAQ,CAAC,WAAW,UAAU;AACvC,uBAAiB,UAAU,QAAQ,KAAK;AAAA,IAC1C,CAAC;AAAA,EACH,GAAG,CAAC,KAAK,UAAU,WAAW,IAAI,kBAAk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SAAQ;AAAA,YACR,WAAW,MAAM,gBAAgB,KAAK;AAAA;AAAA,QACxC;AAAA,SACF,KA9DQ,KA+DV;AAAA,IAEJ,CAAC,GACH;AAAA,IAIF;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ;AAAA,QACR,SAAS,MAAM,eAAe,KAAK;AAAA,QACnC,UAAU;AAAA,QACV,gBAAgB,mBAAmB;AAAA,QACnC,OAAO,EAAE,kEAAkE;AAAA,QAC3E,aAAa,EAAE,6EAA6E;AAAA,QAC5F;AAAA,QACA;AAAA,QACA,aAAa;AAAA;AAAA,IACf;AAAA,KACF;AAEJ;",
4
+ "sourcesContent": ["'use client'\n\nimport { useState, useEffect } from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { Plus, Trash2, AlertCircle } from 'lucide-react'\nimport type { CrudCustomFieldRenderProps } from '@open-mercato/ui/backend/CrudForm'\nimport { BusinessRulesSelector, type BusinessRule } from '../BusinessRulesSelector'\nimport { apiFetch } from '@open-mercato/ui/backend/utils/api'\nimport { EmptyState } from '@open-mercato/ui/backend/EmptyState'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { SwitchField } from '@open-mercato/ui/primitives/switch-field'\nimport { ConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('workflows')\n\n/**\n * Condition definition structure (supports legacy string format and new object format)\n */\nexport type TransitionCondition = string | { ruleId: string; required: boolean }\n\ninterface BusinessRuleConditionsEditorProps extends CrudCustomFieldRenderProps {\n value: TransitionCondition[]\n filterEntityType?: string\n filterRuleType?: string\n}\n\ninterface ConditionWithDetails {\n ruleId: string\n required: boolean\n ruleName?: string\n ruleType?: string\n loading?: boolean\n error?: boolean\n}\n\n/**\n * Normalize legacy string format to object format\n */\nfunction normalizeCondition(raw: TransitionCondition): { ruleId: string; required: boolean } {\n if (typeof raw === 'string') {\n return { ruleId: raw, required: true }\n }\n return raw\n}\n\n/**\n * BusinessRuleConditionsEditor - Custom field component for managing pre/post business rule conditions\n *\n * Integrates with BusinessRulesSelector modal to add/remove conditions.\n * Fetches and displays rule names for selected rule IDs.\n * Supports both legacy string format and new object format with required flag.\n *\n * Used by EdgeEditDialog (pre-conditions and post-conditions)\n */\nexport function BusinessRuleConditionsEditor({\n id,\n value = [],\n setValue,\n disabled,\n filterEntityType,\n filterRuleType,\n}: BusinessRuleConditionsEditorProps) {\n const t = useT()\n const [isModalOpen, setIsModalOpen] = useState(false)\n const [conditionsWithDetails, setConditionsWithDetails] = useState<ConditionWithDetails[]>([])\n\n const conditions = Array.isArray(value) ? value : []\n\n // Fetch rule details when conditions change\n useEffect(() => {\n const normalized = conditions.map(normalizeCondition)\n const withDetails: ConditionWithDetails[] = normalized.map((c) => ({\n ...c,\n loading: true,\n }))\n setConditionsWithDetails(withDetails)\n\n // Fetch details for each rule\n normalized.forEach((condition, index) => {\n fetchRuleDetails(condition.ruleId, index)\n })\n }, [JSON.stringify(conditions.map(normalizeCondition))])\n\n const fetchRuleDetails = async (ruleId: string, index: number) => {\n try {\n const params = new URLSearchParams({ ruleId, pageSize: '1' })\n const response = await apiFetch(`/api/business_rules/rules?${params.toString()}`)\n\n if (response.ok) {\n const data = await response.json()\n const rule = data.items?.[0] as BusinessRule | undefined\n\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: rule?.ruleName || ruleId,\n ruleType: rule?.ruleType,\n loading: false,\n error: !rule,\n }\n }\n return updated\n })\n } else {\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: ruleId,\n loading: false,\n error: true,\n }\n }\n return updated\n })\n }\n } catch (err) {\n logger.error('Failed to fetch rule details', { ruleId, err })\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: ruleId,\n loading: false,\n error: true,\n }\n }\n return updated\n })\n }\n }\n\n const addCondition = (ruleId: string, _rule: BusinessRule) => {\n const newCondition: TransitionCondition = { ruleId, required: true }\n setValue([...conditions, newCondition])\n setIsModalOpen(false)\n }\n\n const removeCondition = (index: number) => {\n const newConditions = conditions.filter((_, i) => i !== index)\n setValue(newConditions)\n }\n\n const toggleRequired = (index: number) => {\n const normalized = normalizeCondition(conditions[index])\n const updated = [...conditions]\n updated[index] = {\n ruleId: normalized.ruleId,\n required: !normalized.required,\n }\n setValue(updated)\n }\n\n const getExcludedRuleIds = (): string[] => {\n return conditions.map((c) => normalizeCondition(c).ruleId)\n }\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex items-center justify-end\">\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={() => setIsModalOpen(true)}\n disabled={disabled}\n >\n <Plus className=\"size-3 mr-1\" />\n {t('workflows.fieldEditors.businessRuleConditions.addRule')}\n </Button>\n </div>\n\n {conditions.length === 0 ? (\n <EmptyState\n title={t('workflows.fieldEditors.businessRuleConditions.emptyTitle')}\n description={t('workflows.fieldEditors.businessRuleConditions.emptyDescription')}\n action={{ label: t('workflows.fieldEditors.businessRuleConditions.addRule'), onClick: () => setIsModalOpen(true), disabled }}\n />\n ) : (\n <div className=\"space-y-2\">\n {conditionsWithDetails.map((condition, index) => {\n const normalized = normalizeCondition(conditions[index])\n return (\n <div key={index} className=\"border border-gray-200 rounded-lg bg-white p-4\">\n <div className=\"flex items-start justify-between\">\n <div className=\"flex-1 min-w-0 space-y-2\">\n {/* Rule Name/ID */}\n <div className=\"flex items-center gap-2\">\n {condition.loading ? (\n <>\n <Spinner size=\"sm\" />\n <span className=\"text-sm text-muted-foreground\">{t('workflows.common.loadingDetails')}</span>\n </>\n ) : condition.error ? (\n <>\n <AlertCircle className=\"size-4 text-amber-600\" />\n <div>\n <span className=\"text-sm font-semibold text-foreground\">{condition.ruleId}</span>\n <p className=\"text-xs text-amber-600\">{t('workflows.common.ruleNotFound')}</p>\n </div>\n </>\n ) : (\n <div>\n <span className=\"text-sm font-semibold text-foreground\">{condition.ruleName}</span>\n {condition.ruleType && (\n <Badge variant=\"secondary\" className=\"text-xs ml-2\">\n {condition.ruleType}\n </Badge>\n )}\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n ID: <code className=\"bg-muted px-1 rounded font-mono\">{condition.ruleId}</code>\n </p>\n </div>\n )}\n </div>\n\n {/* Required Toggle */}\n <SwitchField\n id={`${id}-${index}-required`}\n label={t('workflows.fieldEditors.businessRuleConditions.requiredLabel')}\n flip\n checked={normalized.required}\n onCheckedChange={() => toggleRequired(index)}\n disabled={disabled}\n />\n </div>\n\n {/* Delete Button */}\n <ConfirmDialog\n trigger={\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n disabled={disabled}\n className=\"ml-2 flex-shrink-0\"\n >\n <Trash2 className=\"size-4 text-destructive\" />\n </Button>\n }\n title={t('workflows.fieldEditors.businessRuleConditions.removeCondition')}\n text={t('workflows.fieldEditors.businessRuleConditions.confirmRemove')}\n variant=\"destructive\"\n onConfirm={() => removeCondition(index)}\n />\n </div>\n </div>\n )\n })}\n </div>\n )}\n\n {/* Business Rules Selector Modal */}\n <BusinessRulesSelector\n isOpen={isModalOpen}\n onClose={() => setIsModalOpen(false)}\n onSelect={addCondition}\n excludeRuleIds={getExcludedRuleIds()}\n title={t('workflows.fieldEditors.businessRuleConditions.selectBusinessRule')}\n description={t('workflows.fieldEditors.businessRuleConditions.selectBusinessRuleDescription')}\n filterEntityType={filterEntityType}\n filterRuleType={filterRuleType}\n onlyEnabled={true}\n />\n </div>\n )\n}\n"],
5
+ "mappings": ";AAuKQ,SA4BgB,UAtBd,KANF;AArKR,SAAS,UAAU,iBAAiB;AACpC,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,MAAM,QAAQ,mBAAmB;AAE1C,SAAS,6B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F;AAAA,QACA;AAAA,QACA,aAAa;AAAA;AAAA,IACf;AAAA,KACF;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -79,7 +79,7 @@ function FormFieldArrayEditor({
79
79
  ")"
80
80
  ] }),
81
81
  /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-0.5", children: t("workflows.fieldEditors.formFields.description") }),
82
- error && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-600 mt-1", children: error })
82
+ error && /* @__PURE__ */ jsx("p", { className: "text-xs text-status-error-text mt-1", children: error })
83
83
  ] }),
84
84
  /* @__PURE__ */ jsxs(
85
85
  Button,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/modules/workflows/components/fields/FormFieldArrayEditor.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport { useState } from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@open-mercato/ui/primitives/select'\nimport { Alert, AlertDescription } from '@open-mercato/ui/primitives/alert'\nimport { ChevronDown, Plus, Trash2 } from 'lucide-react'\nimport type { CrudCustomFieldRenderProps } from '@open-mercato/ui/backend/CrudForm'\n\n/**\n * Form field definition structure\n */\nexport interface FormField {\n name: string\n type: string\n label: string\n required: boolean\n placeholder?: string\n options?: string[]\n defaultValue?: string\n}\n\ninterface FormFieldArrayEditorProps extends CrudCustomFieldRenderProps {\n value: FormField[]\n isJsonSchemaFormat?: boolean\n}\n\n/**\n * FormFieldArrayEditor - Custom field component for managing UserTask form fields\n *\n * Provides an interface to add, edit, and remove form field definitions for user tasks.\n * Supports 12 field types with conditional options for select/radio types.\n *\n * Displays a warning banner if the form was converted from JSON Schema format.\n *\n * Used by NodeEditDialog (UserTask type only)\n */\nexport function FormFieldArrayEditor({\n id,\n value = [],\n error,\n setValue,\n disabled,\n isJsonSchemaFormat = false,\n}: FormFieldArrayEditorProps) {\n const t = useT()\n const { confirm, ConfirmDialogElement } = useConfirmDialog()\n const [expandedIndices, setExpandedIndices] = useState<Set<number>>(new Set())\n\n const formFields = Array.isArray(value) ? value : []\n\n const toggleExpanded = (index: number) => {\n const newExpanded = new Set(expandedIndices)\n if (newExpanded.has(index)) {\n newExpanded.delete(index)\n } else {\n newExpanded.add(index)\n }\n setExpandedIndices(newExpanded)\n }\n\n const addFormField = () => {\n const newField: FormField = {\n name: `field_${Date.now()}`,\n type: 'text',\n label: t('workflows.form.newField'),\n required: false,\n placeholder: '',\n }\n const newFields = [...formFields, newField]\n setValue(newFields)\n\n // Auto-expand the newly added field\n const newExpanded = new Set(expandedIndices)\n newExpanded.add(formFields.length)\n setExpandedIndices(newExpanded)\n }\n\n const removeFormField = async (index: number) => {\n const confirmed = await confirm({\n title: t('workflows.fieldEditors.formFields.removeField'),\n text: t('workflows.fieldEditors.formFields.confirmRemove'),\n variant: 'destructive',\n })\n if (!confirmed) return\n\n const newFields = formFields.filter((_, i) => i !== index)\n setValue(newFields)\n\n // Remove from expanded set\n const newExpanded = new Set(expandedIndices)\n newExpanded.delete(index)\n setExpandedIndices(newExpanded)\n }\n\n const updateFormField = (index: number, fieldKey: keyof FormField, fieldValue: any) => {\n const updated = [...formFields]\n updated[index] = { ...updated[index], [fieldKey]: fieldValue }\n setValue(updated)\n }\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <Label className=\"text-sm font-semibold\">{t('workflows.fieldEditors.formFields.title')} ({formFields.length})</Label>\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n {t('workflows.fieldEditors.formFields.description')}\n </p>\n {error && <p className=\"text-xs text-red-600 mt-1\">{error}</p>}\n </div>\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={addFormField}\n disabled={disabled}\n className=\"w-full sm:w-auto\"\n >\n <Plus className=\"size-3 mr-1\" />\n {t('workflows.fieldEditors.formFields.addField')}\n </Button>\n </div>\n\n {/* JSON Schema Format Notice */}\n {isJsonSchemaFormat && (\n <Alert variant=\"info\">\n <AlertDescription className=\"text-xs\">\n {t('workflows.fieldEditors.formFields.jsonSchemaNotice')}\n </AlertDescription>\n </Alert>\n )}\n\n {formFields.length === 0 ? (\n <div className=\"p-4 text-center text-sm text-muted-foreground bg-muted rounded-lg border\">\n {t('workflows.fieldEditors.formFields.emptyState')}\n </div>\n ) : (\n <div className=\"space-y-2\">\n {formFields.map((field, index) => {\n const isExpanded = expandedIndices.has(index)\n return (\n <div key={index} className=\"border border-gray-200 rounded-lg bg-gray-50\">\n {/* Collapsed Header */}\n <button\n type=\"button\"\n onClick={() => toggleExpanded(index)}\n disabled={disabled}\n className=\"w-full px-4 py-3 text-left flex items-center justify-between hover:bg-gray-100 transition-colors rounded-t-lg disabled:opacity-50\"\n >\n <div className=\"flex-1\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <span className=\"text-sm font-semibold text-gray-900\">\n {field.label || field.name}\n </span>\n <Badge variant=\"secondary\" className=\"text-xs\">\n {field.type}\n </Badge>\n {field.required && (\n <Badge variant=\"destructive\" className=\"text-xs text-white\">\n {t('workflows.form.required')}\n </Badge>\n )}\n </div>\n <p className=\"text-xs text-gray-600 mt-1\">\n Field name: <code className=\"bg-white px-1 rounded\">{field.name}</code>\n </p>\n </div>\n <ChevronDown\n className={`w-5 h-5 text-gray-400 transition-transform ${isExpanded ? 'rotate-180' : ''}`}\n />\n </button>\n\n {/* Expanded Content */}\n {isExpanded && (\n <div className=\"px-4 pb-4 space-y-3 border-t border-gray-200 bg-white\">\n {/* Field Name */}\n <div className=\"pt-3\">\n <Label htmlFor={`${id}-${index}-name`} className=\"text-xs font-medium mb-1\">\n {t('workflows.fieldEditors.formFields.fieldName')} *\n </Label>\n <Input\n id={`${id}-${index}-name`}\n type=\"text\"\n value={field.name}\n onChange={(e) => updateFormField(index, 'name', e.target.value)}\n placeholder={t('workflows.fieldEditors.formFields.fieldNamePlaceholder')}\n className=\"text-xs\"\n disabled={disabled}\n />\n <p className=\"text-xs text-muted-foreground mt-0.5\">{t('workflows.fieldEditors.formFields.fieldNameHint')}</p>\n </div>\n\n {/* Field Label */}\n <div>\n <Label htmlFor={`${id}-${index}-label`} className=\"text-xs font-medium mb-1\">\n {t('workflows.fieldEditors.formFields.fieldLabel')} *\n </Label>\n <Input\n id={`${id}-${index}-label`}\n type=\"text\"\n value={field.label}\n onChange={(e) => updateFormField(index, 'label', e.target.value)}\n placeholder={t('workflows.fieldEditors.formFields.fieldLabelPlaceholder')}\n className=\"text-xs\"\n disabled={disabled}\n />\n <p className=\"text-xs text-muted-foreground mt-0.5\">{t('workflows.fieldEditors.formFields.fieldLabelHint')}</p>\n </div>\n\n {/* Field Type */}\n <div>\n <Label htmlFor={`${id}-${index}-type`} className=\"text-xs font-medium mb-1\">\n {t('workflows.fieldEditors.formFields.fieldType')} *\n </Label>\n <Select\n value={field.type}\n onValueChange={(value) => updateFormField(index, 'type', value)}\n disabled={disabled}\n >\n <SelectTrigger id={`${id}-${index}-type`}>\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"text\">{t('workflows.form.fieldTypes.text')}</SelectItem>\n <SelectItem value=\"number\">{t('workflows.form.fieldTypes.number')}</SelectItem>\n <SelectItem value=\"email\">{t('workflows.form.fieldTypes.email')}</SelectItem>\n <SelectItem value=\"tel\">{t('workflows.form.fieldTypes.tel')}</SelectItem>\n <SelectItem value=\"url\">{t('workflows.form.fieldTypes.url')}</SelectItem>\n <SelectItem value=\"textarea\">{t('workflows.form.fieldTypes.textarea')}</SelectItem>\n <SelectItem value=\"select\">{t('workflows.form.fieldTypes.select')}</SelectItem>\n <SelectItem value=\"radio\">{t('workflows.form.fieldTypes.radio')}</SelectItem>\n <SelectItem value=\"checkbox\">{t('workflows.form.fieldTypes.checkbox')}</SelectItem>\n <SelectItem value=\"date\">{t('workflows.form.fieldTypes.date')}</SelectItem>\n <SelectItem value=\"time\">{t('workflows.form.fieldTypes.time')}</SelectItem>\n <SelectItem value=\"datetime-local\">{t('workflows.form.fieldTypes.datetime-local')}</SelectItem>\n </SelectContent>\n </Select>\n </div>\n\n {/* Placeholder */}\n <div>\n <Label htmlFor={`${id}-${index}-placeholder`} className=\"text-xs font-medium mb-1\">\n {t('workflows.fieldEditors.formFields.placeholder')}\n </Label>\n <Input\n id={`${id}-${index}-placeholder`}\n type=\"text\"\n value={field.placeholder || ''}\n onChange={(e) => updateFormField(index, 'placeholder', e.target.value)}\n placeholder={t('workflows.fieldEditors.formFields.placeholderPlaceholder')}\n className=\"text-xs\"\n disabled={disabled}\n />\n </div>\n\n {/* Default Value */}\n <div>\n <Label htmlFor={`${id}-${index}-defaultValue`} className=\"text-xs font-medium mb-1\">\n {t('workflows.fieldEditors.formFields.defaultValue')}\n </Label>\n <Input\n id={`${id}-${index}-defaultValue`}\n type=\"text\"\n value={field.defaultValue || ''}\n onChange={(e) => updateFormField(index, 'defaultValue', e.target.value)}\n placeholder={t('workflows.fieldEditors.formFields.defaultValuePlaceholder')}\n className=\"text-xs\"\n disabled={disabled}\n />\n </div>\n\n {/* Options (for select/radio) */}\n {(field.type === 'select' || field.type === 'radio') && (\n <div>\n <Label htmlFor={`${id}-${index}-options`} className=\"text-xs font-medium mb-1\">\n {t('workflows.fieldEditors.formFields.options')}\n </Label>\n <Input\n id={`${id}-${index}-options`}\n type=\"text\"\n value={field.options?.join(', ') || ''}\n onChange={(e) =>\n updateFormField(\n index,\n 'options',\n e.target.value\n .split(',')\n .map((o) => o.trim())\n .filter(Boolean)\n )\n }\n placeholder={t('workflows.fieldEditors.formFields.optionsPlaceholder')}\n className=\"text-xs\"\n disabled={disabled}\n />\n <p className=\"text-xs text-muted-foreground mt-0.5\">{t('workflows.fieldEditors.formFields.optionsHint')}</p>\n </div>\n )}\n\n {/* Required Checkbox */}\n <div>\n <div className=\"flex items-center gap-2\">\n <input\n type=\"checkbox\"\n id={`${id}-${index}-required`}\n checked={field.required}\n onChange={(e) => updateFormField(index, 'required', e.target.checked)}\n className=\"h-4 w-4 rounded border-gray-300 text-blue-600 focus-visible:ring-ring\"\n disabled={disabled}\n />\n <Label htmlFor={`${id}-${index}-required`} className=\"text-xs font-medium cursor-pointer\">\n {t('workflows.fieldEditors.formFields.requiredField')}\n </Label>\n </div>\n </div>\n\n {/* Delete Button */}\n <div className=\"border-t border-gray-200 pt-3\">\n <Button\n type=\"button\"\n variant=\"destructive\"\n size=\"sm\"\n onClick={() => removeFormField(index)}\n disabled={disabled}\n >\n <Trash2 className=\"size-4 mr-1\" />\n {t('workflows.fieldEditors.formFields.removeField')}\n </Button>\n </div>\n </div>\n )}\n </div>\n )\n })}\n </div>\n )}\n {ConfirmDialogElement}\n </div>\n )\n}\n"],
5
- "mappings": ";AAoHU,SACA,KADA;AAlHV,SAAS,gBAAgB;AACzB,SAAS,YAAY;AACrB,SAAS,wBAAwB;AACjC,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,OAAO,wBAAwB;AACxC,SAAS,aAAa,MAAM,cAAc;AA+BnC,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA,QAAQ,CAAC;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA,qBAAqB;AACvB,GAA8B;AAC5B,QAAM,IAAI,KAAK;AACf,QAAM,EAAE,SAAS,qBAAqB,IAAI,iBAAiB;AAC3D,QAAM,CAAC,iBAAiB,kBAAkB,IAAI,SAAsB,oBAAI,IAAI,CAAC;AAE7E,QAAM,aAAa,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC;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AA,aAC1G;AAAA,UAIF,oBAAC,SACC,+BAAC,SAAI,WAAU,2BACb;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,MAAK;AAAA,gBACL,IAAI,GAAG,EAAE,IAAI,KAAK;AAAA,gBAClB,SAAS,MAAM;AAAA,gBACf,UAAU,CAAC,MAAM,gBAAgB,OAAO,YAAY,EAAE,OAAO,OAAO;AAAA,gBACpE,WAAU;AAAA,gBACV;AAAA;AAAA,YACF;AAAA,YACA,oBAAC,SAAM,SAAS,GAAG,EAAE,IAAI,KAAK,aAAa,WAAU,sCAClD,YAAE,iDAAiD,GACtD;AAAA,aACF,GACF;AAAA,UAGA,oBAAC,SAAI,WAAU,iCACb;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,SAAS,MAAM,gBAAgB,KAAK;AAAA,cACpC;AAAA,cAEA;AAAA,oCAAC,UAAO,WAAU,eAAc;AAAA,gBAC/B,EAAE,+CAA+C;AAAA;AAAA;AAAA,UACpD,GACF;AAAA,WACF;AAAA,WA5LM,KA8LV;AAAA,IAEJ,CAAC,GACH;AAAA,IAED;AAAA,KACH;AAEJ;",
4
+ "sourcesContent": ["'use client'\n\nimport { useState } from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@open-mercato/ui/primitives/select'\nimport { Alert, AlertDescription } from '@open-mercato/ui/primitives/alert'\nimport { ChevronDown, Plus, Trash2 } from 'lucide-react'\nimport type { CrudCustomFieldRenderProps } from '@open-mercato/ui/backend/CrudForm'\n\n/**\n * Form field definition structure\n */\nexport interface FormField {\n name: string\n type: string\n label: string\n required: boolean\n placeholder?: string\n options?: string[]\n defaultValue?: string\n}\n\ninterface FormFieldArrayEditorProps extends CrudCustomFieldRenderProps {\n value: FormField[]\n isJsonSchemaFormat?: boolean\n}\n\n/**\n * FormFieldArrayEditor - Custom field component for managing UserTask form fields\n *\n * Provides an interface to add, edit, and remove form field definitions for user tasks.\n * Supports 12 field types with conditional options for select/radio types.\n *\n * Displays a warning banner if the form was converted from JSON Schema format.\n *\n * Used by NodeEditDialog (UserTask type only)\n */\nexport function FormFieldArrayEditor({\n id,\n value = [],\n error,\n setValue,\n disabled,\n isJsonSchemaFormat = false,\n}: FormFieldArrayEditorProps) {\n const t = useT()\n const { confirm, ConfirmDialogElement } = useConfirmDialog()\n const [expandedIndices, setExpandedIndices] = useState<Set<number>>(new Set())\n\n const formFields = Array.isArray(value) ? value : []\n\n const toggleExpanded = (index: number) => {\n const newExpanded = new Set(expandedIndices)\n if (newExpanded.has(index)) {\n newExpanded.delete(index)\n } else {\n newExpanded.add(index)\n }\n setExpandedIndices(newExpanded)\n }\n\n const addFormField = () => {\n const newField: FormField = {\n name: `field_${Date.now()}`,\n type: 'text',\n label: t('workflows.form.newField'),\n required: false,\n placeholder: '',\n }\n const newFields = [...formFields, newField]\n setValue(newFields)\n\n // Auto-expand the newly added field\n const newExpanded = new Set(expandedIndices)\n newExpanded.add(formFields.length)\n setExpandedIndices(newExpanded)\n }\n\n const removeFormField = async (index: number) => {\n const confirmed = await confirm({\n title: t('workflows.fieldEditors.formFields.removeField'),\n text: t('workflows.fieldEditors.formFields.confirmRemove'),\n variant: 'destructive',\n })\n if (!confirmed) return\n\n const newFields = formFields.filter((_, i) => i !== index)\n setValue(newFields)\n\n // Remove from expanded set\n const newExpanded = new Set(expandedIndices)\n newExpanded.delete(index)\n setExpandedIndices(newExpanded)\n }\n\n const updateFormField = (index: number, fieldKey: keyof FormField, fieldValue: any) => {\n const updated = [...formFields]\n updated[index] = { ...updated[index], [fieldKey]: fieldValue }\n setValue(updated)\n }\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <Label className=\"text-sm font-semibold\">{t('workflows.fieldEditors.formFields.title')} ({formFields.length})</Label>\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n {t('workflows.fieldEditors.formFields.description')}\n </p>\n {error && <p className=\"text-xs text-status-error-text mt-1\">{error}</p>}\n </div>\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={addFormField}\n disabled={disabled}\n className=\"w-full sm:w-auto\"\n >\n <Plus className=\"size-3 mr-1\" />\n {t('workflows.fieldEditors.formFields.addField')}\n </Button>\n </div>\n\n {/* JSON Schema Format Notice */}\n {isJsonSchemaFormat && (\n <Alert variant=\"info\">\n <AlertDescription className=\"text-xs\">\n {t('workflows.fieldEditors.formFields.jsonSchemaNotice')}\n </AlertDescription>\n </Alert>\n )}\n\n {formFields.length === 0 ? (\n <div className=\"p-4 text-center text-sm text-muted-foreground bg-muted rounded-lg border\">\n {t('workflows.fieldEditors.formFields.emptyState')}\n </div>\n ) : (\n <div className=\"space-y-2\">\n {formFields.map((field, index) => {\n const isExpanded = expandedIndices.has(index)\n return (\n <div key={index} className=\"border border-gray-200 rounded-lg bg-gray-50\">\n {/* Collapsed Header */}\n <button\n type=\"button\"\n onClick={() => toggleExpanded(index)}\n disabled={disabled}\n className=\"w-full px-4 py-3 text-left flex items-center justify-between hover:bg-gray-100 transition-colors rounded-t-lg disabled:opacity-50\"\n >\n <div className=\"flex-1\">\n <div className=\"flex flex-wrap items-center gap-2\">\n <span className=\"text-sm font-semibold text-gray-900\">\n {field.label || field.name}\n </span>\n <Badge variant=\"secondary\" className=\"text-xs\">\n {field.type}\n </Badge>\n {field.required && (\n <Badge variant=\"destructive\" className=\"text-xs text-white\">\n {t('workflows.form.required')}\n </Badge>\n )}\n </div>\n <p className=\"text-xs text-gray-600 mt-1\">\n Field name: <code className=\"bg-white px-1 rounded\">{field.name}</code>\n </p>\n </div>\n <ChevronDown\n className={`w-5 h-5 text-gray-400 transition-transform ${isExpanded ? 'rotate-180' : ''}`}\n />\n </button>\n\n {/* Expanded Content */}\n {isExpanded && (\n <div className=\"px-4 pb-4 space-y-3 border-t border-gray-200 bg-white\">\n {/* Field Name */}\n <div className=\"pt-3\">\n <Label htmlFor={`${id}-${index}-name`} className=\"text-xs font-medium mb-1\">\n {t('workflows.fieldEditors.formFields.fieldName')} *\n </Label>\n <Input\n id={`${id}-${index}-name`}\n type=\"text\"\n value={field.name}\n onChange={(e) => updateFormField(index, 'name', e.target.value)}\n placeholder={t('workflows.fieldEditors.formFields.fieldNamePlaceholder')}\n className=\"text-xs\"\n disabled={disabled}\n />\n <p className=\"text-xs text-muted-foreground mt-0.5\">{t('workflows.fieldEditors.formFields.fieldNameHint')}</p>\n </div>\n\n {/* Field Label */}\n <div>\n <Label htmlFor={`${id}-${index}-label`} className=\"text-xs font-medium mb-1\">\n {t('workflows.fieldEditors.formFields.fieldLabel')} *\n </Label>\n <Input\n id={`${id}-${index}-label`}\n type=\"text\"\n value={field.label}\n onChange={(e) => updateFormField(index, 'label', e.target.value)}\n placeholder={t('workflows.fieldEditors.formFields.fieldLabelPlaceholder')}\n className=\"text-xs\"\n disabled={disabled}\n />\n <p className=\"text-xs text-muted-foreground mt-0.5\">{t('workflows.fieldEditors.formFields.fieldLabelHint')}</p>\n </div>\n\n {/* Field Type */}\n <div>\n <Label htmlFor={`${id}-${index}-type`} className=\"text-xs font-medium mb-1\">\n {t('workflows.fieldEditors.formFields.fieldType')} *\n </Label>\n <Select\n value={field.type}\n onValueChange={(value) => updateFormField(index, 'type', value)}\n disabled={disabled}\n >\n <SelectTrigger id={`${id}-${index}-type`}>\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"text\">{t('workflows.form.fieldTypes.text')}</SelectItem>\n <SelectItem value=\"number\">{t('workflows.form.fieldTypes.number')}</SelectItem>\n <SelectItem value=\"email\">{t('workflows.form.fieldTypes.email')}</SelectItem>\n <SelectItem value=\"tel\">{t('workflows.form.fieldTypes.tel')}</SelectItem>\n <SelectItem value=\"url\">{t('workflows.form.fieldTypes.url')}</SelectItem>\n <SelectItem value=\"textarea\">{t('workflows.form.fieldTypes.textarea')}</SelectItem>\n <SelectItem value=\"select\">{t('workflows.form.fieldTypes.select')}</SelectItem>\n <SelectItem value=\"radio\">{t('workflows.form.fieldTypes.radio')}</SelectItem>\n <SelectItem value=\"checkbox\">{t('workflows.form.fieldTypes.checkbox')}</SelectItem>\n <SelectItem value=\"date\">{t('workflows.form.fieldTypes.date')}</SelectItem>\n <SelectItem value=\"time\">{t('workflows.form.fieldTypes.time')}</SelectItem>\n <SelectItem value=\"datetime-local\">{t('workflows.form.fieldTypes.datetime-local')}</SelectItem>\n </SelectContent>\n </Select>\n </div>\n\n {/* Placeholder */}\n <div>\n <Label htmlFor={`${id}-${index}-placeholder`} className=\"text-xs font-medium mb-1\">\n {t('workflows.fieldEditors.formFields.placeholder')}\n </Label>\n <Input\n id={`${id}-${index}-placeholder`}\n type=\"text\"\n value={field.placeholder || ''}\n onChange={(e) => updateFormField(index, 'placeholder', e.target.value)}\n placeholder={t('workflows.fieldEditors.formFields.placeholderPlaceholder')}\n className=\"text-xs\"\n disabled={disabled}\n />\n </div>\n\n {/* Default Value */}\n <div>\n <Label htmlFor={`${id}-${index}-defaultValue`} className=\"text-xs font-medium mb-1\">\n {t('workflows.fieldEditors.formFields.defaultValue')}\n </Label>\n <Input\n id={`${id}-${index}-defaultValue`}\n type=\"text\"\n value={field.defaultValue || ''}\n onChange={(e) => updateFormField(index, 'defaultValue', e.target.value)}\n placeholder={t('workflows.fieldEditors.formFields.defaultValuePlaceholder')}\n className=\"text-xs\"\n disabled={disabled}\n />\n </div>\n\n {/* Options (for select/radio) */}\n {(field.type === 'select' || field.type === 'radio') && (\n <div>\n <Label htmlFor={`${id}-${index}-options`} className=\"text-xs font-medium mb-1\">\n {t('workflows.fieldEditors.formFields.options')}\n </Label>\n <Input\n id={`${id}-${index}-options`}\n type=\"text\"\n value={field.options?.join(', ') || ''}\n onChange={(e) =>\n updateFormField(\n index,\n 'options',\n e.target.value\n .split(',')\n .map((o) => o.trim())\n .filter(Boolean)\n )\n }\n placeholder={t('workflows.fieldEditors.formFields.optionsPlaceholder')}\n className=\"text-xs\"\n disabled={disabled}\n />\n <p className=\"text-xs text-muted-foreground mt-0.5\">{t('workflows.fieldEditors.formFields.optionsHint')}</p>\n </div>\n )}\n\n {/* Required Checkbox */}\n <div>\n <div className=\"flex items-center gap-2\">\n <input\n type=\"checkbox\"\n id={`${id}-${index}-required`}\n checked={field.required}\n onChange={(e) => updateFormField(index, 'required', e.target.checked)}\n className=\"h-4 w-4 rounded border-gray-300 text-blue-600 focus-visible:ring-ring\"\n disabled={disabled}\n />\n <Label htmlFor={`${id}-${index}-required`} className=\"text-xs font-medium cursor-pointer\">\n {t('workflows.fieldEditors.formFields.requiredField')}\n </Label>\n </div>\n </div>\n\n {/* Delete Button */}\n <div className=\"border-t border-gray-200 pt-3\">\n <Button\n type=\"button\"\n variant=\"destructive\"\n size=\"sm\"\n onClick={() => removeFormField(index)}\n disabled={disabled}\n >\n <Trash2 className=\"size-4 mr-1\" />\n {t('workflows.fieldEditors.formFields.removeField')}\n </Button>\n </div>\n </div>\n )}\n </div>\n )\n })}\n </div>\n )}\n {ConfirmDialogElement}\n </div>\n )\n}\n"],
5
+ "mappings": ";AAoHU,SACA,KADA;AAlHV,SAAS,gBAAgB;AACzB,SAAS,YAAY;AACrB,SAAS,wBAAwB;AACjC,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,OAAO,wBAAwB;AACxC,SAAS,aAAa,MAAM,cAAc;AA+BnC,SAAS,qBAAqB;AAAA,EACnC;AAAA,EACA,QAAQ,CAAC;AAAA,EACT;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kBACA,EAAE,OAAO,MACN,MAAM,GAAG,EACT,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EACnB,OAAO,OAAO;AAAA,gBACnB;AAAA,gBAEF,aAAa,EAAE,sDAAsD;AAAA,gBACrE,WAAU;AAAA,gBACV;AAAA;AAAA,YACF;AAAA,YACA,oBAAC,OAAE,WAAU,wCAAwC,YAAE,+CAA+C,GAAE;AAAA,aAC1G;AAAA,UAIF,oBAAC,SACC,+BAAC,SAAI,WAAU,2BACb;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,MAAK;AAAA,gBACL,IAAI,GAAG,EAAE,IAAI,KAAK;AAAA,gBAClB,SAAS,MAAM;AAAA,gBACf,UAAU,CAAC,MAAM,gBAAgB,OAAO,YAAY,EAAE,OAAO,OAAO;AAAA,gBACpE,WAAU;AAAA,gBACV;AAAA;AAAA,YACF;AAAA,YACA,oBAAC,SAAM,SAAS,GAAG,EAAE,IAAI,KAAK,aAAa,WAAU,sCAClD,YAAE,iDAAiD,GACtD;AAAA,aACF,GACF;AAAA,UAGA,oBAAC,SAAI,WAAU,iCACb;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,SAAS,MAAM,gBAAgB,KAAK;AAAA,cACpC;AAAA,cAEA;AAAA,oCAAC,UAAO,WAAU,eAAc;AAAA,gBAC/B,EAAE,+CAA+C;AAAA;AAAA;AAAA,UACpD,GACF;AAAA,WACF;AAAA,WA5LM,KA8LV;AAAA,IAEJ,CAAC,GACH;AAAA,IAED;AAAA,KACH;AAEJ;",
6
6
  "names": ["value"]
7
7
  }
@@ -70,7 +70,7 @@ function MappingArrayEditor({
70
70
  ")"
71
71
  ] }),
72
72
  /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-0.5", children: description }),
73
- error && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-600 mt-1", children: error })
73
+ error && /* @__PURE__ */ jsx("p", { className: "text-xs text-status-error-text mt-1", children: error })
74
74
  ] }),
75
75
  /* @__PURE__ */ jsxs(
76
76
  Button,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/modules/workflows/components/fields/MappingArrayEditor.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport { useState } from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport { ChevronDown, Plus, Trash2 } from 'lucide-react'\nimport type { CrudCustomFieldRenderProps } from '@open-mercato/ui/backend/CrudForm'\n\n/**\n * Mapping definition structure for SubWorkflow input/output\n */\nexport interface Mapping {\n key: string\n value: string\n}\n\ninterface MappingArrayEditorProps extends CrudCustomFieldRenderProps {\n value: Mapping[]\n label?: string\n description?: string\n}\n\n/**\n * MappingArrayEditor - Custom field component for managing SubWorkflow input/output mappings\n *\n * Provides an interface to add, edit, and remove key-value pair mappings.\n * Values support template expressions like {{context.foo}} for dynamic data binding.\n *\n * Used by NodeEditDialog (SubWorkflow type only)\n */\nexport function MappingArrayEditor({\n id,\n value = [],\n error,\n setValue,\n disabled,\n label: labelProp,\n description: descriptionProp,\n}: MappingArrayEditorProps) {\n const t = useT()\n const { confirm, ConfirmDialogElement } = useConfirmDialog()\n const label = labelProp ?? t('workflows.fieldEditors.mappings.label')\n const description = descriptionProp ?? t('workflows.fieldEditors.mappings.description')\n const [expandedIndices, setExpandedIndices] = useState<Set<number>>(new Set())\n\n const mappings = Array.isArray(value) ? value : []\n\n const toggleExpanded = (index: number) => {\n const newExpanded = new Set(expandedIndices)\n if (newExpanded.has(index)) {\n newExpanded.delete(index)\n } else {\n newExpanded.add(index)\n }\n setExpandedIndices(newExpanded)\n }\n\n const addMapping = () => {\n const newMapping: Mapping = {\n key: `key_${Date.now()}`,\n value: '',\n }\n const newMappings = [...mappings, newMapping]\n setValue(newMappings)\n\n // Auto-expand the newly added mapping\n const newExpanded = new Set(expandedIndices)\n newExpanded.add(mappings.length)\n setExpandedIndices(newExpanded)\n }\n\n const removeMapping = async (index: number) => {\n const confirmed = await confirm({\n title: t('workflows.fieldEditors.mappings.removeMapping'),\n text: t('workflows.fieldEditors.mappings.confirmRemove'),\n variant: 'destructive',\n })\n if (!confirmed) return\n\n const newMappings = mappings.filter((_, i) => i !== index)\n setValue(newMappings)\n\n // Remove from expanded set\n const newExpanded = new Set(expandedIndices)\n newExpanded.delete(index)\n setExpandedIndices(newExpanded)\n }\n\n const updateMapping = (index: number, field: keyof Mapping, fieldValue: string) => {\n const updated = [...mappings]\n updated[index] = { ...updated[index], [field]: fieldValue }\n setValue(updated)\n }\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <Label className=\"text-sm font-semibold\">{label} ({mappings.length})</Label>\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n {description}\n </p>\n {error && <p className=\"text-xs text-red-600 mt-1\">{error}</p>}\n </div>\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={addMapping}\n disabled={disabled}\n className=\"w-full sm:w-auto\"\n >\n <Plus className=\"size-3 mr-1\" />\n {t('workflows.fieldEditors.mappings.addMapping')}\n </Button>\n </div>\n\n {mappings.length === 0 ? (\n <div className=\"p-4 text-center text-sm text-muted-foreground bg-muted rounded-lg border\">\n {t('workflows.fieldEditors.mappings.emptyState')}\n </div>\n ) : (\n <div className=\"space-y-2\">\n {mappings.map((mapping, index) => {\n const isExpanded = expandedIndices.has(index)\n return (\n <div key={index} className=\"border border-gray-200 rounded-lg bg-gray-50\">\n {/* Collapsed Header */}\n <button\n type=\"button\"\n onClick={() => toggleExpanded(index)}\n disabled={disabled}\n className=\"w-full px-4 py-3 text-left flex items-center justify-between hover:bg-gray-100 transition-colors rounded-t-lg disabled:opacity-50\"\n >\n <div className=\"flex-1\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm font-semibold text-gray-900\">\n {mapping.key || `Mapping ${index + 1}`}\n </span>\n </div>\n <p className=\"text-xs text-gray-600 mt-1 font-mono truncate\">\n {mapping.value ? (\n <>\n <span className=\"text-gray-400\">=</span> {mapping.value}\n </>\n ) : (\n <span className=\"text-gray-400 italic\">{t('workflows.common.noValueSet')}</span>\n )}\n </p>\n </div>\n <ChevronDown\n className={`w-5 h-5 text-gray-400 transition-transform ${isExpanded ? 'rotate-180' : ''}`}\n />\n </button>\n\n {/* Expanded Content */}\n {isExpanded && (\n <div className=\"px-4 pb-4 space-y-3 border-t border-gray-200 bg-white\">\n {/* Key Field */}\n <div className=\"pt-3\">\n <Label htmlFor={`${id}-${index}-key`} className=\"text-xs font-medium mb-1\">\n {t('workflows.fieldEditors.mappings.key')} *\n </Label>\n <Input\n id={`${id}-${index}-key`}\n type=\"text\"\n value={mapping.key}\n onChange={(e) => updateMapping(index, 'key', e.target.value)}\n placeholder={t('workflows.fieldEditors.mappings.keyPlaceholder')}\n className=\"text-xs\"\n disabled={disabled}\n />\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n {t('workflows.fieldEditors.mappings.keyHint')}\n </p>\n </div>\n\n {/* Value Field */}\n <div>\n <Label htmlFor={`${id}-${index}-value`} className=\"text-xs font-medium mb-1\">\n {t('workflows.fieldEditors.mappings.value')} *\n </Label>\n <Input\n id={`${id}-${index}-value`}\n type=\"text\"\n value={mapping.value}\n onChange={(e) => updateMapping(index, 'value', e.target.value)}\n placeholder={t('workflows.fieldEditors.mappings.valuePlaceholder')}\n className=\"text-xs font-mono\"\n disabled={disabled}\n />\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n {t('workflows.fieldEditors.mappings.valueHint')}\n </p>\n </div>\n\n {/* Delete Button */}\n <div className=\"border-t border-gray-200 pt-3\">\n <Button\n type=\"button\"\n variant=\"destructive\"\n size=\"sm\"\n onClick={() => removeMapping(index)}\n disabled={disabled}\n >\n <Trash2 className=\"size-4 mr-1\" />\n {t('workflows.fieldEditors.mappings.removeMapping')}\n </Button>\n </div>\n </div>\n )}\n </div>\n )\n })}\n </div>\n )}\n {ConfirmDialogElement}\n </div>\n )\n}\n"],
5
- "mappings": ";AAqGU,SA2Cc,UA1Cd,KADA;AAnGV,SAAS,gBAAgB;AACzB,SAAS,YAAY;AACrB,SAAS,wBAAwB;AACjC,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,aAAa,MAAM,cAAc;AAyBnC,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA,QAAQ,CAAC;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,aAAa;AACf,GAA4B;AAC1B,QAAM,IAAI,KAAK;AACf,QAAM,EAAE,SAAS,qBAAqB,IAAI,iBAAiB;AAC3D,QAAM,QAAQ,aAAa,EAAE,uCAAuC;AACpE,QAAM,cAAc,mBAAmB,EAAE,6CAA6C;AACtF,QAAM,CAAC,iBAAiB,kBAAkB,IAAI,SAAsB,oBAAI,IAAI,CAAC;AAE7E,QAAM,WAAW,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC;AAEjD,QAAM,iBAAiB,CAAC,UAAkB;AACxC,UAAM,cAAc,IAAI,IAAI,eAAe;AAC3C,QAAI,YAAY,IAAI,KAAK,GAAG;AAC1B,kBAAY,OAAO,KAAK;AAAA,IAC1B,OAAO;AACL,kBAAY,IAAI,KAAK;AAAA,IACvB;AACA,uBAAmB,WAAW;AAAA,EAChC;AAEA,QAAM,aAAa,MAAM;AACvB,UAAM,aAAsB;AAAA,MAC1B,KAAK,OAAO,KAAK,IAAI,CAAC;AAAA,MACtB,OAAO;AAAA,IACT;AACA,UAAM,cAAc,CAAC,GAAG,UAAU,UAAU;AAC5C,aAAS,WAAW;AAGpB,UAAM,cAAc,IAAI,IAAI,eAAe;AAC3C,gBAAY,IAAI,SAAS,MAAM;AAC/B,uBA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,EAAE,IAAI,KAAK,UAAU,WAAU,4BAC/C;AAAA,gBAAE,uCAAuC;AAAA,cAAE;AAAA,eAC9C;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,IAAI,GAAG,EAAE,IAAI,KAAK;AAAA,gBAClB,MAAK;AAAA,gBACL,OAAO,QAAQ;AAAA,gBACf,UAAU,CAAC,MAAM,cAAc,OAAO,SAAS,EAAE,OAAO,KAAK;AAAA,gBAC7D,aAAa,EAAE,kDAAkD;AAAA,gBACjE,WAAU;AAAA,gBACV;AAAA;AAAA,YACF;AAAA,YACA,oBAAC,OAAE,WAAU,wCACV,YAAE,2CAA2C,GAChD;AAAA,aACF;AAAA,UAGA,oBAAC,SAAI,WAAU,iCACb;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,SAAS,MAAM,cAAc,KAAK;AAAA,cAClC;AAAA,cAEA;AAAA,oCAAC,UAAO,WAAU,eAAc;AAAA,gBAC/B,EAAE,+CAA+C;AAAA;AAAA;AAAA,UACpD,GACF;AAAA,WACF;AAAA,WAnFM,KAqFV;AAAA,IAEJ,CAAC,GACH;AAAA,IAED;AAAA,KACH;AAEJ;",
4
+ "sourcesContent": ["'use client'\n\nimport { useState } from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Input } from '@open-mercato/ui/primitives/input'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport { ChevronDown, Plus, Trash2 } from 'lucide-react'\nimport type { CrudCustomFieldRenderProps } from '@open-mercato/ui/backend/CrudForm'\n\n/**\n * Mapping definition structure for SubWorkflow input/output\n */\nexport interface Mapping {\n key: string\n value: string\n}\n\ninterface MappingArrayEditorProps extends CrudCustomFieldRenderProps {\n value: Mapping[]\n label?: string\n description?: string\n}\n\n/**\n * MappingArrayEditor - Custom field component for managing SubWorkflow input/output mappings\n *\n * Provides an interface to add, edit, and remove key-value pair mappings.\n * Values support template expressions like {{context.foo}} for dynamic data binding.\n *\n * Used by NodeEditDialog (SubWorkflow type only)\n */\nexport function MappingArrayEditor({\n id,\n value = [],\n error,\n setValue,\n disabled,\n label: labelProp,\n description: descriptionProp,\n}: MappingArrayEditorProps) {\n const t = useT()\n const { confirm, ConfirmDialogElement } = useConfirmDialog()\n const label = labelProp ?? t('workflows.fieldEditors.mappings.label')\n const description = descriptionProp ?? t('workflows.fieldEditors.mappings.description')\n const [expandedIndices, setExpandedIndices] = useState<Set<number>>(new Set())\n\n const mappings = Array.isArray(value) ? value : []\n\n const toggleExpanded = (index: number) => {\n const newExpanded = new Set(expandedIndices)\n if (newExpanded.has(index)) {\n newExpanded.delete(index)\n } else {\n newExpanded.add(index)\n }\n setExpandedIndices(newExpanded)\n }\n\n const addMapping = () => {\n const newMapping: Mapping = {\n key: `key_${Date.now()}`,\n value: '',\n }\n const newMappings = [...mappings, newMapping]\n setValue(newMappings)\n\n // Auto-expand the newly added mapping\n const newExpanded = new Set(expandedIndices)\n newExpanded.add(mappings.length)\n setExpandedIndices(newExpanded)\n }\n\n const removeMapping = async (index: number) => {\n const confirmed = await confirm({\n title: t('workflows.fieldEditors.mappings.removeMapping'),\n text: t('workflows.fieldEditors.mappings.confirmRemove'),\n variant: 'destructive',\n })\n if (!confirmed) return\n\n const newMappings = mappings.filter((_, i) => i !== index)\n setValue(newMappings)\n\n // Remove from expanded set\n const newExpanded = new Set(expandedIndices)\n newExpanded.delete(index)\n setExpandedIndices(newExpanded)\n }\n\n const updateMapping = (index: number, field: keyof Mapping, fieldValue: string) => {\n const updated = [...mappings]\n updated[index] = { ...updated[index], [field]: fieldValue }\n setValue(updated)\n }\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <Label className=\"text-sm font-semibold\">{label} ({mappings.length})</Label>\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n {description}\n </p>\n {error && <p className=\"text-xs text-status-error-text mt-1\">{error}</p>}\n </div>\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={addMapping}\n disabled={disabled}\n className=\"w-full sm:w-auto\"\n >\n <Plus className=\"size-3 mr-1\" />\n {t('workflows.fieldEditors.mappings.addMapping')}\n </Button>\n </div>\n\n {mappings.length === 0 ? (\n <div className=\"p-4 text-center text-sm text-muted-foreground bg-muted rounded-lg border\">\n {t('workflows.fieldEditors.mappings.emptyState')}\n </div>\n ) : (\n <div className=\"space-y-2\">\n {mappings.map((mapping, index) => {\n const isExpanded = expandedIndices.has(index)\n return (\n <div key={index} className=\"border border-gray-200 rounded-lg bg-gray-50\">\n {/* Collapsed Header */}\n <button\n type=\"button\"\n onClick={() => toggleExpanded(index)}\n disabled={disabled}\n className=\"w-full px-4 py-3 text-left flex items-center justify-between hover:bg-gray-100 transition-colors rounded-t-lg disabled:opacity-50\"\n >\n <div className=\"flex-1\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm font-semibold text-gray-900\">\n {mapping.key || `Mapping ${index + 1}`}\n </span>\n </div>\n <p className=\"text-xs text-gray-600 mt-1 font-mono truncate\">\n {mapping.value ? (\n <>\n <span className=\"text-gray-400\">=</span> {mapping.value}\n </>\n ) : (\n <span className=\"text-gray-400 italic\">{t('workflows.common.noValueSet')}</span>\n )}\n </p>\n </div>\n <ChevronDown\n className={`w-5 h-5 text-gray-400 transition-transform ${isExpanded ? 'rotate-180' : ''}`}\n />\n </button>\n\n {/* Expanded Content */}\n {isExpanded && (\n <div className=\"px-4 pb-4 space-y-3 border-t border-gray-200 bg-white\">\n {/* Key Field */}\n <div className=\"pt-3\">\n <Label htmlFor={`${id}-${index}-key`} className=\"text-xs font-medium mb-1\">\n {t('workflows.fieldEditors.mappings.key')} *\n </Label>\n <Input\n id={`${id}-${index}-key`}\n type=\"text\"\n value={mapping.key}\n onChange={(e) => updateMapping(index, 'key', e.target.value)}\n placeholder={t('workflows.fieldEditors.mappings.keyPlaceholder')}\n className=\"text-xs\"\n disabled={disabled}\n />\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n {t('workflows.fieldEditors.mappings.keyHint')}\n </p>\n </div>\n\n {/* Value Field */}\n <div>\n <Label htmlFor={`${id}-${index}-value`} className=\"text-xs font-medium mb-1\">\n {t('workflows.fieldEditors.mappings.value')} *\n </Label>\n <Input\n id={`${id}-${index}-value`}\n type=\"text\"\n value={mapping.value}\n onChange={(e) => updateMapping(index, 'value', e.target.value)}\n placeholder={t('workflows.fieldEditors.mappings.valuePlaceholder')}\n className=\"text-xs font-mono\"\n disabled={disabled}\n />\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n {t('workflows.fieldEditors.mappings.valueHint')}\n </p>\n </div>\n\n {/* Delete Button */}\n <div className=\"border-t border-gray-200 pt-3\">\n <Button\n type=\"button\"\n variant=\"destructive\"\n size=\"sm\"\n onClick={() => removeMapping(index)}\n disabled={disabled}\n >\n <Trash2 className=\"size-4 mr-1\" />\n {t('workflows.fieldEditors.mappings.removeMapping')}\n </Button>\n </div>\n </div>\n )}\n </div>\n )\n })}\n </div>\n )}\n {ConfirmDialogElement}\n </div>\n )\n}\n"],
5
+ "mappings": ";AAqGU,SA2Cc,UA1Cd,KADA;AAnGV,SAAS,gBAAgB;AACzB,SAAS,YAAY;AACrB,SAAS,wBAAwB;AACjC,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,aAAa,MAAM,cAAc;AAyBnC,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA,QAAQ,CAAC;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,aAAa;AACf,GAA4B;AAC1B,QAAM,IAAI,KAAK;AACf,QAAM,EAAE,SAAS,qBAAqB,IAAI,iBAAiB;AAC3D,QAAM,QAAQ,aAAa,EAAE,uCAAuC;AACpE,QAAM,cAAc,mBAAmB,EAAE,6CAA6C;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EAAE,+CAA+C;AAAA;AAAA;AAAA,UACpD,GACF;AAAA,WACF;AAAA,WAnFM,KAqFV;AAAA,IAEJ,CAAC,GACH;AAAA,IAED;AAAA,KACH;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -248,7 +248,7 @@ function StartPreConditionsEditor({
248
248
  size: "sm",
249
249
  title: t("workflows.common.delete"),
250
250
  disabled,
251
- children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4 text-red-600" })
251
+ children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4 text-destructive" })
252
252
  }
253
253
  ),
254
254
  title: t("workflows.fieldEditors.preConditions.removePreCondition"),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/modules/workflows/components/fields/StartPreConditionsEditor.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport { useState, useEffect, useCallback } from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport { Textarea } from '@open-mercato/ui/primitives/textarea'\nimport { Plus, Trash2, AlertCircle, ChevronUp, ChevronDown } from 'lucide-react'\nimport { BusinessRulesSelector, type BusinessRule } from '../BusinessRulesSelector'\nimport { apiFetch } from '@open-mercato/ui/backend/utils/api'\nimport { EmptyState } from '@open-mercato/ui/backend/EmptyState'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { SwitchField } from '@open-mercato/ui/primitives/switch-field'\nimport { ConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('workflows')\n\n/**\n * StartPreCondition interface matching the schema in validators.ts\n */\nexport interface StartPreCondition {\n ruleId: string\n required: boolean\n validationMessage?: Record<string, string> // e.g., { en: 'Message', pl: 'Wiadomo\u015B\u0107' }\n}\n\ninterface StartPreConditionsEditorProps {\n value?: StartPreCondition[] | unknown\n setValue?: ((value: unknown) => void) | ((value: StartPreCondition[]) => void)\n disabled?: boolean\n}\n\ninterface ConditionWithDetails extends StartPreCondition {\n ruleName?: string\n ruleType?: string\n loading?: boolean\n error?: boolean\n}\n\n/**\n * LocalizedMessageTextarea - Textarea with local state that only updates parent on blur\n */\nfunction LocalizedMessageTextarea({\n value,\n onChange,\n disabled,\n id,\n placeholder,\n hint,\n}: {\n value: Record<string, string> | undefined\n onChange: (messages: Record<string, string>) => void\n disabled?: boolean\n id: string\n placeholder: string\n hint: string\n}) {\n const getValidationMessagesString = (messages: Record<string, string> | undefined): string => {\n if (!messages) return ''\n return Object.entries(messages)\n .filter(([_, msg]) => msg)\n .map(([locale, msg]) => `${locale}: ${msg}`)\n .join('\\n')\n }\n\n const parseValidationMessagesString = (str: string): Record<string, string> => {\n const result: Record<string, string> = {}\n str.split('\\n').forEach(line => {\n const match = line.match(/^(\\w+):\\s*(.*)$/)\n if (match) {\n result[match[1]] = match[2]\n }\n })\n return result\n }\n\n const [localValue, setLocalValue] = useState(() => getValidationMessagesString(value))\n\n // Update local value when external value changes\n useEffect(() => {\n setLocalValue(getValidationMessagesString(value))\n }, [value])\n\n const handleBlur = useCallback(() => {\n onChange(parseValidationMessagesString(localValue))\n }, [localValue, onChange])\n\n return (\n <>\n <Textarea\n id={id}\n value={localValue}\n onChange={(e) => setLocalValue(e.target.value)}\n onBlur={handleBlur}\n placeholder={placeholder}\n rows={2}\n className=\"mt-1 font-mono text-xs\"\n disabled={disabled}\n />\n <p className=\"text-xs text-muted-foreground mt-1\">\n {hint}\n </p>\n </>\n )\n}\n\n/**\n * StartPreConditionsEditor - Editor for START step pre-conditions\n *\n * Uses BusinessRulesSelector modal for selecting business rules (searchable).\n * Supports localized validation messages for each pre-condition.\n * Matches the style of TransitionsEditor and BusinessRuleConditionsEditor.\n */\nexport function StartPreConditionsEditor({\n value,\n setValue,\n disabled = false,\n}: StartPreConditionsEditorProps) {\n const t = useT()\n const [isModalOpen, setIsModalOpen] = useState(false)\n const [conditionsWithDetails, setConditionsWithDetails] = useState<ConditionWithDetails[]>([])\n\n // Safely cast value to StartPreCondition array\n const conditions: StartPreCondition[] = Array.isArray(value) ? value : []\n\n // Helper to call setValue with proper typing\n const updateValue = (newValue: StartPreCondition[]) => {\n if (setValue) {\n setValue(newValue)\n }\n }\n\n // Fetch rule details when conditions change\n useEffect(() => {\n const withDetails: ConditionWithDetails[] = conditions.map((c) => ({\n ...c,\n loading: true,\n }))\n setConditionsWithDetails(withDetails)\n\n // Fetch details for each rule\n conditions.forEach((condition, index) => {\n fetchRuleDetails(condition.ruleId, index)\n })\n }, [JSON.stringify(conditions.map(c => c.ruleId))])\n\n const fetchRuleDetails = async (ruleId: string, index: number) => {\n try {\n const params = new URLSearchParams({ ruleId, pageSize: '1' })\n const response = await apiFetch(`/api/business_rules/rules?${params.toString()}`)\n\n if (response.ok) {\n const data = await response.json()\n const rule = data.items?.[0] as BusinessRule | undefined\n\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: rule?.ruleName || ruleId,\n ruleType: rule?.ruleType,\n loading: false,\n error: !rule,\n }\n }\n return updated\n })\n } else {\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: ruleId,\n loading: false,\n error: true,\n }\n }\n return updated\n })\n }\n } catch (err) {\n logger.error('Failed to fetch rule details', { ruleId, err })\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: ruleId,\n loading: false,\n error: true,\n }\n }\n return updated\n })\n }\n }\n\n const addCondition = (ruleId: string, _rule: BusinessRule) => {\n const newCondition: StartPreCondition = {\n ruleId,\n required: true,\n validationMessage: { en: '' },\n }\n updateValue([...conditions, newCondition])\n setIsModalOpen(false)\n }\n\n const updateCondition = (index: number, updates: Partial<StartPreCondition>) => {\n const updated = [...conditions]\n updated[index] = { ...updated[index], ...updates }\n updateValue(updated)\n }\n\n const removeCondition = (index: number) => {\n updateValue(conditions.filter((_, i) => i !== index))\n }\n\n const moveCondition = (index: number, direction: 'up' | 'down') => {\n const newIndex = direction === 'up' ? index - 1 : index + 1\n if (newIndex < 0 || newIndex >= conditions.length) return\n\n const updated = [...conditions]\n const temp = updated[index]\n updated[index] = updated[newIndex]\n updated[newIndex] = temp\n updateValue(updated)\n }\n\n const getExcludedRuleIds = (): string[] => {\n return conditions.map((c) => c.ruleId)\n }\n\n return (\n <div className=\"space-y-4\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <p className=\"text-sm text-muted-foreground\">\n {t('workflows.fieldEditors.preConditions.description')}\n </p>\n </div>\n <Button\n type=\"button\"\n onClick={() => setIsModalOpen(true)}\n variant=\"outline\"\n size=\"sm\"\n disabled={disabled}\n className=\"w-full sm:w-auto\"\n >\n <Plus className=\"h-4 w-4 mr-1\" />\n {t('workflows.fieldEditors.preConditions.addRule')}\n </Button>\n </div>\n\n {conditions.length === 0 && (\n <EmptyState\n title={t('workflows.fieldEditors.preConditions.emptyTitle')}\n description={t('workflows.fieldEditors.preConditions.emptyDescription')}\n action={{ label: t('workflows.fieldEditors.preConditions.addRule'), onClick: () => setIsModalOpen(true), disabled }}\n />\n )}\n\n <div className=\"space-y-3\">\n {conditionsWithDetails.map((condition, index) => (\n <div key={index} className=\"border border-gray-200 rounded-lg bg-white p-4\">\n <div className=\"space-y-3\">\n {/* Header row with rule info and actions */}\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between\">\n <div className=\"flex-1 min-w-0\">\n {/* Rule Name/ID */}\n {condition.loading ? (\n <div className=\"flex items-center gap-2\">\n <Spinner size=\"sm\" />\n <span className=\"text-sm text-muted-foreground\">{t('workflows.common.loadingDetails')}</span>\n </div>\n ) : condition.error ? (\n <div className=\"flex items-center gap-2\">\n <AlertCircle className=\"size-4 text-amber-600\" />\n <div>\n <span className=\"text-sm font-semibold text-foreground\">{condition.ruleId}</span>\n <p className=\"text-xs text-amber-600\">{t('workflows.common.ruleNotFound')}</p>\n </div>\n </div>\n ) : (\n <div>\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm font-semibold text-foreground\">{condition.ruleName}</span>\n {condition.ruleType && (\n <Badge variant=\"secondary\" className=\"text-xs\">\n {condition.ruleType}\n </Badge>\n )}\n </div>\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n ID: <code className=\"bg-muted px-1 rounded font-mono\">{condition.ruleId}</code>\n </p>\n </div>\n )}\n </div>\n\n {/* Action buttons */}\n <div className=\"flex items-center gap-1 self-end sm:self-auto\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => moveCondition(index, 'up')}\n disabled={index === 0 || disabled}\n title={t('workflows.common.moveUp')}\n >\n <ChevronUp className=\"h-4 w-4\" />\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => moveCondition(index, 'down')}\n disabled={index === conditions.length - 1 || disabled}\n title={t('workflows.common.moveDown')}\n >\n <ChevronDown className=\"h-4 w-4\" />\n </Button>\n <ConfirmDialog\n trigger={\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n title={t('workflows.common.delete')}\n disabled={disabled}\n >\n <Trash2 className=\"h-4 w-4 text-red-600\" />\n </Button>\n }\n title={t('workflows.fieldEditors.preConditions.removePreCondition')}\n text={t('workflows.fieldEditors.preConditions.confirmRemove')}\n variant=\"destructive\"\n onConfirm={() => removeCondition(index)}\n />\n </div>\n </div>\n\n {/* Required toggle */}\n <SwitchField\n id={`precondition-${index}-required`}\n label={t('workflows.fieldEditors.preConditions.requiredLabel')}\n flip\n checked={conditions[index]?.required ?? true}\n onCheckedChange={(checked) => updateCondition(index, { required: checked })}\n disabled={disabled}\n />\n\n {/* Validation Messages */}\n <div>\n <Label htmlFor={`precondition-${index}-messages`} className=\"text-xs\">\n {t('workflows.fieldEditors.preConditions.validationMessages')}\n </Label>\n <LocalizedMessageTextarea\n id={`precondition-${index}-messages`}\n value={conditions[index]?.validationMessage}\n onChange={(messages) => updateCondition(index, { validationMessage: messages })}\n disabled={disabled}\n placeholder={t('workflows.fieldEditors.preConditions.validationMessagesPlaceholder')}\n hint={t('workflows.fieldEditors.preConditions.validationMessagesHint')}\n />\n </div>\n </div>\n </div>\n ))}\n </div>\n\n {/* Business Rules Selector Modal */}\n <BusinessRulesSelector\n isOpen={isModalOpen}\n onClose={() => setIsModalOpen(false)}\n onSelect={addCondition}\n excludeRuleIds={getExcludedRuleIds()}\n title={t('workflows.fieldEditors.preConditions.selectBusinessRule')}\n description={t('workflows.fieldEditors.preConditions.selectBusinessRuleDescription')}\n filterRuleType=\"GUARD\"\n onlyEnabled={true}\n />\n </div>\n )\n}\n"],
5
- "mappings": ";AA0FI,mBACE,KADF;AAxFJ,SAAS,UAAU,WAAW,mBAAmB;AACjD,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,MAAM,QAAQ,aAAa,WAAW,mBAAmB;AAClE,SAAS,6BAAgD;AACzD,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAE7B,MAAM,SAAS,aAAa,WAAW;AA2BvC,SAAS,yBAAyB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAOG;AACD,QAAM,8BAA8B,CAAC,aAAyD;AAC5F,QAAI,CAAC,SAAU,QAAO;AACtB,WAAO,OAAO,QAAQ,QAAQ,EAC3B,OAAO,CAAC,CAAC,GAAG,GAAG,MAAM,GAAG,EACxB,IAAI,CAAC,CAAC,QAAQ,GAAG,MAAM,GAAG,MAAM,KAAK,GAAG,EAAE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AAC,YAAY,gBAAgB,OAAO,EAAE,UAAU,QAAQ,CAAC;AAAA,UAC1E;AAAA;AAAA,MACF;AAAA,MAGA,qBAAC,SACC;AAAA,4BAAC,SAAM,SAAS,gBAAgB,KAAK,aAAa,WAAU,WACzD,YAAE,yDAAyD,GAC9D;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,IAAI,gBAAgB,KAAK;AAAA,YACzB,OAAO,WAAW,KAAK,GAAG;AAAA,YAC1B,UAAU,CAAC,aAAa,gBAAgB,OAAO,EAAE,mBAAmB,SAAS,CAAC;AAAA,YAC9E;AAAA,YACA,aAAa,EAAE,oEAAoE;AAAA,YACnF,MAAM,EAAE,6DAA6D;AAAA;AAAA,QACvE;AAAA,SACF;AAAA,OACF,KAtGQ,KAuGV,CACD,GACH;AAAA,IAGA;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ;AAAA,QACR,SAAS,MAAM,eAAe,KAAK;AAAA,QACnC,UAAU;AAAA,QACV,gBAAgB,mBAAmB;AAAA,QACnC,OAAO,EAAE,yDAAyD;AAAA,QAClE,aAAa,EAAE,oEAAoE;AAAA,QACnF,gBAAe;AAAA,QACf,aAAa;AAAA;AAAA,IACf;AAAA,KACF;AAEJ;",
4
+ "sourcesContent": ["'use client'\n\nimport { useState, useEffect, useCallback } from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport { Textarea } from '@open-mercato/ui/primitives/textarea'\nimport { Plus, Trash2, AlertCircle, ChevronUp, ChevronDown } from 'lucide-react'\nimport { BusinessRulesSelector, type BusinessRule } from '../BusinessRulesSelector'\nimport { apiFetch } from '@open-mercato/ui/backend/utils/api'\nimport { EmptyState } from '@open-mercato/ui/backend/EmptyState'\nimport { Spinner } from '@open-mercato/ui/primitives/spinner'\nimport { SwitchField } from '@open-mercato/ui/primitives/switch-field'\nimport { ConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('workflows')\n\n/**\n * StartPreCondition interface matching the schema in validators.ts\n */\nexport interface StartPreCondition {\n ruleId: string\n required: boolean\n validationMessage?: Record<string, string> // e.g., { en: 'Message', pl: 'Wiadomo\u015B\u0107' }\n}\n\ninterface StartPreConditionsEditorProps {\n value?: StartPreCondition[] | unknown\n setValue?: ((value: unknown) => void) | ((value: StartPreCondition[]) => void)\n disabled?: boolean\n}\n\ninterface ConditionWithDetails extends StartPreCondition {\n ruleName?: string\n ruleType?: string\n loading?: boolean\n error?: boolean\n}\n\n/**\n * LocalizedMessageTextarea - Textarea with local state that only updates parent on blur\n */\nfunction LocalizedMessageTextarea({\n value,\n onChange,\n disabled,\n id,\n placeholder,\n hint,\n}: {\n value: Record<string, string> | undefined\n onChange: (messages: Record<string, string>) => void\n disabled?: boolean\n id: string\n placeholder: string\n hint: string\n}) {\n const getValidationMessagesString = (messages: Record<string, string> | undefined): string => {\n if (!messages) return ''\n return Object.entries(messages)\n .filter(([_, msg]) => msg)\n .map(([locale, msg]) => `${locale}: ${msg}`)\n .join('\\n')\n }\n\n const parseValidationMessagesString = (str: string): Record<string, string> => {\n const result: Record<string, string> = {}\n str.split('\\n').forEach(line => {\n const match = line.match(/^(\\w+):\\s*(.*)$/)\n if (match) {\n result[match[1]] = match[2]\n }\n })\n return result\n }\n\n const [localValue, setLocalValue] = useState(() => getValidationMessagesString(value))\n\n // Update local value when external value changes\n useEffect(() => {\n setLocalValue(getValidationMessagesString(value))\n }, [value])\n\n const handleBlur = useCallback(() => {\n onChange(parseValidationMessagesString(localValue))\n }, [localValue, onChange])\n\n return (\n <>\n <Textarea\n id={id}\n value={localValue}\n onChange={(e) => setLocalValue(e.target.value)}\n onBlur={handleBlur}\n placeholder={placeholder}\n rows={2}\n className=\"mt-1 font-mono text-xs\"\n disabled={disabled}\n />\n <p className=\"text-xs text-muted-foreground mt-1\">\n {hint}\n </p>\n </>\n )\n}\n\n/**\n * StartPreConditionsEditor - Editor for START step pre-conditions\n *\n * Uses BusinessRulesSelector modal for selecting business rules (searchable).\n * Supports localized validation messages for each pre-condition.\n * Matches the style of TransitionsEditor and BusinessRuleConditionsEditor.\n */\nexport function StartPreConditionsEditor({\n value,\n setValue,\n disabled = false,\n}: StartPreConditionsEditorProps) {\n const t = useT()\n const [isModalOpen, setIsModalOpen] = useState(false)\n const [conditionsWithDetails, setConditionsWithDetails] = useState<ConditionWithDetails[]>([])\n\n // Safely cast value to StartPreCondition array\n const conditions: StartPreCondition[] = Array.isArray(value) ? value : []\n\n // Helper to call setValue with proper typing\n const updateValue = (newValue: StartPreCondition[]) => {\n if (setValue) {\n setValue(newValue)\n }\n }\n\n // Fetch rule details when conditions change\n useEffect(() => {\n const withDetails: ConditionWithDetails[] = conditions.map((c) => ({\n ...c,\n loading: true,\n }))\n setConditionsWithDetails(withDetails)\n\n // Fetch details for each rule\n conditions.forEach((condition, index) => {\n fetchRuleDetails(condition.ruleId, index)\n })\n }, [JSON.stringify(conditions.map(c => c.ruleId))])\n\n const fetchRuleDetails = async (ruleId: string, index: number) => {\n try {\n const params = new URLSearchParams({ ruleId, pageSize: '1' })\n const response = await apiFetch(`/api/business_rules/rules?${params.toString()}`)\n\n if (response.ok) {\n const data = await response.json()\n const rule = data.items?.[0] as BusinessRule | undefined\n\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: rule?.ruleName || ruleId,\n ruleType: rule?.ruleType,\n loading: false,\n error: !rule,\n }\n }\n return updated\n })\n } else {\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: ruleId,\n loading: false,\n error: true,\n }\n }\n return updated\n })\n }\n } catch (err) {\n logger.error('Failed to fetch rule details', { ruleId, err })\n setConditionsWithDetails((prev) => {\n const updated = [...prev]\n if (updated[index]) {\n updated[index] = {\n ...updated[index],\n ruleName: ruleId,\n loading: false,\n error: true,\n }\n }\n return updated\n })\n }\n }\n\n const addCondition = (ruleId: string, _rule: BusinessRule) => {\n const newCondition: StartPreCondition = {\n ruleId,\n required: true,\n validationMessage: { en: '' },\n }\n updateValue([...conditions, newCondition])\n setIsModalOpen(false)\n }\n\n const updateCondition = (index: number, updates: Partial<StartPreCondition>) => {\n const updated = [...conditions]\n updated[index] = { ...updated[index], ...updates }\n updateValue(updated)\n }\n\n const removeCondition = (index: number) => {\n updateValue(conditions.filter((_, i) => i !== index))\n }\n\n const moveCondition = (index: number, direction: 'up' | 'down') => {\n const newIndex = direction === 'up' ? index - 1 : index + 1\n if (newIndex < 0 || newIndex >= conditions.length) return\n\n const updated = [...conditions]\n const temp = updated[index]\n updated[index] = updated[newIndex]\n updated[newIndex] = temp\n updateValue(updated)\n }\n\n const getExcludedRuleIds = (): string[] => {\n return conditions.map((c) => c.ruleId)\n }\n\n return (\n <div className=\"space-y-4\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n <div>\n <p className=\"text-sm text-muted-foreground\">\n {t('workflows.fieldEditors.preConditions.description')}\n </p>\n </div>\n <Button\n type=\"button\"\n onClick={() => setIsModalOpen(true)}\n variant=\"outline\"\n size=\"sm\"\n disabled={disabled}\n className=\"w-full sm:w-auto\"\n >\n <Plus className=\"h-4 w-4 mr-1\" />\n {t('workflows.fieldEditors.preConditions.addRule')}\n </Button>\n </div>\n\n {conditions.length === 0 && (\n <EmptyState\n title={t('workflows.fieldEditors.preConditions.emptyTitle')}\n description={t('workflows.fieldEditors.preConditions.emptyDescription')}\n action={{ label: t('workflows.fieldEditors.preConditions.addRule'), onClick: () => setIsModalOpen(true), disabled }}\n />\n )}\n\n <div className=\"space-y-3\">\n {conditionsWithDetails.map((condition, index) => (\n <div key={index} className=\"border border-gray-200 rounded-lg bg-white p-4\">\n <div className=\"space-y-3\">\n {/* Header row with rule info and actions */}\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between\">\n <div className=\"flex-1 min-w-0\">\n {/* Rule Name/ID */}\n {condition.loading ? (\n <div className=\"flex items-center gap-2\">\n <Spinner size=\"sm\" />\n <span className=\"text-sm text-muted-foreground\">{t('workflows.common.loadingDetails')}</span>\n </div>\n ) : condition.error ? (\n <div className=\"flex items-center gap-2\">\n <AlertCircle className=\"size-4 text-amber-600\" />\n <div>\n <span className=\"text-sm font-semibold text-foreground\">{condition.ruleId}</span>\n <p className=\"text-xs text-amber-600\">{t('workflows.common.ruleNotFound')}</p>\n </div>\n </div>\n ) : (\n <div>\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm font-semibold text-foreground\">{condition.ruleName}</span>\n {condition.ruleType && (\n <Badge variant=\"secondary\" className=\"text-xs\">\n {condition.ruleType}\n </Badge>\n )}\n </div>\n <p className=\"text-xs text-muted-foreground mt-0.5\">\n ID: <code className=\"bg-muted px-1 rounded font-mono\">{condition.ruleId}</code>\n </p>\n </div>\n )}\n </div>\n\n {/* Action buttons */}\n <div className=\"flex items-center gap-1 self-end sm:self-auto\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => moveCondition(index, 'up')}\n disabled={index === 0 || disabled}\n title={t('workflows.common.moveUp')}\n >\n <ChevronUp className=\"h-4 w-4\" />\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => moveCondition(index, 'down')}\n disabled={index === conditions.length - 1 || disabled}\n title={t('workflows.common.moveDown')}\n >\n <ChevronDown className=\"h-4 w-4\" />\n </Button>\n <ConfirmDialog\n trigger={\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n title={t('workflows.common.delete')}\n disabled={disabled}\n >\n <Trash2 className=\"h-4 w-4 text-destructive\" />\n </Button>\n }\n title={t('workflows.fieldEditors.preConditions.removePreCondition')}\n text={t('workflows.fieldEditors.preConditions.confirmRemove')}\n variant=\"destructive\"\n onConfirm={() => removeCondition(index)}\n />\n </div>\n </div>\n\n {/* Required toggle */}\n <SwitchField\n id={`precondition-${index}-required`}\n label={t('workflows.fieldEditors.preConditions.requiredLabel')}\n flip\n checked={conditions[index]?.required ?? true}\n onCheckedChange={(checked) => updateCondition(index, { required: checked })}\n disabled={disabled}\n />\n\n {/* Validation Messages */}\n <div>\n <Label htmlFor={`precondition-${index}-messages`} className=\"text-xs\">\n {t('workflows.fieldEditors.preConditions.validationMessages')}\n </Label>\n <LocalizedMessageTextarea\n id={`precondition-${index}-messages`}\n value={conditions[index]?.validationMessage}\n onChange={(messages) => updateCondition(index, { validationMessage: messages })}\n disabled={disabled}\n placeholder={t('workflows.fieldEditors.preConditions.validationMessagesPlaceholder')}\n hint={t('workflows.fieldEditors.preConditions.validationMessagesHint')}\n />\n </div>\n </div>\n </div>\n ))}\n </div>\n\n {/* Business Rules Selector Modal */}\n <BusinessRulesSelector\n isOpen={isModalOpen}\n onClose={() => setIsModalOpen(false)}\n onSelect={addCondition}\n excludeRuleIds={getExcludedRuleIds()}\n title={t('workflows.fieldEditors.preConditions.selectBusinessRule')}\n description={t('workflows.fieldEditors.preConditions.selectBusinessRuleDescription')}\n filterRuleType=\"GUARD\"\n onlyEnabled={true}\n />\n </div>\n )\n}\n"],
5
+ "mappings": ";AA0FI,mBACE,KADF;AAxFJ,SAAS,UAAU,WAAW,mBAAmB;AACjD,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,MAAM,QAAQ,aAAa,WAAW,mBAAmB;AAClE,SAAS,6BAAgD;AACzD,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAE7B,MAAM,SAAS,aAAa,WAAW;AA2BvC,SAAS,yBAAyB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AA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AQ;AAAA,cACR,WAAW,MAAM,gBAAgB,KAAK;AAAA;AAAA,UACxC;AAAA,WACF;AAAA,SACF;AAAA,MAGA;AAAA,QAAC;AAAA;AAAA,UACC,IAAI,gBAAgB,KAAK;AAAA,UACzB,OAAO,EAAE,oDAAoD;AAAA,UAC7D,MAAI;AAAA,UACJ,SAAS,WAAW,KAAK,GAAG,YAAY;AAAA,UACxC,iBAAiB,CAAC,YAAY,gBAAgB,OAAO,EAAE,UAAU,QAAQ,CAAC;AAAA,UAC1E;AAAA;AAAA,MACF;AAAA,MAGA,qBAAC,SACC;AAAA,4BAAC,SAAM,SAAS,gBAAgB,KAAK,aAAa,WAAU,WACzD,YAAE,yDAAyD,GAC9D;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,IAAI,gBAAgB,KAAK;AAAA,YACzB,OAAO,WAAW,KAAK,GAAG;AAAA,YAC1B,UAAU,CAAC,aAAa,gBAAgB,OAAO,EAAE,mBAAmB,SAAS,CAAC;AAAA,YAC9E;AAAA,YACA,aAAa,EAAE,oEAAoE;AAAA,YACnF,MAAM,EAAE,6DAA6D;AAAA;AAAA,QACvE;AAAA,SACF;AAAA,OACF,KAtGQ,KAuGV,CACD,GACH;AAAA,IAGA;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ;AAAA,QACR,SAAS,MAAM,eAAe,KAAK;AAAA,QACnC,UAAU;AAAA,QACV,gBAAgB,mBAAmB;AAAA,QACnC,OAAO,EAAE,yDAAyD;AAAA,QAClE,aAAa,EAAE,oEAAoE;AAAA,QACnF,gBAAe;AAAA,QACf,aAAa;AAAA;AAAA,IACf;AAAA,KACF;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -85,7 +85,7 @@ function WorkflowSelectorField({
85
85
  /* @__PURE__ */ jsxs("div", { children: [
86
86
  /* @__PURE__ */ jsx(Label, { htmlFor: id, className: "text-sm font-medium", children: label }),
87
87
  /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-0.5", children: description }),
88
- error && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-600 mt-1", children: error })
88
+ error && /* @__PURE__ */ jsx("p", { className: "text-xs text-status-error-text mt-1", children: error })
89
89
  ] }),
90
90
  !workflowId ? (
91
91
  /* No Workflow Selected */
@@ -114,10 +114,10 @@ function WorkflowSelectorField({
114
114
  /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: t("workflows.common.loadingDetails") })
115
115
  ] }) : workflowDetails?.error ? /* @__PURE__ */ jsxs(Fragment, { children: [
116
116
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
117
- /* @__PURE__ */ jsx(AlertCircle, { className: "size-4 text-yellow-600" }),
117
+ /* @__PURE__ */ jsx(AlertCircle, { className: "size-4 text-status-warning-text" }),
118
118
  /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold text-gray-900", children: workflowId })
119
119
  ] }),
120
- /* @__PURE__ */ jsx("p", { className: "text-xs text-yellow-600", children: t("workflows.common.workflowNotFoundOrUnavailable") })
120
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-status-warning-text", children: t("workflows.common.workflowNotFoundOrUnavailable") })
121
121
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
122
122
  /* @__PURE__ */ jsxs("div", { children: [
123
123
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
@@ -126,7 +126,7 @@ function WorkflowSelectorField({
126
126
  "v",
127
127
  workflowDetails.version
128
128
  ] }),
129
- workflowDetails?.enabled !== void 0 && (workflowDetails.enabled ? /* @__PURE__ */ jsx(Badge, { variant: "default", className: "bg-emerald-500 text-xs", children: t("common.enabled") }) : /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: t("common.disabled") }))
129
+ workflowDetails?.enabled !== void 0 && (workflowDetails.enabled ? /* @__PURE__ */ jsx(Badge, { variant: "default", className: "bg-status-success-solid text-status-success-solid-foreground text-xs", children: t("common.enabled") }) : /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: t("common.disabled") }))
130
130
  ] }),
131
131
  /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground font-mono mt-0.5", children: workflowId })
132
132
  ] }),