@aglyn/plugins-workflows 1.0.0-beta.221 → 1.0.0-beta.223

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 (101) hide show
  1. package/README.md +22 -14
  2. package/package.json +12 -12
  3. package/src/lib/components/automation-step-fields.component.d.ts +16 -16
  4. package/src/lib/components/automation-step-fields.component.js +146 -12
  5. package/src/lib/components/automation-step-fields.component.js.map +1 -1
  6. package/src/lib/components/automation-trigger-conditions.component.d.ts +25 -3
  7. package/src/lib/components/automation-trigger-conditions.component.js +89 -10
  8. package/src/lib/components/automation-trigger-conditions.component.js.map +1 -1
  9. package/src/lib/components/host-actions-card.component.js +126 -84
  10. package/src/lib/components/host-actions-card.component.js.map +1 -1
  11. package/src/lib/components/host-webhooks-card.component.js +2 -1
  12. package/src/lib/components/host-webhooks-card.component.js.map +1 -1
  13. package/src/lib/components/host-workflows-card.component.js +31 -10
  14. package/src/lib/components/host-workflows-card.component.js.map +1 -1
  15. package/src/lib/components/org-automation-editor.component.d.ts +2 -1
  16. package/src/lib/components/org-automation-editor.component.js +20 -11
  17. package/src/lib/components/org-automation-editor.component.js.map +1 -1
  18. package/src/lib/components/org-automations-card.component.js +2 -1
  19. package/src/lib/components/org-automations-card.component.js.map +1 -1
  20. package/src/lib/components/run-quota-line.component.d.ts +17 -4
  21. package/src/lib/components/run-quota-line.component.js +16 -7
  22. package/src/lib/components/run-quota-line.component.js.map +1 -1
  23. package/src/lib/components/site-org-automations-panel.component.js +2 -1
  24. package/src/lib/components/site-org-automations-panel.component.js.map +1 -1
  25. package/src/lib/components/workflows-console-page.js +18 -7
  26. package/src/lib/components/workflows-console-page.js.map +1 -1
  27. package/src/lib/declarations.d.ts +28 -0
  28. package/src/lib/declarations.js +37 -0
  29. package/src/lib/declarations.js.map +1 -0
  30. package/src/lib/declarations.server.js +17 -0
  31. package/src/lib/declarations.server.js.map +1 -1
  32. package/src/lib/engine/email-merge.d.ts +69 -0
  33. package/src/lib/engine/email-merge.js +98 -0
  34. package/src/lib/engine/email-merge.js.map +1 -0
  35. package/src/lib/engine/run-event-actions.d.ts +35 -10
  36. package/src/lib/engine/run-event-actions.js +256 -369
  37. package/src/lib/engine/run-event-actions.js.map +1 -1
  38. package/src/lib/engine/run-event-automations.d.ts +1 -1
  39. package/src/lib/engine/run-event-automations.js.map +1 -1
  40. package/src/lib/engine/run-event-workflows.d.ts +2 -1
  41. package/src/lib/engine/run-event-workflows.js +71 -30
  42. package/src/lib/engine/run-event-workflows.js.map +1 -1
  43. package/src/lib/engine/run-meter.d.ts +98 -0
  44. package/src/lib/engine/run-meter.js +121 -0
  45. package/src/lib/engine/run-meter.js.map +1 -0
  46. package/src/lib/engine/run-org-automations.d.ts +3 -2
  47. package/src/lib/engine/run-org-automations.js +17 -12
  48. package/src/lib/engine/run-org-automations.js.map +1 -1
  49. package/src/lib/engine/triggered-docs.d.ts +39 -0
  50. package/src/lib/engine/triggered-docs.js +47 -0
  51. package/src/lib/engine/triggered-docs.js.map +1 -0
  52. package/src/lib/engine/workflow-steps.d.ts +1 -1
  53. package/src/lib/engine/workflow-steps.js +3 -2
  54. package/src/lib/engine/workflow-steps.js.map +1 -1
  55. package/src/lib/model/host-actions.d.ts +284 -0
  56. package/src/lib/model/host-actions.js +316 -0
  57. package/src/lib/model/host-actions.js.map +1 -0
  58. package/src/lib/model/org-automations.d.ts +8 -5
  59. package/src/lib/model/org-automations.js +14 -8
  60. package/src/lib/model/org-automations.js.map +1 -1
  61. package/src/lib/model/step-outcomes.d.ts +2 -2
  62. package/src/lib/model/step-outcomes.js +1 -1
  63. package/src/lib/model/step-outcomes.js.map +1 -1
  64. package/src/lib/plugin.js +10 -0
  65. package/src/lib/plugin.js.map +1 -1
  66. package/src/lib/server/action-test-run-route.d.ts +3 -2
  67. package/src/lib/server/action-test-run-route.js +3 -2
  68. package/src/lib/server/action-test-run-route.js.map +1 -1
  69. package/src/lib/server/org-automations-routes.d.ts +42 -1
  70. package/src/lib/server/org-automations-routes.js +120 -72
  71. package/src/lib/server/org-automations-routes.js.map +1 -1
  72. package/src/lib/server-automation-drafts.d.ts +2 -2
  73. package/src/lib/server-automation-drafts.js +11 -7
  74. package/src/lib/server-automation-drafts.js.map +1 -1
  75. package/src/lib/server.js +19 -13
  76. package/src/lib/server.js.map +1 -1
  77. package/src/lib/testing/stand-in-crm-steps.d.ts +45 -0
  78. package/src/lib/testing/stand-in-crm-steps.js +97 -0
  79. package/src/lib/testing/stand-in-crm-steps.js.map +1 -0
  80. package/src/lib/testing/stand-in-dataset-list.js +11 -3
  81. package/src/lib/testing/stand-in-dataset-list.js.map +1 -1
  82. package/src/lib/testing/stand-in-dataset-steps.d.ts +43 -0
  83. package/src/lib/testing/stand-in-dataset-steps.js +65 -0
  84. package/src/lib/testing/stand-in-dataset-steps.js.map +1 -0
  85. package/src/lib/testing/stand-in-person-records.d.ts +35 -0
  86. package/src/lib/testing/stand-in-person-records.js +54 -0
  87. package/src/lib/testing/stand-in-person-records.js.map +1 -0
  88. package/src/lib/testing/stand-in-recipes.d.ts +36 -0
  89. package/src/lib/testing/stand-in-recipes.js +206 -0
  90. package/src/lib/testing/stand-in-recipes.js.map +1 -0
  91. package/src/lib/transfer/org-automations-package.d.ts +54 -0
  92. package/src/lib/transfer/org-automations-package.js +167 -0
  93. package/src/lib/transfer/org-automations-package.js.map +1 -0
  94. package/src/lib/transfer/org-automations-package.server.d.ts +38 -0
  95. package/src/lib/transfer/org-automations-package.server.js +296 -0
  96. package/src/lib/transfer/org-automations-package.server.js.map +1 -0
  97. package/src/lib/usage-axes.js +5 -1
  98. package/src/lib/usage-axes.js.map +1 -1
  99. package/src/lib/engine/crm-action-steps.d.ts +0 -142
  100. package/src/lib/engine/crm-action-steps.js +0 -452
  101. package/src/lib/engine/crm-action-steps.js.map +0 -1
package/README.md CHANGED
@@ -26,13 +26,15 @@ runs an automation:
26
26
  - `run-event-workflows.ts` and `run-event-actions.ts` — the runners. A host
27
27
  event runs the workflows triggered by it and the actions listening for it;
28
28
  the site-event dispatch runs one action a published page fired.
29
- - `run-event-actions.ts` also holds the step executors — datasets, email,
30
- webhooks, lists, campaigns, alerts, custom events — and the flow steps —
31
- behind `runServerStep`, one step at a time, which is what lets a workflow
32
- perform an Actions step without a second copy of any of them. Its
33
- `executeWorkflow` is the workflow half: function calls through the pure
34
- evaluator, Actions steps through that executor, in one scope.
35
- - `crm-action-steps.ts` — the five CRM steps.
29
+ - `run-event-actions.ts` also holds the step executors — email, webhooks,
30
+ lists, campaigns, alerts, custom events — and the flow steps — behind
31
+ `runServerStep`, one step at a time, which is what lets a workflow perform
32
+ an Actions step without a second copy of any of them. A step that writes
33
+ another plugin's records — a dataset row, a contact's stage — is handed to
34
+ the executor that plugin registered on the server-step seam
35
+ (`plugin-server-steps`). Its `executeWorkflow` is the workflow half:
36
+ function calls through the pure evaluator, Actions steps through that
37
+ executor, in one scope.
36
38
  - `flow-enrollments.ts` — where a person waits between one step of a flow and
37
39
  the next, resumed by the `resume-flow-waits` job. A workflow's enrollment id
38
40
  is kept apart from an action's, so the two kinds never share a row.
@@ -75,13 +77,17 @@ the page view is core's own, and every other event is declared under
75
77
  `hostEvents` by the plugin whose doors raise it. What only the engine reads
76
78
  is this plugin's: the run history's past-tense step phrases
77
79
  (`model/step-outcomes.ts`), a webhook's stored shape and its URL guard
78
- (`model/webhooks.ts`), the CRM steps' grouping (`engine/crm-action-steps.ts`)
79
- and the event-chaining depth (`model/workflows.ts`). The automation
80
- vocabulary the other plugins author against — the server steps, flows,
81
- recipes and their validation — is still in the core
82
- (`@aglyn/aglyn/app-utils/actions`), because the AI plugin drafts automations
83
- against it and the CRM plugin installs its recipes, and neither may import
84
- this plugin.
80
+ (`model/webhooks.ts`) and the event-chaining depth (`model/workflows.ts`). The
81
+ automation vocabulary — the server steps' shapes, the flow's bounds and each
82
+ server step's checks — is this plugin's too (`model/host-actions.ts`). The
83
+ plugins that write automations without loading this one meet it through core
84
+ seams: each step's name, hold and typed fields are declared under
85
+ `interactionSteps` in `plugins.config.json`; the checks are registered from
86
+ this plugin's `declarations` entry (`interaction-step-checks`), so a recipe the
87
+ CRM installs or a draft the AI grades is refused as this editor would refuse
88
+ it; the stored shape and the slice a visitor's page receives are core's
89
+ (`site-interactions`); and a drafted automation is handed over through the
90
+ `automation` resource's draft writer (`server-automation-drafts.ts`).
85
91
 
86
92
  ## Entry points
87
93
 
@@ -90,6 +96,8 @@ this plugin.
90
96
  flow-resume job, the automation draft writer, the org automation doors, and
91
97
  the Actions card's test run (`automations/actions/test-run`, console only —
92
98
  the page runtime's `events/dispatch` is a tenant route).
99
+ - `./declarations` — the server steps' checks, registered in both apps and in
100
+ the console's browser before any surface loads.
93
101
  - `./declarations.server` — the boot registration above.
94
102
 
95
103
  ## License
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/plugins-workflows",
3
- "version": "1.0.0-beta.221",
3
+ "version": "1.0.0-beta.223",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://aglyn.com",
6
6
  "repository": {
@@ -25,17 +25,17 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "dependencies": {
28
- "@aglyn/aglyn": "1.0.0-beta.221",
29
- "@aglyn/shared-data-mdi": "1.0.0-beta.221",
30
- "@aglyn/shared-ui-jsx": "1.0.0-beta.221",
31
- "@aglyn/shared-ui-next": "1.0.0-beta.221",
32
- "@aglyn/shared-ui-snackstack": "1.0.0-beta.221",
33
- "@aglyn/shared-util-email": "1.0.0-beta.221",
34
- "@aglyn/shared-util-http": "1.0.0-beta.221",
35
- "@aglyn/shared-util-timestamp": "1.0.0-beta.221",
36
- "@aglyn/tenant-data-admin": "1.0.0-beta.221",
37
- "@aglyn/tenant-feature-instance": "1.0.0-beta.221",
38
- "@aglyn/tenant-runtime": "1.0.0-beta.221",
28
+ "@aglyn/aglyn": "1.0.0-beta.223",
29
+ "@aglyn/shared-data-mdi": "1.0.0-beta.223",
30
+ "@aglyn/shared-ui-jsx": "1.0.0-beta.223",
31
+ "@aglyn/shared-ui-next": "1.0.0-beta.223",
32
+ "@aglyn/shared-ui-snackstack": "1.0.0-beta.223",
33
+ "@aglyn/shared-util-email": "1.0.0-beta.223",
34
+ "@aglyn/shared-util-http": "1.0.0-beta.223",
35
+ "@aglyn/shared-util-timestamp": "1.0.0-beta.223",
36
+ "@aglyn/tenant-data-admin": "1.0.0-beta.223",
37
+ "@aglyn/tenant-feature-instance": "1.0.0-beta.223",
38
+ "@aglyn/tenant-runtime": "1.0.0-beta.223",
39
39
  "@swc/helpers": "0.5.23"
40
40
  },
41
41
  "peerDependencies": {
@@ -1,19 +1,5 @@
1
- /**
2
- * ONE STEP EDITOR FOR BOTH AUTOMATION BUILDERS (AGL-3105).
3
- *
4
- * A step's fields belong to the step, not to the card the step is edited on.
5
- * The Actions builder and the Workflows builder both hold an ordered list of
6
- * steps, and a workflow step may be any server-side Actions step, so the
7
- * fields it takes — which dataset, which campaign, how long to wait, what to
8
- * say — are asked here and in one place. A second copy would be two editors
9
- * of one vocabulary, drifting a field at a time.
10
- *
11
- * What the card keeps is the list: what "Add step" builds, how many are
12
- * allowed, and what a kind the Actions vocabulary does not hold looks like —
13
- * a workflow's function call, handed in as `fields`.
14
- */
15
- import { type HostActionStep, type HostActionStepType } from '@aglyn/aglyn';
16
1
  import type { ReactNode } from 'react';
2
+ import { type HostActionStep, type HostActionStepType } from '../model/host-actions';
17
3
  /**
18
4
  * What a field holding a placeholder shows: an error state and what to do
19
5
  * about it. A placeholder is a value a person still has to supply, written in
@@ -66,9 +52,23 @@ export interface AutomationStepFieldsProps {
66
52
  * step and a function call is not one.
67
53
  */
68
54
  fields?: ReactNode;
55
+ /**
56
+ * Where the step sits (AGL-3458): the automation's trigger event and
57
+ * whether a wait comes before it — what decides whether a `sendEmail` step
58
+ * can be a transactional reply. Absent, the email step shows no switch.
59
+ */
60
+ replyContext?: {
61
+ event: string | null | undefined;
62
+ afterWait: boolean;
63
+ };
69
64
  }
65
+ /**
66
+ * What the email step says about its merge tags (AGL-3458): both spellings
67
+ * the run fills, from the contact or the lead the event is about.
68
+ */
69
+ export declare const SEND_EMAIL_MERGE_HELP: string;
70
70
  /**
71
71
  * One step's row: its number, what it does, the fields that kind takes, and
72
72
  * the condition that gates it.
73
73
  */
74
- export declare function AutomationStepFields({ step, index, kind, kinds, stepForKind, pickers, onSteps, fields, }: AutomationStepFieldsProps): import("react").JSX.Element;
74
+ export declare function AutomationStepFields({ step, index, kind, kinds, stepForKind, pickers, onSteps, fields, replyContext, }: AutomationStepFieldsProps): import("react").JSX.Element;
@@ -15,6 +15,7 @@
15
15
  * limitations under the License.
16
16
  */ 'use client';
17
17
  import { _ as _extends } from "@swc/helpers/_/_extends";
18
+ import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
18
19
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
19
20
  /**
20
21
  * ONE STEP EDITOR FOR BOTH AUTOMATION BUILDERS (AGL-3105).
@@ -29,9 +30,24 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
29
30
  * What the card keeps is the list: what "Add step" builds, how many are
30
31
  * allowed, and what a kind the Actions vocabulary does not hold looks like —
31
32
  * a workflow's function call, handed in as `fields`.
32
- */ import { CONTACT_LIFECYCLE_STAGE_LABELS, CONTACT_LIFECYCLE_STAGES, CONTACT_TAG_MAX_LENGTH, CRM_ACTIVITY_KIND_LABELS, CRM_ACTIVITY_KINDS, CRM_TASK_KIND_LABELS, CRM_TASK_KINDS, CRM_TASK_MAX_DUE_DAYS, HOST_EVENT_TYPES, hostEventLabel, isInteractionAttributeAllowed } from "@aglyn/aglyn";
33
- import { automationPlaceholderIn } from "@aglyn/aglyn/app-utils/automation-placeholders";
34
- import { IconButton, MenuItem, Stack, TextField, Typography } from "@mui/material";
33
+ */ import { CONTACT_LIFECYCLE_STAGE_LABELS, CONTACT_LIFECYCLE_STAGES, CONTACT_TAG_MAX_LENGTH, CRM_ACTIVITY_DIRECTION_LABELS, CRM_ACTIVITY_DIRECTIONS, CRM_ACTIVITY_KIND_LABELS, CRM_ACTIVITY_KINDS, CRM_TASK_KIND_LABELS, CRM_TASK_KINDS, CRM_TASK_MAX_DUE_DAYS, HOST_EVENT_TYPES, hostEventLabel, isInteractionAttributeAllowed } from "@aglyn/aglyn";
34
+ import { FormControlLabel, FormHelperText, IconButton, MenuItem, Stack, Switch, TextField, Typography } from "@mui/material";
35
+ import { SEND_EMAIL_REPLY_INELIGIBLE_REASONS, sendEmailIsTransactionalReply, sendEmailReplyIneligibility } from "../model/host-actions.js";
36
+ import { draftPlaceholderIn } from "@aglyn/aglyn/app-utils/draft-placeholders";
37
+ /** A task's priorities, by meaning, as the create-task step offers them (AGL-3517). */ const TASK_PRIORITY_OPTIONS = [
38
+ {
39
+ value: 'high',
40
+ label: 'High'
41
+ },
42
+ {
43
+ value: 'normal',
44
+ label: 'Normal'
45
+ },
46
+ {
47
+ value: 'low',
48
+ label: 'Low'
49
+ }
50
+ ];
35
51
  /**
36
52
  * The durations a wait may be set to, from the picker.
37
53
  *
@@ -120,7 +136,7 @@ import { IconButton, MenuItem, Stack, TextField, Typography } from "@mui/materia
120
136
  * square brackets where it belongs — an automation drafted for review carries
121
137
  * one wherever it could not name a real record or did not know a fact.
122
138
  */ export function placeholderState(value, help) {
123
- return automationPlaceholderIn(value) ? {
139
+ return draftPlaceholderIn(value) ? {
124
140
  error: true,
125
141
  helperText: help
126
142
  } : {};
@@ -129,7 +145,7 @@ import { IconButton, MenuItem, Stack, TextField, Typography } from "@mui/materia
129
145
  * A picker whose stored reference is a placeholder name and no id: the record
130
146
  * the draft asked for, which the site did not have when it was written.
131
147
  */ function placeholderReference(name, id, noun) {
132
- const words = String(id != null ? id : '').trim() ? null : automationPlaceholderIn(name);
148
+ const words = String(id != null ? id : '').trim() ? null : draftPlaceholderIn(name);
133
149
  return words ? {
134
150
  error: true,
135
151
  helperText: `Pick the ${noun} — the draft asked for “${words}”`
@@ -323,12 +339,52 @@ export function defaultStep(type) {
323
339
  };
324
340
  }
325
341
  }
342
+ /**
343
+ * The email step's TRANSACTIONAL REPLY switch (AGL-3458) — visible on every
344
+ * email step, so which kind of message it sends is never a guess.
345
+ *
346
+ * On by default for a step that qualifies: the trigger is the recipient's own
347
+ * form submission, booking or sign-up, nothing waits before the step, and it
348
+ * goes to the address the event carries. Such a reply leaves with no
349
+ * unsubscribe header and no unsubscribe link. A step that does not qualify
350
+ * shows the switch off and disabled, saying why, because it is a mailing and
351
+ * keeps its unsubscribe whatever it says.
352
+ */ function SendEmailReplySwitch({ step, context, onChange }) {
353
+ const ineligible = sendEmailReplyIneligibility(step, context);
354
+ const on = sendEmailIsTransactionalReply(step, context);
355
+ return /*#__PURE__*/ _jsxs(Stack, {
356
+ sx: {
357
+ pl: 3
358
+ },
359
+ children: [
360
+ /*#__PURE__*/ _jsx(FormControlLabel, {
361
+ control: /*#__PURE__*/ _jsx(Switch, {
362
+ size: "small",
363
+ checked: on,
364
+ disabled: ineligible !== null,
365
+ onChange: (event)=>onChange(event.target.checked)
366
+ }),
367
+ label: "Transactional reply (no unsubscribe)"
368
+ }),
369
+ /*#__PURE__*/ _jsx(FormHelperText, {
370
+ sx: {
371
+ mt: 0
372
+ },
373
+ children: ineligible ? `Sent as a mailing with an unsubscribe link: ${SEND_EMAIL_REPLY_INELIGIBLE_REASONS[ineligible]}.` : on ? 'Answers what this person just did, so it goes without an unsubscribe ' + 'link or header. Bounced, complaining and unsubscribed addresses are still skipped.' : 'Sent as a mailing, with an unsubscribe link and header.'
374
+ })
375
+ ]
376
+ });
377
+ }
378
+ /**
379
+ * What the email step says about its merge tags (AGL-3458): both spellings
380
+ * the run fills, from the contact or the lead the event is about.
381
+ */ export const SEND_EMAIL_MERGE_HELP = 'Merge tags: {{firstName|there}}, {{name}}, {{email}}, or {{contact.firstName}}, ' + '{{lead.company}}, {{site.name}} — filled from the contact or lead the event is ' + 'about; the text after | is used when there is no value.';
326
382
  /**
327
383
  * One step's row: its number, what it does, the fields that kind takes, and
328
384
  * the condition that gates it.
329
- */ export function AutomationStepFields({ step, index, kind, kinds, stepForKind, pickers, onSteps, fields }) {
330
- var _ref, _step_workflowId, _step_severity, _ref1, _step_webhookId, _ref2, _step_datasetId, _step_overlayId, _step_selector, _step_selector1, _step_className, _step_selector2, _step_selector3, _step_offsetPx, _step_selector4, _step_name, _step_value, _step_drawerNodeId, _step_menuNodeId, _step_html, _step_code, _step_url, _step_eventName, _step_subject, _step_body, _step_title, _step_listId, _step_campaignId, _step_lifecycleStage, _step_tag, _step_title1, _step_kind, _step_dueInDays, _step_kind1, _step_body1, _step_eventName1, _step_timeoutMinutes, _step_delayMinutes, _ref3, _step_when_conditions__field, _step_when_conditions__value;
331
- var _workflowOptions_find, _webhookOptions_find, _datasetOptions_find, _step_when_conditions_, _step_when_conditions, _step_when, _step_when_conditions_1, _step_when_conditions1, _step_when1, _step_when_conditions_2, _step_when_conditions2, _step_when2, _step_when_conditions_3, _step_when_conditions3, _step_when3;
385
+ */ export function AutomationStepFields({ step, index, kind, kinds, stepForKind, pickers, onSteps, fields, replyContext }) {
386
+ var _ref, _step_workflowId, _step_severity, _ref1, _step_webhookId, _ref2, _step_datasetId, _step_overlayId, _step_selector, _step_selector1, _step_className, _step_selector2, _step_selector3, _step_offsetPx, _step_selector4, _step_name, _step_value, _step_drawerNodeId, _step_menuNodeId, _step_html, _step_code, _step_url, _step_eventName, _step_subject, _step_body, _step_title, _step_listId, _step_campaignId, _step_lifecycleStage, _step_tag, _step_title1, _step_kind, _step_priority, _step_dueInDays, _step_kind1, _step_direction, _CRM_ACTIVITY_DIRECTIONS_step_kind, _step_body1, _step_eventName1, _step_timeoutMinutes, _step_delayMinutes, _ref3, _step_when_conditions__field, _step_when_conditions__value;
387
+ var _workflowOptions_find, _webhookOptions_find, _datasetOptions_find, _CRM_ACTIVITY_DIRECTIONS_step_kind1, _step_when_conditions_, _step_when_conditions, _step_when, _step_when_conditions_1, _step_when_conditions1, _step_when1, _step_when_conditions_2, _step_when_conditions2, _step_when2, _step_when_conditions_3, _step_when_conditions3, _step_when3;
332
388
  const { workflowOptions, datasetOptions, overlayOptions, listOptions, campaignOptions, webhookOptions } = pickers;
333
389
  /*
334
390
  * The list, edited as a draft holding it — the shape both cards' own
@@ -774,6 +830,7 @@ export function defaultStep(type) {
774
830
  size: "small",
775
831
  multiline: true,
776
832
  maxRows: 3,
833
+ helperText: SEND_EMAIL_MERGE_HELP,
777
834
  sx: {
778
835
  flex: 1
779
836
  }
@@ -962,7 +1019,7 @@ export function defaultStep(type) {
962
1019
  })),
963
1020
  /*#__PURE__*/ _jsx(TextField, {
964
1021
  select: true,
965
- label: "Kind",
1022
+ label: "Type",
966
1023
  value: (_step_kind = step.kind) != null ? _step_kind : '',
967
1024
  onChange: (event)=>patch((previous)=>_extends({}, previous, {
968
1025
  steps: previous.steps.map((s, index2)=>index2 === index && s.type === 'createCrmTask' ? _extends({}, s, {
@@ -978,6 +1035,24 @@ export function defaultStep(type) {
978
1035
  children: CRM_TASK_KIND_LABELS[kind]
979
1036
  }, kind))
980
1037
  }),
1038
+ /*#__PURE__*/ _jsx(TextField, {
1039
+ select: true,
1040
+ label: "Priority",
1041
+ value: (_step_priority = step.priority) != null ? _step_priority : 'normal',
1042
+ onChange: (event)=>patch((previous)=>_extends({}, previous, {
1043
+ steps: previous.steps.map((s, index2)=>index2 === index && s.type === 'createCrmTask' ? _extends({}, s, {
1044
+ priority: event.target.value
1045
+ }) : s)
1046
+ })),
1047
+ size: "small",
1048
+ sx: {
1049
+ minWidth: 110
1050
+ },
1051
+ children: TASK_PRIORITY_OPTIONS.map((option)=>/*#__PURE__*/ _jsx(MenuItem, {
1052
+ value: option.value,
1053
+ children: option.label
1054
+ }, option.value))
1055
+ }),
981
1056
  /*#__PURE__*/ _jsx(TextField, {
982
1057
  type: "number",
983
1058
  label: "Due in (days)",
@@ -1012,9 +1087,21 @@ export function defaultStep(type) {
1012
1087
  label: "Kind",
1013
1088
  value: (_step_kind1 = step.kind) != null ? _step_kind1 : '',
1014
1089
  onChange: (event)=>patch((previous)=>_extends({}, previous, {
1015
- steps: previous.steps.map((s, index2)=>index2 === index && s.type === 'logCrmActivity' ? _extends({}, s, {
1016
- kind: event.target.value
1017
- }) : s)
1090
+ steps: previous.steps.map((s, index2)=>{
1091
+ var _CRM_ACTIVITY_DIRECTIONS_kind;
1092
+ if (index2 !== index || s.type !== 'logCrmActivity') return s;
1093
+ const kind = event.target.value;
1094
+ // A direction the new kind does not take goes with the old one.
1095
+ const { direction } = s, rest = _object_without_properties_loose(s, [
1096
+ "direction"
1097
+ ]);
1098
+ return direction && ((_CRM_ACTIVITY_DIRECTIONS_kind = CRM_ACTIVITY_DIRECTIONS[kind]) != null ? _CRM_ACTIVITY_DIRECTIONS_kind : []).includes(direction) ? _extends({}, rest, {
1099
+ kind,
1100
+ direction
1101
+ }) : _extends({}, rest, {
1102
+ kind
1103
+ });
1104
+ })
1018
1105
  })),
1019
1106
  size: "small",
1020
1107
  sx: {
@@ -1025,6 +1112,44 @@ export function defaultStep(type) {
1025
1112
  children: CRM_ACTIVITY_KIND_LABELS[kind]
1026
1113
  }, kind))
1027
1114
  }),
1115
+ ((_CRM_ACTIVITY_DIRECTIONS_step_kind1 = CRM_ACTIVITY_DIRECTIONS[step.kind]) == null ? void 0 : _CRM_ACTIVITY_DIRECTIONS_step_kind1.length) ? /*#__PURE__*/ _jsxs(TextField, {
1116
+ select: true,
1117
+ label: "Direction",
1118
+ value: (_step_direction = step.direction) != null ? _step_direction : '',
1119
+ onChange: (event)=>patch((previous)=>_extends({}, previous, {
1120
+ steps: previous.steps.map((s, index2)=>{
1121
+ if (index2 !== index || s.type !== 'logCrmActivity') return s;
1122
+ const { direction: _direction } = s, rest = _object_without_properties_loose(s, [
1123
+ "direction"
1124
+ ]);
1125
+ return event.target.value ? _extends({}, rest, {
1126
+ direction: event.target.value
1127
+ }) : rest;
1128
+ })
1129
+ })),
1130
+ size: "small",
1131
+ sx: {
1132
+ minWidth: 120
1133
+ },
1134
+ slotProps: {
1135
+ select: {
1136
+ displayEmpty: true
1137
+ },
1138
+ inputLabel: {
1139
+ shrink: true
1140
+ }
1141
+ },
1142
+ children: [
1143
+ /*#__PURE__*/ _jsx(MenuItem, {
1144
+ value: "",
1145
+ children: 'Not said'
1146
+ }),
1147
+ ((_CRM_ACTIVITY_DIRECTIONS_step_kind = CRM_ACTIVITY_DIRECTIONS[step.kind]) != null ? _CRM_ACTIVITY_DIRECTIONS_step_kind : []).map((direction)=>/*#__PURE__*/ _jsx(MenuItem, {
1148
+ value: direction,
1149
+ children: CRM_ACTIVITY_DIRECTION_LABELS[direction]
1150
+ }, direction))
1151
+ ]
1152
+ }) : null,
1028
1153
  /*#__PURE__*/ _jsx(TextField, _extends({
1029
1154
  label: "What happened"
1030
1155
  }, placeholderState(step.body, 'Fill in the placeholders'), {
@@ -1103,6 +1228,15 @@ export function defaultStep(type) {
1103
1228
  })
1104
1229
  ]
1105
1230
  }),
1231
+ !fields && step.type === 'sendEmail' && replyContext ? /*#__PURE__*/ _jsx(SendEmailReplySwitch, {
1232
+ step: step,
1233
+ context: replyContext,
1234
+ onChange: (transactional)=>patch((previous)=>_extends({}, previous, {
1235
+ steps: previous.steps.map((s, index2)=>index2 === index ? _extends({}, s, {
1236
+ transactional
1237
+ }) : s)
1238
+ }))
1239
+ }) : null,
1106
1240
  fields ? null : /*#__PURE__*/ _jsxs(Stack, {
1107
1241
  direction: "row",
1108
1242
  spacing: 1,