@burdenoff/microfe-planmagnet 2026.930.20 → 2026.930.22

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/dist/node_modules/lodash/_arrayEach.js +14 -0
  2. package/dist/node_modules/lodash/_arrayEach.js.map +1 -0
  3. package/dist/node_modules/lodash/_assignValue.js +17 -0
  4. package/dist/node_modules/lodash/_assignValue.js.map +1 -0
  5. package/dist/node_modules/lodash/_baseAssign.js +16 -0
  6. package/dist/node_modules/lodash/_baseAssign.js.map +1 -0
  7. package/dist/node_modules/lodash/_baseAssignIn.js +16 -0
  8. package/dist/node_modules/lodash/_baseAssignIn.js.map +1 -0
  9. package/dist/node_modules/lodash/_baseClone.js +64 -0
  10. package/dist/node_modules/lodash/_baseClone.js.map +1 -0
  11. package/dist/node_modules/lodash/_baseCreate.js +21 -0
  12. package/dist/node_modules/lodash/_baseCreate.js.map +1 -0
  13. package/dist/node_modules/lodash/_baseIsMap.js +16 -0
  14. package/dist/node_modules/lodash/_baseIsMap.js.map +1 -0
  15. package/dist/node_modules/lodash/_baseIsSet.js +16 -0
  16. package/dist/node_modules/lodash/_baseIsSet.js.map +1 -0
  17. package/dist/node_modules/lodash/_baseKeysIn.js +20 -0
  18. package/dist/node_modules/lodash/_baseKeysIn.js.map +1 -0
  19. package/dist/node_modules/lodash/_baseSum.js +17 -0
  20. package/dist/node_modules/lodash/_baseSum.js.map +1 -0
  21. package/dist/node_modules/lodash/_baseUnset.js +26 -0
  22. package/dist/node_modules/lodash/_baseUnset.js.map +1 -0
  23. package/dist/node_modules/lodash/_cloneArrayBuffer.js +16 -0
  24. package/dist/node_modules/lodash/_cloneArrayBuffer.js.map +1 -0
  25. package/dist/node_modules/lodash/_cloneBuffer.js +17 -0
  26. package/dist/node_modules/lodash/_cloneBuffer.js.map +1 -0
  27. package/dist/node_modules/lodash/_cloneDataView.js +16 -0
  28. package/dist/node_modules/lodash/_cloneDataView.js.map +1 -0
  29. package/dist/node_modules/lodash/_cloneRegExp.js +15 -0
  30. package/dist/node_modules/lodash/_cloneRegExp.js.map +1 -0
  31. package/dist/node_modules/lodash/_cloneSymbol.js +15 -0
  32. package/dist/node_modules/lodash/_cloneSymbol.js.map +1 -0
  33. package/dist/node_modules/lodash/_cloneTypedArray.js +16 -0
  34. package/dist/node_modules/lodash/_cloneTypedArray.js.map +1 -0
  35. package/dist/node_modules/lodash/_copyArray.js +15 -0
  36. package/dist/node_modules/lodash/_copyArray.js.map +1 -0
  37. package/dist/node_modules/lodash/_copyObject.js +22 -0
  38. package/dist/node_modules/lodash/_copyObject.js.map +1 -0
  39. package/dist/node_modules/lodash/_copySymbols.js +16 -0
  40. package/dist/node_modules/lodash/_copySymbols.js.map +1 -0
  41. package/dist/node_modules/lodash/_copySymbolsIn.js +16 -0
  42. package/dist/node_modules/lodash/_copySymbolsIn.js.map +1 -0
  43. package/dist/node_modules/lodash/_customOmitClone.js +15 -0
  44. package/dist/node_modules/lodash/_customOmitClone.js.map +1 -0
  45. package/dist/node_modules/lodash/_flatRest.js +17 -0
  46. package/dist/node_modules/lodash/_flatRest.js.map +1 -0
  47. package/dist/node_modules/lodash/_getAllKeysIn.js +17 -0
  48. package/dist/node_modules/lodash/_getAllKeysIn.js.map +1 -0
  49. package/dist/node_modules/lodash/_getSymbolsIn.js +18 -0
  50. package/dist/node_modules/lodash/_getSymbolsIn.js.map +1 -0
  51. package/dist/node_modules/lodash/_initCloneArray.js +15 -0
  52. package/dist/node_modules/lodash/_initCloneArray.js.map +1 -0
  53. package/dist/node_modules/lodash/_initCloneByTag.js +40 -0
  54. package/dist/node_modules/lodash/_initCloneByTag.js.map +1 -0
  55. package/dist/node_modules/lodash/_initCloneObject.js +17 -0
  56. package/dist/node_modules/lodash/_initCloneObject.js.map +1 -0
  57. package/dist/node_modules/lodash/_nativeKeysIn.js +15 -0
  58. package/dist/node_modules/lodash/_nativeKeysIn.js.map +1 -0
  59. package/dist/node_modules/lodash/_parent.js +16 -0
  60. package/dist/node_modules/lodash/_parent.js.map +1 -0
  61. package/dist/node_modules/lodash/flatten.js +15 -0
  62. package/dist/node_modules/lodash/flatten.js.map +1 -0
  63. package/dist/node_modules/lodash/isMap.js +14 -0
  64. package/dist/node_modules/lodash/isMap.js.map +1 -0
  65. package/dist/node_modules/lodash/isSet.js +14 -0
  66. package/dist/node_modules/lodash/isSet.js.map +1 -0
  67. package/dist/node_modules/lodash/keysIn.js +17 -0
  68. package/dist/node_modules/lodash/keysIn.js.map +1 -0
  69. package/dist/node_modules/lodash/maxBy.js +17 -0
  70. package/dist/node_modules/lodash/maxBy.js.map +1 -0
  71. package/dist/node_modules/lodash/omit.js +28 -0
  72. package/dist/node_modules/lodash/omit.js.map +1 -0
  73. package/dist/node_modules/lodash/sumBy.js +16 -0
  74. package/dist/node_modules/lodash/sumBy.js.map +1 -0
  75. package/dist/node_modules/recharts/es6/chart/Sankey.js +556 -0
  76. package/dist/node_modules/recharts/es6/chart/Sankey.js.map +1 -0
  77. package/dist/node_modules/recharts/es6/chart/Treemap.js +545 -0
  78. package/dist/node_modules/recharts/es6/chart/Treemap.js.map +1 -0
  79. package/dist/node_modules/recharts/es6/shape/Polygon.js +112 -0
  80. package/dist/node_modules/recharts/es6/shape/Polygon.js.map +1 -0
  81. package/dist/node_modules/recharts/es6/util/Constants.js +31 -0
  82. package/dist/node_modules/recharts/es6/util/Constants.js.map +1 -0
  83. package/dist/node_modules/recharts/es6/util/ReactUtils.js +15 -10
  84. package/dist/node_modules/recharts/es6/util/ReactUtils.js.map +1 -1
  85. package/dist/planmagnet/automation/AutomationExecutionsPanel.d.ts.map +1 -1
  86. package/dist/planmagnet/automation/AutomationExecutionsPanel.js +43 -39
  87. package/dist/planmagnet/automation/AutomationExecutionsPanel.js.map +1 -1
  88. package/dist/planmagnet/automation/AutomationRuleFields.d.ts +23 -4
  89. package/dist/planmagnet/automation/AutomationRuleFields.d.ts.map +1 -1
  90. package/dist/planmagnet/automation/AutomationRuleFields.js +255 -108
  91. package/dist/planmagnet/automation/AutomationRuleFields.js.map +1 -1
  92. package/dist/planmagnet/automation/automationRuleTypes.d.ts +138 -15
  93. package/dist/planmagnet/automation/automationRuleTypes.d.ts.map +1 -1
  94. package/dist/planmagnet/automation/automationRuleTypes.js +162 -22
  95. package/dist/planmagnet/automation/automationRuleTypes.js.map +1 -1
  96. package/dist/planmagnet/controls/AutomationRuleControls.d.ts.map +1 -1
  97. package/dist/planmagnet/controls/AutomationRuleControls.js +78 -73
  98. package/dist/planmagnet/controls/AutomationRuleControls.js.map +1 -1
  99. package/dist/planmagnet/controls/CompetitorControls.js +7 -7
  100. package/dist/planmagnet/controls/FeatureControls.js +38 -38
  101. package/dist/planmagnet/controls/ProgramControls.js +8 -8
  102. package/dist/planmagnet/dependency/DependencyGraph.js +9 -9
  103. package/dist/planmagnet/dependency/DependencyPanel.js +13 -13
  104. package/dist/planmagnet/pages/ActivityActivityPagePage.js +16 -16
  105. package/dist/planmagnet/pages/ActivityActivityPagePage.js.map +1 -1
  106. package/dist/planmagnet/pages/AnalyticsAnalyticsPagePage.d.ts.map +1 -1
  107. package/dist/planmagnet/pages/AnalyticsAnalyticsPagePage.js +91 -73
  108. package/dist/planmagnet/pages/AnalyticsAnalyticsPagePage.js.map +1 -1
  109. package/dist/planmagnet/pages/AutomationAutomationRuleDetailPagePage.d.ts.map +1 -1
  110. package/dist/planmagnet/pages/AutomationAutomationRuleDetailPagePage.js +85 -76
  111. package/dist/planmagnet/pages/AutomationAutomationRuleDetailPagePage.js.map +1 -1
  112. package/dist/planmagnet/pages/AutomationAutomationRulesPagePage.js +18 -18
  113. package/dist/planmagnet/pages/AutomationAutomationRulesPagePage.js.map +1 -1
  114. package/dist/planmagnet/pages/AutomationCreateAutomationRulePagePage.d.ts.map +1 -1
  115. package/dist/planmagnet/pages/AutomationCreateAutomationRulePagePage.js +49 -45
  116. package/dist/planmagnet/pages/AutomationCreateAutomationRulePagePage.js.map +1 -1
  117. package/dist/planmagnet/pages/DashboardDashboardPagePage.js +11 -11
  118. package/dist/planmagnet/pages/DashboardsProjectManagerPagePage.js +5 -5
  119. package/dist/planmagnet/pages/DashboardsTeamUtilizationPagePage.js +5 -5
  120. package/dist/planmagnet/pages/IntegrationsNewSyncPagePage.js +6 -6
  121. package/dist/planmagnet/pages/IntegrationsNewSyncPagePage.js.map +1 -1
  122. package/dist/planmagnet/pages/IntegrationsSyncsPagePage.js +8 -8
  123. package/dist/planmagnet/pages/ProjectsBudgetsPagePage.js +10 -10
  124. package/dist/planmagnet/pages/ProjectsCriticalPathPagePage.js +6 -6
  125. package/dist/planmagnet/pages/ProjectsEditProjectPagePage.js +5 -5
  126. package/dist/planmagnet/pages/ProjectsPlanningPagePage.js +8 -8
  127. package/dist/planmagnet/pages/SprintsStartSprintPagePage.js +4 -4
  128. package/dist/planmagnet/pages/analytics/StatusFlowCard.d.ts +8 -0
  129. package/dist/planmagnet/pages/analytics/StatusFlowCard.d.ts.map +1 -0
  130. package/dist/planmagnet/pages/analytics/StatusFlowCard.js +231 -0
  131. package/dist/planmagnet/pages/analytics/StatusFlowCard.js.map +1 -0
  132. package/dist/planmagnet/pages/analytics/WorkBreakdownCard.d.ts +6 -0
  133. package/dist/planmagnet/pages/analytics/WorkBreakdownCard.d.ts.map +1 -0
  134. package/dist/planmagnet/pages/analytics/WorkBreakdownCard.js +364 -0
  135. package/dist/planmagnet/pages/analytics/WorkBreakdownCard.js.map +1 -0
  136. package/dist/planmagnet/people/People.d.ts.map +1 -1
  137. package/dist/planmagnet/people/People.js +30 -17
  138. package/dist/planmagnet/people/People.js.map +1 -1
  139. package/dist/planmagnet/roadmaps/RoadmapControls.js +17 -17
  140. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AutomationRuleFields.js","names":[],"sources":["../../../src/planmagnet/automation/AutomationRuleFields.tsx"],"sourcesContent":["import { Button, Input } from '@burdenoff/fe-libs/ui';\nimport { Plus, X } from 'lucide-react';\nimport {\n AssigneeSelect,\n WORK_ITEM_PRIORITIES,\n WORK_ITEM_STATUSES,\n enumLabel,\n} from '../controls/WorkItemControls';\nimport { ProjectSelect } from '../controls/Pickers';\nimport {\n ACTION_TYPES,\n ACTION_TYPE_LABEL,\n AUTOMATIC_TRIGGER_TYPES,\n CONDITION_FIELDS,\n CONDITION_OPERATORS,\n CONDITION_OPERATOR_LABEL,\n TRIGGER_TYPES,\n TRIGGER_TYPE_LABEL,\n type ActionType,\n type ConditionOperator,\n type RuleAction,\n type RuleCondition,\n type TriggerType,\n} from './automationRuleTypes';\n\n/** The editable shape both the create and edit pages share. */\nexport interface AutomationRuleFormState {\n name: string;\n description: string;\n projectId: string;\n triggerType: TriggerType;\n conditions: RuleCondition[];\n actions: RuleAction[];\n}\n\n// No width here: a native <select> does not go through tailwind-merge, so a `w-full` in a shared class and a\n// `w-32` added next to it BOTH land on the element and the stylesheet order decides — `w-full` won, the\n// operator / action-type selects took the whole row and squeezed the value input beside them to ~26px, so\n// nobody could see the value they typed. Rows size their own selects; `fieldClass` is the full-width form.\nconst fieldBaseClass =\n 'rounded-md border border-input bg-background px-3 py-2 text-sm disabled:opacity-60';\nconst fieldClass = `mt-1 w-full ${fieldBaseClass}`;\n\n// fe-libs' <Input> sets its own text color via `text-text-primary` (a semantic token from its own theme\n// scope), but every Input below sits in a row that also carries this file's OTHER token family\n// (`fieldClass` above uses `border-input`/`bg-background`, and the rest of this microfe standardizes on\n// `text-foreground`/`bg-background`/`border-input`). Passing this class merges via `cn()` (tailwind-merge),\n// which recognizes both `text-text-primary` and `text-foreground` as the same \"text color\" group and keeps\n// only the last one — so this pins every value/label an editor renders here to the token this microfe's own\n// pages already render correctly with, instead of leaving it to whichever token happens to win the cascade.\nconst inputTextClass = 'text-foreground';\n\nfunction ActionValueEditor({\n action,\n onChange,\n}: {\n action: RuleAction;\n onChange: (value: string) => void;\n}) {\n switch (action.type) {\n case 'ASSIGN_TO_USER':\n return <AssigneeSelect value={action.value} onChange={onChange} />;\n case 'SET_STATUS':\n return (\n <select\n className={`${fieldBaseClass} w-full`}\n value={action.value}\n onChange={(e) => onChange(e.target.value)}\n >\n <option value=\"\">Choose a status</option>\n {WORK_ITEM_STATUSES.map((s) => (\n <option key={s} value={s}>\n {enumLabel(s)}\n </option>\n ))}\n </select>\n );\n case 'SET_PRIORITY':\n return (\n <select\n className={`${fieldBaseClass} w-full`}\n value={action.value}\n onChange={(e) => onChange(e.target.value)}\n >\n <option value=\"\">Choose a priority</option>\n {WORK_ITEM_PRIORITIES.map((p) => (\n <option key={p} value={p}>\n {enumLabel(p)}\n </option>\n ))}\n </select>\n );\n case 'ADD_LABEL':\n default:\n return (\n <Input\n aria-label=\"Label\"\n className={inputTextClass}\n placeholder=\"e.g. needs-review\"\n value={action.value}\n onChange={(e) => onChange(e.target.value)}\n />\n );\n }\n}\n\n/** The actions builder: only the four types the engine can actually dispatch (see automationRuleTypes.ts). */\nexport function ActionsEditor({\n actions,\n onChange,\n}: {\n actions: RuleAction[];\n onChange: (next: RuleAction[]) => void;\n}) {\n const update = (index: number, patch: Partial<RuleAction>) =>\n onChange(actions.map((a, i) => (i === index ? { ...a, ...patch } : a)));\n const remove = (index: number) => onChange(actions.filter((_, i) => i !== index));\n const add = () => onChange([...actions, { type: 'ASSIGN_TO_USER', value: '' }]);\n\n return (\n <div className=\"space-y-2\">\n {actions.map((action, index) => {\n // A rule created before this UI existed (or via the API directly) can carry an action type this\n // builder does not offer (e.g. POST_COMMENT, which the engine never dispatches — see\n // automationRuleTypes.ts). Keep it selectable and visible rather than silently swapping it out from\n // under the user the moment they open the edit page.\n const known = (ACTION_TYPES as readonly string[]).includes(action.type);\n const typeOptions = known ? ACTION_TYPES : [action.type, ...ACTION_TYPES];\n return (\n <div key={index} className=\"space-y-1\">\n <div className=\"flex items-start gap-2\">\n <select\n aria-label=\"Action type\"\n className={`${fieldBaseClass} w-40 shrink-0`}\n value={action.type}\n onChange={(e) =>\n update(index, {\n type: e.target.value as ActionType,\n value: e.target.value === action.type ? action.value : '',\n })\n }\n >\n {typeOptions.map((t) => (\n <option key={t} value={t}>\n {known || t !== action.type ? (ACTION_TYPE_LABEL[t as ActionType] ?? t) : t}\n </option>\n ))}\n </select>\n <div className=\"min-w-0 flex-1\">\n <ActionValueEditor action={action} onChange={(value) => update(index, { value })} />\n </div>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n aria-label=\"Remove action\"\n onClick={() => remove(index)}\n >\n <X className=\"h-4 w-4\" />\n </Button>\n </div>\n {!known && (\n <p className=\"text-xs text-muted-foreground\">\n This action type is not run by the engine yet; the rule keeps it but never\n dispatches it.\n </p>\n )}\n </div>\n );\n })}\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n onClick={add}\n data-testid=\"automation-add-action\"\n >\n <Plus className=\"mr-1 h-4 w-4\" />\n Add action\n </Button>\n {actions.length === 0 && (\n <p className=\"text-xs text-muted-foreground\">\n A rule with no actions still records that it ran, but changes nothing.\n </p>\n )}\n </div>\n );\n}\n\n/** The conditions builder. A rule with no conditions always matches — the gate is opt-in (engine default). */\nexport function ConditionsEditor({\n conditions,\n onChange,\n}: {\n conditions: RuleCondition[];\n onChange: (next: RuleCondition[]) => void;\n}) {\n const update = (index: number, patch: Partial<RuleCondition>) =>\n onChange(conditions.map((c, i) => (i === index ? { ...c, ...patch } : c)));\n const remove = (index: number) => onChange(conditions.filter((_, i) => i !== index));\n const add = () => onChange([...conditions, { field: 'status', operator: 'eq', value: '' }]);\n\n return (\n <div className=\"space-y-2\">\n {conditions.map((condition, index) => (\n <div key={index} className=\"flex items-start gap-2\">\n <Input\n aria-label=\"Condition field\"\n list=\"automation-condition-fields\"\n className={`w-36 shrink-0 ${inputTextClass}`}\n placeholder=\"field\"\n value={condition.field}\n onChange={(e) => update(index, { field: e.target.value })}\n />\n <select\n aria-label=\"Condition operator\"\n className={`${fieldBaseClass} w-32 shrink-0`}\n value={condition.operator}\n onChange={(e) => update(index, { operator: e.target.value as ConditionOperator })}\n >\n {CONDITION_OPERATORS.map((op) => (\n <option key={op} value={op}>\n {CONDITION_OPERATOR_LABEL[op]}\n </option>\n ))}\n </select>\n {condition.operator !== 'exists' && (\n <Input\n aria-label=\"Condition value\"\n className={`min-w-0 flex-1 ${inputTextClass}`}\n placeholder={\n condition.operator === 'in' || condition.operator === 'notIn'\n ? 'comma, separated, values'\n : 'value'\n }\n value={condition.value}\n onChange={(e) => update(index, { value: e.target.value })}\n />\n )}\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n aria-label=\"Remove condition\"\n onClick={() => remove(index)}\n >\n <X className=\"h-4 w-4\" />\n </Button>\n </div>\n ))}\n <datalist id=\"automation-condition-fields\">\n {CONDITION_FIELDS.map((f) => (\n <option key={f} value={f} />\n ))}\n </datalist>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n onClick={add}\n data-testid=\"automation-add-condition\"\n >\n <Plus className=\"mr-1 h-4 w-4\" />\n Add condition\n </Button>\n {conditions.length === 0 && (\n <p className=\"text-xs text-muted-foreground\">\n No conditions: the rule matches every event.\n </p>\n )}\n </div>\n );\n}\n\n/** Name, description, project, trigger, conditions and actions — the fields create and edit share. */\nexport function AutomationRuleFields({\n form,\n onChange,\n projectLocked = false,\n}: {\n form: AutomationRuleFormState;\n onChange: (next: AutomationRuleFormState) => void;\n /** The edit page cannot change the project (the API accepts no `projectId` on update). */\n projectLocked?: boolean;\n}) {\n return (\n <div className=\"space-y-4\">\n <div>\n <label htmlFor=\"automation-name\" className=\"text-sm font-medium\">\n Name\n </label>\n <Input\n id=\"automation-name\"\n className={`mt-1 ${inputTextClass}`}\n value={form.name}\n onChange={(e) => onChange({ ...form, name: e.target.value })}\n placeholder=\"e.g. Assign new bugs to triage\"\n />\n </div>\n <div>\n <label htmlFor=\"automation-description\" className=\"text-sm font-medium\">\n Description\n </label>\n <textarea\n id=\"automation-description\"\n className=\"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm min-h-[72px]\"\n value={form.description}\n onChange={(e) => onChange({ ...form, description: e.target.value })}\n placeholder=\"What this rule is for\"\n />\n </div>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"automation-project\" className=\"text-sm font-medium\">\n Project\n </label>\n {projectLocked ? (\n <p className=\"mt-1 text-sm text-muted-foreground\">\n A rule&apos;s project cannot be changed after it is created.\n </p>\n ) : (\n <div className=\"mt-1\">\n <ProjectSelect\n id=\"automation-project\"\n value={form.projectId}\n onChange={(projectId) => onChange({ ...form, projectId })}\n />\n </div>\n )}\n </div>\n <div>\n <label htmlFor=\"automation-trigger\" className=\"text-sm font-medium\">\n Trigger\n </label>\n <select\n id=\"automation-trigger\"\n className={fieldClass}\n value={form.triggerType}\n onChange={(e) => onChange({ ...form, triggerType: e.target.value as TriggerType })}\n >\n {TRIGGER_TYPES.map((t) => (\n <option key={t} value={t}>\n {TRIGGER_TYPE_LABEL[t]}\n {AUTOMATIC_TRIGGER_TYPES.has(t) ? '' : ' (not yet automatic)'}\n </option>\n ))}\n </select>\n {!AUTOMATIC_TRIGGER_TYPES.has(form.triggerType) && (\n <p className=\"mt-1 text-xs text-muted-foreground\">\n This trigger is saved but does not fire on its own yet — use{' '}\n <span className=\"font-medium\">Run now</span> to run it against a work item.\n </p>\n )}\n </div>\n </div>\n <div>\n <p className=\"text-sm font-medium\">Conditions</p>\n <p className=\"mb-2 text-xs text-muted-foreground\">\n All conditions must match. Leave empty to match every event.\n </p>\n <ConditionsEditor\n conditions={form.conditions}\n onChange={(conditions) => onChange({ ...form, conditions })}\n />\n </div>\n <div>\n <p className=\"text-sm font-medium\">Actions</p>\n <p className=\"mb-2 text-xs text-muted-foreground\">\n Run in order when the conditions match.\n </p>\n <ActionsEditor\n actions={form.actions}\n onChange={(actions) => onChange({ ...form, actions })}\n />\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;AAuCA,IAAM,IACJ,sFACI,IAAa,eAAe,KAS5B,IAAiB;AAEvB,SAA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AAC,UAAD;MACE,IAAG;MACH,WAAW;MACX,OAAO,EAAK;MACZ,WAAW,MAAM,EAAS;OAAE,GAAG;OAAM,aAAa,EAAE,OAAO;OAAsB,CAAC;gBAEjF,EAAc,KAAK,MAClB,kBAAC,UAAD;OAAgB,OAAO;iBAAvB,CACG,EAAmB,IACnB,EAAwB,IAAI,EAAE,GAAG,KAAK,uBAChC;SAHI,EAGJ,CACT;MACK,CAAA;KACR,CAAC,EAAwB,IAAI,EAAK,YAAY,IAC7C,kBAAC,KAAD;MAAG,WAAU;gBAAb;OAAkD;OACa;OAC7D,kBAAC,QAAD;QAAM,WAAU;kBAAc;QAAc,CAAA;;OAC1C;;KAEF,EAAA,CAAA,CACF;;GACN,kBAAC,OAAD,EAAA,UAAA;IACE,kBAAC,KAAD;KAAG,WAAU;eAAsB;KAAc,CAAA;IACjD,kBAAC,KAAD;KAAG,WAAU;eAAqC;KAE9C,CAAA;IACJ,kBAAC,GAAD;KACE,YAAY,EAAK;KACjB,WAAW,MAAe,EAAS;MAAE,GAAG;MAAM;MAAY,CAAC;KAC3D,CAAA;IACE,EAAA,CAAA;GACN,kBAAC,OAAD,EAAA,UAAA;IACE,kBAAC,KAAD;KAAG,WAAU;eAAsB;KAAW,CAAA;IAC9C,kBAAC,KAAD;KAAG,WAAU;eAAqC;KAE9C,CAAA;IACJ,kBAAC,GAAD;KACE,SAAS,EAAK;KACd,WAAW,MAAY,EAAS;MAAE,GAAG;MAAM;MAAS,CAAC;KACrD,CAAA;IACE,EAAA,CAAA;GACF"}
1
+ {"version":3,"file":"AutomationRuleFields.js","names":[],"sources":["../../../src/planmagnet/automation/AutomationRuleFields.tsx"],"sourcesContent":["import { Button, Checkbox, Input, Textarea } from '@burdenoff/fe-libs/ui';\nimport { Plus, X } from 'lucide-react';\nimport {\n AssigneeSelect,\n WORK_ITEM_PRIORITIES,\n WORK_ITEM_STATUSES,\n enumLabel,\n} from '../controls/WorkItemControls';\nimport { ProjectSelect } from '../controls/Pickers';\nimport {\n ACTION_TYPES,\n ACTION_TYPE_LABEL,\n AUTOMATION_TEMPLATE_MAX_LENGTH,\n CHANNEL_POSTING_AVAILABLE,\n CHANNEL_POSTING_BLOCKED_MESSAGE,\n CHANNEL_POSTING_OPTION_REASON,\n CONDITION_FIELDS,\n CONDITION_OPERATORS,\n CONDITION_OPERATOR_LABEL,\n NO_WORK_ITEM_TRIGGER_TYPES,\n POST_COMMENT_MAX_RENDERED_LENGTH,\n TEMPLATE_PLACEHOLDER_INFO,\n TRIGGER_TYPES,\n TRIGGER_TYPE_LABEL,\n WORK_ITEM_ACTION_TYPES,\n parseScheduleDays,\n renderTemplatePreview,\n templatePlaceholdersForTrigger,\n templateSampleValues,\n triggerHint,\n triggerOptionSuffix,\n type ActionType,\n type ConditionOperator,\n type RuleAction,\n type RuleCondition,\n type TriggerType,\n} from './automationRuleTypes';\n\n/** The editable shape both the create and edit pages share. `conditions` is used for every trigger except\n * `SCHEDULE`, which has its own dedicated shape (`scheduleStatuses`/`scheduleNotUpdatedForDays`) — see\n * `automationRuleTypes.ts`'s `ScheduleConditions` doc comment for why it cannot reuse the generic editor. */\nexport interface AutomationRuleFormState {\n name: string;\n description: string;\n projectId: string;\n triggerType: TriggerType;\n conditions: RuleCondition[];\n scheduleStatuses: string[];\n scheduleNotUpdatedForDays: string;\n actions: RuleAction[];\n}\n\n// No width here: a native <select> does not go through tailwind-merge, so a `w-full` in a shared class and a\n// `w-32` added next to it BOTH land on the element and the stylesheet order decides — `w-full` won, the\n// operator / action-type selects took the whole row and squeezed the value input beside them to ~26px, so\n// nobody could see the value they typed. Rows size their own selects; `fieldClass` is the full-width form.\nconst fieldBaseClass =\n 'rounded-md border border-input bg-background px-3 py-2 text-sm disabled:opacity-60';\nconst fieldClass = `mt-1 w-full ${fieldBaseClass}`;\n\n// fe-libs' <Input> sets its own text color via `text-text-primary` (a semantic token from its own theme\n// scope), but every Input below sits in a row that also carries this file's OTHER token family\n// (`fieldClass` above uses `border-input`/`bg-background`, and the rest of this microfe standardizes on\n// `text-foreground`/`bg-background`/`border-input`). Passing this class merges via `cn()` (tailwind-merge),\n// which recognizes both `text-text-primary` and `text-foreground` as the same \"text color\" group and keeps\n// only the last one — so this pins every value/label an editor renders here to the token this microfe's own\n// pages already render correctly with, instead of leaving it to whichever token happens to win the cascade.\nconst inputTextClass = 'text-foreground';\n\n/** The POST_COMMENT template textarea + live character count + placeholder picker/help + rendered preview\n * (BOFF-8047 follow-up). `POST_TO_CHANNEL` never reaches this — it stays a disabled option (see `ActionValueEditor`\n * below) while `CHANNEL_POSTING_AVAILABLE` is false, so its own template UI is not built yet. */\nfunction TemplateEditor({\n value,\n triggerType,\n onChange,\n}: {\n value: string;\n triggerType: TriggerType;\n onChange: (value: string) => void;\n}) {\n const placeholders = templatePlaceholdersForTrigger(triggerType);\n const preview = renderTemplatePreview(\n value,\n templateSampleValues(triggerType),\n POST_COMMENT_MAX_RENDERED_LENGTH\n );\n\n const insert = (token: string) => onChange(`${value}{{${token}}}`);\n\n return (\n <div className=\"space-y-2\">\n <div>\n <Textarea\n aria-label=\"Comment template\"\n data-testid=\"automation-template\"\n className={`min-h-[72px] w-full ${inputTextClass}`}\n maxLength={AUTOMATION_TEMPLATE_MAX_LENGTH}\n placeholder=\"e.g. Automatically moved to {{toStatus}} by {{actor}}\"\n value={value}\n onChange={(e) => onChange(e.target.value)}\n />\n <p className=\"mt-1 text-xs text-muted-foreground\">\n {value.length} / {AUTOMATION_TEMPLATE_MAX_LENGTH} characters\n </p>\n </div>\n <div>\n <p className=\"text-xs font-medium text-muted-foreground\">Insert a placeholder</p>\n <div data-testid=\"automation-placeholders\" className=\"mt-1 flex flex-wrap gap-1.5\">\n {placeholders.map((token) => (\n <button\n key={token}\n type=\"button\"\n onClick={() => insert(token)}\n title={`Insert {{${token}}} — ${TEMPLATE_PLACEHOLDER_INFO[token]?.label ?? token}`}\n className=\"rounded-full border border-input px-2 py-0.5 text-xs text-muted-foreground hover:bg-muted\"\n >\n {`{{${token}}}`}\n </button>\n ))}\n </div>\n </div>\n <div\n data-testid=\"automation-template-preview\"\n className=\"rounded-md border border-dashed border-input p-2 text-xs\"\n >\n <p className=\"font-medium text-foreground\">Preview</p>\n <p className=\"mt-0.5 whitespace-pre-wrap text-muted-foreground\">\n {preview || <span className=\"italic\">Nothing to show yet — write a template above.</span>}\n </p>\n </div>\n </div>\n );\n}\n\nfunction ActionValueEditor({\n action,\n triggerType,\n onChange,\n}: {\n action: RuleAction;\n triggerType: TriggerType;\n onChange: (value: string) => void;\n}) {\n switch (action.type) {\n case 'ASSIGN_TO_USER':\n return <AssigneeSelect value={action.value} onChange={onChange} />;\n case 'SET_STATUS':\n return (\n <select\n className={`${fieldBaseClass} w-full`}\n value={action.value}\n onChange={(e) => onChange(e.target.value)}\n >\n <option value=\"\">Choose a status</option>\n {WORK_ITEM_STATUSES.map((s) => (\n <option key={s} value={s}>\n {enumLabel(s)}\n </option>\n ))}\n </select>\n );\n case 'SET_PRIORITY':\n return (\n <select\n className={`${fieldBaseClass} w-full`}\n value={action.value}\n onChange={(e) => onChange(e.target.value)}\n >\n <option value=\"\">Choose a priority</option>\n {WORK_ITEM_PRIORITIES.map((p) => (\n <option key={p} value={p}>\n {enumLabel(p)}\n </option>\n ))}\n </select>\n );\n case 'POST_COMMENT':\n return <TemplateEditor value={action.value} triggerType={triggerType} onChange={onChange} />;\n case 'POST_TO_CHANNEL':\n // Gated off (BOFF-8240): still shown, never editable into something savable. `action.value`/`channelId` on\n // an existing rule (saved before this UI existed, or via the API directly) stays visible read-only rather\n // than vanishing, but `saveBlockReason` refuses to save the form while this action is present.\n return (\n <div className=\"space-y-1\">\n <Input\n aria-label=\"Channel message template (read-only — not available yet)\"\n className={inputTextClass}\n value={action.value}\n disabled\n readOnly\n />\n <p className=\"text-xs text-destructive\">{CHANNEL_POSTING_BLOCKED_MESSAGE}</p>\n </div>\n );\n case 'ADD_LABEL':\n default:\n return (\n <Input\n aria-label=\"Label\"\n className={inputTextClass}\n placeholder=\"e.g. needs-review\"\n value={action.value}\n onChange={(e) => onChange(e.target.value)}\n />\n );\n }\n}\n\n/** The actions builder: the five types the engine can dispatch, trigger-aware (BOFF-8047 follow-up —\n * automationRuleTypes.ts's header has the full scope). `POST_TO_CHANNEL` is always visible but disabled (gated\n * off, BOFF-8240). For a trigger in `NO_WORK_ITEM_TRIGGER_TYPES` (the sprint and release triggers), no work-item\n * action can ever dispatch — existing rows stay visible (and removable) so a rule saved before this restriction\n * existed can still be cleaned up, but they are frozen and no new one can be added. */\nexport function ActionsEditor({\n actions,\n triggerType,\n onChange,\n}: {\n actions: RuleAction[];\n triggerType: TriggerType;\n onChange: (next: RuleAction[]) => void;\n}) {\n const noWorkItem = NO_WORK_ITEM_TRIGGER_TYPES.has(triggerType);\n const update = (index: number, patch: Partial<RuleAction>) =>\n onChange(actions.map((a, i) => (i === index ? { ...a, ...patch } : a)));\n const remove = (index: number) => onChange(actions.filter((_, i) => i !== index));\n const add = () => onChange([...actions, { type: 'ASSIGN_TO_USER', value: '' }]);\n\n return (\n <div className=\"space-y-2\">\n {noWorkItem && (\n <p className=\"text-xs text-muted-foreground\">\n This trigger has no target work item, so none of the actions below can run for it. Remove\n any left over from before this restriction existed, or switch to a different trigger.\n </p>\n )}\n {actions.map((action, index) => {\n // A rule created before this UI existed (or via the API directly) can carry an action type this\n // builder does not offer. Keep it selectable and visible rather than silently swapping it out from\n // under the user the moment they open the edit page.\n const known = (ACTION_TYPES as readonly string[]).includes(action.type);\n const typeOptions = known ? ACTION_TYPES : [action.type, ...ACTION_TYPES];\n const frozen = noWorkItem && WORK_ITEM_ACTION_TYPES.has(action.type);\n return (\n <div key={index} className=\"space-y-1\">\n <div className=\"flex items-start gap-2\">\n <select\n aria-label=\"Action type\"\n data-testid=\"automation-action-type\"\n className={`${fieldBaseClass} w-40 shrink-0`}\n value={action.type}\n disabled={frozen}\n onChange={(e) =>\n update(index, {\n type: e.target.value as ActionType,\n value: e.target.value === action.type ? action.value : '',\n })\n }\n >\n {typeOptions.map((t) => {\n const isChannel = t === 'POST_TO_CHANNEL';\n const disabled = isChannel && !CHANNEL_POSTING_AVAILABLE;\n const label =\n known || t !== action.type ? (ACTION_TYPE_LABEL[t as ActionType] ?? t) : t;\n return (\n <option key={t} value={t} disabled={disabled}>\n {disabled ? `${label} — ${CHANNEL_POSTING_OPTION_REASON}` : label}\n </option>\n );\n })}\n </select>\n <div className=\"min-w-0 flex-1\">\n <ActionValueEditor\n action={action}\n triggerType={triggerType}\n onChange={(value) => update(index, { value })}\n />\n </div>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n aria-label=\"Remove action\"\n onClick={() => remove(index)}\n >\n <X className=\"h-4 w-4\" />\n </Button>\n </div>\n {!known && (\n <p className=\"text-xs text-muted-foreground\">\n This action type is not run by the engine yet; the rule keeps it but never\n dispatches it.\n </p>\n )}\n </div>\n );\n })}\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n onClick={add}\n disabled={noWorkItem}\n title={\n noWorkItem ? 'This trigger has no target work item — no action can be added.' : undefined\n }\n data-testid=\"automation-add-action\"\n >\n <Plus className=\"mr-1 h-4 w-4\" />\n Add action\n </Button>\n {actions.length === 0 && !noWorkItem && (\n <p className=\"text-xs text-muted-foreground\">\n A rule with no actions still records that it ran, but changes nothing.\n </p>\n )}\n </div>\n );\n}\n\n/** The conditions builder. A rule with no conditions always matches — the gate is opt-in (engine default). Used\n * for every trigger except `SCHEDULE` — see `ScheduleConditionsEditor` below. */\nexport function ConditionsEditor({\n conditions,\n onChange,\n}: {\n conditions: RuleCondition[];\n onChange: (next: RuleCondition[]) => void;\n}) {\n const update = (index: number, patch: Partial<RuleCondition>) =>\n onChange(conditions.map((c, i) => (i === index ? { ...c, ...patch } : c)));\n const remove = (index: number) => onChange(conditions.filter((_, i) => i !== index));\n const add = () => onChange([...conditions, { field: 'status', operator: 'eq', value: '' }]);\n\n return (\n <div className=\"space-y-2\">\n {conditions.map((condition, index) => (\n <div key={index} className=\"flex items-start gap-2\">\n <Input\n aria-label=\"Condition field\"\n list=\"automation-condition-fields\"\n className={`w-36 shrink-0 ${inputTextClass}`}\n placeholder=\"field\"\n value={condition.field}\n onChange={(e) => update(index, { field: e.target.value })}\n />\n <select\n aria-label=\"Condition operator\"\n className={`${fieldBaseClass} w-32 shrink-0`}\n value={condition.operator}\n onChange={(e) => update(index, { operator: e.target.value as ConditionOperator })}\n >\n {CONDITION_OPERATORS.map((op) => (\n <option key={op} value={op}>\n {CONDITION_OPERATOR_LABEL[op]}\n </option>\n ))}\n </select>\n {condition.operator !== 'exists' && (\n <Input\n aria-label=\"Condition value\"\n className={`min-w-0 flex-1 ${inputTextClass}`}\n placeholder={\n condition.operator === 'in' || condition.operator === 'notIn'\n ? 'comma, separated, values'\n : 'value'\n }\n value={condition.value}\n onChange={(e) => update(index, { value: e.target.value })}\n />\n )}\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n aria-label=\"Remove condition\"\n onClick={() => remove(index)}\n >\n <X className=\"h-4 w-4\" />\n </Button>\n </div>\n ))}\n <datalist id=\"automation-condition-fields\">\n {CONDITION_FIELDS.map((f) => (\n <option key={f} value={f} />\n ))}\n </datalist>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n onClick={add}\n data-testid=\"automation-add-condition\"\n >\n <Plus className=\"mr-1 h-4 w-4\" />\n Add condition\n </Button>\n {conditions.length === 0 && (\n <p className=\"text-xs text-muted-foreground\">\n No conditions: the rule matches every event.\n </p>\n )}\n </div>\n );\n}\n\n/** The SCHEDULE trigger's own condition editor (AUT-27): statuses (multi-select of `WorkItemStatus`) + \"not\n * updated for N days\", writing exactly the `{ status, notUpdatedForDays }` shape `parseScheduleConditions`\n * (automation-scheduler.ts) reads — never the generic field/operator/value array. */\nexport function ScheduleConditionsEditor({\n statuses,\n days,\n onStatusesChange,\n onDaysChange,\n}: {\n statuses: string[];\n days: string;\n onStatusesChange: (next: string[]) => void;\n onDaysChange: (next: string) => void;\n}) {\n const toggle = (status: string) =>\n onStatusesChange(\n statuses.includes(status) ? statuses.filter((s) => s !== status) : [...statuses, status]\n );\n const parsedDays = parseScheduleDays(days);\n\n return (\n <div className=\"space-y-3\">\n <div>\n <p className=\"text-sm font-medium\">Statuses</p>\n <div\n data-testid=\"automation-schedule-statuses\"\n role=\"group\"\n aria-label=\"Statuses to watch\"\n className=\"mt-1 flex flex-wrap gap-2\"\n >\n {WORK_ITEM_STATUSES.map((s) => (\n <label\n key={s}\n className=\"flex items-center gap-1.5 rounded-md border border-input px-2 py-1 text-sm\"\n >\n <Checkbox\n checked={statuses.includes(s)}\n onCheckedChange={() => toggle(s)}\n aria-label={enumLabel(s)}\n />\n {enumLabel(s)}\n </label>\n ))}\n </div>\n {statuses.length === 0 && (\n <p className=\"mt-1 text-xs text-destructive\">Choose at least one status.</p>\n )}\n </div>\n <div>\n <label htmlFor=\"automation-schedule-days\" className=\"text-sm font-medium\">\n Not updated for (days)\n </label>\n <Input\n id=\"automation-schedule-days\"\n data-testid=\"automation-schedule-days\"\n inputMode=\"numeric\"\n pattern=\"[0-9]*\"\n className={`mt-1 w-28 ${inputTextClass}`}\n value={days}\n onChange={(e) => onDaysChange(e.target.value)}\n placeholder=\"e.g. 7\"\n />\n {days !== '' && parsedDays === null && (\n <p className=\"mt-1 text-xs text-destructive\">Enter a whole number of days, 1 or more.</p>\n )}\n </div>\n <p className=\"text-xs text-muted-foreground\">\n Runs once a day against every work item matching these statuses and staleness window, and\n acts on each matching item at most once per day.\n </p>\n </div>\n );\n}\n\n/** Name, description, project, trigger, conditions and actions — the fields create and edit share. */\nexport function AutomationRuleFields({\n form,\n onChange,\n projectLocked = false,\n}: {\n form: AutomationRuleFormState;\n onChange: (next: AutomationRuleFormState) => void;\n /** The edit page cannot change the project (the API accepts no `projectId` on update). */\n projectLocked?: boolean;\n}) {\n const hint = triggerHint(form.triggerType);\n const isSchedule = form.triggerType === 'SCHEDULE';\n\n return (\n <div className=\"space-y-4\">\n <div>\n <label htmlFor=\"automation-name\" className=\"text-sm font-medium\">\n Name\n </label>\n <Input\n id=\"automation-name\"\n className={`mt-1 ${inputTextClass}`}\n value={form.name}\n onChange={(e) => onChange({ ...form, name: e.target.value })}\n placeholder=\"e.g. Assign new bugs to triage\"\n />\n </div>\n <div>\n <label htmlFor=\"automation-description\" className=\"text-sm font-medium\">\n Description\n </label>\n <textarea\n id=\"automation-description\"\n className=\"mt-1 w-full rounded-md border border-input bg-background px-3 py-2 text-sm min-h-[72px]\"\n value={form.description}\n onChange={(e) => onChange({ ...form, description: e.target.value })}\n placeholder=\"What this rule is for\"\n />\n </div>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"automation-project\" className=\"text-sm font-medium\">\n Project\n </label>\n {projectLocked ? (\n <p className=\"mt-1 text-sm text-muted-foreground\">\n A rule&apos;s project cannot be changed after it is created.\n </p>\n ) : (\n <div className=\"mt-1\">\n <ProjectSelect\n id=\"automation-project\"\n value={form.projectId}\n onChange={(projectId) => onChange({ ...form, projectId })}\n />\n </div>\n )}\n </div>\n <div>\n <label htmlFor=\"automation-trigger\" className=\"text-sm font-medium\">\n Trigger\n </label>\n <select\n id=\"automation-trigger\"\n className={fieldClass}\n value={form.triggerType}\n onChange={(e) => onChange({ ...form, triggerType: e.target.value as TriggerType })}\n >\n {TRIGGER_TYPES.map((t) => (\n <option key={t} value={t}>\n {TRIGGER_TYPE_LABEL[t]}\n {triggerOptionSuffix(t)}\n </option>\n ))}\n </select>\n {hint && (\n <p\n data-testid=\"automation-trigger-hint\"\n className={`mt-1 text-xs ${NO_WORK_ITEM_TRIGGER_TYPES.has(form.triggerType) ? 'text-destructive' : 'text-muted-foreground'}`}\n >\n {hint}\n </p>\n )}\n </div>\n </div>\n <div>\n <p className=\"text-sm font-medium\">{isSchedule ? 'Schedule conditions' : 'Conditions'}</p>\n <p className=\"mb-2 text-xs text-muted-foreground\">\n {isSchedule\n ? 'Which work items this schedule watches.'\n : 'All conditions must match. Leave empty to match every event.'}\n </p>\n {isSchedule ? (\n <ScheduleConditionsEditor\n statuses={form.scheduleStatuses}\n days={form.scheduleNotUpdatedForDays}\n onStatusesChange={(scheduleStatuses) => onChange({ ...form, scheduleStatuses })}\n onDaysChange={(scheduleNotUpdatedForDays) =>\n onChange({ ...form, scheduleNotUpdatedForDays })\n }\n />\n ) : (\n <ConditionsEditor\n conditions={form.conditions}\n onChange={(conditions) => onChange({ ...form, conditions })}\n />\n )}\n </div>\n <div>\n <p className=\"text-sm font-medium\">Actions</p>\n <p className=\"mb-2 text-xs text-muted-foreground\">\n Run in order when the conditions match.\n </p>\n <ActionsEditor\n actions={form.actions}\n triggerType={form.triggerType}\n onChange={(actions) => onChange({ ...form, actions })}\n />\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;AAwDA,IAAM,IACJ,sFACI,IAAa,eAAe,KAS5B,IAAiB;AAKvB,SAAS,EAAe,EACtB,UACA,gBACA,eAKC;CACD,IAAM,IAAe,EAA+B,EAAY,EAC1D,IAAU,EACd,GACA,EAAqB,EAAY,EACjC,EACD,EAEK,KAAU,MAAkB,EAAS,GAAG,EAAM,IAAI,EAAM,IAAI;AAElE,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf;GACE,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,GAAD;IACE,cAAW;IACX,eAAY;IACZ,WAAW,uBAAuB;IAClC,WAAW;IACX,aAAY;IACL;IACP,WAAW,MAAM,EAAS,EAAE,OAAO,MAAM;IACzC,CAAA,EACF,kBAAC,KAAD;IAAG,WAAU;cAAb;KACG,EAAM;KAAO;KAAI;KAA+B;KAC/C;MACA,EAAA,CAAA;GACN,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,KAAD;IAAG,WAAU;cAA4C;IAAwB,CAAA,EACjF,kBAAC,OAAD;IAAK,eAAY;IAA0B,WAAU;cAClD,EAAa,KAAK,MACjB,kBAAC,UAAD;KAEE,MAAK;KACL,eAAe,EAAO,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,CAAA;KAEF,EAAA,CAAA,CACF;;GACN,kBAAC,OAAD,EAAA,UAAA;IACE,kBAAC,KAAD;KAAG,WAAU;eAAuB,IAAa,wBAAwB;KAAiB,CAAA;IAC1F,kBAAC,KAAD;KAAG,WAAU;eACV,IACG,4CACA;KACF,CAAA;IACH,IACC,kBAAC,GAAD;KACE,UAAU,EAAK;KACf,MAAM,EAAK;KACX,mBAAmB,MAAqB,EAAS;MAAE,GAAG;MAAM;MAAkB,CAAC;KAC/E,eAAe,MACb,EAAS;MAAE,GAAG;MAAM;MAA2B,CAAC;KAElD,CAAA,GAEF,kBAAC,GAAD;KACE,YAAY,EAAK;KACjB,WAAW,MAAe,EAAS;MAAE,GAAG;MAAM;MAAY,CAAC;KAC3D,CAAA;IAEA,EAAA,CAAA;GACN,kBAAC,OAAD,EAAA,UAAA;IACE,kBAAC,KAAD;KAAG,WAAU;eAAsB;KAAW,CAAA;IAC9C,kBAAC,KAAD;KAAG,WAAU;eAAqC;KAE9C,CAAA;IACJ,kBAAC,GAAD;KACE,SAAS,EAAK;KACd,aAAa,EAAK;KAClB,WAAW,MAAY,EAAS;MAAE,GAAG;MAAM;MAAS,CAAC;KACrD,CAAA;IACE,EAAA,CAAA;GACF"}
@@ -2,30 +2,71 @@
2
2
  * Automation rules (BOFF-8047). Shared trigger/condition/action vocabulary, kept in one place so the create
3
3
  * page, the edit page and the list's summaries can never drift from each other or from the engine.
4
4
  *
5
- * Scope note (from `automation-engine.ts`, the source of truth): only two triggers fire automatically today —
6
- * `WORK_ITEM_CREATED` and `WORK_ITEM_STATUS_CHANGED` — and only four action types can be dispatched —
7
- * `ASSIGN_TO_USER`, `ADD_LABEL`, `SET_STATUS`, `SET_PRIORITY`. The other five trigger types are real schema
8
- * values the service accepts and stores (so a rule can be prepared ahead of a future engine change), but they
9
- * never fire on their own; "Run now" (`planmagnetExecuteAutomationRule`) works for a rule of ANY trigger type,
10
- * including `MANUAL`, because it targets one named work item directly rather than listening for an event.
5
+ * Scope note, rewritten from the real engine (wspace-planmagnet-svc `src/modules/automation/services/
6
+ * automation-engine.ts` + `automation-scheduler.ts`, both merged and prod-verified — svc PR #64):
11
7
  *
12
- * The actions builder below offers ONLY the four dispatchable types: offering the others would create a rule
13
- * whose own execution log immediately reports "declared action(s) are not supported" — a UI that can build a
14
- * rule the backend documents as silently dropping is worse than not offering the option.
8
+ * - Triggers that fire AUTOMATICALLY: `WORK_ITEM_CREATED`, `WORK_ITEM_STATUS_CHANGED`, `WORK_ITEM_ASSIGNED`
9
+ * (from every WorkItem write that changes status/assignee), `SPRINT_STARTED`/`SPRINT_COMPLETED` (a sprint
10
+ * transition), `RELEASE_RELEASED` (a release's real transition into RELEASED — not a re-send) and `SCHEDULE`
11
+ * (a daily background scan — see `automation-scheduler.ts`, NOT dispatched from a write path at all). Still
12
+ * real, accepted, saved schema values but INERT — never fire on their own: `WORK_ITEM_UPDATED`,
13
+ * `MILESTONE_DUE`, `WEBHOOK`. `MANUAL` is not inert, it is intentionally manual-only: it runs only via
14
+ * "Run now" (`planmagnetExecuteAutomationRule`), which works for a rule of ANY trigger type because it
15
+ * targets one named work item directly instead of listening for an event.
16
+ * - Dispatchable actions: `ASSIGN_TO_USER`, `ADD_LABEL`, `SET_STATUS`, `SET_PRIORITY` (the four WorkItem
17
+ * fields an automation can mutate), `POST_COMMENT` (a templated comment on the triggering work item,
18
+ * authored by the fixed `automation:engine` identity — see `AUTOMATION_ACTOR_NAMES` in `../people/People`)
19
+ * and `POST_TO_CHANNEL` (a templated message to a Conversations channel) — but `POST_TO_CHANNEL` is gated
20
+ * OFF in prod (`isChannelPostingEnabled()` in the engine) until Platform ticket BOFF-8240 ships: saving one
21
+ * is refused server-side with "Posting to a chat channel from an automation is not available yet", so this
22
+ * UI never lets it be selected or saved either (see `CHANNEL_POSTING_AVAILABLE` below).
23
+ * - `SPRINT_STARTED`/`SPRINT_COMPLETED`/`RELEASE_RELEASED` carry NO target work item (`sprint.service.ts`/
24
+ * `release.service.ts` never set `workItemId` on their `TriggerData`), so every work-item action — all five
25
+ * above except `POST_TO_CHANNEL` — cannot run for them. Today that leaves such a rule able to do nothing
26
+ * (the only action that *could* apply, `POST_TO_CHANNEL`, is itself gated off), so the builder below refuses
27
+ * to offer work-item actions for these triggers and blocks Save entirely rather than let someone build a
28
+ * rule that silently never fires anything.
15
29
  */
16
- export declare const AUTOMATIC_TRIGGER_TYPES: Set<string>;
17
- export declare const TRIGGER_TYPES: readonly ["WORK_ITEM_CREATED", "WORK_ITEM_STATUS_CHANGED", "WORK_ITEM_UPDATED", "WORK_ITEM_ASSIGNED", "SPRINT_STARTED", "SPRINT_COMPLETED", "MILESTONE_DUE", "SCHEDULE", "WEBHOOK", "MANUAL"];
30
+ export declare const TRIGGER_TYPES: readonly ["WORK_ITEM_CREATED", "WORK_ITEM_STATUS_CHANGED", "WORK_ITEM_ASSIGNED", "SPRINT_STARTED", "SPRINT_COMPLETED", "RELEASE_RELEASED", "SCHEDULE", "WORK_ITEM_UPDATED", "MILESTONE_DUE", "WEBHOOK", "MANUAL"];
18
31
  export type TriggerType = (typeof TRIGGER_TYPES)[number];
19
32
  export declare const TRIGGER_TYPE_LABEL: Record<TriggerType, string>;
20
33
  /** Looks up a trigger type's label; falls back to the raw value for one this UI does not yet know (forward
21
34
  * compatible with a value the service adds later). Cast: `TRIGGER_TYPE_LABEL` is keyed by the known union, but
22
35
  * a value read back from the API is a plain string. */
23
36
  export declare function triggerTypeLabel(value: string): string;
37
+ /** Fires on its own — dispatched from a real write path or the daily SCHEDULE scan (automation-engine.ts's
38
+ * `AutomationTriggerType` union, 7 values). Everything else in `TRIGGER_TYPES` is either inert (accepted,
39
+ * saved, never fires) or intentionally manual-only. */
40
+ export declare const AUTOMATIC_TRIGGER_TYPES: ReadonlySet<TriggerType>;
41
+ /** Accepted and saved (so a rule can be prepared ahead of a future engine change) but never fires on its own —
42
+ * no dispatcher call site exists yet for these (automation-engine.ts's header). Distinct from `MANUAL`, which
43
+ * is deliberately manual-only rather than an unfinished trigger. */
44
+ export declare const INERT_TRIGGER_TYPES: ReadonlySet<TriggerType>;
45
+ /** Fires automatically but its `TriggerData` never carries a `workItemId` (sprint.service.ts / release.service.ts
46
+ * build it without one) — so no work-item action can ever dispatch for it. */
47
+ export declare const NO_WORK_ITEM_TRIGGER_TYPES: ReadonlySet<TriggerType>;
48
+ /** The trigger-select option suffix — mirrors what the rule can actually do, not just whether it is automatic. */
49
+ export declare function triggerOptionSuffix(trigger: TriggerType): string;
50
+ /** The explanatory note shown under the trigger select — `null` for a trigger that needs no caveat (an
51
+ * ordinary automatic, work-item-bearing trigger). Rendered with `data-testid="automation-trigger-hint"`. */
52
+ export declare function triggerHint(trigger: TriggerType): string | null;
24
53
  export declare const RULE_STATUSES: readonly ["ACTIVE", "PAUSED", "DISABLED", "ERROR"];
25
54
  export type RuleStatus = (typeof RULE_STATUSES)[number];
26
- export declare const ACTION_TYPES: readonly ["ASSIGN_TO_USER", "ADD_LABEL", "SET_STATUS", "SET_PRIORITY"];
55
+ export declare const ACTION_TYPES: readonly ["ASSIGN_TO_USER", "ADD_LABEL", "SET_STATUS", "SET_PRIORITY", "POST_COMMENT", "POST_TO_CHANNEL"];
27
56
  export type ActionType = (typeof ACTION_TYPES)[number];
28
57
  export declare const ACTION_TYPE_LABEL: Record<ActionType, string>;
58
+ /** Every action that mutates/comments on the triggering WORK ITEM (automation-engine.ts's `dispatchAction`: only
59
+ * `POST_TO_CHANNEL` is handled without one). These are the actions `NO_WORK_ITEM_TRIGGER_TYPES` cannot run. */
60
+ export declare const WORK_ITEM_ACTION_TYPES: ReadonlySet<ActionType>;
61
+ /** `POST_TO_CHANNEL` is gated off (BOFF-8240) — mirrors `isChannelPostingEnabled()` in automation-engine.ts,
62
+ * which this frontend has no way to read directly (it is a server env flag). Flip this only once that ships
63
+ * AND the option below is meant to become selectable — until then it stays visible but disabled everywhere. */
64
+ export declare const CHANNEL_POSTING_AVAILABLE = false;
65
+ /** Short reason shown on the disabled option itself. */
66
+ export declare const CHANNEL_POSTING_OPTION_REASON = "Not available yet \u2014 waiting on a platform change";
67
+ /** The engine's own refusal message (`automation.errors.channelPostingUnavailable`), reused so a blocked save
68
+ * never contradicts what the server would say if the block were somehow bypassed. */
69
+ export declare const CHANNEL_POSTING_BLOCKED_MESSAGE = "Posting to a chat channel from an automation is not available yet.";
29
70
  export interface RuleAction {
30
71
  type: ActionType;
31
72
  value: string;
@@ -33,7 +74,8 @@ export interface RuleAction {
33
74
  export declare const CONDITION_OPERATORS: readonly ["eq", "neq", "in", "notIn", "contains", "gt", "gte", "lt", "lte", "exists"];
34
75
  export type ConditionOperator = (typeof CONDITION_OPERATORS)[number];
35
76
  export declare const CONDITION_OPERATOR_LABEL: Record<ConditionOperator, string>;
36
- /** Fields present on every automatic trigger's snapshot (`TriggerData` in automation-engine.ts). */
77
+ /** Fields present on every automatic trigger's snapshot (`TriggerData` in automation-engine.ts). Only meaningful
78
+ * for non-`SCHEDULE` triggers — `SCHEDULE` has its own dedicated condition shape, see `ScheduleConditions` below. */
37
79
  export declare const CONDITION_FIELDS: readonly ["status", "previousStatus", "priority", "type", "assigneeId", "title", "labels", "sprintId", "projectId"];
38
80
  export interface RuleCondition {
39
81
  field: string;
@@ -41,12 +83,15 @@ export interface RuleCondition {
41
83
  /** Raw editor value; for `in`/`notIn` this is a comma-separated list, converted to an array on submit. */
42
84
  value: string;
43
85
  }
44
- /** actions[] (form shape) -> actions JSON the API accepts. */
86
+ /** actions[] (form shape) -> actions JSON the API accepts. Never emits a `POST_TO_CHANNEL` action — nothing in
87
+ * this builder can produce one while `CHANNEL_POSTING_AVAILABLE` is false (see `saveBlockReason`, which refuses
88
+ * to save a form that somehow still carries one). */
45
89
  export declare function actionsToApi(actions: RuleAction[]): {
46
90
  type: ActionType;
47
91
  value: string;
48
92
  }[];
49
- /** conditions[] (form shape) -> conditions JSON the API accepts, or undefined when there are none. */
93
+ /** conditions[] (form shape) -> conditions JSON the API accepts, or undefined when there are none. Only used for
94
+ * non-`SCHEDULE` triggers — see `scheduleConditionsToApi` for `SCHEDULE`'s own shape. */
50
95
  export declare function conditionsToApi(conditions: RuleCondition[]): {
51
96
  field: string;
52
97
  operator: ConditionOperator;
@@ -57,4 +102,82 @@ export declare function conditionsFromApi(raw: unknown): RuleCondition[];
57
102
  /** API actions JSON -> form shape, for the edit page. Action types this builder does not offer are kept (so an
58
103
  * existing rule's own configuration is never silently dropped by opening the edit page) but shown as read-only. */
59
104
  export declare function actionsFromApi(raw: unknown): RuleAction[];
105
+ export interface ScheduleConditions {
106
+ status: string[];
107
+ notUpdatedForDays: number;
108
+ }
109
+ /** A whole number of days, 1 or more — a stricter (but compatible) subset of the engine's own `number > 0` check,
110
+ * chosen because "half a day" has no sensible UI meaning here. */
111
+ export declare function parseScheduleDays(raw: string): number | null;
112
+ /** API `conditions` JSON -> the SCHEDULE editor's own form fields. Lenient (shows whatever is there, even if it
113
+ * would fail `parseScheduleConditions` server-side) so an existing malformed rule can still be opened and fixed,
114
+ * rather than silently reset. */
115
+ export declare function scheduleConditionsFromApi(raw: unknown): {
116
+ statuses: string[];
117
+ days: string;
118
+ };
119
+ /** The SCHEDULE editor's own form fields -> exactly the `{ status, notUpdatedForDays }` shape
120
+ * `parseScheduleConditions` reads. `undefined` when not yet valid — callers gate Save on this instead of ever
121
+ * submitting an unreadable value. */
122
+ export declare function scheduleConditionsToApi(statuses: string[], daysText: string): ScheduleConditions | undefined;
123
+ export declare function isScheduleConditionsValid(statuses: string[], daysText: string): boolean;
124
+ /** `AUTOMATION_TEMPLATE_MAX_LENGTH` in automation-engine.ts — the longest a template's raw `value` may be,
125
+ * checked at rule create/update. */
126
+ export declare const AUTOMATION_TEMPLATE_MAX_LENGTH = 2000;
127
+ /** `POST_COMMENT_MAX_RENDERED_LENGTH` in automation-engine.ts — the longest a RENDERED comment body may be. */
128
+ export declare const POST_COMMENT_MAX_RENDERED_LENGTH = 2000;
129
+ /** `POST_TO_CHANNEL_MAX_RENDERED_LENGTH` in automation-engine.ts — shorter, matching a chat message. */
130
+ export declare const POST_TO_CHANNEL_MAX_RENDERED_LENGTH = 500;
131
+ /** Mirrors `renderAutomationTemplate` in automation-engine.ts: an unknown or unpopulated `{{key}}` renders empty,
132
+ * the result is trimmed, and it is truncated (with an ellipsis) to `maxLength`. */
133
+ export declare function renderTemplatePreview(template: string, values: Record<string, string | undefined>, maxLength: number): string;
134
+ /** Every placeholder token `buildAutomationTemplateValues` (automation-engine.ts) knows how to fill, with a
135
+ * short label for the picker and a representative sample value for the preview. */
136
+ export declare const TEMPLATE_PLACEHOLDER_INFO: Record<string, {
137
+ label: string;
138
+ sample: string;
139
+ }>;
140
+ /**
141
+ * Exactly which placeholders will actually render something (non-empty) for a POST_COMMENT/POST_TO_CHANNEL
142
+ * template on a rule of this trigger type — read from `buildAutomationTemplateValues` plus every call site that
143
+ * builds a `TriggerData` for it (`workitem.service.ts`'s `toTriggerData`/`fireAutomationTrigger`,
144
+ * `sprint.service.ts`'s `fireSprintAutomationTrigger`, `release.service.ts`'s `fireReleaseAutomationTrigger`,
145
+ * `automation-scheduler.ts`'s `toScheduleTriggerData`, and `automation.service.ts`'s `execute()` for "Run now",
146
+ * which every inert/manual trigger relies on):
147
+ *
148
+ * - `SPRINT_STARTED`/`SPRINT_COMPLETED`: `{ projectId, sprintId, sprintName }` only — no work item, no status.
149
+ * - `RELEASE_RELEASED`: `{ projectId, releaseId, releaseVersion, releaseName }` only — no work item, no status.
150
+ * - `WORK_ITEM_STATUS_CHANGED`: the only automatic trigger that sets `previousStatus` (to the status before the
151
+ * write) alongside the new `status` — every other trigger either omits it or sets it to `null`.
152
+ * - `WORK_ITEM_CREATED`/`WORK_ITEM_ASSIGNED`/`SCHEDULE` carry the work item's key/title/status but never a
153
+ * `fromStatus` — their real dispatch paths (`workitem.service.ts`'s `toTriggerData`, `automation-scheduler.ts`'s
154
+ * `toScheduleTriggerData`) both set `key: item.key` from the live row.
155
+ * - `WORK_ITEM_UPDATED`/`MILESTONE_DUE`/`WEBHOOK`/`MANUAL` are the same "work item title/status, no fromStatus"
156
+ * shape MINUS `workItem.key`: `automation.service.ts#execute()` — the ONLY path these ever run through, since
157
+ * none of the four has a real dispatcher — builds its `mergedTriggerData` from the FE's `{ workItemId }`
158
+ * payload (`AutomationRuleControls.tsx`'s `RunAutomationRuleDialog`) plus a fresh `prisma.workItem` read, and
159
+ * that object never assigns a `key` field. Offering `{{workItem.key}}` here would let someone build a template
160
+ * that is GUARANTEED to render an empty string every single time it runs — not merely omitted when unset like
161
+ * a normal "no value for this trigger" placeholder, but structurally unreachable for these four trigger types.
162
+ *
163
+ * `actor` is always populated (the real triggering actor, `AUTOMATION_SCHEDULER_ACTOR_ID` for SCHEDULE, or the
164
+ * "Run now" caller) so it is available for every trigger.
165
+ */
166
+ export declare function templatePlaceholdersForTrigger(trigger: TriggerType): readonly string[];
167
+ /** Sample values for exactly the placeholders `templatePlaceholdersForTrigger` says apply to this trigger — any
168
+ * other `{{...}}` in the template previews empty, matching what the real engine would do. */
169
+ export declare function templateSampleValues(trigger: TriggerType): Record<string, string | undefined>;
170
+ /** `null` when this trigger needs no explanation blocking Save; the reason string otherwise (same text as
171
+ * `triggerHint` for a `NO_WORK_ITEM_TRIGGER_TYPES` trigger — the one case that blocks Save outright). */
172
+ export declare function triggerSaveBlockReason(trigger: TriggerType): string | null;
173
+ /** Combines every reason a rule form cannot be saved yet: a trigger with no possible action, a `POST_TO_CHANNEL`
174
+ * action while channel posting is gated off, or (for `SCHEDULE`) a not-yet-valid schedule window. `null` means
175
+ * the form is save-able as far as these rules are concerned (the caller still checks name/project separately). */
176
+ export declare function saveBlockReason(form: {
177
+ triggerType: TriggerType;
178
+ actions: RuleAction[];
179
+ scheduleStatuses: string[];
180
+ scheduleNotUpdatedForDays: string;
181
+ }): string | null;
182
+ export declare function splitExecutionErrors(message: string | null | undefined): string[];
60
183
  //# sourceMappingURL=automationRuleTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"automationRuleTypes.d.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,EAAE,MAAM,GAAG,SAAS,CAAC,EAC1C,SAAS,EAAE,MAAM,GAChB,MAAM,CAQR;AAED;oFACoF;AACpF,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CASvF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,MAAM,EAAE,CAStF;AAED;8FAC8F;AAC9F,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAM7F;AAOD;0GAC0G;AAC1G,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAE1E;AAED;;mHAEmH;AACnH,wBAAgB,eAAe,CAAC,IAAI,EAAE;IACpC,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,yBAAyB,EAAE,MAAM,CAAC;CACnC,GAAG,MAAM,GAAG,IAAI,CAahB;AASD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,EAAE,CAMjF"}
@@ -1,46 +1,73 @@
1
1
  //#region src/planmagnet/automation/automationRuleTypes.ts
2
- var e = new Set(["WORK_ITEM_CREATED", "WORK_ITEM_STATUS_CHANGED"]), t = [
2
+ var e = [
3
3
  "WORK_ITEM_CREATED",
4
4
  "WORK_ITEM_STATUS_CHANGED",
5
- "WORK_ITEM_UPDATED",
6
5
  "WORK_ITEM_ASSIGNED",
7
6
  "SPRINT_STARTED",
8
7
  "SPRINT_COMPLETED",
9
- "MILESTONE_DUE",
8
+ "RELEASE_RELEASED",
10
9
  "SCHEDULE",
10
+ "WORK_ITEM_UPDATED",
11
+ "MILESTONE_DUE",
11
12
  "WEBHOOK",
12
13
  "MANUAL"
13
- ], n = {
14
+ ], t = {
14
15
  WORK_ITEM_CREATED: "Work item created",
15
16
  WORK_ITEM_STATUS_CHANGED: "Work item status changed",
16
- WORK_ITEM_UPDATED: "Work item updated",
17
17
  WORK_ITEM_ASSIGNED: "Work item assigned",
18
18
  SPRINT_STARTED: "Sprint started",
19
19
  SPRINT_COMPLETED: "Sprint completed",
20
- MILESTONE_DUE: "Milestone due",
20
+ RELEASE_RELEASED: "Release shipped",
21
21
  SCHEDULE: "Schedule",
22
+ WORK_ITEM_UPDATED: "Work item updated",
23
+ MILESTONE_DUE: "Milestone due",
22
24
  WEBHOOK: "Webhook",
23
25
  MANUAL: "Manual only"
24
26
  };
25
- function r(e) {
26
- return n[e] ?? e;
27
+ function n(e) {
28
+ return t[e] ?? e;
27
29
  }
28
- var i = [
30
+ var r = new Set([
31
+ "WORK_ITEM_UPDATED",
32
+ "MILESTONE_DUE",
33
+ "WEBHOOK"
34
+ ]), i = new Set([
35
+ "SPRINT_STARTED",
36
+ "SPRINT_COMPLETED",
37
+ "RELEASE_RELEASED"
38
+ ]);
39
+ function a(e) {
40
+ return e === "SCHEDULE" ? " (runs daily)" : i.has(e) ? " (no target work item)" : r.has(e) ? " (not yet automatic)" : e === "MANUAL" ? " (run manually)" : "";
41
+ }
42
+ function o(e) {
43
+ return i.has(e) ? "This trigger fires automatically, but it has no target work item — only \"Post to a channel\" could apply, and that is not available yet (waiting on a platform change). A rule with this trigger cannot do anything right now, so it cannot be saved yet." : e === "SCHEDULE" ? "Runs once a day against every work item matching the statuses and staleness window below, and acts on each matching item at most once per day." : r.has(e) ? "This trigger is saved but does not fire on its own yet — use Run now to run it against a work item." : e === "MANUAL" ? "Manual rules never fire on their own — use Run now to run this rule against a work item." : null;
44
+ }
45
+ var s = [
29
46
  "ACTIVE",
30
47
  "PAUSED",
31
48
  "DISABLED",
32
49
  "ERROR"
33
- ], a = [
50
+ ], c = [
34
51
  "ASSIGN_TO_USER",
35
52
  "ADD_LABEL",
36
53
  "SET_STATUS",
37
- "SET_PRIORITY"
38
- ], o = {
54
+ "SET_PRIORITY",
55
+ "POST_COMMENT",
56
+ "POST_TO_CHANNEL"
57
+ ], l = {
39
58
  ASSIGN_TO_USER: "Assign to user",
40
59
  ADD_LABEL: "Add label",
41
60
  SET_STATUS: "Set status",
42
- SET_PRIORITY: "Set priority"
43
- }, s = [
61
+ SET_PRIORITY: "Set priority",
62
+ POST_COMMENT: "Post a comment",
63
+ POST_TO_CHANNEL: "Post to a channel"
64
+ }, u = new Set([
65
+ "ASSIGN_TO_USER",
66
+ "ADD_LABEL",
67
+ "SET_STATUS",
68
+ "SET_PRIORITY",
69
+ "POST_COMMENT"
70
+ ]), d = "Not available yet — waiting on a platform change", f = "Posting to a chat channel from an automation is not available yet.", p = [
44
71
  "eq",
45
72
  "neq",
46
73
  "in",
@@ -51,7 +78,7 @@ var i = [
51
78
  "lt",
52
79
  "lte",
53
80
  "exists"
54
- ], c = {
81
+ ], m = {
55
82
  eq: "is",
56
83
  neq: "is not",
57
84
  in: "is one of",
@@ -62,7 +89,7 @@ var i = [
62
89
  lt: "<",
63
90
  lte: "<=",
64
91
  exists: "is set"
65
- }, l = [
92
+ }, h = [
66
93
  "status",
67
94
  "previousStatus",
68
95
  "priority",
@@ -73,13 +100,13 @@ var i = [
73
100
  "sprintId",
74
101
  "projectId"
75
102
  ];
76
- function u(e) {
103
+ function g(e) {
77
104
  return e.filter((e) => e.value.trim() !== "").map((e) => ({
78
105
  type: e.type,
79
106
  value: e.value.trim()
80
107
  }));
81
108
  }
82
- function d(e) {
109
+ function _(e) {
83
110
  let t = e.filter((e) => e.field.trim() !== "");
84
111
  if (t.length !== 0) return t.map((e) => e.operator === "exists" ? {
85
112
  field: e.field.trim(),
@@ -94,20 +121,133 @@ function d(e) {
94
121
  value: e.value
95
122
  });
96
123
  }
97
- function f(e) {
124
+ function v(e) {
98
125
  return Array.isArray(e) ? e.filter((e) => !!e && typeof e == "object" && typeof e.field == "string").map((e) => ({
99
126
  field: e.field,
100
- operator: s.includes(e.operator) ? e.operator : "eq",
127
+ operator: p.includes(e.operator) ? e.operator : "eq",
101
128
  value: Array.isArray(e.value) ? e.value.join(", ") : e.value == null ? "" : String(e.value)
102
129
  })) : [];
103
130
  }
104
- function p(e) {
131
+ function y(e) {
105
132
  return Array.isArray(e) ? e.filter((e) => !!e && typeof e == "object" && typeof e.type == "string").map((e) => ({
106
133
  type: e.type,
107
134
  value: e.value == null ? "" : String(e.value)
108
135
  })) : [];
109
136
  }
137
+ function b(e) {
138
+ let t = e.trim();
139
+ if (!/^\d+$/.test(t)) return null;
140
+ let n = Number(t);
141
+ return n >= 1 ? n : null;
142
+ }
143
+ function x(e) {
144
+ if (!e || typeof e != "object") return {
145
+ statuses: [],
146
+ days: ""
147
+ };
148
+ let t = e.status, n = e.notUpdatedForDays;
149
+ return {
150
+ statuses: Array.isArray(t) ? t.filter((e) => typeof e == "string") : [],
151
+ days: typeof n == "number" && Number.isFinite(n) ? String(n) : ""
152
+ };
153
+ }
154
+ function S(e, t) {
155
+ let n = b(t);
156
+ if (!(e.length === 0 || n === null)) return {
157
+ status: e,
158
+ notUpdatedForDays: n
159
+ };
160
+ }
161
+ function C(e, t) {
162
+ return e.length > 0 && b(t) !== null;
163
+ }
164
+ var w = 2e3, T = 2e3, E = /\{\{\s*([a-zA-Z][a-zA-Z0-9_.]*)\s*\}\}/g;
165
+ function D(e) {
166
+ let t = "";
167
+ for (let n of e) {
168
+ let e = n.codePointAt(0) ?? 0;
169
+ t += e <= 31 || e === 127 || n === "[" || n === "]" || n === "(" || n === ")" ? " " : n;
170
+ }
171
+ return t.trim();
172
+ }
173
+ function O(e, t, n) {
174
+ let r = e.replace(E, (e, n) => {
175
+ let r = t[n];
176
+ return r === void 0 ? "" : D(r);
177
+ }).trim();
178
+ return r.length <= n ? r : `${r.slice(0, Math.max(0, n - 1))}…`;
179
+ }
180
+ var k = {
181
+ "workItem.key": {
182
+ label: "Work item key",
183
+ sample: "PM-42"
184
+ },
185
+ "workItem.title": {
186
+ label: "Work item title",
187
+ sample: "Fix checkout crash"
188
+ },
189
+ fromStatus: {
190
+ label: "Previous status",
191
+ sample: "In Progress"
192
+ },
193
+ toStatus: {
194
+ label: "New status",
195
+ sample: "Done"
196
+ },
197
+ actor: {
198
+ label: "Actor",
199
+ sample: "Jane Doe"
200
+ },
201
+ "sprint.name": {
202
+ label: "Sprint name",
203
+ sample: "Sprint 14"
204
+ },
205
+ "release.version": {
206
+ label: "Release version",
207
+ sample: "2026.930.1"
208
+ },
209
+ "release.name": {
210
+ label: "Release name",
211
+ sample: "September release"
212
+ }
213
+ };
214
+ function A(e) {
215
+ return e === "SPRINT_STARTED" || e === "SPRINT_COMPLETED" ? ["sprint.name", "actor"] : e === "RELEASE_RELEASED" ? [
216
+ "release.version",
217
+ "release.name",
218
+ "actor"
219
+ ] : e === "WORK_ITEM_STATUS_CHANGED" ? [
220
+ "workItem.key",
221
+ "workItem.title",
222
+ "fromStatus",
223
+ "toStatus",
224
+ "actor"
225
+ ] : r.has(e) || e === "MANUAL" ? [
226
+ "workItem.title",
227
+ "toStatus",
228
+ "actor"
229
+ ] : [
230
+ "workItem.key",
231
+ "workItem.title",
232
+ "toStatus",
233
+ "actor"
234
+ ];
235
+ }
236
+ function j(e) {
237
+ let t = {};
238
+ for (let n of A(e)) t[n] = k[n]?.sample;
239
+ return t;
240
+ }
241
+ function M(e) {
242
+ return i.has(e) ? o(e) : null;
243
+ }
244
+ function N(e) {
245
+ return M(e.triggerType) || (e.actions.some((e) => e.type === "POST_TO_CHANNEL") ? f : e.triggerType === "SCHEDULE" && !C(e.scheduleStatuses, e.scheduleNotUpdatedForDays) ? "Choose at least one status and a whole number of days (1 or more) before saving this schedule." : null);
246
+ }
247
+ function P(e) {
248
+ return e ? e.split("; ").map((e) => e.trim()).filter(Boolean) : [];
249
+ }
110
250
  //#endregion
111
- export { a as ACTION_TYPES, o as ACTION_TYPE_LABEL, e as AUTOMATIC_TRIGGER_TYPES, l as CONDITION_FIELDS, s as CONDITION_OPERATORS, c as CONDITION_OPERATOR_LABEL, i as RULE_STATUSES, t as TRIGGER_TYPES, n as TRIGGER_TYPE_LABEL, p as actionsFromApi, u as actionsToApi, f as conditionsFromApi, d as conditionsToApi, r as triggerTypeLabel };
251
+ export { c as ACTION_TYPES, l as ACTION_TYPE_LABEL, w as AUTOMATION_TEMPLATE_MAX_LENGTH, f as CHANNEL_POSTING_BLOCKED_MESSAGE, d as CHANNEL_POSTING_OPTION_REASON, h as CONDITION_FIELDS, p as CONDITION_OPERATORS, m as CONDITION_OPERATOR_LABEL, i as NO_WORK_ITEM_TRIGGER_TYPES, T as POST_COMMENT_MAX_RENDERED_LENGTH, s as RULE_STATUSES, k as TEMPLATE_PLACEHOLDER_INFO, e as TRIGGER_TYPES, t as TRIGGER_TYPE_LABEL, u as WORK_ITEM_ACTION_TYPES, y as actionsFromApi, g as actionsToApi, v as conditionsFromApi, _ as conditionsToApi, b as parseScheduleDays, O as renderTemplatePreview, N as saveBlockReason, x as scheduleConditionsFromApi, S as scheduleConditionsToApi, P as splitExecutionErrors, A as templatePlaceholdersForTrigger, j as templateSampleValues, o as triggerHint, a as triggerOptionSuffix, n as triggerTypeLabel };
112
252
 
113
253
  //# sourceMappingURL=automationRuleTypes.js.map