@open-mercato/core 0.6.3-develop.3876.1.d40fe4ec2d → 0.6.3-develop.3894.1.352abf4240

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 (140) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/modules/attachments/api/file/[id]/route.js +7 -2
  3. package/dist/modules/attachments/api/file/[id]/route.js.map +2 -2
  4. package/dist/modules/attachments/api/image/[id]/[[...slug]]/route.js +7 -4
  5. package/dist/modules/attachments/api/image/[id]/[[...slug]]/route.js.map +2 -2
  6. package/dist/modules/audit_logs/services/accessLogService.js +127 -8
  7. package/dist/modules/audit_logs/services/accessLogService.js.map +2 -2
  8. package/dist/modules/auth/backend/auth/profile/page.js +1 -1
  9. package/dist/modules/auth/backend/auth/profile/page.js.map +2 -2
  10. package/dist/modules/auth/backend/profile/change-password/page.js +1 -1
  11. package/dist/modules/auth/backend/profile/change-password/page.js.map +2 -2
  12. package/dist/modules/auth/backend/users/[id]/edit/page.js +1 -1
  13. package/dist/modules/auth/backend/users/[id]/edit/page.js.map +2 -2
  14. package/dist/modules/auth/backend/users/create/page.js +6 -1
  15. package/dist/modules/auth/backend/users/create/page.js.map +2 -2
  16. package/dist/modules/auth/di.js +17 -3
  17. package/dist/modules/auth/di.js.map +2 -2
  18. package/dist/modules/auth/services/rbacDefaultCache.js +110 -0
  19. package/dist/modules/auth/services/rbacDefaultCache.js.map +7 -0
  20. package/dist/modules/catalog/backend/catalog/products/[id]/page.js +8 -1
  21. package/dist/modules/catalog/backend/catalog/products/[id]/page.js.map +2 -2
  22. package/dist/modules/catalog/backend/catalog/products/[productId]/variants/[variantId]/page.js +3 -2
  23. package/dist/modules/catalog/backend/catalog/products/[productId]/variants/[variantId]/page.js.map +2 -2
  24. package/dist/modules/catalog/backend/catalog/products/[productId]/variants/create/page.js +3 -2
  25. package/dist/modules/catalog/backend/catalog/products/[productId]/variants/create/page.js.map +2 -2
  26. package/dist/modules/configs/cli.js +27 -14
  27. package/dist/modules/configs/cli.js.map +2 -2
  28. package/dist/modules/currencies/api/currencies/route.js +3 -4
  29. package/dist/modules/currencies/api/currencies/route.js.map +2 -2
  30. package/dist/modules/currencies/api/exchange-rates/route.js +3 -4
  31. package/dist/modules/currencies/api/exchange-rates/route.js.map +2 -2
  32. package/dist/modules/customers/api/people/route.js +26 -24
  33. package/dist/modules/customers/api/people/route.js.map +2 -2
  34. package/dist/modules/directory/subscribers/invalidateOrgScopeCache.js +26 -0
  35. package/dist/modules/directory/subscribers/invalidateOrgScopeCache.js.map +7 -0
  36. package/dist/modules/directory/utils/organizationScope.js +85 -0
  37. package/dist/modules/directory/utils/organizationScope.js.map +2 -2
  38. package/dist/modules/resources/backend/resources/resource-types/[id]/edit/page.js +1 -1
  39. package/dist/modules/resources/backend/resources/resource-types/[id]/edit/page.js.map +2 -2
  40. package/dist/modules/sales/backend/sales/channels/[channelId]/edit/page.js +1 -1
  41. package/dist/modules/sales/backend/sales/channels/[channelId]/edit/page.js.map +2 -2
  42. package/dist/modules/sales/components/channels/ChannelOfferForm.js +1 -1
  43. package/dist/modules/sales/components/channels/ChannelOfferForm.js.map +2 -2
  44. package/dist/modules/workflows/backend/definitions/[id]/page.js +2 -1
  45. package/dist/modules/workflows/backend/definitions/[id]/page.js.map +2 -2
  46. package/dist/modules/workflows/backend/definitions/create/page.js +4 -2
  47. package/dist/modules/workflows/backend/definitions/create/page.js.map +2 -2
  48. package/dist/modules/workflows/backend/definitions/visual-editor/page.js +20 -3
  49. package/dist/modules/workflows/backend/definitions/visual-editor/page.js.map +2 -2
  50. package/dist/modules/workflows/components/ActivitiesEditor.js +34 -1
  51. package/dist/modules/workflows/components/ActivitiesEditor.js.map +2 -2
  52. package/dist/modules/workflows/components/NodeEditDialog.js +153 -17
  53. package/dist/modules/workflows/components/NodeEditDialog.js.map +2 -2
  54. package/dist/modules/workflows/components/StepsEditor.js +31 -0
  55. package/dist/modules/workflows/components/StepsEditor.js.map +2 -2
  56. package/dist/modules/workflows/components/WorkflowGraph.js +3 -2
  57. package/dist/modules/workflows/components/WorkflowGraph.js.map +2 -2
  58. package/dist/modules/workflows/components/nodes/WaitForTimerNode.js +54 -0
  59. package/dist/modules/workflows/components/nodes/WaitForTimerNode.js.map +7 -0
  60. package/dist/modules/workflows/components/nodes/index.js +3 -1
  61. package/dist/modules/workflows/components/nodes/index.js.map +2 -2
  62. package/dist/modules/workflows/data/validators.js +117 -0
  63. package/dist/modules/workflows/data/validators.js.map +2 -2
  64. package/dist/modules/workflows/di.js +5 -1
  65. package/dist/modules/workflows/di.js.map +2 -2
  66. package/dist/modules/workflows/lib/activity-executor.js +42 -1
  67. package/dist/modules/workflows/lib/activity-executor.js.map +2 -2
  68. package/dist/modules/workflows/lib/activity-queue-types.js.map +2 -2
  69. package/dist/modules/workflows/lib/activity-worker-handler.js +24 -0
  70. package/dist/modules/workflows/lib/activity-worker-handler.js.map +2 -2
  71. package/dist/modules/workflows/lib/duration.js +32 -0
  72. package/dist/modules/workflows/lib/duration.js.map +7 -0
  73. package/dist/modules/workflows/lib/event-logger.js +1 -0
  74. package/dist/modules/workflows/lib/event-logger.js.map +2 -2
  75. package/dist/modules/workflows/lib/format-validation-error.js +12 -0
  76. package/dist/modules/workflows/lib/format-validation-error.js.map +7 -0
  77. package/dist/modules/workflows/lib/graph-utils.js +6 -3
  78. package/dist/modules/workflows/lib/graph-utils.js.map +2 -2
  79. package/dist/modules/workflows/lib/node-type-icons.js +9 -5
  80. package/dist/modules/workflows/lib/node-type-icons.js.map +2 -2
  81. package/dist/modules/workflows/lib/signal-handler.js +55 -23
  82. package/dist/modules/workflows/lib/signal-handler.js.map +2 -2
  83. package/dist/modules/workflows/lib/step-handler.js +79 -29
  84. package/dist/modules/workflows/lib/step-handler.js.map +2 -2
  85. package/dist/modules/workflows/lib/timer-handler.js +159 -0
  86. package/dist/modules/workflows/lib/timer-handler.js.map +7 -0
  87. package/dist/modules/workflows/lib/workflow-executor.js +1 -1
  88. package/dist/modules/workflows/lib/workflow-executor.js.map +2 -2
  89. package/dist/modules/workflows/workers/workflow-activities.worker.js +20 -4
  90. package/dist/modules/workflows/workers/workflow-activities.worker.js.map +2 -2
  91. package/package.json +7 -7
  92. package/src/modules/attachments/api/file/[id]/route.ts +7 -2
  93. package/src/modules/attachments/api/image/[id]/[[...slug]]/route.ts +7 -4
  94. package/src/modules/audit_logs/services/accessLogService.ts +179 -15
  95. package/src/modules/auth/backend/auth/profile/page.tsx +1 -1
  96. package/src/modules/auth/backend/profile/change-password/page.tsx +1 -1
  97. package/src/modules/auth/backend/users/[id]/edit/page.tsx +1 -1
  98. package/src/modules/auth/backend/users/create/page.tsx +6 -1
  99. package/src/modules/auth/di.ts +26 -3
  100. package/src/modules/auth/services/rbacDefaultCache.ts +145 -0
  101. package/src/modules/catalog/backend/catalog/products/[id]/page.tsx +8 -1
  102. package/src/modules/catalog/backend/catalog/products/[productId]/variants/[variantId]/page.tsx +3 -2
  103. package/src/modules/catalog/backend/catalog/products/[productId]/variants/create/page.tsx +3 -2
  104. package/src/modules/configs/cli.ts +34 -13
  105. package/src/modules/currencies/api/currencies/route.ts +3 -4
  106. package/src/modules/currencies/api/exchange-rates/route.ts +3 -4
  107. package/src/modules/customers/api/people/route.ts +27 -25
  108. package/src/modules/directory/subscribers/invalidateOrgScopeCache.ts +39 -0
  109. package/src/modules/directory/utils/organizationScope.ts +121 -0
  110. package/src/modules/resources/backend/resources/resource-types/[id]/edit/page.tsx +1 -1
  111. package/src/modules/sales/backend/sales/channels/[channelId]/edit/page.tsx +1 -1
  112. package/src/modules/sales/components/channels/ChannelOfferForm.tsx +1 -1
  113. package/src/modules/workflows/backend/definitions/[id]/page.tsx +3 -2
  114. package/src/modules/workflows/backend/definitions/create/page.tsx +4 -2
  115. package/src/modules/workflows/backend/definitions/visual-editor/page.tsx +18 -1
  116. package/src/modules/workflows/components/ActivitiesEditor.tsx +40 -0
  117. package/src/modules/workflows/components/NodeEditDialog.tsx +218 -30
  118. package/src/modules/workflows/components/StepsEditor.tsx +36 -0
  119. package/src/modules/workflows/components/WorkflowGraph.tsx +2 -1
  120. package/src/modules/workflows/components/nodes/WaitForTimerNode.tsx +70 -0
  121. package/src/modules/workflows/components/nodes/index.ts +3 -0
  122. package/src/modules/workflows/data/validators.ts +121 -0
  123. package/src/modules/workflows/di.ts +4 -0
  124. package/src/modules/workflows/i18n/de.json +10 -1
  125. package/src/modules/workflows/i18n/en.json +10 -1
  126. package/src/modules/workflows/i18n/es.json +10 -1
  127. package/src/modules/workflows/i18n/pl.json +10 -1
  128. package/src/modules/workflows/lib/activity-executor.ts +86 -2
  129. package/src/modules/workflows/lib/activity-queue-types.ts +18 -11
  130. package/src/modules/workflows/lib/activity-worker-handler.ts +29 -0
  131. package/src/modules/workflows/lib/duration.ts +51 -0
  132. package/src/modules/workflows/lib/event-logger.ts +1 -0
  133. package/src/modules/workflows/lib/format-validation-error.ts +30 -0
  134. package/src/modules/workflows/lib/graph-utils.ts +3 -0
  135. package/src/modules/workflows/lib/node-type-icons.ts +6 -2
  136. package/src/modules/workflows/lib/signal-handler.ts +62 -24
  137. package/src/modules/workflows/lib/step-handler.ts +107 -50
  138. package/src/modules/workflows/lib/timer-handler.ts +213 -0
  139. package/src/modules/workflows/lib/workflow-executor.ts +1 -1
  140. package/src/modules/workflows/workers/workflow-activities.worker.ts +33 -7
@@ -247,7 +247,40 @@ function ActivitiesEditor({ value = [], onChange, error }) {
247
247
  )
248
248
  ] })
249
249
  ] }),
250
- /* @__PURE__ */ jsxs("div", { children: [
250
+ activity.activityType === "WAIT" && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
251
+ /* @__PURE__ */ jsxs("div", { children: [
252
+ /* @__PURE__ */ jsx(Label, { htmlFor: `activity-${index}-duration`, className: "text-xs", children: t("workflows.activities.waitDuration") }),
253
+ /* @__PURE__ */ jsx(
254
+ Input,
255
+ {
256
+ id: `activity-${index}-duration`,
257
+ value: activity.config?.duration || "",
258
+ onChange: (e) => updateActivity(index, "config", { ...activity.config, duration: e.target.value, until: void 0 }),
259
+ placeholder: t("workflows.activities.waitDurationPlaceholder"),
260
+ disabled: !!activity.config?.until,
261
+ className: "mt-1"
262
+ }
263
+ ),
264
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-1", children: t("workflows.activities.waitDurationDescription") })
265
+ ] }),
266
+ /* @__PURE__ */ jsx("div", { className: "text-xs text-center text-muted-foreground", children: t("workflows.activities.waitOr") }),
267
+ /* @__PURE__ */ jsxs("div", { children: [
268
+ /* @__PURE__ */ jsx(Label, { htmlFor: `activity-${index}-until`, className: "text-xs", children: t("workflows.activities.waitUntil") }),
269
+ /* @__PURE__ */ jsx(
270
+ Input,
271
+ {
272
+ id: `activity-${index}-until`,
273
+ type: "datetime-local",
274
+ value: activity.config?.until ? activity.config.until.slice(0, 16) : "",
275
+ onChange: (e) => updateActivity(index, "config", { ...activity.config, until: e.target.value ? new Date(e.target.value).toISOString() : void 0, duration: void 0 }),
276
+ disabled: !!activity.config?.duration,
277
+ className: "mt-1"
278
+ }
279
+ ),
280
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-1", children: t("workflows.activities.waitUntilDescription") })
281
+ ] })
282
+ ] }),
283
+ activity.activityType !== "WAIT" && /* @__PURE__ */ jsxs("div", { children: [
251
284
  /* @__PURE__ */ jsxs(Label, { htmlFor: `activity-${index}-config`, className: "text-xs", children: [
252
285
  t("workflows.activities.config"),
253
286
  " (JSON)"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/modules/workflows/components/ActivitiesEditor.tsx"],
4
- "sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\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 {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@open-mercato/ui/primitives/select'\nimport { Textarea } from '@open-mercato/ui/primitives/textarea'\nimport { Trash2, Plus, ChevronUp, ChevronDown } from 'lucide-react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\n\ninterface Activity {\n activityId: string\n activityName: string\n activityType: string\n config?: Record<string, any>\n async?: boolean\n retryPolicy?: {\n maxAttempts?: number\n retryDelay?: number\n backoffMultiplier?: number\n }\n timeout?: number\n compensation?: Record<string, any>\n}\n\ninterface ActivitiesEditorProps {\n value: Activity[]\n onChange: (activities: Activity[]) => void\n error?: string\n}\n\nconst ACTIVITY_TYPES = [\n { value: 'SEND_EMAIL', label: 'Send Email' },\n { value: 'CALL_API', label: 'Call API' },\n { value: 'UPDATE_ENTITY', label: 'Update Entity' },\n { value: 'EMIT_EVENT', label: 'Emit Event' },\n { value: 'CALL_WEBHOOK', label: 'Call Webhook' },\n { value: 'EXECUTE_FUNCTION', label: 'Execute Function' },\n { value: 'WAIT', label: 'Wait' },\n]\n\nexport function ActivitiesEditor({ value = [], onChange, error }: ActivitiesEditorProps) {\n const t = useT()\n\n const addActivity = () => {\n const newActivity: Activity = {\n activityId: `activity_${Date.now()}`,\n activityName: t('workflows.common.newActivity'),\n activityType: 'CALL_API',\n config: {},\n async: false,\n retryPolicy: {\n maxAttempts: 3,\n retryDelay: 1000,\n backoffMultiplier: 2,\n },\n }\n onChange([...value, newActivity])\n }\n\n const updateActivity = (index: number, field: keyof Activity, fieldValue: any) => {\n const updated = [...value]\n updated[index] = { ...updated[index], [field]: fieldValue }\n onChange(updated)\n }\n\n const updateRetryPolicy = (index: number, field: string, fieldValue: any) => {\n const updated = [...value]\n updated[index] = {\n ...updated[index],\n retryPolicy: {\n ...updated[index].retryPolicy,\n [field]: fieldValue,\n },\n }\n onChange(updated)\n }\n\n const removeActivity = (index: number) => {\n onChange(value.filter((_, i) => i !== index))\n }\n\n const moveActivity = (index: number, direction: 'up' | 'down') => {\n const newIndex = direction === 'up' ? index - 1 : index + 1\n if (newIndex < 0 || newIndex >= value.length) return\n\n const updated = [...value]\n const temp = updated[index]\n updated[index] = updated[newIndex]\n updated[newIndex] = temp\n onChange(updated)\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.form.descriptions.activities')}\n </p>\n {error && <p className=\"text-sm text-red-600 mt-1\">{error}</p>}\n </div>\n <Button type=\"button\" onClick={addActivity} variant=\"outline\" size=\"sm\" className=\"w-full sm:w-auto\">\n <Plus className=\"h-4 w-4 mr-1\" />\n {t('workflows.form.addActivity')}\n </Button>\n </div>\n\n {value.length === 0 && (\n <div className=\"p-6 text-center text-muted-foreground border rounded-md bg-muted\">\n {t('workflows.form.noActivities')}\n </div>\n )}\n\n <div className=\"space-y-3\">\n {value.map((activity, index) => (\n <div key={index} className=\"p-4 border rounded-md bg-card shadow-sm border-l-4 border-l-green-500\">\n <div className=\"space-y-3\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between\">\n <div className=\"flex-1 grid grid-cols-1 sm:grid-cols-2 gap-3\">\n <div>\n <Label htmlFor={`activity-${index}-id`} className=\"text-xs\">\n {t('workflows.activities.activityId')} *\n </Label>\n <Input\n id={`activity-${index}-id`}\n value={activity.activityId}\n onChange={(e) => updateActivity(index, 'activityId', e.target.value)}\n placeholder=\"activity_name\"\n className=\"mt-1\"\n />\n </div>\n <div>\n <Label htmlFor={`activity-${index}-name`} className=\"text-xs\">\n {t('workflows.activities.activityName')} *\n </Label>\n <Input\n id={`activity-${index}-name`}\n value={activity.activityName}\n onChange={(e) => updateActivity(index, 'activityName', e.target.value)}\n placeholder={t('workflows.activities.activityName')}\n className=\"mt-1\"\n />\n </div>\n </div>\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={() => moveActivity(index, 'up')}\n disabled={index === 0}\n title={t('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={() => moveActivity(index, 'down')}\n disabled={index === value.length - 1}\n title={t('common.moveDown')}\n >\n <ChevronDown className=\"h-4 w-4\" />\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => removeActivity(index)}\n title={t('common.delete')}\n >\n <Trash2 className=\"h-4 w-4 text-red-600\" />\n </Button>\n </div>\n </div>\n\n <div className=\"grid grid-cols-1 sm:grid-cols-3 gap-3\">\n <div>\n <Label htmlFor={`activity-${index}-type`} className=\"text-xs\">\n {t('workflows.activities.activityType')} *\n </Label>\n <Select\n value={activity.activityType}\n onValueChange={(value) => updateActivity(index, 'activityType', value)}\n >\n <SelectTrigger id={`activity-${index}-type`} className=\"mt-1\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {ACTIVITY_TYPES.map((type) => (\n <SelectItem key={type.value} value={type.value}>\n {t(`workflows.activities.types.${type.value}`)}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n <div>\n <Label htmlFor={`activity-${index}-timeout`} className=\"text-xs\">\n {t('workflows.activities.timeout')} (ms)\n </Label>\n <Input\n id={`activity-${index}-timeout`}\n type=\"number\"\n value={activity.timeout || ''}\n onChange={(e) => updateActivity(index, 'timeout', e.target.value ? parseInt(e.target.value) : undefined)}\n placeholder=\"30000\"\n className=\"mt-1\"\n />\n </div>\n <div className=\"flex items-end pb-2\">\n <div className=\"flex items-center space-x-2\">\n <input\n type=\"checkbox\"\n id={`activity-${index}-async`}\n checked={activity.async || false}\n onChange={(e) => updateActivity(index, 'async', e.target.checked)}\n className=\"h-4 w-4\"\n />\n <Label htmlFor={`activity-${index}-async`} className=\"text-xs cursor-pointer\">\n {t('workflows.activities.async')}\n </Label>\n </div>\n </div>\n </div>\n\n <div className=\"grid grid-cols-1 sm:grid-cols-3 gap-3\">\n <div>\n <Label htmlFor={`activity-${index}-retry-attempts`} className=\"text-xs\">\n {t('workflows.form.maxRetryAttempts')}\n </Label>\n <Input\n id={`activity-${index}-retry-attempts`}\n type=\"number\"\n value={activity.retryPolicy?.maxAttempts || 3}\n onChange={(e) => updateRetryPolicy(index, 'maxAttempts', parseInt(e.target.value))}\n className=\"mt-1\"\n />\n </div>\n <div>\n <Label htmlFor={`activity-${index}-retry-delay`} className=\"text-xs\">\n {t('workflows.form.retryDelay')} (ms)\n </Label>\n <Input\n id={`activity-${index}-retry-delay`}\n type=\"number\"\n value={activity.retryPolicy?.retryDelay || 1000}\n onChange={(e) => updateRetryPolicy(index, 'retryDelay', parseInt(e.target.value))}\n className=\"mt-1\"\n />\n </div>\n <div>\n <Label htmlFor={`activity-${index}-backoff`} className=\"text-xs\">\n {t('workflows.form.backoffMultiplier')}\n </Label>\n <Input\n id={`activity-${index}-backoff`}\n type=\"number\"\n step=\"0.1\"\n value={activity.retryPolicy?.backoffMultiplier || 2}\n onChange={(e) => updateRetryPolicy(index, 'backoffMultiplier', parseFloat(e.target.value))}\n className=\"mt-1\"\n />\n </div>\n </div>\n\n <div>\n <Label htmlFor={`activity-${index}-config`} className=\"text-xs\">\n {t('workflows.activities.config')} (JSON)\n </Label>\n <Textarea\n id={`activity-${index}-config`}\n value={JSON.stringify(activity.config || {}, null, 2)}\n onChange={(e) => {\n try {\n const parsed = JSON.parse(e.target.value)\n updateActivity(index, 'config', parsed)\n } catch {\n // Invalid JSON, don't update\n }\n }}\n placeholder='{\"key\": \"value\"}'\n rows={3}\n className=\"mt-1 font-mono text-xs\"\n />\n </div>\n </div>\n </div>\n ))}\n </div>\n </div>\n )\n}\n"],
5
- "mappings": ";AAuGQ,SACE,KADF;AApGR,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,gBAAgB;AACzB,SAAS,QAAQ,MAAM,WAAW,mBAAmB;AAC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A,6BAAC,SAAM,SAAS,YAAY,KAAK,WAAW,WAAU,WACnD;AAAA,YAAE,6BAA6B;AAAA,UAAE;AAAA,WACpC;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,IAAI,YAAY,KAAK;AAAA,YACrB,OAAO,KAAK,UAAU,SAAS,UAAU,CAAC,GAAG,MAAM,CAAC;AAAA,YACpD,UAAU,CAAC,MAAM;AACf,kBAAI;AACF,sBAAM,SAAS,KAAK,MAAM,EAAE,OAAO,KAAK;AACxC,+BAAe,OAAO,UAAU,MAAM;AAAA,cACxC,QAAQ;AAAA,cAER;AAAA,YACF;AAAA,YACA,aAAY;AAAA,YACZ,MAAM;AAAA,YACN,WAAU;AAAA;AAAA,QACZ;AAAA,SACF;AAAA,OACF,KA5KQ,KA6KV,CACD,GACH;AAAA,KACF;AAEJ;",
4
+ "sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\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 {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@open-mercato/ui/primitives/select'\nimport { Textarea } from '@open-mercato/ui/primitives/textarea'\nimport { Trash2, Plus, ChevronUp, ChevronDown } from 'lucide-react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\n\ninterface Activity {\n activityId: string\n activityName: string\n activityType: string\n config?: Record<string, any>\n async?: boolean\n retryPolicy?: {\n maxAttempts?: number\n retryDelay?: number\n backoffMultiplier?: number\n }\n timeout?: number\n compensation?: Record<string, any>\n}\n\ninterface ActivitiesEditorProps {\n value: Activity[]\n onChange: (activities: Activity[]) => void\n error?: string\n}\n\nconst ACTIVITY_TYPES = [\n { value: 'SEND_EMAIL', label: 'Send Email' },\n { value: 'CALL_API', label: 'Call API' },\n { value: 'UPDATE_ENTITY', label: 'Update Entity' },\n { value: 'EMIT_EVENT', label: 'Emit Event' },\n { value: 'CALL_WEBHOOK', label: 'Call Webhook' },\n { value: 'EXECUTE_FUNCTION', label: 'Execute Function' },\n { value: 'WAIT', label: 'Wait' },\n]\n\nexport function ActivitiesEditor({ value = [], onChange, error }: ActivitiesEditorProps) {\n const t = useT()\n\n const addActivity = () => {\n const newActivity: Activity = {\n activityId: `activity_${Date.now()}`,\n activityName: t('workflows.common.newActivity'),\n activityType: 'CALL_API',\n config: {},\n async: false,\n retryPolicy: {\n maxAttempts: 3,\n retryDelay: 1000,\n backoffMultiplier: 2,\n },\n }\n onChange([...value, newActivity])\n }\n\n const updateActivity = (index: number, field: keyof Activity, fieldValue: any) => {\n const updated = [...value]\n updated[index] = { ...updated[index], [field]: fieldValue }\n onChange(updated)\n }\n\n const updateRetryPolicy = (index: number, field: string, fieldValue: any) => {\n const updated = [...value]\n updated[index] = {\n ...updated[index],\n retryPolicy: {\n ...updated[index].retryPolicy,\n [field]: fieldValue,\n },\n }\n onChange(updated)\n }\n\n const removeActivity = (index: number) => {\n onChange(value.filter((_, i) => i !== index))\n }\n\n const moveActivity = (index: number, direction: 'up' | 'down') => {\n const newIndex = direction === 'up' ? index - 1 : index + 1\n if (newIndex < 0 || newIndex >= value.length) return\n\n const updated = [...value]\n const temp = updated[index]\n updated[index] = updated[newIndex]\n updated[newIndex] = temp\n onChange(updated)\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.form.descriptions.activities')}\n </p>\n {error && <p className=\"text-sm text-red-600 mt-1\">{error}</p>}\n </div>\n <Button type=\"button\" onClick={addActivity} variant=\"outline\" size=\"sm\" className=\"w-full sm:w-auto\">\n <Plus className=\"h-4 w-4 mr-1\" />\n {t('workflows.form.addActivity')}\n </Button>\n </div>\n\n {value.length === 0 && (\n <div className=\"p-6 text-center text-muted-foreground border rounded-md bg-muted\">\n {t('workflows.form.noActivities')}\n </div>\n )}\n\n <div className=\"space-y-3\">\n {value.map((activity, index) => (\n <div key={index} className=\"p-4 border rounded-md bg-card shadow-sm border-l-4 border-l-green-500\">\n <div className=\"space-y-3\">\n <div className=\"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between\">\n <div className=\"flex-1 grid grid-cols-1 sm:grid-cols-2 gap-3\">\n <div>\n <Label htmlFor={`activity-${index}-id`} className=\"text-xs\">\n {t('workflows.activities.activityId')} *\n </Label>\n <Input\n id={`activity-${index}-id`}\n value={activity.activityId}\n onChange={(e) => updateActivity(index, 'activityId', e.target.value)}\n placeholder=\"activity_name\"\n className=\"mt-1\"\n />\n </div>\n <div>\n <Label htmlFor={`activity-${index}-name`} className=\"text-xs\">\n {t('workflows.activities.activityName')} *\n </Label>\n <Input\n id={`activity-${index}-name`}\n value={activity.activityName}\n onChange={(e) => updateActivity(index, 'activityName', e.target.value)}\n placeholder={t('workflows.activities.activityName')}\n className=\"mt-1\"\n />\n </div>\n </div>\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={() => moveActivity(index, 'up')}\n disabled={index === 0}\n title={t('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={() => moveActivity(index, 'down')}\n disabled={index === value.length - 1}\n title={t('common.moveDown')}\n >\n <ChevronDown className=\"h-4 w-4\" />\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => removeActivity(index)}\n title={t('common.delete')}\n >\n <Trash2 className=\"h-4 w-4 text-red-600\" />\n </Button>\n </div>\n </div>\n\n <div className=\"grid grid-cols-1 sm:grid-cols-3 gap-3\">\n <div>\n <Label htmlFor={`activity-${index}-type`} className=\"text-xs\">\n {t('workflows.activities.activityType')} *\n </Label>\n <Select\n value={activity.activityType}\n onValueChange={(value) => updateActivity(index, 'activityType', value)}\n >\n <SelectTrigger id={`activity-${index}-type`} className=\"mt-1\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {ACTIVITY_TYPES.map((type) => (\n <SelectItem key={type.value} value={type.value}>\n {t(`workflows.activities.types.${type.value}`)}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n <div>\n <Label htmlFor={`activity-${index}-timeout`} className=\"text-xs\">\n {t('workflows.activities.timeout')} (ms)\n </Label>\n <Input\n id={`activity-${index}-timeout`}\n type=\"number\"\n value={activity.timeout || ''}\n onChange={(e) => updateActivity(index, 'timeout', e.target.value ? parseInt(e.target.value) : undefined)}\n placeholder=\"30000\"\n className=\"mt-1\"\n />\n </div>\n <div className=\"flex items-end pb-2\">\n <div className=\"flex items-center space-x-2\">\n <input\n type=\"checkbox\"\n id={`activity-${index}-async`}\n checked={activity.async || false}\n onChange={(e) => updateActivity(index, 'async', e.target.checked)}\n className=\"h-4 w-4\"\n />\n <Label htmlFor={`activity-${index}-async`} className=\"text-xs cursor-pointer\">\n {t('workflows.activities.async')}\n </Label>\n </div>\n </div>\n </div>\n\n <div className=\"grid grid-cols-1 sm:grid-cols-3 gap-3\">\n <div>\n <Label htmlFor={`activity-${index}-retry-attempts`} className=\"text-xs\">\n {t('workflows.form.maxRetryAttempts')}\n </Label>\n <Input\n id={`activity-${index}-retry-attempts`}\n type=\"number\"\n value={activity.retryPolicy?.maxAttempts || 3}\n onChange={(e) => updateRetryPolicy(index, 'maxAttempts', parseInt(e.target.value))}\n className=\"mt-1\"\n />\n </div>\n <div>\n <Label htmlFor={`activity-${index}-retry-delay`} className=\"text-xs\">\n {t('workflows.form.retryDelay')} (ms)\n </Label>\n <Input\n id={`activity-${index}-retry-delay`}\n type=\"number\"\n value={activity.retryPolicy?.retryDelay || 1000}\n onChange={(e) => updateRetryPolicy(index, 'retryDelay', parseInt(e.target.value))}\n className=\"mt-1\"\n />\n </div>\n <div>\n <Label htmlFor={`activity-${index}-backoff`} className=\"text-xs\">\n {t('workflows.form.backoffMultiplier')}\n </Label>\n <Input\n id={`activity-${index}-backoff`}\n type=\"number\"\n step=\"0.1\"\n value={activity.retryPolicy?.backoffMultiplier || 2}\n onChange={(e) => updateRetryPolicy(index, 'backoffMultiplier', parseFloat(e.target.value))}\n className=\"mt-1\"\n />\n </div>\n </div>\n\n {activity.activityType === 'WAIT' && (\n <div className=\"space-y-3\">\n <div>\n <Label htmlFor={`activity-${index}-duration`} className=\"text-xs\">\n {t('workflows.activities.waitDuration')}\n </Label>\n <Input\n id={`activity-${index}-duration`}\n value={activity.config?.duration || ''}\n onChange={(e) => updateActivity(index, 'config', { ...activity.config, duration: e.target.value, until: undefined })}\n placeholder={t('workflows.activities.waitDurationPlaceholder')}\n disabled={!!activity.config?.until}\n className=\"mt-1\"\n />\n <p className=\"text-xs text-muted-foreground mt-1\">\n {t('workflows.activities.waitDurationDescription')}\n </p>\n </div>\n <div className=\"text-xs text-center text-muted-foreground\">{t('workflows.activities.waitOr')}</div>\n <div>\n <Label htmlFor={`activity-${index}-until`} className=\"text-xs\">\n {t('workflows.activities.waitUntil')}\n </Label>\n <Input\n id={`activity-${index}-until`}\n type=\"datetime-local\"\n value={activity.config?.until ? activity.config.until.slice(0, 16) : ''}\n onChange={(e) => updateActivity(index, 'config', { ...activity.config, until: e.target.value ? new Date(e.target.value).toISOString() : undefined, duration: undefined })}\n disabled={!!activity.config?.duration}\n className=\"mt-1\"\n />\n <p className=\"text-xs text-muted-foreground mt-1\">\n {t('workflows.activities.waitUntilDescription')}\n </p>\n </div>\n </div>\n )}\n\n {activity.activityType !== 'WAIT' && (\n <div>\n <Label htmlFor={`activity-${index}-config`} className=\"text-xs\">\n {t('workflows.activities.config')} (JSON)\n </Label>\n <Textarea\n id={`activity-${index}-config`}\n value={JSON.stringify(activity.config || {}, null, 2)}\n onChange={(e) => {\n try {\n const parsed = JSON.parse(e.target.value)\n updateActivity(index, 'config', parsed)\n } catch {\n // Invalid JSON, don't update\n }\n }}\n placeholder='{\"key\": \"value\"}'\n rows={3}\n className=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AAK,EAAE,OAAO,KAAK,EAAE,YAAY,IAAI,QAAW,UAAU,OAAU,CAAC;AAAA,cACxK,UAAU,CAAC,CAAC,SAAS,QAAQ;AAAA,cAC7B,WAAU;AAAA;AAAA,UACZ;AAAA,UACA,oBAAC,OAAE,WAAU,sCACV,YAAE,2CAA2C,GAChD;AAAA,WACF;AAAA,SACF;AAAA,MAGD,SAAS,iBAAiB,UAC3B,qBAAC,SACC;AAAA,6BAAC,SAAM,SAAS,YAAY,KAAK,WAAW,WAAU,WACnD;AAAA,YAAE,6BAA6B;AAAA,UAAE;AAAA,WACpC;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,IAAI,YAAY,KAAK;AAAA,YACrB,OAAO,KAAK,UAAU,SAAS,UAAU,CAAC,GAAG,MAAM,CAAC;AAAA,YACpD,UAAU,CAAC,MAAM;AACf,kBAAI;AACF,sBAAM,SAAS,KAAK,MAAM,EAAE,OAAO,KAAK;AACxC,+BAAe,OAAO,UAAU,MAAM;AAAA,cACxC,QAAQ;AAAA,cAER;AAAA,YACF;AAAA,YACA,aAAY;AAAA,YACZ,MAAM;AAAA,YACN,WAAU;AAAA;AAAA,QACZ;AAAA,SACF;AAAA,OAEF,KApNQ,KAqNV,CACD,GACH;AAAA,KACF;AAEJ;",
6
6
  "names": ["value"]
7
7
  }
@@ -20,6 +20,7 @@ import { JsonBuilder } from "@open-mercato/ui/backend/JsonBuilder";
20
20
  import { StartPreConditionsEditor } from "./fields/StartPreConditionsEditor.js";
21
21
  import { useT } from "@open-mercato/shared/lib/i18n/context";
22
22
  import { useConfirmDialog } from "@open-mercato/ui/backend/confirm-dialog";
23
+ import { isFutureIsoDateString, isValidDurationString } from "../data/validators.js";
23
24
  function NodeEditDialog({ node, isOpen, onClose, onSave, onDelete }) {
24
25
  const t = useT();
25
26
  const { confirm: confirmDialog, ConfirmDialogElement } = useConfirmDialog();
@@ -46,9 +47,12 @@ function NodeEditDialog({ node, isOpen, onClose, onSave, onDelete }) {
46
47
  const [showWorkflowSelector, setShowWorkflowSelector] = useState(false);
47
48
  const [signalName, setSignalName] = useState("");
48
49
  const [signalTimeout, setSignalTimeout] = useState("");
50
+ const [timerDuration, setTimerDuration] = useState("");
51
+ const [timerUntil, setTimerUntil] = useState("");
49
52
  const [stepActivities, setStepActivities] = useState([]);
50
53
  const [expandedStepActivities, setExpandedStepActivities] = useState(/* @__PURE__ */ new Set());
51
54
  const [preConditions, setPreConditions] = useState([]);
55
+ const [fieldErrors, setFieldErrors] = useState({});
52
56
  const convertJsonSchemaToFields = (schema) => {
53
57
  if (!schema || !schema.properties) return [];
54
58
  const fields = [];
@@ -147,6 +151,13 @@ function NodeEditDialog({ node, isOpen, onClose, onSave, onDelete }) {
147
151
  setSignalName("");
148
152
  setSignalTimeout("");
149
153
  }
154
+ if (node.type === "waitForTimer") {
155
+ setTimerDuration(nodeData?.config?.duration || "");
156
+ setTimerUntil(nodeData?.config?.until || "");
157
+ } else {
158
+ setTimerDuration("");
159
+ setTimerUntil("");
160
+ }
150
161
  if (node.type === "automated" && nodeData?.activities) {
151
162
  setStepActivities(nodeData.activities);
152
163
  } else if (node.type === "automated") {
@@ -182,6 +193,7 @@ function NodeEditDialog({ node, isOpen, onClose, onSave, onDelete }) {
182
193
  }
183
194
  setAdvancedConfig(advancedFields);
184
195
  setExpandedFields(/* @__PURE__ */ new Set());
196
+ setFieldErrors({});
185
197
  }
186
198
  }, [node, isOpen]);
187
199
  const addFormField = () => {
@@ -230,6 +242,23 @@ function NodeEditDialog({ node, isOpen, onClose, onSave, onDelete }) {
230
242
  };
231
243
  const handleSave = () => {
232
244
  if (!node) return;
245
+ const errors = {};
246
+ if (node.type === "waitForTimer") {
247
+ if (timerDuration && !isValidDurationString(timerDuration)) {
248
+ errors.timerDuration = t("workflows.validation.invalidDuration");
249
+ }
250
+ if (timerUntil && !isFutureIsoDateString(timerUntil)) {
251
+ errors.timerUntil = t("workflows.validation.untilMustBeFuture");
252
+ }
253
+ }
254
+ if (node.type === "waitForSignal" && signalTimeout && !isValidDurationString(signalTimeout)) {
255
+ errors.signalTimeout = t("workflows.validation.invalidDuration");
256
+ }
257
+ if (Object.keys(errors).length > 0) {
258
+ setFieldErrors(errors);
259
+ return;
260
+ }
261
+ setFieldErrors({});
233
262
  const sanitizedId = sanitizeId(node.id);
234
263
  if (sanitizedId !== node.id) {
235
264
  alert(t("workflows.nodeEditor.stepIdSanitized", { from: node.id, to: sanitizedId }));
@@ -296,6 +325,15 @@ function NodeEditDialog({ node, isOpen, onClose, onSave, onDelete }) {
296
325
  updates.signalConfig = config;
297
326
  }
298
327
  }
328
+ if (node.type === "waitForTimer") {
329
+ const config = {};
330
+ if (timerDuration) {
331
+ config.duration = timerDuration;
332
+ } else if (timerUntil) {
333
+ config.until = timerUntil;
334
+ }
335
+ updates.config = Object.keys(config).length > 0 ? config : void 0;
336
+ }
299
337
  if (node.type === "automated" && stepActivities.length > 0) {
300
338
  updates.activities = stepActivities;
301
339
  }
@@ -326,7 +364,10 @@ function NodeEditDialog({ node, isOpen, onClose, onSave, onDelete }) {
326
364
  end: t("workflows.nodeTypes.end"),
327
365
  userTask: t("workflows.nodeTypes.userTask"),
328
366
  automated: t("workflows.nodeTypes.automated"),
329
- decision: t("workflows.nodeTypes.decision")
367
+ decision: t("workflows.nodeTypes.decision"),
368
+ waitForSignal: t("workflows.nodeTypes.waitForSignal"),
369
+ waitForTimer: t("workflows.nodeTypes.waitForTimer"),
370
+ subWorkflow: t("workflows.nodeTypes.subWorkflow")
330
371
  }[node.type || "automated"];
331
372
  const isEditable = node.type !== "end";
332
373
  const isStartNode = node.type === "start";
@@ -402,7 +443,7 @@ function NodeEditDialog({ node, isOpen, onClose, onSave, onDelete }) {
402
443
  ),
403
444
  /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mt-1", children: t("workflows.form.descriptions.description") })
404
445
  ] }),
405
- /* @__PURE__ */ jsxs("div", { children: [
446
+ node.type !== "waitForSignal" && node.type !== "waitForTimer" && /* @__PURE__ */ jsxs("div", { children: [
406
447
  /* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: t("workflows.form.timeout") }),
407
448
  /* @__PURE__ */ jsx(
408
449
  Input,
@@ -416,7 +457,7 @@ function NodeEditDialog({ node, isOpen, onClose, onSave, onDelete }) {
416
457
  /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mt-1", children: t("workflows.form.descriptions.timeout") })
417
458
  ] }),
418
459
  node.type === "userTask" && /* @__PURE__ */ jsxs(Fragment, { children: [
419
- /* @__PURE__ */ jsx("div", { className: "border-t border-gray-200 pt-4 mt-4", children: /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-gray-900 mb-3", children: t("workflows.nodeEditor.userTaskConfig") }) }),
460
+ /* @__PURE__ */ jsx("div", { className: "border-t border-gray-200 pt-4 mt-4", children: /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-foreground mb-3", children: t("workflows.nodeEditor.userTaskConfig") }) }),
420
461
  /* @__PURE__ */ jsxs("div", { children: [
421
462
  /* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: t("workflows.form.assignedTo") }),
422
463
  /* @__PURE__ */ jsx(
@@ -459,7 +500,7 @@ function NodeEditDialog({ node, isOpen, onClose, onSave, onDelete }) {
459
500
  /* @__PURE__ */ jsxs("div", { className: "border-t border-gray-200 pt-4 mt-4", children: [
460
501
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-3", children: [
461
502
  /* @__PURE__ */ jsxs("div", { children: [
462
- /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-gray-900", children: t("workflows.form.formFields", { count: formFields.length }) }),
503
+ /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-foreground", children: t("workflows.form.formFields", { count: formFields.length }) }),
463
504
  /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mt-0.5", children: t("workflows.form.descriptions.formFields") })
464
505
  ] }),
465
506
  /* @__PURE__ */ jsxs(
@@ -492,7 +533,7 @@ function NodeEditDialog({ node, isOpen, onClose, onSave, onDelete }) {
492
533
  children: [
493
534
  /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
494
535
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
495
- /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold text-gray-900", children: field.label || field.name }),
536
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold text-foreground", children: field.label || field.name }),
496
537
  /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: field.type }),
497
538
  field.required && /* @__PURE__ */ jsx(Badge, { variant: "destructive", className: "text-xs text-white", children: t("workflows.form.required") })
498
539
  ] }),
@@ -648,7 +689,7 @@ function NodeEditDialog({ node, isOpen, onClose, onSave, onDelete }) {
648
689
  node.type === "automated" && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "border-t border-gray-200 pt-4 mt-4", children: [
649
690
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-3", children: [
650
691
  /* @__PURE__ */ jsxs("div", { children: [
651
- /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-gray-900", children: t("workflows.form.stepActivities", { count: stepActivities.length }) }),
692
+ /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-foreground", children: t("workflows.form.stepActivities", { count: stepActivities.length }) }),
652
693
  /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mt-0.5", children: t("workflows.form.descriptions.activities") })
653
694
  ] }),
654
695
  /* @__PURE__ */ jsxs(
@@ -696,7 +737,7 @@ function NodeEditDialog({ node, isOpen, onClose, onSave, onDelete }) {
696
737
  children: [
697
738
  /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
698
739
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
699
- /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold text-gray-900", children: activity.activityName || activity.activityId || `Activity ${index + 1}` }),
740
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold text-foreground", children: activity.activityName || activity.activityId || `Activity ${index + 1}` }),
700
741
  /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "text-xs", children: activity.activityType }),
701
742
  activity.async && /* @__PURE__ */ jsx(Badge, { variant: "outline", className: "text-xs", children: t("workflows.form.async") })
702
743
  ] }),
@@ -777,7 +818,8 @@ function NodeEditDialog({ node, isOpen, onClose, onSave, onDelete }) {
777
818
  /* @__PURE__ */ jsx(SelectItem, { value: "UPDATE_ENTITY", children: t("workflows.activities.types.UPDATE_ENTITY") }),
778
819
  /* @__PURE__ */ jsx(SelectItem, { value: "EMIT_EVENT", children: t("workflows.activities.types.EMIT_EVENT") }),
779
820
  /* @__PURE__ */ jsx(SelectItem, { value: "CALL_WEBHOOK", children: t("workflows.activities.types.CALL_WEBHOOK") }),
780
- /* @__PURE__ */ jsx(SelectItem, { value: "EXECUTE_FUNCTION", children: t("workflows.activities.types.EXECUTE_FUNCTION") })
821
+ /* @__PURE__ */ jsx(SelectItem, { value: "EXECUTE_FUNCTION", children: t("workflows.activities.types.EXECUTE_FUNCTION") }),
822
+ /* @__PURE__ */ jsx(SelectItem, { value: "WAIT", children: t("workflows.activities.types.WAIT") })
781
823
  ] })
782
824
  ]
783
825
  }
@@ -893,7 +935,45 @@ function NodeEditDialog({ node, isOpen, onClose, onSave, onDelete }) {
893
935
  ),
894
936
  /* @__PURE__ */ jsx("span", { className: "text-xs text-gray-700", children: t("workflows.form.executeAsync") })
895
937
  ] }) }),
896
- /* @__PURE__ */ jsxs("div", { children: [
938
+ activity.activityType === "WAIT" && /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
939
+ /* @__PURE__ */ jsxs("div", { children: [
940
+ /* @__PURE__ */ jsx("label", { className: "block text-xs font-medium text-gray-700 mb-1", children: t("workflows.activities.waitDuration") }),
941
+ /* @__PURE__ */ jsx(
942
+ Input,
943
+ {
944
+ size: "sm",
945
+ type: "text",
946
+ value: activity.config?.duration || "",
947
+ onChange: (e) => {
948
+ const updated = [...stepActivities];
949
+ updated[index].config = { ...updated[index].config, duration: e.target.value, until: void 0 };
950
+ setStepActivities(updated);
951
+ },
952
+ placeholder: t("workflows.activities.waitDurationPlaceholder")
953
+ }
954
+ ),
955
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-1", children: t("workflows.activities.waitDurationDescription") })
956
+ ] }),
957
+ /* @__PURE__ */ jsx("div", { className: "text-xs text-center text-muted-foreground", children: t("workflows.activities.waitOr") }),
958
+ /* @__PURE__ */ jsxs("div", { children: [
959
+ /* @__PURE__ */ jsx("label", { className: "block text-xs font-medium text-gray-700 mb-1", children: t("workflows.activities.waitUntil") }),
960
+ /* @__PURE__ */ jsx(
961
+ Input,
962
+ {
963
+ size: "sm",
964
+ type: "datetime-local",
965
+ value: activity.config?.until ? activity.config.until.slice(0, 16) : "",
966
+ onChange: (e) => {
967
+ const updated = [...stepActivities];
968
+ updated[index].config = { ...updated[index].config, until: e.target.value ? new Date(e.target.value).toISOString() : void 0, duration: void 0 };
969
+ setStepActivities(updated);
970
+ }
971
+ }
972
+ ),
973
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-1", children: t("workflows.activities.waitUntilDescription") })
974
+ ] })
975
+ ] }),
976
+ activity.activityType !== "WAIT" && /* @__PURE__ */ jsxs("div", { children: [
897
977
  /* @__PURE__ */ jsx("label", { className: "block text-xs font-medium text-gray-700 mb-1", children: t("workflows.form.configuration") }),
898
978
  /* @__PURE__ */ jsx(
899
979
  JsonBuilder,
@@ -931,7 +1011,7 @@ function NodeEditDialog({ node, isOpen, onClose, onSave, onDelete }) {
931
1011
  }) })
932
1012
  ] }) }),
933
1013
  node.type === "subWorkflow" && /* @__PURE__ */ jsxs(Fragment, { children: [
934
- /* @__PURE__ */ jsx("div", { className: "border-t border-gray-200 pt-4 mt-4", children: /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-gray-900 mb-3", children: t("workflows.form.subWorkflowConfig") }) }),
1014
+ /* @__PURE__ */ jsx("div", { className: "border-t border-gray-200 pt-4 mt-4", children: /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-foreground mb-3", children: t("workflows.form.subWorkflowConfig") }) }),
935
1015
  /* @__PURE__ */ jsxs("div", { children: [
936
1016
  /* @__PURE__ */ jsxs("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: [
937
1017
  t("workflows.form.workflowToInvoke"),
@@ -977,7 +1057,7 @@ function NodeEditDialog({ node, isOpen, onClose, onSave, onDelete }) {
977
1057
  /* @__PURE__ */ jsxs("div", { className: "border-t border-gray-200 pt-4 mt-4", children: [
978
1058
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-3", children: [
979
1059
  /* @__PURE__ */ jsxs("div", { children: [
980
- /* @__PURE__ */ jsx("h4", { className: "text-sm font-semibold text-gray-900", children: t("workflows.form.inputMapping", { count: inputMappings.length }) }),
1060
+ /* @__PURE__ */ jsx("h4", { className: "text-sm font-semibold text-foreground", children: t("workflows.form.inputMapping", { count: inputMappings.length }) }),
981
1061
  /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mt-0.5", children: t("workflows.form.descriptions.inputMapping") })
982
1062
  ] }),
983
1063
  /* @__PURE__ */ jsxs(
@@ -1045,7 +1125,7 @@ function NodeEditDialog({ node, isOpen, onClose, onSave, onDelete }) {
1045
1125
  /* @__PURE__ */ jsxs("div", { className: "border-t border-gray-200 pt-4 mt-4", children: [
1046
1126
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-3", children: [
1047
1127
  /* @__PURE__ */ jsxs("div", { children: [
1048
- /* @__PURE__ */ jsx("h4", { className: "text-sm font-semibold text-gray-900", children: t("workflows.form.outputMapping", { count: outputMappings.length }) }),
1128
+ /* @__PURE__ */ jsx("h4", { className: "text-sm font-semibold text-foreground", children: t("workflows.form.outputMapping", { count: outputMappings.length }) }),
1049
1129
  /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mt-0.5", children: t("workflows.form.descriptions.outputMapping") })
1050
1130
  ] }),
1051
1131
  /* @__PURE__ */ jsxs(
@@ -1112,7 +1192,7 @@ function NodeEditDialog({ node, isOpen, onClose, onSave, onDelete }) {
1112
1192
  ] })
1113
1193
  ] }),
1114
1194
  node.type === "waitForSignal" && /* @__PURE__ */ jsxs(Fragment, { children: [
1115
- /* @__PURE__ */ jsx("div", { className: "border-t border-gray-200 pt-4 mt-4", children: /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-gray-900 mb-3", children: t("workflows.form.signalConfig") }) }),
1195
+ /* @__PURE__ */ jsx("div", { className: "border-t border-gray-200 pt-4 mt-4", children: /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-foreground mb-3", children: t("workflows.form.signalConfig") }) }),
1116
1196
  /* @__PURE__ */ jsxs("div", { children: [
1117
1197
  /* @__PURE__ */ jsxs("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: [
1118
1198
  t("workflows.form.signalName"),
@@ -1136,11 +1216,67 @@ function NodeEditDialog({ node, isOpen, onClose, onSave, onDelete }) {
1136
1216
  {
1137
1217
  type: "text",
1138
1218
  value: signalTimeout,
1139
- onChange: (e) => setSignalTimeout(e.target.value),
1140
- placeholder: t("workflows.form.placeholders.signalTimeout")
1219
+ onChange: (e) => {
1220
+ setSignalTimeout(e.target.value);
1221
+ if (fieldErrors.signalTimeout) {
1222
+ const next = { ...fieldErrors };
1223
+ delete next.signalTimeout;
1224
+ setFieldErrors(next);
1225
+ }
1226
+ },
1227
+ placeholder: t("workflows.form.placeholders.signalTimeout"),
1228
+ "aria-invalid": fieldErrors.signalTimeout ? true : void 0
1229
+ }
1230
+ ),
1231
+ fieldErrors.signalTimeout ? /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive mt-1", children: fieldErrors.signalTimeout }) : /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mt-1", children: t("workflows.form.descriptions.signalTimeout") })
1232
+ ] })
1233
+ ] }),
1234
+ node.type === "waitForTimer" && /* @__PURE__ */ jsxs(Fragment, { children: [
1235
+ /* @__PURE__ */ jsx("div", { className: "border-t border-gray-200 pt-4 mt-4", children: /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-foreground mb-3", children: t("workflows.steps.types.WAIT_FOR_TIMER") }) }),
1236
+ /* @__PURE__ */ jsxs("div", { children: [
1237
+ /* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: t("workflows.activities.waitDuration") }),
1238
+ /* @__PURE__ */ jsx(
1239
+ Input,
1240
+ {
1241
+ type: "text",
1242
+ value: timerDuration,
1243
+ onChange: (e) => {
1244
+ setTimerDuration(e.target.value);
1245
+ if (e.target.value) setTimerUntil("");
1246
+ if (fieldErrors.timerDuration) {
1247
+ const next = { ...fieldErrors };
1248
+ delete next.timerDuration;
1249
+ setFieldErrors(next);
1250
+ }
1251
+ },
1252
+ placeholder: t("workflows.activities.waitDurationPlaceholder"),
1253
+ "aria-invalid": fieldErrors.timerDuration ? true : void 0
1254
+ }
1255
+ ),
1256
+ fieldErrors.timerDuration ? /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive mt-1", children: fieldErrors.timerDuration }) : /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mt-1", children: t("workflows.activities.waitDurationDescription") })
1257
+ ] }),
1258
+ /* @__PURE__ */ jsxs("div", { children: [
1259
+ /* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: t("workflows.activities.waitUntil") }),
1260
+ /* @__PURE__ */ jsx(
1261
+ Input,
1262
+ {
1263
+ type: "datetime-local",
1264
+ value: timerUntil ? timerUntil.slice(0, 16) : "",
1265
+ min: new Date(Date.now() - (/* @__PURE__ */ new Date()).getTimezoneOffset() * 6e4).toISOString().slice(0, 16),
1266
+ onChange: (e) => {
1267
+ const next = e.target.value ? new Date(e.target.value).toISOString() : "";
1268
+ setTimerUntil(next);
1269
+ if (next) setTimerDuration("");
1270
+ if (fieldErrors.timerUntil) {
1271
+ const nextErrors = { ...fieldErrors };
1272
+ delete nextErrors.timerUntil;
1273
+ setFieldErrors(nextErrors);
1274
+ }
1275
+ },
1276
+ "aria-invalid": fieldErrors.timerUntil ? true : void 0
1141
1277
  }
1142
1278
  ),
1143
- /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mt-1", children: t("workflows.form.descriptions.signalTimeout") })
1279
+ fieldErrors.timerUntil ? /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive mt-1", children: fieldErrors.timerUntil }) : /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mt-1", children: t("workflows.activities.waitUntilDescription") })
1144
1280
  ] })
1145
1281
  ] }),
1146
1282
  /* @__PURE__ */ jsxs("div", { className: "border-t border-gray-200 pt-4 mt-4", children: [
@@ -1151,7 +1287,7 @@ function NodeEditDialog({ node, isOpen, onClose, onSave, onDelete }) {
1151
1287
  onClick: () => setShowAdvanced(!showAdvanced),
1152
1288
  className: "flex items-center justify-between w-full text-left",
1153
1289
  children: [
1154
- /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-gray-900", children: t("workflows.form.advancedConfiguration") }),
1290
+ /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-foreground", children: t("workflows.form.advancedConfiguration") }),
1155
1291
  /* @__PURE__ */ jsx(
1156
1292
  "svg",
1157
1293
  {