@aglyn/plugins-workflows 1.0.0-beta.221 → 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.
- package/README.md +22 -14
- package/package.json +12 -12
- package/src/lib/components/automation-step-fields.component.d.ts +1 -15
- package/src/lib/components/automation-step-fields.component.js +93 -10
- package/src/lib/components/automation-step-fields.component.js.map +1 -1
- package/src/lib/components/automation-trigger-conditions.component.d.ts +2 -1
- package/src/lib/components/automation-trigger-conditions.component.js.map +1 -1
- package/src/lib/components/host-actions-card.component.js +85 -77
- package/src/lib/components/host-actions-card.component.js.map +1 -1
- package/src/lib/components/host-webhooks-card.component.js +2 -1
- package/src/lib/components/host-webhooks-card.component.js.map +1 -1
- package/src/lib/components/host-workflows-card.component.js.map +1 -1
- package/src/lib/components/org-automation-editor.component.d.ts +2 -1
- package/src/lib/components/org-automation-editor.component.js.map +1 -1
- package/src/lib/components/org-automations-card.component.js +2 -1
- package/src/lib/components/org-automations-card.component.js.map +1 -1
- package/src/lib/components/run-quota-line.component.d.ts +17 -4
- package/src/lib/components/run-quota-line.component.js +16 -7
- package/src/lib/components/run-quota-line.component.js.map +1 -1
- package/src/lib/components/site-org-automations-panel.component.js +2 -1
- package/src/lib/components/site-org-automations-panel.component.js.map +1 -1
- package/src/lib/components/workflows-console-page.js +18 -7
- package/src/lib/components/workflows-console-page.js.map +1 -1
- package/src/lib/declarations.d.ts +28 -0
- package/src/lib/declarations.js +37 -0
- package/src/lib/declarations.js.map +1 -0
- package/src/lib/declarations.server.js +17 -0
- package/src/lib/declarations.server.js.map +1 -1
- package/src/lib/engine/run-event-actions.d.ts +5 -10
- package/src/lib/engine/run-event-actions.js +103 -320
- package/src/lib/engine/run-event-actions.js.map +1 -1
- package/src/lib/engine/run-event-automations.d.ts +1 -1
- package/src/lib/engine/run-event-automations.js.map +1 -1
- package/src/lib/engine/run-event-workflows.d.ts +2 -1
- package/src/lib/engine/run-event-workflows.js +27 -22
- package/src/lib/engine/run-event-workflows.js.map +1 -1
- package/src/lib/engine/run-meter.d.ts +98 -0
- package/src/lib/engine/run-meter.js +121 -0
- package/src/lib/engine/run-meter.js.map +1 -0
- package/src/lib/engine/run-org-automations.d.ts +3 -2
- package/src/lib/engine/run-org-automations.js +14 -11
- package/src/lib/engine/run-org-automations.js.map +1 -1
- package/src/lib/engine/workflow-steps.d.ts +1 -1
- package/src/lib/engine/workflow-steps.js +3 -2
- package/src/lib/engine/workflow-steps.js.map +1 -1
- package/src/lib/model/host-actions.d.ts +231 -0
- package/src/lib/model/host-actions.js +268 -0
- package/src/lib/model/host-actions.js.map +1 -0
- package/src/lib/model/org-automations.d.ts +2 -1
- package/src/lib/model/org-automations.js +6 -3
- package/src/lib/model/org-automations.js.map +1 -1
- package/src/lib/model/step-outcomes.d.ts +2 -2
- package/src/lib/model/step-outcomes.js +1 -1
- package/src/lib/model/step-outcomes.js.map +1 -1
- package/src/lib/plugin.js +10 -0
- package/src/lib/plugin.js.map +1 -1
- package/src/lib/server/action-test-run-route.d.ts +3 -2
- package/src/lib/server/action-test-run-route.js +3 -2
- package/src/lib/server/action-test-run-route.js.map +1 -1
- package/src/lib/server/org-automations-routes.d.ts +42 -1
- package/src/lib/server/org-automations-routes.js +120 -72
- package/src/lib/server/org-automations-routes.js.map +1 -1
- package/src/lib/server-automation-drafts.d.ts +2 -2
- package/src/lib/server-automation-drafts.js +9 -6
- package/src/lib/server-automation-drafts.js.map +1 -1
- package/src/lib/server.js +19 -13
- package/src/lib/server.js.map +1 -1
- package/src/lib/testing/stand-in-crm-steps.d.ts +45 -0
- package/src/lib/testing/stand-in-crm-steps.js +97 -0
- package/src/lib/testing/stand-in-crm-steps.js.map +1 -0
- package/src/lib/testing/stand-in-dataset-list.js +11 -3
- package/src/lib/testing/stand-in-dataset-list.js.map +1 -1
- package/src/lib/testing/stand-in-dataset-steps.d.ts +43 -0
- package/src/lib/testing/stand-in-dataset-steps.js +65 -0
- package/src/lib/testing/stand-in-dataset-steps.js.map +1 -0
- package/src/lib/testing/stand-in-person-records.d.ts +35 -0
- package/src/lib/testing/stand-in-person-records.js +54 -0
- package/src/lib/testing/stand-in-person-records.js.map +1 -0
- package/src/lib/testing/stand-in-recipes.d.ts +35 -0
- package/src/lib/testing/stand-in-recipes.js +201 -0
- package/src/lib/testing/stand-in-recipes.js.map +1 -0
- package/src/lib/transfer/org-automations-package.d.ts +54 -0
- package/src/lib/transfer/org-automations-package.js +167 -0
- package/src/lib/transfer/org-automations-package.js.map +1 -0
- package/src/lib/transfer/org-automations-package.server.d.ts +38 -0
- package/src/lib/transfer/org-automations-package.server.js +296 -0
- package/src/lib/transfer/org-automations-package.server.js.map +1 -0
- package/src/lib/usage-axes.js +5 -1
- package/src/lib/usage-axes.js.map +1 -1
- package/src/lib/engine/crm-action-steps.d.ts +0 -142
- package/src/lib/engine/crm-action-steps.js +0 -452
- 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,
|
|
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:
|
|
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,
|
|
100
|
-
var
|
|
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.
|
|
281
|
-
*
|
|
282
|
-
* —
|
|
283
|
-
*
|
|
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 [
|
|
286
|
-
const [
|
|
292
|
+
const [pickFor, setPickFor] = useState(null);
|
|
293
|
+
const [pickedId, setPickedId] = useState('');
|
|
287
294
|
/**
|
|
288
|
-
* The
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*/ const
|
|
292
|
-
|
|
293
|
-
|
|
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
|
-
|
|
307
|
+
pickedKind
|
|
297
308
|
], {
|
|
298
309
|
idField: '$id'
|
|
299
310
|
});
|
|
300
|
-
const { rows:
|
|
301
|
-
//
|
|
302
|
-
//
|
|
303
|
-
const
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
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.
|
|
314
|
-
|
|
315
|
-
|
|
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
|
|
323
|
-
const recipe =
|
|
324
|
-
const
|
|
325
|
-
if (!recipe || !
|
|
326
|
-
|
|
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
|
-
|
|
336
|
+
picked
|
|
329
337
|
}), null));
|
|
330
338
|
}, [
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
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({},
|
|
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 ?
|
|
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(
|
|
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 =
|
|
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:
|
|
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 “${(
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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: (
|
|
822
|
-
combinator: (
|
|
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((
|
|
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((
|
|
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: (
|
|
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((
|
|
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: (
|
|
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: (
|
|
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: (
|
|
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
|
-
((
|
|
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: ((
|
|
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(
|
|
991
|
-
onClose: ()=>
|
|
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: (
|
|
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:
|
|
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
|
-
|
|
1019
|
+
pickTruncated ? /*#__PURE__*/ _jsx(Alert, {
|
|
1012
1020
|
severity: "info",
|
|
1013
|
-
children: `Offering the first ${EDITOR_OPTION_CEILING}
|
|
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
|
-
|
|
1023
|
+
pickOptions.length ? /*#__PURE__*/ _jsx(TextField, {
|
|
1016
1024
|
select: true,
|
|
1017
|
-
label:
|
|
1018
|
-
value:
|
|
1019
|
-
onChange: (event)=>
|
|
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:
|
|
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:
|
|
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: ()=>
|
|
1047
|
+
onClick: ()=>setPickFor(null),
|
|
1040
1048
|
children: 'Cancel'
|
|
1041
1049
|
}),
|
|
1042
1050
|
/*#__PURE__*/ _jsx(Button, {
|
|
1043
1051
|
variant: "contained",
|
|
1044
|
-
disabled: !
|
|
1045
|
-
onClick:
|
|
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 — ${(
|
|
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, {
|