@open-mercato/core 0.6.7-develop.6677.1.beabb7ca12 → 0.6.7-develop.6685.1.77c0a5591b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/dist/generated/entities/gateway_payment_operation/index.js +2 -0
- package/dist/generated/entities/gateway_payment_operation/index.js.map +2 -2
- package/dist/generated/entities/gateway_transaction/index.js +2 -0
- package/dist/generated/entities/gateway_transaction/index.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +2 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/modules/payment_gateways/api/capture/route.js +1 -1
- package/dist/modules/payment_gateways/api/capture/route.js.map +2 -2
- package/dist/modules/payment_gateways/data/entities.js +7 -0
- package/dist/modules/payment_gateways/data/entities.js.map +2 -2
- package/dist/modules/payment_gateways/lib/capture-ledger.js +183 -0
- package/dist/modules/payment_gateways/lib/capture-ledger.js.map +7 -0
- package/dist/modules/payment_gateways/lib/gateway-service.js +70 -8
- package/dist/modules/payment_gateways/lib/gateway-service.js.map +2 -2
- package/dist/modules/payment_gateways/lib/payment-operation-idempotency.js +1 -0
- package/dist/modules/payment_gateways/lib/payment-operation-idempotency.js.map +2 -2
- package/dist/modules/payment_gateways/migrations/Migration20260725101500_payment_gateways.js +16 -0
- package/dist/modules/payment_gateways/migrations/Migration20260725101500_payment_gateways.js.map +7 -0
- package/dist/modules/query_index/lib/indexer.js +12 -2
- package/dist/modules/query_index/lib/indexer.js.map +2 -2
- package/dist/modules/workflows/backend/definitions/visual-editor/page.js +5 -2
- package/dist/modules/workflows/backend/definitions/visual-editor/page.js.map +2 -2
- package/dist/modules/workflows/components/ActivitiesEditor.js +67 -11
- package/dist/modules/workflows/components/ActivitiesEditor.js.map +2 -2
- package/dist/modules/workflows/components/TransitionsEditor.js +205 -163
- package/dist/modules/workflows/components/TransitionsEditor.js.map +2 -2
- package/dist/modules/workflows/data/validators.js +34 -1
- package/dist/modules/workflows/data/validators.js.map +3 -3
- package/dist/modules/workflows/lib/activity-executor.js +18 -2
- package/dist/modules/workflows/lib/activity-executor.js.map +2 -2
- package/dist/modules/workflows/lib/format-validation-error.js +46 -1
- package/dist/modules/workflows/lib/format-validation-error.js.map +2 -2
- package/generated/entities/gateway_payment_operation/index.ts +1 -0
- package/generated/entities/gateway_transaction/index.ts +1 -0
- package/generated/entity-fields-registry.ts +2 -0
- package/package.json +7 -7
- package/src/modules/payment_gateways/api/capture/route.ts +1 -1
- package/src/modules/payment_gateways/data/entities.ts +8 -2
- package/src/modules/payment_gateways/lib/capture-ledger.ts +260 -0
- package/src/modules/payment_gateways/lib/gateway-service.ts +83 -10
- package/src/modules/payment_gateways/lib/payment-operation-idempotency.ts +1 -0
- package/src/modules/payment_gateways/migrations/.snapshot-open-mercato.json +34 -0
- package/src/modules/payment_gateways/migrations/Migration20260725101500_payment_gateways.ts +21 -0
- package/src/modules/query_index/lib/indexer.ts +25 -2
- package/src/modules/workflows/backend/definitions/visual-editor/page.tsx +12 -3
- package/src/modules/workflows/components/ActivitiesEditor.tsx +96 -12
- package/src/modules/workflows/components/TransitionsEditor.tsx +75 -17
- package/src/modules/workflows/data/validators.ts +52 -1
- package/src/modules/workflows/i18n/de.json +2 -0
- package/src/modules/workflows/i18n/en.json +2 -0
- package/src/modules/workflows/i18n/es.json +2 -0
- package/src/modules/workflows/i18n/pl.json +2 -0
- package/src/modules/workflows/lib/activity-executor.ts +38 -3
- package/src/modules/workflows/lib/format-validation-error.ts +60 -0
|
@@ -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 {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=\"mt-1 font-mono text-xs\"\n />\n </div>\n )}\n </div>\n </div>\n ))}\n </div>\n </div>\n )\n}\n"],
|
|
5
|
-
"mappings": ";
|
|
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 // Milliseconds, matching the executor and the definition schema. This field\n // used to be written as `timeout` (a number) while the schema typed `timeout`\n // as an ISO 8601 string, so saving a timeout from this editor failed\n // validation outright (#4424).\n timeoutMs?: 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\n/**\n * Per-activity draft of the raw JSON config text (#4234).\n *\n * The config textarea used to be controlled directly by\n * `JSON.stringify(activity.config)`, and its onChange dropped anything that\n * did not parse. Every intermediate keystroke of a hand edit is invalid JSON,\n * so the state never advanced and React re-rendered the previous serialized\n * value \u2014 the field read as frozen/non-editable right after a config was\n * pasted. Keeping the raw text locally lets the user type freely; the parsed\n * object is propagated whenever the text is valid, and an inline error is shown\n * while it is not.\n */\ntype ConfigDraft = { text: string; error: string | null }\n\nfunction serializeConfig(config: Record<string, unknown> | undefined): string {\n return JSON.stringify(config ?? {}, null, 2)\n}\n\nexport function ActivitiesEditor({ value = [], onChange, error }: ActivitiesEditorProps) {\n const t = useT()\n const [configDrafts, setConfigDrafts] = React.useState<Record<number, ConfigDraft>>({})\n\n const configTextFor = (index: number, activity: Activity): string =>\n configDrafts[index]?.text ?? serializeConfig(activity.config)\n\n const handleConfigTextChange = (index: number, text: string) => {\n let parsed: Record<string, unknown> | null = null\n let parseError: string | null = null\n try {\n const candidate = JSON.parse(text) as unknown\n if (candidate && typeof candidate === 'object' && !Array.isArray(candidate)) {\n parsed = candidate as Record<string, unknown>\n } else {\n parseError = t('workflows.activities.configMustBeObject', 'Config must be a JSON object')\n }\n } catch (err) {\n parseError = err instanceof Error ? err.message : t('workflows.activities.configInvalidJson', 'Invalid JSON')\n }\n\n setConfigDrafts((drafts) => ({ ...drafts, [index]: { text, error: parseError } }))\n if (parsed) updateActivity(index, 'config', parsed)\n }\n\n // Drop the raw draft once the field loses focus and its content is valid, so\n // the textarea goes back to mirroring the canonical (re-formatted) config.\n const handleConfigBlur = (index: number) => {\n setConfigDrafts((drafts) => {\n if (!drafts[index] || drafts[index].error) return drafts\n const next = { ...drafts }\n delete next[index]\n return next\n })\n }\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 // Keep the index-keyed drafts aligned with the re-indexed activities:\n // drop the removed row's draft and shift every later draft down by one,\n // otherwise a pending (invalid) draft would render over a different row.\n setConfigDrafts((drafts) => {\n const next: Record<number, ConfigDraft> = {}\n for (const key of Object.keys(drafts)) {\n const i = Number(key)\n if (i === index) continue\n next[i > index ? i - 1 : i] = drafts[i]\n }\n return next\n })\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 // Swap the two rows' drafts too, so an in-progress edit follows its activity.\n setConfigDrafts((drafts) => {\n if (!(index in drafts) && !(newIndex in drafts)) return drafts\n const next = { ...drafts }\n const atIndex = drafts[index]\n const atNew = drafts[newIndex]\n if (atNew !== undefined) next[index] = atNew\n else delete next[index]\n if (atIndex !== undefined) next[newIndex] = atIndex\n else delete next[newIndex]\n return next\n })\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.timeoutMs || ''}\n onChange={(e) => updateActivity(index, 'timeoutMs', 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={configTextFor(index, activity)}\n onChange={(e) => handleConfigTextChange(index, e.target.value)}\n onBlur={() => handleConfigBlur(index)}\n aria-invalid={configDrafts[index]?.error ? true : undefined}\n aria-describedby={configDrafts[index]?.error ? `activity-${index}-config-error` : undefined}\n placeholder='{\"key\": \"value\"}'\n rows={3}\n className=\"mt-1 font-mono text-xs\"\n />\n {configDrafts[index]?.error ? (\n <p\n id={`activity-${index}-config-error`}\n className=\"mt-1 text-xs text-status-error-text\"\n role=\"alert\"\n >\n {configDrafts[index]?.error}\n </p>\n ) : null}\n </div>\n )}\n </div>\n </div>\n ))}\n </div>\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAsLQ,SACE,KADF;AApLR,YAAY,WAAW;AACvB,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;AACrD,SAAS,YAAY;AA2BrB,MAAM,iBAAiB;AAAA,EACrB,EAAE,OAAO,cAAc,OAAO,aAAa;AAAA,EAC3C,EAAE,OAAO,YAAY,OAAO,WAAW;AAAA,EACvC,EAAE,OAAO,iBAAiB,OAAO,gBAAgB;AAAA,EACjD,EAAE,OAAO,cAAc,OAAO,aAAa;AAAA,EAC3C,EAAE,OAAO,gBA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E,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,cAAc,OAAO,QAAQ;AAAA,YACpC,UAAU,CAAC,MAAM,uBAAuB,OAAO,EAAE,OAAO,KAAK;AAAA,YAC7D,QAAQ,MAAM,iBAAiB,KAAK;AAAA,YACpC,gBAAc,aAAa,KAAK,GAAG,QAAQ,OAAO;AAAA,YAClD,oBAAkB,aAAa,KAAK,GAAG,QAAQ,YAAY,KAAK,kBAAkB;AAAA,YAClF,aAAY;AAAA,YACZ,MAAM;AAAA,YACN,WAAU;AAAA;AAAA,QACZ;AAAA,QACC,aAAa,KAAK,GAAG,QACpB;AAAA,UAAC;AAAA;AAAA,YACC,IAAI,YAAY,KAAK;AAAA,YACrB,WAAU;AAAA,YACV,MAAK;AAAA,YAEJ,uBAAa,KAAK,GAAG;AAAA;AAAA,QACxB,IACE;AAAA,SACN;AAAA,OAEF,KAzNQ,KA0NV,CACD,GACH;AAAA,KACF;AAEJ;",
|
|
6
6
|
"names": ["value"]
|
|
7
7
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
3
4
|
import { Button } from "@open-mercato/ui/primitives/button";
|
|
4
5
|
import { Input } from "@open-mercato/ui/primitives/input";
|
|
5
6
|
import { Label } from "@open-mercato/ui/primitives/label";
|
|
@@ -30,6 +31,37 @@ const ACTIVITY_TYPES = [
|
|
|
30
31
|
];
|
|
31
32
|
function TransitionsEditor({ value = [], onChange, steps = [], error }) {
|
|
32
33
|
const t = useT();
|
|
34
|
+
const [configDrafts, setConfigDrafts] = React.useState({});
|
|
35
|
+
const configDraftKey = (transition, activity) => `${transition.transitionId}:${activity.activityId}`;
|
|
36
|
+
const handleConfigTextChange = (transitionIndex, activityIndex, text) => {
|
|
37
|
+
const transition = value[transitionIndex];
|
|
38
|
+
const activity = transition.activities?.[activityIndex];
|
|
39
|
+
if (!activity) return;
|
|
40
|
+
let parsed = null;
|
|
41
|
+
let parseError = null;
|
|
42
|
+
try {
|
|
43
|
+
const candidate = JSON.parse(text);
|
|
44
|
+
if (candidate && typeof candidate === "object" && !Array.isArray(candidate)) {
|
|
45
|
+
parsed = candidate;
|
|
46
|
+
} else {
|
|
47
|
+
parseError = t("workflows.activities.configMustBeObject", "Config must be a JSON object");
|
|
48
|
+
}
|
|
49
|
+
} catch (err) {
|
|
50
|
+
parseError = err instanceof Error ? err.message : t("workflows.activities.configInvalidJson", "Invalid JSON");
|
|
51
|
+
}
|
|
52
|
+
const key = configDraftKey(transition, activity);
|
|
53
|
+
setConfigDrafts((drafts) => ({ ...drafts, [key]: { text, error: parseError } }));
|
|
54
|
+
if (parsed) updateActivity(transitionIndex, activityIndex, "config", parsed);
|
|
55
|
+
};
|
|
56
|
+
const handleConfigBlur = (transition, activity) => {
|
|
57
|
+
const key = configDraftKey(transition, activity);
|
|
58
|
+
setConfigDrafts((drafts) => {
|
|
59
|
+
if (!drafts[key] || drafts[key].error) return drafts;
|
|
60
|
+
const next = { ...drafts };
|
|
61
|
+
delete next[key];
|
|
62
|
+
return next;
|
|
63
|
+
});
|
|
64
|
+
};
|
|
33
65
|
const addTransition = () => {
|
|
34
66
|
const newTransition = {
|
|
35
67
|
transitionId: `transition_${Date.now()}`,
|
|
@@ -307,198 +339,208 @@ function TransitionsEditor({ value = [], onChange, steps = [], error }) {
|
|
|
307
339
|
)
|
|
308
340
|
] }),
|
|
309
341
|
(transition.activities || []).length === 0 && /* @__PURE__ */ jsx("div", { className: "p-3 text-center text-xs text-muted-foreground border rounded-md bg-muted", children: t("workflows.form.noActivitiesInTransition") }),
|
|
310
|
-
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: (transition.activities || []).map((activity, activityIndex) =>
|
|
311
|
-
|
|
312
|
-
|
|
342
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-2", children: (transition.activities || []).map((activity, activityIndex) => {
|
|
343
|
+
const draftKey = configDraftKey(transition, activity);
|
|
344
|
+
const configDraft = configDrafts[draftKey];
|
|
345
|
+
return /* @__PURE__ */ jsx("div", { className: "p-3 border rounded-md bg-muted shadow-sm border-l-4 border-l-green-500", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
346
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between", children: [
|
|
347
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 grid grid-cols-1 sm:grid-cols-2 gap-2", children: [
|
|
348
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
349
|
+
/* @__PURE__ */ jsxs(Label, { htmlFor: `activity-${index}-${activityIndex}-id`, className: "text-xs", children: [
|
|
350
|
+
t("workflows.activities.activityId"),
|
|
351
|
+
" *"
|
|
352
|
+
] }),
|
|
353
|
+
/* @__PURE__ */ jsx(
|
|
354
|
+
Input,
|
|
355
|
+
{
|
|
356
|
+
id: `activity-${index}-${activityIndex}-id`,
|
|
357
|
+
value: activity.activityId,
|
|
358
|
+
onChange: (e) => updateActivity(index, activityIndex, "activityId", e.target.value),
|
|
359
|
+
placeholder: "activity_name",
|
|
360
|
+
className: "mt-1 text-xs h-8"
|
|
361
|
+
}
|
|
362
|
+
)
|
|
363
|
+
] }),
|
|
364
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
365
|
+
/* @__PURE__ */ jsxs(Label, { htmlFor: `activity-${index}-${activityIndex}-name`, className: "text-xs", children: [
|
|
366
|
+
t("workflows.activities.activityName"),
|
|
367
|
+
" *"
|
|
368
|
+
] }),
|
|
369
|
+
/* @__PURE__ */ jsx(
|
|
370
|
+
Input,
|
|
371
|
+
{
|
|
372
|
+
id: `activity-${index}-${activityIndex}-name`,
|
|
373
|
+
value: activity.activityName,
|
|
374
|
+
onChange: (e) => updateActivity(index, activityIndex, "activityName", e.target.value),
|
|
375
|
+
placeholder: t("workflows.activities.activityName"),
|
|
376
|
+
className: "mt-1 text-xs h-8"
|
|
377
|
+
}
|
|
378
|
+
)
|
|
379
|
+
] })
|
|
380
|
+
] }),
|
|
381
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 self-end sm:self-auto", children: [
|
|
382
|
+
/* @__PURE__ */ jsx(
|
|
383
|
+
Button,
|
|
384
|
+
{
|
|
385
|
+
type: "button",
|
|
386
|
+
variant: "ghost",
|
|
387
|
+
size: "sm",
|
|
388
|
+
onClick: () => moveActivity(index, activityIndex, "up"),
|
|
389
|
+
disabled: activityIndex === 0,
|
|
390
|
+
title: t("common.moveUp"),
|
|
391
|
+
children: /* @__PURE__ */ jsx(ChevronUp, { className: "h-3 w-3" })
|
|
392
|
+
}
|
|
393
|
+
),
|
|
394
|
+
/* @__PURE__ */ jsx(
|
|
395
|
+
Button,
|
|
396
|
+
{
|
|
397
|
+
type: "button",
|
|
398
|
+
variant: "ghost",
|
|
399
|
+
size: "sm",
|
|
400
|
+
onClick: () => moveActivity(index, activityIndex, "down"),
|
|
401
|
+
disabled: activityIndex === (transition.activities || []).length - 1,
|
|
402
|
+
title: t("common.moveDown"),
|
|
403
|
+
children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" })
|
|
404
|
+
}
|
|
405
|
+
),
|
|
406
|
+
/* @__PURE__ */ jsx(
|
|
407
|
+
Button,
|
|
408
|
+
{
|
|
409
|
+
type: "button",
|
|
410
|
+
variant: "ghost",
|
|
411
|
+
size: "sm",
|
|
412
|
+
onClick: () => removeActivity(index, activityIndex),
|
|
413
|
+
title: t("common.delete"),
|
|
414
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "h-3 w-3 text-red-600" })
|
|
415
|
+
}
|
|
416
|
+
)
|
|
417
|
+
] })
|
|
418
|
+
] }),
|
|
419
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-3 gap-2", children: [
|
|
313
420
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
314
|
-
/* @__PURE__ */ jsxs(Label, { htmlFor: `activity-${index}-${activityIndex}-
|
|
315
|
-
t("workflows.activities.
|
|
421
|
+
/* @__PURE__ */ jsxs(Label, { htmlFor: `activity-${index}-${activityIndex}-type`, className: "text-xs", children: [
|
|
422
|
+
t("workflows.activities.activityType"),
|
|
316
423
|
" *"
|
|
317
424
|
] }),
|
|
425
|
+
/* @__PURE__ */ jsxs(
|
|
426
|
+
Select,
|
|
427
|
+
{
|
|
428
|
+
value: activity.activityType,
|
|
429
|
+
onValueChange: (value2) => updateActivity(index, activityIndex, "activityType", value2),
|
|
430
|
+
children: [
|
|
431
|
+
/* @__PURE__ */ jsx(SelectTrigger, { id: `activity-${index}-${activityIndex}-type`, size: "sm", className: "mt-1", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
432
|
+
/* @__PURE__ */ jsx(SelectContent, { children: ACTIVITY_TYPES.map((type) => /* @__PURE__ */ jsx(SelectItem, { value: type.value, children: t(`workflows.activities.types.${type.value}`) }, type.value)) })
|
|
433
|
+
]
|
|
434
|
+
}
|
|
435
|
+
)
|
|
436
|
+
] }),
|
|
437
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
438
|
+
/* @__PURE__ */ jsxs(Label, { htmlFor: `activity-${index}-${activityIndex}-timeout`, className: "text-xs", children: [
|
|
439
|
+
t("workflows.activities.timeout"),
|
|
440
|
+
" (ms)"
|
|
441
|
+
] }),
|
|
318
442
|
/* @__PURE__ */ jsx(
|
|
319
443
|
Input,
|
|
320
444
|
{
|
|
321
|
-
id: `activity-${index}-${activityIndex}-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
445
|
+
id: `activity-${index}-${activityIndex}-timeout`,
|
|
446
|
+
type: "number",
|
|
447
|
+
value: activity.timeoutMs || "",
|
|
448
|
+
onChange: (e) => updateActivity(index, activityIndex, "timeoutMs", e.target.value ? parseInt(e.target.value) : void 0),
|
|
449
|
+
placeholder: "30000",
|
|
325
450
|
className: "mt-1 text-xs h-8"
|
|
326
451
|
}
|
|
327
452
|
)
|
|
328
453
|
] }),
|
|
454
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-end pb-1", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
455
|
+
/* @__PURE__ */ jsx(
|
|
456
|
+
"input",
|
|
457
|
+
{
|
|
458
|
+
type: "checkbox",
|
|
459
|
+
id: `activity-${index}-${activityIndex}-async`,
|
|
460
|
+
checked: activity.async || false,
|
|
461
|
+
onChange: (e) => updateActivity(index, activityIndex, "async", e.target.checked),
|
|
462
|
+
className: "h-3 w-3"
|
|
463
|
+
}
|
|
464
|
+
),
|
|
465
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: `activity-${index}-${activityIndex}-async`, className: "text-xs cursor-pointer", children: t("workflows.activities.async") })
|
|
466
|
+
] }) })
|
|
467
|
+
] }),
|
|
468
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-3 gap-2", children: [
|
|
329
469
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
330
|
-
/* @__PURE__ */
|
|
331
|
-
|
|
332
|
-
|
|
470
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: `activity-${index}-${activityIndex}-retry-attempts`, className: "text-xs", children: t("workflows.form.maxRetryAttempts") }),
|
|
471
|
+
/* @__PURE__ */ jsx(
|
|
472
|
+
Input,
|
|
473
|
+
{
|
|
474
|
+
id: `activity-${index}-${activityIndex}-retry-attempts`,
|
|
475
|
+
type: "number",
|
|
476
|
+
value: activity.retryPolicy?.maxAttempts || 3,
|
|
477
|
+
onChange: (e) => updateRetryPolicy(index, activityIndex, "maxAttempts", parseInt(e.target.value)),
|
|
478
|
+
className: "mt-1 text-xs h-8"
|
|
479
|
+
}
|
|
480
|
+
)
|
|
481
|
+
] }),
|
|
482
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
483
|
+
/* @__PURE__ */ jsxs(Label, { htmlFor: `activity-${index}-${activityIndex}-retry-delay`, className: "text-xs", children: [
|
|
484
|
+
t("workflows.form.retryDelay"),
|
|
485
|
+
" (ms)"
|
|
333
486
|
] }),
|
|
334
487
|
/* @__PURE__ */ jsx(
|
|
335
488
|
Input,
|
|
336
489
|
{
|
|
337
|
-
id: `activity-${index}-${activityIndex}-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
490
|
+
id: `activity-${index}-${activityIndex}-retry-delay`,
|
|
491
|
+
type: "number",
|
|
492
|
+
value: activity.retryPolicy?.retryDelay || 1e3,
|
|
493
|
+
onChange: (e) => updateRetryPolicy(index, activityIndex, "retryDelay", parseInt(e.target.value)),
|
|
341
494
|
className: "mt-1 text-xs h-8"
|
|
342
495
|
}
|
|
343
496
|
)
|
|
344
|
-
] })
|
|
345
|
-
] }),
|
|
346
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 self-end sm:self-auto", children: [
|
|
347
|
-
/* @__PURE__ */ jsx(
|
|
348
|
-
Button,
|
|
349
|
-
{
|
|
350
|
-
type: "button",
|
|
351
|
-
variant: "ghost",
|
|
352
|
-
size: "sm",
|
|
353
|
-
onClick: () => moveActivity(index, activityIndex, "up"),
|
|
354
|
-
disabled: activityIndex === 0,
|
|
355
|
-
title: t("common.moveUp"),
|
|
356
|
-
children: /* @__PURE__ */ jsx(ChevronUp, { className: "h-3 w-3" })
|
|
357
|
-
}
|
|
358
|
-
),
|
|
359
|
-
/* @__PURE__ */ jsx(
|
|
360
|
-
Button,
|
|
361
|
-
{
|
|
362
|
-
type: "button",
|
|
363
|
-
variant: "ghost",
|
|
364
|
-
size: "sm",
|
|
365
|
-
onClick: () => moveActivity(index, activityIndex, "down"),
|
|
366
|
-
disabled: activityIndex === (transition.activities || []).length - 1,
|
|
367
|
-
title: t("common.moveDown"),
|
|
368
|
-
children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" })
|
|
369
|
-
}
|
|
370
|
-
),
|
|
371
|
-
/* @__PURE__ */ jsx(
|
|
372
|
-
Button,
|
|
373
|
-
{
|
|
374
|
-
type: "button",
|
|
375
|
-
variant: "ghost",
|
|
376
|
-
size: "sm",
|
|
377
|
-
onClick: () => removeActivity(index, activityIndex),
|
|
378
|
-
title: t("common.delete"),
|
|
379
|
-
children: /* @__PURE__ */ jsx(Trash2, { className: "h-3 w-3 text-red-600" })
|
|
380
|
-
}
|
|
381
|
-
)
|
|
382
|
-
] })
|
|
383
|
-
] }),
|
|
384
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-3 gap-2", children: [
|
|
385
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
386
|
-
/* @__PURE__ */ jsxs(Label, { htmlFor: `activity-${index}-${activityIndex}-type`, className: "text-xs", children: [
|
|
387
|
-
t("workflows.activities.activityType"),
|
|
388
|
-
" *"
|
|
389
497
|
] }),
|
|
390
|
-
/* @__PURE__ */ jsxs(
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
498
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
499
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: `activity-${index}-${activityIndex}-backoff`, className: "text-xs", children: t("workflows.form.backoffMultiplier") }),
|
|
500
|
+
/* @__PURE__ */ jsx(
|
|
501
|
+
Input,
|
|
502
|
+
{
|
|
503
|
+
id: `activity-${index}-${activityIndex}-backoff`,
|
|
504
|
+
type: "number",
|
|
505
|
+
step: "0.1",
|
|
506
|
+
value: activity.retryPolicy?.backoffMultiplier || 2,
|
|
507
|
+
onChange: (e) => updateRetryPolicy(index, activityIndex, "backoffMultiplier", parseFloat(e.target.value)),
|
|
508
|
+
className: "mt-1 text-xs h-8"
|
|
509
|
+
}
|
|
510
|
+
)
|
|
511
|
+
] })
|
|
401
512
|
] }),
|
|
402
513
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
403
|
-
/* @__PURE__ */ jsxs(Label, { htmlFor: `activity-${index}-${activityIndex}-
|
|
404
|
-
t("workflows.activities.
|
|
405
|
-
" (
|
|
514
|
+
/* @__PURE__ */ jsxs(Label, { htmlFor: `activity-${index}-${activityIndex}-config`, className: "text-xs", children: [
|
|
515
|
+
t("workflows.activities.config"),
|
|
516
|
+
" (JSON)"
|
|
406
517
|
] }),
|
|
407
518
|
/* @__PURE__ */ jsx(
|
|
408
|
-
|
|
519
|
+
Textarea,
|
|
409
520
|
{
|
|
410
|
-
id: `activity-${index}-${activityIndex}-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-end pb-1", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
420
|
-
/* @__PURE__ */ jsx(
|
|
421
|
-
"input",
|
|
422
|
-
{
|
|
423
|
-
type: "checkbox",
|
|
424
|
-
id: `activity-${index}-${activityIndex}-async`,
|
|
425
|
-
checked: activity.async || false,
|
|
426
|
-
onChange: (e) => updateActivity(index, activityIndex, "async", e.target.checked),
|
|
427
|
-
className: "h-3 w-3"
|
|
521
|
+
id: `activity-${index}-${activityIndex}-config`,
|
|
522
|
+
value: configDraft?.text ?? JSON.stringify(activity.config || {}, null, 2),
|
|
523
|
+
onChange: (e) => handleConfigTextChange(index, activityIndex, e.target.value),
|
|
524
|
+
onBlur: () => handleConfigBlur(transition, activity),
|
|
525
|
+
"aria-invalid": configDraft?.error ? true : void 0,
|
|
526
|
+
"aria-describedby": configDraft?.error ? `activity-${index}-${activityIndex}-config-error` : void 0,
|
|
527
|
+
placeholder: '{"key": "value"}',
|
|
528
|
+
rows: 2,
|
|
529
|
+
className: "mt-1 font-mono text-xs"
|
|
428
530
|
}
|
|
429
531
|
),
|
|
430
|
-
/* @__PURE__ */ jsx(
|
|
431
|
-
|
|
432
|
-
] }),
|
|
433
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-3 gap-2", children: [
|
|
434
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
435
|
-
/* @__PURE__ */ jsx(Label, { htmlFor: `activity-${index}-${activityIndex}-retry-attempts`, className: "text-xs", children: t("workflows.form.maxRetryAttempts") }),
|
|
436
|
-
/* @__PURE__ */ jsx(
|
|
437
|
-
Input,
|
|
438
|
-
{
|
|
439
|
-
id: `activity-${index}-${activityIndex}-retry-attempts`,
|
|
440
|
-
type: "number",
|
|
441
|
-
value: activity.retryPolicy?.maxAttempts || 3,
|
|
442
|
-
onChange: (e) => updateRetryPolicy(index, activityIndex, "maxAttempts", parseInt(e.target.value)),
|
|
443
|
-
className: "mt-1 text-xs h-8"
|
|
444
|
-
}
|
|
445
|
-
)
|
|
446
|
-
] }),
|
|
447
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
448
|
-
/* @__PURE__ */ jsxs(Label, { htmlFor: `activity-${index}-${activityIndex}-retry-delay`, className: "text-xs", children: [
|
|
449
|
-
t("workflows.form.retryDelay"),
|
|
450
|
-
" (ms)"
|
|
451
|
-
] }),
|
|
452
|
-
/* @__PURE__ */ jsx(
|
|
453
|
-
Input,
|
|
454
|
-
{
|
|
455
|
-
id: `activity-${index}-${activityIndex}-retry-delay`,
|
|
456
|
-
type: "number",
|
|
457
|
-
value: activity.retryPolicy?.retryDelay || 1e3,
|
|
458
|
-
onChange: (e) => updateRetryPolicy(index, activityIndex, "retryDelay", parseInt(e.target.value)),
|
|
459
|
-
className: "mt-1 text-xs h-8"
|
|
460
|
-
}
|
|
461
|
-
)
|
|
462
|
-
] }),
|
|
463
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
464
|
-
/* @__PURE__ */ jsx(Label, { htmlFor: `activity-${index}-${activityIndex}-backoff`, className: "text-xs", children: t("workflows.form.backoffMultiplier") }),
|
|
465
|
-
/* @__PURE__ */ jsx(
|
|
466
|
-
Input,
|
|
532
|
+
configDraft?.error ? /* @__PURE__ */ jsx(
|
|
533
|
+
"p",
|
|
467
534
|
{
|
|
468
|
-
id: `activity-${index}-${activityIndex}-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
onChange: (e) => updateRetryPolicy(index, activityIndex, "backoffMultiplier", parseFloat(e.target.value)),
|
|
473
|
-
className: "mt-1 text-xs h-8"
|
|
535
|
+
id: `activity-${index}-${activityIndex}-config-error`,
|
|
536
|
+
className: "mt-1 text-xs text-status-error-text",
|
|
537
|
+
role: "alert",
|
|
538
|
+
children: configDraft.error
|
|
474
539
|
}
|
|
475
|
-
)
|
|
540
|
+
) : null
|
|
476
541
|
] })
|
|
477
|
-
] }),
|
|
478
|
-
|
|
479
|
-
/* @__PURE__ */ jsxs(Label, { htmlFor: `activity-${index}-${activityIndex}-config`, className: "text-xs", children: [
|
|
480
|
-
t("workflows.activities.config"),
|
|
481
|
-
" (JSON)"
|
|
482
|
-
] }),
|
|
483
|
-
/* @__PURE__ */ jsx(
|
|
484
|
-
Textarea,
|
|
485
|
-
{
|
|
486
|
-
id: `activity-${index}-${activityIndex}-config`,
|
|
487
|
-
value: JSON.stringify(activity.config || {}, null, 2),
|
|
488
|
-
onChange: (e) => {
|
|
489
|
-
try {
|
|
490
|
-
const parsed = JSON.parse(e.target.value);
|
|
491
|
-
updateActivity(index, activityIndex, "config", parsed);
|
|
492
|
-
} catch {
|
|
493
|
-
}
|
|
494
|
-
},
|
|
495
|
-
placeholder: '{"key": "value"}',
|
|
496
|
-
rows: 2,
|
|
497
|
-
className: "mt-1 font-mono text-xs"
|
|
498
|
-
}
|
|
499
|
-
)
|
|
500
|
-
] })
|
|
501
|
-
] }) }, activityIndex)) })
|
|
542
|
+
] }) }, draftKey);
|
|
543
|
+
}) })
|
|
502
544
|
] })
|
|
503
545
|
] }) }, index)) })
|
|
504
546
|
] });
|