@aglyn/plugins-workflows 1.0.0-beta.220 → 1.0.0-beta.222

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 (92) 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 +1 -15
  4. package/src/lib/components/automation-step-fields.component.js +93 -10
  5. package/src/lib/components/automation-step-fields.component.js.map +1 -1
  6. package/src/lib/components/automation-trigger-conditions.component.d.ts +2 -1
  7. package/src/lib/components/automation-trigger-conditions.component.js.map +1 -1
  8. package/src/lib/components/host-actions-card.component.js +85 -77
  9. package/src/lib/components/host-actions-card.component.js.map +1 -1
  10. package/src/lib/components/host-webhooks-card.component.js +2 -1
  11. package/src/lib/components/host-webhooks-card.component.js.map +1 -1
  12. package/src/lib/components/host-workflows-card.component.js.map +1 -1
  13. package/src/lib/components/org-automation-editor.component.d.ts +2 -1
  14. package/src/lib/components/org-automation-editor.component.js.map +1 -1
  15. package/src/lib/components/org-automations-card.component.js +2 -1
  16. package/src/lib/components/org-automations-card.component.js.map +1 -1
  17. package/src/lib/components/run-quota-line.component.d.ts +17 -4
  18. package/src/lib/components/run-quota-line.component.js +16 -7
  19. package/src/lib/components/run-quota-line.component.js.map +1 -1
  20. package/src/lib/components/site-org-automations-panel.component.js +2 -1
  21. package/src/lib/components/site-org-automations-panel.component.js.map +1 -1
  22. package/src/lib/components/workflows-console-page.js +18 -7
  23. package/src/lib/components/workflows-console-page.js.map +1 -1
  24. package/src/lib/declarations.d.ts +28 -0
  25. package/src/lib/declarations.js +37 -0
  26. package/src/lib/declarations.js.map +1 -0
  27. package/src/lib/declarations.server.js +17 -0
  28. package/src/lib/declarations.server.js.map +1 -1
  29. package/src/lib/engine/run-event-actions.d.ts +5 -10
  30. package/src/lib/engine/run-event-actions.js +147 -330
  31. package/src/lib/engine/run-event-actions.js.map +1 -1
  32. package/src/lib/engine/run-event-automations.d.ts +1 -1
  33. package/src/lib/engine/run-event-automations.js.map +1 -1
  34. package/src/lib/engine/run-event-workflows.d.ts +2 -1
  35. package/src/lib/engine/run-event-workflows.js +27 -22
  36. package/src/lib/engine/run-event-workflows.js.map +1 -1
  37. package/src/lib/engine/run-meter.d.ts +98 -0
  38. package/src/lib/engine/run-meter.js +121 -0
  39. package/src/lib/engine/run-meter.js.map +1 -0
  40. package/src/lib/engine/run-org-automations.d.ts +3 -2
  41. package/src/lib/engine/run-org-automations.js +14 -11
  42. package/src/lib/engine/run-org-automations.js.map +1 -1
  43. package/src/lib/engine/workflow-steps.d.ts +1 -1
  44. package/src/lib/engine/workflow-steps.js +3 -2
  45. package/src/lib/engine/workflow-steps.js.map +1 -1
  46. package/src/lib/model/host-actions.d.ts +231 -0
  47. package/src/lib/model/host-actions.js +268 -0
  48. package/src/lib/model/host-actions.js.map +1 -0
  49. package/src/lib/model/org-automations.d.ts +2 -1
  50. package/src/lib/model/org-automations.js +6 -3
  51. package/src/lib/model/org-automations.js.map +1 -1
  52. package/src/lib/model/step-outcomes.d.ts +2 -2
  53. package/src/lib/model/step-outcomes.js +1 -1
  54. package/src/lib/model/step-outcomes.js.map +1 -1
  55. package/src/lib/plugin.js +10 -0
  56. package/src/lib/plugin.js.map +1 -1
  57. package/src/lib/server/action-test-run-route.d.ts +3 -2
  58. package/src/lib/server/action-test-run-route.js +3 -2
  59. package/src/lib/server/action-test-run-route.js.map +1 -1
  60. package/src/lib/server/org-automations-routes.d.ts +42 -1
  61. package/src/lib/server/org-automations-routes.js +120 -72
  62. package/src/lib/server/org-automations-routes.js.map +1 -1
  63. package/src/lib/server-automation-drafts.d.ts +2 -2
  64. package/src/lib/server-automation-drafts.js +9 -6
  65. package/src/lib/server-automation-drafts.js.map +1 -1
  66. package/src/lib/server.js +19 -13
  67. package/src/lib/server.js.map +1 -1
  68. package/src/lib/testing/stand-in-crm-steps.d.ts +45 -0
  69. package/src/lib/testing/stand-in-crm-steps.js +97 -0
  70. package/src/lib/testing/stand-in-crm-steps.js.map +1 -0
  71. package/src/lib/testing/stand-in-dataset-list.js +11 -3
  72. package/src/lib/testing/stand-in-dataset-list.js.map +1 -1
  73. package/src/lib/testing/stand-in-dataset-steps.d.ts +43 -0
  74. package/src/lib/testing/stand-in-dataset-steps.js +65 -0
  75. package/src/lib/testing/stand-in-dataset-steps.js.map +1 -0
  76. package/src/lib/testing/stand-in-person-records.d.ts +35 -0
  77. package/src/lib/testing/stand-in-person-records.js +54 -0
  78. package/src/lib/testing/stand-in-person-records.js.map +1 -0
  79. package/src/lib/testing/stand-in-recipes.d.ts +35 -0
  80. package/src/lib/testing/stand-in-recipes.js +201 -0
  81. package/src/lib/testing/stand-in-recipes.js.map +1 -0
  82. package/src/lib/transfer/org-automations-package.d.ts +54 -0
  83. package/src/lib/transfer/org-automations-package.js +167 -0
  84. package/src/lib/transfer/org-automations-package.js.map +1 -0
  85. package/src/lib/transfer/org-automations-package.server.d.ts +38 -0
  86. package/src/lib/transfer/org-automations-package.server.js +296 -0
  87. package/src/lib/transfer/org-automations-package.server.js.map +1 -0
  88. package/src/lib/usage-axes.js +5 -1
  89. package/src/lib/usage-axes.js.map +1 -1
  90. package/src/lib/engine/crm-action-steps.d.ts +0 -142
  91. package/src/lib/engine/crm-action-steps.js +0 -452
  92. package/src/lib/engine/crm-action-steps.js.map +0 -1
@@ -16,9 +16,10 @@
16
16
  */ 'use client';
17
17
  import { _ as _extends } from "@swc/helpers/_/_extends";
18
18
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
- import { ACTION_MAX_STEPS, checkEntitlement, createResourceUid, CRM_ACTION_RECIPES, ELEMENT_SCOPED_SITE_EVENTS, HOST_ACTION_STEP_LABELS, HOST_EVENT_TYPES, hostActionDocument, hostActionRecipeId, hostEventLabel, hostEventPayloadHint, isSiteEventType, pluginDocsHelp, SITE_EVENT_TYPES, validateHostAction } from "@aglyn/aglyn";
20
- import { automationPlaceholders, describeAutomationPlaceholder } from "@aglyn/aglyn/app-utils/automation-placeholders";
19
+ import { ACTION_MAX_STEPS, checkEntitlement, createResourceUid, ELEMENT_SCOPED_SITE_EVENTS, HOST_EVENT_TYPES, hostEventLabel, hostEventPayloadHint, isSiteEventType, pluginDocsHelp, SITE_EVENT_TYPES } from "@aglyn/aglyn";
21
20
  import { useConsoleWidgetSlot } from "@aglyn/aglyn/app-utils/console-widget-slot-context";
21
+ import { interactionRecipe, interactionRecipes, interactionRecipeStamp } from "@aglyn/aglyn/plugin-manager/interaction-recipes";
22
+ import { pluginRecordListQuery, pluginRecordsFromRows } from "@aglyn/aglyn/plugin-manager/plugin-record-lists";
22
23
  import { AUTOMATION_EDITOR_ZONE, HOST_AUTOMATIONS_ZONE } from "./workflow-zones.js";
23
24
  import { CardDisplay, useConfirmationContext } from "@aglyn/shared-ui-jsx";
24
25
  import { ListPagination } from "@aglyn/shared-ui-jsx/components/list-pagination.component";
@@ -35,6 +36,9 @@ import { AutomationStepFields, defaultStep } from "./automation-step-fields.comp
35
36
  import { conditionRowsFromTrigger, conditionsFromRows, EMPTY_CONDITION_ROW, TriggerConditionRows } from "./automation-trigger-conditions.component.js";
36
37
  import HostRunHistoryCard from "./host-run-history-card.component.js";
37
38
  import { EDITOR_OPTION_CEILING, useAutomationStepPickers } from "./use-automation-step-pickers.js";
39
+ import { siteInteractionDocument } from "@aglyn/aglyn/app-utils/site-interactions";
40
+ import { HOST_ACTION_STEP_LABELS, validateHostAction } from "../model/host-actions.js";
41
+ import { describeInteractionPlaceholder, interactionPlaceholders } from "@aglyn/aglyn/app-utils/draft-placeholders";
38
42
  const CUSTOM_EVENT_VALUE = '__custom__';
39
43
  /**
40
44
  * How many action documents the card reads.
@@ -86,7 +90,7 @@ const CUSTOM_EVENT_VALUE = '__custom__';
86
90
  conditionCombinator: ((_action_trigger12 = action.trigger) == null ? void 0 : _action_trigger12.combinator) === 'or' ? 'or' : 'and',
87
91
  // A recipe stamps what it builds, and a stored action carries what it
88
92
  // was saved with — one reader for both doors, unknown kept unknown.
89
- recipe: hostActionRecipeId(action)
93
+ recipe: interactionRecipeStamp(action)
90
94
  };
91
95
  }
92
96
  /** A trigger bound to one element, which makes the row an interaction. */ const LEAF_SELECTOR = /^\[data-aglyn="leaf:.+"\]$/;
@@ -96,8 +100,8 @@ const CUSTOM_EVENT_VALUE = '__custom__';
96
100
  * event, dataset append). Runs server-side via runEventActions; paid
97
101
  * feature (`actions` flag, Pro+, `actionRunsPerMonth` metered).
98
102
  */ export function HostActionsCard(props) {
99
- var _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _hostEventPayloadHint, _ref6, _ref7, _ref8, _ref9, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _runsFor_name;
100
- var _CRM_ACTION_RECIPES_find;
103
+ var _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _hostEventPayloadHint, _ref7, _ref8, _ref9, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _runsFor_name;
104
+ var _pickFor_picks, _interactionRecipe, _pickFor_picks1, _pickFor_picks2, _pickFor_picks3, _pickFor_picks4, _pickFor_picks5;
101
105
  const { hostId, org } = props;
102
106
  // Org-shared data root (AGL-237). Null until the org lookup settles
103
107
  // (AGL-1061), and for a host with no owning org — the pre-migration host
@@ -277,60 +281,64 @@ const CUSTOM_EVENT_VALUE = '__custom__';
277
281
  *
278
282
  * A recipe opens the editor prefilled and writes nothing: the draft it
279
283
  * builds is the one Save would persist, and until then it is state in
280
- * this card and nowhere else. Three recipes open at once; "Tag by form"
281
- * needs a form first, and the form is this site's — `hosts/{hostId}/forms`
282
- * — so the picker is the one host-scoped piece of the feature, held here
283
- * rather than in the catalog.
284
+ * this card and nowhere else. The recipes are the plugins' that write them
285
+ * (`interaction-recipes`, AGL-3080) — the CRM's "Welcome a new lead" is the
286
+ * CRM's — and this card offers whatever they registered. Most open at once;
287
+ * one that picks a record first opens a picker, and the records are listed
288
+ * through the list source the plugin that keeps them publishes, for this
289
+ * site — the one host-scoped piece of the feature, held here rather than in
290
+ * the recipe.
284
291
  */ const [recipesAnchor, setRecipesAnchor] = useState(null);
285
- const [formPickFor, setFormPickFor] = useState(null);
286
- const [pickedFormId, setPickedFormId] = useState('');
292
+ const [pickFor, setPickFor] = useState(null);
293
+ const [pickedId, setPickedId] = useState('');
287
294
  /**
288
- * The form picker has been opened at least once — the `editorOpened`
289
- * latch's twin, and for the same reason: the forms window is read for
290
- * this picker only, and a reader who never opens it pays nothing.
291
- */ const [formPickerOpened, setFormPickerOpened] = useState(false);
292
- if (formPickFor && !formPickerOpened) setFormPickerOpened(true);
293
- const { data: formRead } = useFirestoreCollection(()=>formPickerOpened ? collectionCeiling(collection(firestore, 'hosts', hostId, 'forms'), EDITOR_OPTION_CEILING) : null, [
295
+ * The picker has been opened at least once — the `editorOpened` latch's
296
+ * twin, and for the same reason: the records are read for this picker only,
297
+ * and a reader who never opens it pays nothing.
298
+ */ const pickKind = (_ref2 = pickFor == null ? void 0 : (_pickFor_picks = pickFor.picks) == null ? void 0 : _pickFor_picks.kind) != null ? _ref2 : null;
299
+ const [pickedKind, setPickedKind] = useState(null);
300
+ if (pickKind && pickKind !== pickedKind) setPickedKind(pickKind);
301
+ const { data: pickRead } = useFirestoreCollection(()=>pickedKind ? pluginRecordListQuery(pickedKind, firestore, {
302
+ hostId,
303
+ limit: EDITOR_OPTION_CEILING + 1
304
+ }) : null, [
294
305
  firestore,
295
306
  hostId,
296
- formPickerOpened
307
+ pickedKind
297
308
  ], {
298
309
  idField: '$id'
299
310
  });
300
- const { rows: formDocs, truncated: formsTruncated } = ceilingedWindow(formRead, EDITOR_OPTION_CEILING);
301
- // An archived form collects nothing, so a recipe keyed on it would never
302
- // fire; the name falls back to the id the way every form list's does.
303
- const formOptions = (formDocs != null ? formDocs : []).filter((form)=>!form.archivedAt).map((form)=>{
304
- var _form_displayName;
305
- return {
306
- id: form.$id,
307
- name: String((_form_displayName = form.displayName) != null ? _form_displayName : '').trim() || form.$id
308
- };
309
- }).sort((a, b)=>a.name.localeCompare(b.name));
311
+ const { rows: pickRows, truncated: pickTruncated } = ceilingedWindow(pickRead, EDITOR_OPTION_CEILING);
312
+ // What the owner leaves out (an archived form collects nothing, so a recipe
313
+ // keyed on it would never fire) is not offered.
314
+ const pickOptions = pluginRecordsFromRows(pickedKind != null ? pickedKind : '', pickRows).map((record)=>({
315
+ id: record.id,
316
+ name: record.name
317
+ })).sort((a, b)=>a.name.localeCompare(b.name));
310
318
  const handleRecipe = useCallback((recipe)=>{
311
319
  setRecipesAnchor(null);
312
320
  if (!actionsEntitled()) return;
313
- if (recipe.needs === 'form') {
314
- setPickedFormId('');
315
- setFormPickFor(recipe);
321
+ if (recipe.picks) {
322
+ setPickedId('');
323
+ setPickFor(recipe);
316
324
  return;
317
325
  }
318
326
  setDraft(draftFromAction(recipe.build(), null));
319
327
  }, [
320
328
  actionsEntitled
321
329
  ]);
322
- const handleFormPicked = useCallback(()=>{
323
- const recipe = formPickFor;
324
- const form = formOptions.find((option)=>option.id === pickedFormId);
325
- if (!recipe || !form) return;
326
- setFormPickFor(null);
330
+ const handlePicked = useCallback(()=>{
331
+ const recipe = pickFor;
332
+ const picked = pickOptions.find((option)=>option.id === pickedId);
333
+ if (!recipe || !picked) return;
334
+ setPickFor(null);
327
335
  setDraft(draftFromAction(recipe.build({
328
- form
336
+ picked
329
337
  }), null));
330
338
  }, [
331
- formPickFor,
332
- formOptions,
333
- pickedFormId
339
+ pickFor,
340
+ pickOptions,
341
+ pickedId
334
342
  ]);
335
343
  // Run log + test runs (AGL-266).
336
344
  const [runsFor, setRunsFor] = useState(null);
@@ -468,7 +476,7 @@ const CUSTOM_EVENT_VALUE = '__custom__';
468
476
  unreadable: Boolean(draft.id) && actionsStatus === 'error',
469
477
  fromCache: Boolean(draft.id) && actionsFromCache
470
478
  }, async ()=>{
471
- await setDoc(doc(firestore, 'hosts', hostId, 'actions', id), _extends({}, hostActionDocument(candidate), {
479
+ await setDoc(doc(firestore, 'hosts', hostId, 'actions', id), _extends({}, siteInteractionDocument(candidate), {
472
480
  updatedAt: Timestamp.now()
473
481
  }, draft.id ? {} : {
474
482
  createdAt: Timestamp.now()
@@ -529,11 +537,11 @@ const CUSTOM_EVENT_VALUE = '__custom__';
529
537
  * step holding it fails every run and a condition holding one never
530
538
  * matches, so turning such an automation on is confirmed, naming what
531
539
  * is still missing.
532
- */ const missing = enabled ? automationPlaceholders(action) : [];
540
+ */ const missing = enabled ? interactionPlaceholders(action) : [];
533
541
  if (missing.length) {
534
542
  const confirmed = await confirm({
535
543
  title: 'Switch on with placeholders?',
536
- description: `"${action.name}" still has ${missing.length === 1 ? 'a placeholder' : `${missing.length} placeholders`} ` + `to fill in: ${missing.slice(0, 3).map(describeAutomationPlaceholder).join('; ')}` + `${missing.length > 3 ? '; …' : ''}. Open it with Edit to fill ` + `${missing.length === 1 ? 'it' : 'them'} in first.`,
544
+ description: `"${action.name}" still has ${missing.length === 1 ? 'a placeholder' : `${missing.length} placeholders`} ` + `to fill in: ${missing.slice(0, 3).map(describeInteractionPlaceholder).join('; ')}` + `${missing.length > 3 ? '; …' : ''}. Open it with Edit to fill ` + `${missing.length === 1 ? 'it' : 'them'} in first.`,
537
545
  confirmationText: 'Switch on anyway'
538
546
  }).then(()=>true).catch(()=>false);
539
547
  if (!confirmed) return;
@@ -565,7 +573,7 @@ const CUSTOM_EVENT_VALUE = '__custom__';
565
573
  visibleActions.map((action)=>{
566
574
  var _action_steps, _ref;
567
575
  var _action_trigger, _action_trigger1;
568
- const missing = automationPlaceholders(action).length;
576
+ const missing = interactionPlaceholders(action).length;
569
577
  return /*#__PURE__*/ _jsxs(Stack, {
570
578
  direction: "row",
571
579
  spacing: 1,
@@ -682,7 +690,7 @@ const CUSTOM_EVENT_VALUE = '__custom__';
682
690
  anchorEl: recipesAnchor,
683
691
  open: Boolean(recipesAnchor),
684
692
  onClose: ()=>setRecipesAnchor(null),
685
- children: CRM_ACTION_RECIPES.map((recipe)=>/*#__PURE__*/ _jsx(MenuItem, {
693
+ children: interactionRecipes().map((recipe)=>/*#__PURE__*/ _jsx(MenuItem, {
686
694
  onClick: ()=>handleRecipe(recipe),
687
695
  children: /*#__PURE__*/ _jsx(ListItemText, {
688
696
  primary: recipe.title,
@@ -734,7 +742,7 @@ const CUSTOM_EVENT_VALUE = '__custom__';
734
742
  (draft == null ? void 0 : draft.recipe) ? /*#__PURE__*/ _jsx(Typography, {
735
743
  variant: "body2",
736
744
  color: "text.secondary",
737
- children: `Started from the “${(_ref2 = (_CRM_ACTION_RECIPES_find = CRM_ACTION_RECIPES.find((recipe)=>recipe.id === draft.recipe)) == null ? void 0 : _CRM_ACTION_RECIPES_find.title) != null ? _ref2 : 'recipe'}” recipe — change anything, then save.`
745
+ children: `Started from the “${(_ref3 = (_interactionRecipe = interactionRecipe(draft.recipe)) == null ? void 0 : _interactionRecipe.title) != null ? _ref3 : 'recipe'}” recipe — change anything, then save.`
738
746
  }) : null,
739
747
  truncatedPickers.length > 0 ? /*#__PURE__*/ _jsx(Alert, {
740
748
  severity: "info",
@@ -745,7 +753,7 @@ const CUSTOM_EVENT_VALUE = '__custom__';
745
753
  }) : null,
746
754
  /*#__PURE__*/ _jsx(TextField, {
747
755
  label: "Name",
748
- value: (_ref3 = draft == null ? void 0 : draft.name) != null ? _ref3 : '',
756
+ value: (_ref4 = draft == null ? void 0 : draft.name) != null ? _ref4 : '',
749
757
  onChange: (event)=>patch((previous)=>_extends({}, previous, {
750
758
  name: event.target.value
751
759
  })),
@@ -762,7 +770,7 @@ const CUSTOM_EVENT_VALUE = '__custom__';
762
770
  /*#__PURE__*/ _jsxs(TextField, {
763
771
  select: true,
764
772
  label: "Trigger event",
765
- value: (_ref4 = draft == null ? void 0 : draft.trigger.event) != null ? _ref4 : '',
773
+ value: (_ref5 = draft == null ? void 0 : draft.trigger.event) != null ? _ref5 : '',
766
774
  onChange: (event)=>patch((previous)=>_extends({}, previous, {
767
775
  trigger: _extends({}, previous.trigger, {
768
776
  event: event.target.value
@@ -789,7 +797,7 @@ const CUSTOM_EVENT_VALUE = '__custom__';
789
797
  }),
790
798
  (draft == null ? void 0 : draft.trigger.event) === CUSTOM_EVENT_VALUE ? /*#__PURE__*/ _jsx(TextField, {
791
799
  label: "Custom event name",
792
- value: (_ref5 = draft == null ? void 0 : draft.customEvent) != null ? _ref5 : '',
800
+ value: (_ref6 = draft == null ? void 0 : draft.customEvent) != null ? _ref6 : '',
793
801
  onChange: (event)=>patch((previous)=>_extends({}, previous, {
794
802
  customEvent: event.target.value
795
803
  })),
@@ -804,7 +812,7 @@ const CUSTOM_EVENT_VALUE = '__custom__';
804
812
  // for this event; nothing for an event whose payload is not
805
813
  // written down, rather than a guess.
806
814
  helperText: (_hostEventPayloadHint = hostEventPayloadHint(draft == null ? void 0 : draft.trigger.event)) != null ? _hostEventPayloadHint : undefined,
807
- value: (_ref6 = draft == null ? void 0 : draft.trigger.filter) != null ? _ref6 : '',
815
+ value: (_ref7 = draft == null ? void 0 : draft.trigger.filter) != null ? _ref7 : '',
808
816
  onChange: (event)=>patch((previous)=>_extends({}, previous, {
809
817
  trigger: _extends({}, previous.trigger, {
810
818
  filter: event.target.value
@@ -818,8 +826,8 @@ const CUSTOM_EVENT_VALUE = '__custom__';
818
826
  ]
819
827
  }),
820
828
  /*#__PURE__*/ _jsx(TriggerConditionRows, {
821
- rows: (_ref7 = draft == null ? void 0 : draft.conditionRows) != null ? _ref7 : [],
822
- combinator: (_ref8 = draft == null ? void 0 : draft.conditionCombinator) != null ? _ref8 : 'and',
829
+ rows: (_ref8 = draft == null ? void 0 : draft.conditionRows) != null ? _ref8 : [],
830
+ combinator: (_ref9 = draft == null ? void 0 : draft.conditionCombinator) != null ? _ref9 : 'and',
823
831
  onRowsChange: (update)=>patch((previous)=>_extends({}, previous, {
824
832
  conditionRows: update(previous.conditionRows)
825
833
  })),
@@ -827,15 +835,15 @@ const CUSTOM_EVENT_VALUE = '__custom__';
827
835
  conditionCombinator: combinator
828
836
  }))
829
837
  }),
830
- isSiteEventType((_ref9 = draft == null ? void 0 : draft.trigger.event) != null ? _ref9 : '') ? // Site-event config (AGL-256): what/where the trigger watches.
838
+ isSiteEventType((_ref10 = draft == null ? void 0 : draft.trigger.event) != null ? _ref10 : '') ? // Site-event config (AGL-256): what/where the trigger watches.
831
839
  /*#__PURE__*/ _jsxs(Stack, {
832
840
  direction: "row",
833
841
  spacing: 1,
834
842
  children: [
835
- ELEMENT_SCOPED_SITE_EVENTS.includes((_ref10 = draft == null ? void 0 : draft.trigger.event) != null ? _ref10 : '') ? /*#__PURE__*/ _jsx(TextField, {
843
+ ELEMENT_SCOPED_SITE_EVENTS.includes((_ref11 = draft == null ? void 0 : draft.trigger.event) != null ? _ref11 : '') ? /*#__PURE__*/ _jsx(TextField, {
836
844
  label: "CSS selector",
837
845
  placeholder: "#pricing-table",
838
- value: (_ref11 = draft == null ? void 0 : draft.trigger.selector) != null ? _ref11 : '',
846
+ value: (_ref12 = draft == null ? void 0 : draft.trigger.selector) != null ? _ref12 : '',
839
847
  onChange: (event)=>patch((previous)=>_extends({}, previous, {
840
848
  trigger: _extends({}, previous.trigger, {
841
849
  selector: event.target.value
@@ -849,10 +857,10 @@ const CUSTOM_EVENT_VALUE = '__custom__';
849
857
  [
850
858
  'scrollDepth',
851
859
  'timeOnPage'
852
- ].includes((_ref12 = draft == null ? void 0 : draft.trigger.event) != null ? _ref12 : '') ? /*#__PURE__*/ _jsx(TextField, {
860
+ ].includes((_ref13 = draft == null ? void 0 : draft.trigger.event) != null ? _ref13 : '') ? /*#__PURE__*/ _jsx(TextField, {
853
861
  type: "number",
854
862
  label: (draft == null ? void 0 : draft.trigger.event) === 'scrollDepth' ? 'Scroll %' : 'Seconds',
855
- value: (_ref13 = draft == null ? void 0 : draft.trigger.threshold) != null ? _ref13 : '',
863
+ value: (_ref14 = draft == null ? void 0 : draft.trigger.threshold) != null ? _ref14 : '',
856
864
  onChange: (event)=>patch((previous)=>_extends({}, previous, {
857
865
  trigger: _extends({}, previous.trigger, {
858
866
  threshold: Number(event.target.value)
@@ -866,7 +874,7 @@ const CUSTOM_EVENT_VALUE = '__custom__';
866
874
  /*#__PURE__*/ _jsx(TextField, {
867
875
  label: "Only on pages (optional)",
868
876
  placeholder: "/pricing or /blog/*",
869
- value: (_ref14 = draft == null ? void 0 : draft.trigger.pathPattern) != null ? _ref14 : '',
877
+ value: (_ref15 = draft == null ? void 0 : draft.trigger.pathPattern) != null ? _ref15 : '',
870
878
  onChange: (event)=>patch((previous)=>_extends({}, previous, {
871
879
  trigger: _extends({}, previous.trigger, {
872
880
  pathPattern: event.target.value
@@ -928,7 +936,7 @@ const CUSTOM_EVENT_VALUE = '__custom__';
928
936
  sx: {
929
937
  width: 150
930
938
  },
931
- value: (_ref15 = draft == null ? void 0 : draft.trigger.cooldownMinutes) != null ? _ref15 : 60,
939
+ value: (_ref16 = draft == null ? void 0 : draft.trigger.cooldownMinutes) != null ? _ref16 : 60,
932
940
  onChange: (event)=>patch((previous)=>_extends({}, previous, {
933
941
  trigger: _extends({}, previous.trigger, {
934
942
  cooldownMinutes: Number(event.target.value)
@@ -942,7 +950,7 @@ const CUSTOM_EVENT_VALUE = '__custom__';
942
950
  color: "text.secondary",
943
951
  children: 'Steps (run in order)'
944
952
  }),
945
- ((_ref16 = draft == null ? void 0 : draft.steps) != null ? _ref16 : []).map((step, index)=>/*#__PURE__*/ _jsx(AutomationStepFields, {
953
+ ((_ref17 = draft == null ? void 0 : draft.steps) != null ? _ref17 : []).map((step, index)=>/*#__PURE__*/ _jsx(AutomationStepFields, {
946
954
  step: step,
947
955
  index: index,
948
956
  kind: step.type,
@@ -958,7 +966,7 @@ const CUSTOM_EVENT_VALUE = '__custom__';
958
966
  sx: {
959
967
  alignSelf: 'flex-start'
960
968
  },
961
- disabled: ((_ref17 = draft == null ? void 0 : draft.steps.length) != null ? _ref17 : 0) >= ACTION_MAX_STEPS,
969
+ disabled: ((_ref18 = draft == null ? void 0 : draft.steps.length) != null ? _ref18 : 0) >= ACTION_MAX_STEPS,
962
970
  onClick: ()=>patch((previous)=>_extends({}, previous, {
963
971
  steps: [
964
972
  ...previous.steps,
@@ -987,13 +995,13 @@ const CUSTOM_EVENT_VALUE = '__custom__';
987
995
  ]
988
996
  }),
989
997
  /*#__PURE__*/ _jsxs(Dialog, {
990
- open: Boolean(formPickFor),
991
- onClose: ()=>setFormPickFor(null),
998
+ open: Boolean(pickFor),
999
+ onClose: ()=>setPickFor(null),
992
1000
  maxWidth: "xs",
993
1001
  fullWidth: true,
994
1002
  children: [
995
1003
  /*#__PURE__*/ _jsx(DialogTitle, {
996
- children: (_ref18 = formPickFor == null ? void 0 : formPickFor.title) != null ? _ref18 : ''
1004
+ children: (_ref19 = pickFor == null ? void 0 : pickFor.title) != null ? _ref19 : ''
997
1005
  }),
998
1006
  /*#__PURE__*/ _jsxs(DialogContent, {
999
1007
  sx: {
@@ -1006,29 +1014,29 @@ const CUSTOM_EVENT_VALUE = '__custom__';
1006
1014
  /*#__PURE__*/ _jsx(Typography, {
1007
1015
  variant: "body2",
1008
1016
  color: "text.secondary",
1009
- children: 'Pick the form whose new contacts get the tag. The action opens ' + 'ready to edit; nothing is saved until you save it.'
1017
+ children: `${(_ref20 = pickFor == null ? void 0 : (_pickFor_picks1 = pickFor.picks) == null ? void 0 : _pickFor_picks1.prompt) != null ? _ref20 : ''} The action opens ready to edit; ` + 'nothing is saved until you save it.'
1010
1018
  }),
1011
- formsTruncated ? /*#__PURE__*/ _jsx(Alert, {
1019
+ pickTruncated ? /*#__PURE__*/ _jsx(Alert, {
1012
1020
  severity: "info",
1013
- children: `Offering the first ${EDITOR_OPTION_CEILING} forms, ordered by ` + 'id. This site has more, so the form you want may not be listed.'
1021
+ children: `Offering the first ${EDITOR_OPTION_CEILING} ${(_ref21 = pickFor == null ? void 0 : (_pickFor_picks2 = pickFor.picks) == null ? void 0 : _pickFor_picks2.plural) != null ? _ref21 : ''}, ` + `ordered by id. This site has more, so the ` + `${((_ref22 = pickFor == null ? void 0 : (_pickFor_picks3 = pickFor.picks) == null ? void 0 : _pickFor_picks3.label) != null ? _ref22 : '').toLowerCase()} you want may not be listed.`
1014
1022
  }) : null,
1015
- formOptions.length ? /*#__PURE__*/ _jsx(TextField, {
1023
+ pickOptions.length ? /*#__PURE__*/ _jsx(TextField, {
1016
1024
  select: true,
1017
- label: "Form",
1018
- value: pickedFormId,
1019
- onChange: (event)=>setPickedFormId(event.target.value),
1025
+ label: (_ref23 = pickFor == null ? void 0 : (_pickFor_picks4 = pickFor.picks) == null ? void 0 : _pickFor_picks4.label) != null ? _ref23 : '',
1026
+ value: pickedId,
1027
+ onChange: (event)=>setPickedId(event.target.value),
1020
1028
  size: "small",
1021
1029
  sx: {
1022
1030
  mt: 1
1023
1031
  },
1024
- children: formOptions.map((option)=>/*#__PURE__*/ _jsx(MenuItem, {
1032
+ children: pickOptions.map((option)=>/*#__PURE__*/ _jsx(MenuItem, {
1025
1033
  value: option.id,
1026
1034
  children: option.name
1027
1035
  }, option.id))
1028
1036
  }) : /*#__PURE__*/ _jsx(Typography, {
1029
1037
  variant: "body2",
1030
1038
  color: "text.secondary",
1031
- children: 'This site has no forms yet. Add one in the besigner, then come back.'
1039
+ children: (_ref24 = pickFor == null ? void 0 : (_pickFor_picks5 = pickFor.picks) == null ? void 0 : _pickFor_picks5.none) != null ? _ref24 : ''
1032
1040
  })
1033
1041
  ]
1034
1042
  }),
@@ -1036,13 +1044,13 @@ const CUSTOM_EVENT_VALUE = '__custom__';
1036
1044
  children: [
1037
1045
  /*#__PURE__*/ _jsx(Button, {
1038
1046
  color: "inherit",
1039
- onClick: ()=>setFormPickFor(null),
1047
+ onClick: ()=>setPickFor(null),
1040
1048
  children: 'Cancel'
1041
1049
  }),
1042
1050
  /*#__PURE__*/ _jsx(Button, {
1043
1051
  variant: "contained",
1044
- disabled: !pickedFormId,
1045
- onClick: handleFormPicked,
1052
+ disabled: !pickedId,
1053
+ onClick: handlePicked,
1046
1054
  children: 'Use recipe'
1047
1055
  })
1048
1056
  ]
@@ -1057,7 +1065,7 @@ const CUSTOM_EVENT_VALUE = '__custom__';
1057
1065
  fullWidth: true,
1058
1066
  children: [
1059
1067
  /*#__PURE__*/ _jsx(DialogTitle, {
1060
- children: `Runs — ${(_ref19 = runsFor == null ? void 0 : runsFor.name) != null ? _ref19 : ''}`
1068
+ children: `Runs — ${(_ref25 = runsFor == null ? void 0 : runsFor.name) != null ? _ref25 : ''}`
1061
1069
  }),
1062
1070
  /*#__PURE__*/ _jsx(DialogContent, {
1063
1071
  children: runsFor ? /*#__PURE__*/ _jsx(HostRunHistoryCard, {