@bigbinary/neeto-rules-frontend 2.7.23 → 2.7.25
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/app/javascript/src/translations/ar.json +4 -2
- package/app/javascript/src/translations/bg.json +4 -2
- package/app/javascript/src/translations/ca.json +4 -2
- package/app/javascript/src/translations/cs.json +4 -2
- package/app/javascript/src/translations/da.json +4 -2
- package/app/javascript/src/translations/de.json +4 -2
- package/app/javascript/src/translations/en.json +1 -0
- package/app/javascript/src/translations/es-MX.json +4 -2
- package/app/javascript/src/translations/es.json +4 -2
- package/app/javascript/src/translations/et.json +4 -2
- package/app/javascript/src/translations/fi.json +4 -2
- package/app/javascript/src/translations/fil.json +4 -2
- package/app/javascript/src/translations/fr.json +4 -2
- package/app/javascript/src/translations/he.json +4 -2
- package/app/javascript/src/translations/hi.json +4 -2
- package/app/javascript/src/translations/hr.json +4 -2
- package/app/javascript/src/translations/hu.json +4 -2
- package/app/javascript/src/translations/id.json +4 -2
- package/app/javascript/src/translations/it.json +4 -2
- package/app/javascript/src/translations/ja.json +4 -2
- package/app/javascript/src/translations/ko.json +4 -2
- package/app/javascript/src/translations/nl.json +4 -2
- package/app/javascript/src/translations/pl.json +4 -2
- package/app/javascript/src/translations/pt-BR.json +4 -2
- package/app/javascript/src/translations/pt.json +4 -2
- package/app/javascript/src/translations/ro.json +4 -2
- package/app/javascript/src/translations/ru.json +4 -2
- package/app/javascript/src/translations/sk.json +4 -2
- package/app/javascript/src/translations/sl.json +4 -2
- package/app/javascript/src/translations/sv.json +4 -2
- package/app/javascript/src/translations/th.json +4 -2
- package/app/javascript/src/translations/tr.json +4 -2
- package/app/javascript/src/translations/uk.json +4 -2
- package/app/javascript/src/translations/vi.json +4 -2
- package/app/javascript/src/translations/zh-CN.json +4 -2
- package/app/javascript/src/translations/zh-TW.json +4 -2
- package/dist/.ready +1 -1
- package/dist/cjs/v2/NeetoRulesBuilder.js +466 -227
- package/dist/cjs/v2/NeetoRulesBuilder.js.map +1 -1
- package/dist/cjs/v2/NeetoRulesForm.js +1 -1
- package/dist/cjs/v2/index.js +1 -1
- package/dist/{index-CvpoP63h.js → index-Br0dDuGK.js} +2 -2
- package/dist/index-Br0dDuGK.js.map +1 -0
- package/dist/{index-puRtNWZV.js → index-D1PW24Zw.js} +2 -2
- package/dist/index-D1PW24Zw.js.map +1 -0
- package/dist/v2/NeetoRulesBuilder.js +466 -227
- package/dist/v2/NeetoRulesBuilder.js.map +1 -1
- package/dist/v2/NeetoRulesForm.js +1 -1
- package/dist/v2/index.js +1 -1
- package/package.json +1 -1
- package/dist/index-CvpoP63h.js.map +0 -1
- package/dist/index-puRtNWZV.js.map +0 -1
|
@@ -13,7 +13,7 @@ var neetoCist = require('@bigbinary/neeto-cist');
|
|
|
13
13
|
var Container = require('@bigbinary/neeto-molecules/v2/Container');
|
|
14
14
|
var Header = require('@bigbinary/neeto-molecules/v2/Header');
|
|
15
15
|
var reactI18next = require('react-i18next');
|
|
16
|
-
var index = require('../../index-
|
|
16
|
+
var index = require('../../index-D1PW24Zw.js');
|
|
17
17
|
var useCustomDataStore = require('../../useCustomDataStore-DPmWkEhs.js');
|
|
18
18
|
var useUtilityStore = require('../../useUtilityStore-gtPhFvpI.js');
|
|
19
19
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
@@ -180,6 +180,7 @@ var BUILDER_PANEL_TYPES = {
|
|
|
180
180
|
CONDITION_VALUE: "builder-condition-value",
|
|
181
181
|
ACTION_CHANNEL: "builder-action-channel",
|
|
182
182
|
ACTION_CONFIG: "builder-action-config",
|
|
183
|
+
ACTION_STEP: "builder-action-step",
|
|
183
184
|
RECIPIENT: "builder-recipient",
|
|
184
185
|
DELAY: "builder-delay",
|
|
185
186
|
LEAD_TIME: "builder-lead-time",
|
|
@@ -200,15 +201,16 @@ var BUILDER_ANCHORS = {
|
|
|
200
201
|
ACTION_CHANNEL: "action-channel",
|
|
201
202
|
ACTION_CONFIG: "action-config",
|
|
202
203
|
ACTION_RECIPIENT: "action-recipient",
|
|
204
|
+
ACTION_STEP: "action-step",
|
|
203
205
|
RULE_DELAY: "rule-delay",
|
|
204
206
|
META_NAME: "meta-name",
|
|
205
207
|
SCOPE: "scope",
|
|
206
208
|
SCOPE_PHONE_FIELD: "scope-phone-field"
|
|
207
209
|
};
|
|
208
|
-
var TOKEN_TO_PANEL_TYPE = (_TOKEN_TO_PANEL_TYPE = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_TOKEN_TO_PANEL_TYPE, BUILDER_ANCHORS.TRIGGER_ADD, BUILDER_PANEL_TYPES.TRIGGER), BUILDER_ANCHORS.TRIGGER_REPLACE, BUILDER_PANEL_TYPES.TRIGGER), BUILDER_ANCHORS.TRIGGER_ACTOR, BUILDER_PANEL_TYPES.ACTOR), BUILDER_ANCHORS.COND_FIELD, BUILDER_PANEL_TYPES.CONDITION_FIELD), BUILDER_ANCHORS.COND_OP_TOGGLE, BUILDER_PANEL_TYPES.OPERATOR), BUILDER_ANCHORS.COND_CONNECTOR, BUILDER_PANEL_TYPES.CONNECTOR), BUILDER_ANCHORS.COND_VALUES, BUILDER_PANEL_TYPES.CONDITION_VALUE), BUILDER_ANCHORS.ACTION_ADD, BUILDER_PANEL_TYPES.ACTION_CHANNEL), BUILDER_ANCHORS.ACTION_CHANNEL, BUILDER_PANEL_TYPES.ACTION_CHANNEL), BUILDER_ANCHORS.ACTION_CONFIG, BUILDER_PANEL_TYPES.ACTION_CONFIG), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_TOKEN_TO_PANEL_TYPE, BUILDER_ANCHORS.ACTION_RECIPIENT, BUILDER_PANEL_TYPES.RECIPIENT), BUILDER_ANCHORS.RULE_DELAY, BUILDER_PANEL_TYPES.DELAY), BUILDER_ANCHORS.TRIGGER_LEAD_TIME, BUILDER_PANEL_TYPES.LEAD_TIME), BUILDER_ANCHORS.META_NAME, BUILDER_PANEL_TYPES.NAME), BUILDER_ANCHORS.SCOPE, BUILDER_PANEL_TYPES.SCOPE), BUILDER_ANCHORS.SCOPE_PHONE_FIELD, BUILDER_PANEL_TYPES.SCOPE_PHONE_FIELD));
|
|
210
|
+
var TOKEN_TO_PANEL_TYPE = (_TOKEN_TO_PANEL_TYPE = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_TOKEN_TO_PANEL_TYPE, BUILDER_ANCHORS.TRIGGER_ADD, BUILDER_PANEL_TYPES.TRIGGER), BUILDER_ANCHORS.TRIGGER_REPLACE, BUILDER_PANEL_TYPES.TRIGGER), BUILDER_ANCHORS.TRIGGER_ACTOR, BUILDER_PANEL_TYPES.ACTOR), BUILDER_ANCHORS.COND_FIELD, BUILDER_PANEL_TYPES.CONDITION_FIELD), BUILDER_ANCHORS.COND_OP_TOGGLE, BUILDER_PANEL_TYPES.OPERATOR), BUILDER_ANCHORS.COND_CONNECTOR, BUILDER_PANEL_TYPES.CONNECTOR), BUILDER_ANCHORS.COND_VALUES, BUILDER_PANEL_TYPES.CONDITION_VALUE), BUILDER_ANCHORS.ACTION_ADD, BUILDER_PANEL_TYPES.ACTION_CHANNEL), BUILDER_ANCHORS.ACTION_CHANNEL, BUILDER_PANEL_TYPES.ACTION_CHANNEL), BUILDER_ANCHORS.ACTION_CONFIG, BUILDER_PANEL_TYPES.ACTION_CONFIG), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_TOKEN_TO_PANEL_TYPE, BUILDER_ANCHORS.ACTION_RECIPIENT, BUILDER_PANEL_TYPES.RECIPIENT), BUILDER_ANCHORS.ACTION_STEP, BUILDER_PANEL_TYPES.ACTION_STEP), BUILDER_ANCHORS.RULE_DELAY, BUILDER_PANEL_TYPES.DELAY), BUILDER_ANCHORS.TRIGGER_LEAD_TIME, BUILDER_PANEL_TYPES.LEAD_TIME), BUILDER_ANCHORS.META_NAME, BUILDER_PANEL_TYPES.NAME), BUILDER_ANCHORS.SCOPE, BUILDER_PANEL_TYPES.SCOPE), BUILDER_ANCHORS.SCOPE_PHONE_FIELD, BUILDER_PANEL_TYPES.SCOPE_PHONE_FIELD));
|
|
209
211
|
var LARGE_PANEL_TYPES = [BUILDER_PANEL_TYPES.ACTION_CONFIG, BUILDER_PANEL_TYPES.SCOPE, BUILDER_PANEL_TYPES.NAME];
|
|
210
212
|
var CONDITION_ANCHORS = [BUILDER_ANCHORS.COND_FIELD, BUILDER_ANCHORS.COND_OP_TOGGLE, BUILDER_ANCHORS.COND_VALUES, BUILDER_ANCHORS.COND_CONNECTOR];
|
|
211
|
-
var ACTION_ANCHORS = [BUILDER_ANCHORS.ACTION_CHANNEL, BUILDER_ANCHORS.ACTION_CONFIG, BUILDER_ANCHORS.ACTION_RECIPIENT];
|
|
213
|
+
var ACTION_ANCHORS = [BUILDER_ANCHORS.ACTION_CHANNEL, BUILDER_ANCHORS.ACTION_CONFIG, BUILDER_ANCHORS.ACTION_RECIPIENT, BUILDER_ANCHORS.ACTION_STEP];
|
|
212
214
|
var PANE_SEARCH_THRESHOLD = 8;
|
|
213
215
|
var CONFIG_FOCUSABLE_SELECTOR = 'input:not([type="radio"]):not([type="checkbox"]), textarea, [contenteditable="true"]';
|
|
214
216
|
var SMS_TYPES = ["sms", "smsToNumbers"];
|
|
@@ -269,7 +271,7 @@ var useReplayFlash = function useReplayFlash(flashSeq) {
|
|
|
269
271
|
return ref;
|
|
270
272
|
};
|
|
271
273
|
|
|
272
|
-
var _excluded = ["children", "state", "active", "invalid", "onClick", "className", "dataTestid"];
|
|
274
|
+
var _excluded$1 = ["children", "state", "active", "invalid", "onClick", "className", "dataTestid"];
|
|
273
275
|
function ownKeys$c(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
274
276
|
function _objectSpread$c(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$c(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$c(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
275
277
|
var Token = function Token(_ref) {
|
|
@@ -283,7 +285,7 @@ var Token = function Token(_ref) {
|
|
|
283
285
|
onClick = _ref.onClick,
|
|
284
286
|
className = _ref.className,
|
|
285
287
|
dataTestid = _ref.dataTestid,
|
|
286
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
288
|
+
rest = _objectWithoutProperties(_ref, _excluded$1);
|
|
287
289
|
var isInteractive = typeof onClick === "function" && state !== TOKEN_STATE.DISABLED;
|
|
288
290
|
var tokenRef = useReplayFlash(invalid);
|
|
289
291
|
return /*#__PURE__*/jsxRuntime.jsx("span", _objectSpread$c(_objectSpread$c({
|
|
@@ -327,8 +329,13 @@ var isExcludeVerb = function isExcludeVerb(verb) {
|
|
|
327
329
|
var isMultiValueVerb = function isMultiValueVerb(verb) {
|
|
328
330
|
return String(verb).includes(VERB_TOKENS.MULTI_VALUE);
|
|
329
331
|
};
|
|
332
|
+
|
|
333
|
+
// Lowers a label so it reads mid-sentence, but never an acronym: "API" and
|
|
334
|
+
// "SMS" are already how they should appear.
|
|
330
335
|
var sentencify = function sentencify(label) {
|
|
331
|
-
|
|
336
|
+
if (!label) return label;
|
|
337
|
+
if (label.charAt(1) === label.charAt(1).toUpperCase()) return label;
|
|
338
|
+
return label.charAt(0).toLowerCase() + label.slice(1);
|
|
332
339
|
};
|
|
333
340
|
var copyFor = function copyFor(value, args) {
|
|
334
341
|
return typeof value === "function" ? value(args) : value;
|
|
@@ -437,10 +444,43 @@ var channelOption = function channelOption(_ref10) {
|
|
|
437
444
|
return ((_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : option.id) === channel;
|
|
438
445
|
});
|
|
439
446
|
};
|
|
440
|
-
|
|
441
|
-
|
|
447
|
+
|
|
448
|
+
// A step is an extra sentence token a host hangs off an action — its own
|
|
449
|
+
// separator, its own pane — for settings that do not belong in the config pane.
|
|
450
|
+
// Its key shares the action's metadata namespace, so declaring one is how a
|
|
451
|
+
// host hands a field to the step: whoever declares it owns it, and the config
|
|
452
|
+
// pane stops validating it.
|
|
453
|
+
var actionStepsOf = function actionStepsOf(_ref11) {
|
|
442
454
|
var schema = _ref11.schema,
|
|
443
455
|
action = _ref11.action;
|
|
456
|
+
return actionParts({
|
|
457
|
+
schema: schema,
|
|
458
|
+
action: action
|
|
459
|
+
}).steps || [];
|
|
460
|
+
};
|
|
461
|
+
var stepValueOf = function stepValueOf(_ref12) {
|
|
462
|
+
var _action$metadata;
|
|
463
|
+
var action = _ref12.action,
|
|
464
|
+
step = _ref12.step;
|
|
465
|
+
return action === null || action === void 0 || (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata[step.key];
|
|
466
|
+
};
|
|
467
|
+
var stepLabelOf = function stepLabelOf(_ref13) {
|
|
468
|
+
var _find;
|
|
469
|
+
var action = _ref13.action,
|
|
470
|
+
step = _ref13.step;
|
|
471
|
+
var value = stepValueOf({
|
|
472
|
+
action: action,
|
|
473
|
+
step: step
|
|
474
|
+
});
|
|
475
|
+
return ((_find = (step.options || []).find(function (option) {
|
|
476
|
+
var _option$value2;
|
|
477
|
+
return ((_option$value2 = option.value) !== null && _option$value2 !== void 0 ? _option$value2 : option.id) === value;
|
|
478
|
+
})) === null || _find === void 0 ? void 0 : _find.label) || "";
|
|
479
|
+
};
|
|
480
|
+
var actionParts = function actionParts(_ref14) {
|
|
481
|
+
var _actions$actionForNam, _action$recipient, _actions$channelMeta, _find2, _find3, _channelMeta$needsRec, _actions$configValueL;
|
|
482
|
+
var schema = _ref14.schema,
|
|
483
|
+
action = _ref14.action;
|
|
444
484
|
var actions = (schema === null || schema === void 0 ? void 0 : schema.actions) || {};
|
|
445
485
|
var resolved = action !== null && action !== void 0 && action.channel ? {
|
|
446
486
|
channel: action.channel,
|
|
@@ -462,7 +502,7 @@ var actionParts = function actionParts(_ref11) {
|
|
|
462
502
|
var _recipient$value;
|
|
463
503
|
return ((_recipient$value = recipient.value) !== null && _recipient$value !== void 0 ? _recipient$value : recipient.id) === recipientValue;
|
|
464
504
|
};
|
|
465
|
-
var recipientLabel = ((
|
|
505
|
+
var recipientLabel = ((_find2 = (actions.recipients || []).find(matchesRecipient)) === null || _find2 === void 0 ? void 0 : _find2.label) || ((_find3 = ((option === null || option === void 0 ? void 0 : option.recipients) || []).find(matchesRecipient)) === null || _find3 === void 0 ? void 0 : _find3.label) || recipientValue;
|
|
466
506
|
return {
|
|
467
507
|
option: option,
|
|
468
508
|
channel: channel,
|
|
@@ -481,6 +521,7 @@ var actionParts = function actionParts(_ref11) {
|
|
|
481
521
|
recipientLabel: recipientLabel,
|
|
482
522
|
configTitle: channelMeta.configTitle || (option === null || option === void 0 ? void 0 : option.configTitle),
|
|
483
523
|
configSubtitle: channelMeta.configSubtitle || (option === null || option === void 0 ? void 0 : option.configSubtitle),
|
|
524
|
+
steps: channelMeta.steps || (option === null || option === void 0 ? void 0 : option.steps) || [],
|
|
484
525
|
recipientTitle: channelMeta.recipientTitle || (option === null || option === void 0 ? void 0 : option.recipientTitle),
|
|
485
526
|
recipientSubtitle: channelMeta.recipientSubtitle || (option === null || option === void 0 ? void 0 : option.recipientSubtitle)
|
|
486
527
|
};
|
|
@@ -489,13 +530,13 @@ var actionParts = function actionParts(_ref11) {
|
|
|
489
530
|
// Which condition fields a host offers can depend on the rule — a trigger may
|
|
490
531
|
// only support a subset. Lookups deliberately keep using the full list so a
|
|
491
532
|
// field already on the rule still resolves after the offer narrows.
|
|
492
|
-
var offeredConditionFields = function offeredConditionFields(
|
|
493
|
-
var
|
|
494
|
-
var schema =
|
|
495
|
-
rule =
|
|
496
|
-
return (
|
|
533
|
+
var offeredConditionFields = function offeredConditionFields(_ref15) {
|
|
534
|
+
var _ref16, _schema$conditions$fi, _schema$conditions3, _schema$conditions3$f, _schema$conditions4;
|
|
535
|
+
var schema = _ref15.schema,
|
|
536
|
+
rule = _ref15.rule;
|
|
537
|
+
return (_ref16 = (_schema$conditions$fi = schema === null || schema === void 0 || (_schema$conditions3 = schema.conditions) === null || _schema$conditions3 === void 0 || (_schema$conditions3$f = _schema$conditions3.fieldsFor) === null || _schema$conditions3$f === void 0 ? void 0 : _schema$conditions3$f.call(_schema$conditions3, {
|
|
497
538
|
rule: rule
|
|
498
|
-
})) !== null && _schema$conditions$fi !== void 0 ? _schema$conditions$fi : schema === null || schema === void 0 || (_schema$conditions4 = schema.conditions) === null || _schema$conditions4 === void 0 ? void 0 : _schema$conditions4.fields) !== null &&
|
|
539
|
+
})) !== null && _schema$conditions$fi !== void 0 ? _schema$conditions$fi : schema === null || schema === void 0 || (_schema$conditions4 = schema.conditions) === null || _schema$conditions4 === void 0 ? void 0 : _schema$conditions4.fields) !== null && _ref16 !== void 0 ? _ref16 : [];
|
|
499
540
|
};
|
|
500
541
|
var hasTrigger = function hasTrigger(rule) {
|
|
501
542
|
return !ramda.isEmpty((rule === null || rule === void 0 ? void 0 : rule.triggers) || []);
|
|
@@ -509,50 +550,68 @@ var isTriggerEnabled = function isTriggerEnabled(schema) {
|
|
|
509
550
|
var _schema$triggers2;
|
|
510
551
|
return (schema === null || schema === void 0 || (_schema$triggers2 = schema.triggers) === null || _schema$triggers2 === void 0 ? void 0 : _schema$triggers2.enabled) !== false;
|
|
511
552
|
};
|
|
512
|
-
var isTriggerSatisfied = function isTriggerSatisfied(
|
|
513
|
-
var rule =
|
|
514
|
-
schema =
|
|
553
|
+
var isTriggerSatisfied = function isTriggerSatisfied(_ref17) {
|
|
554
|
+
var rule = _ref17.rule,
|
|
555
|
+
schema = _ref17.schema;
|
|
515
556
|
return !isTriggerEnabled(schema) || hasTrigger(rule);
|
|
516
557
|
};
|
|
517
|
-
var hasRequiredConditions = function hasRequiredConditions(
|
|
558
|
+
var hasRequiredConditions = function hasRequiredConditions(_ref18) {
|
|
518
559
|
var _schema$conditions5;
|
|
519
|
-
var rule =
|
|
520
|
-
schema =
|
|
560
|
+
var rule = _ref18.rule,
|
|
561
|
+
schema = _ref18.schema;
|
|
521
562
|
return (schema === null || schema === void 0 || (_schema$conditions5 = schema.conditions) === null || _schema$conditions5 === void 0 ? void 0 : _schema$conditions5.allowEmpty) === false ? neetoCist.isNotEmpty((rule === null || rule === void 0 ? void 0 : rule.conditions) || []) : true;
|
|
522
563
|
};
|
|
523
|
-
var
|
|
524
|
-
var rule =
|
|
525
|
-
schema =
|
|
564
|
+
var hasUnansweredStep = function hasUnansweredStep(_ref19) {
|
|
565
|
+
var rule = _ref19.rule,
|
|
566
|
+
schema = _ref19.schema;
|
|
567
|
+
return ((rule === null || rule === void 0 ? void 0 : rule.actions) || []).some(function (action) {
|
|
568
|
+
return actionStepsOf({
|
|
569
|
+
schema: schema,
|
|
570
|
+
action: action
|
|
571
|
+
}).some(function (step) {
|
|
572
|
+
return step.required && !stepValueOf({
|
|
573
|
+
action: action,
|
|
574
|
+
step: step
|
|
575
|
+
});
|
|
576
|
+
});
|
|
577
|
+
});
|
|
578
|
+
};
|
|
579
|
+
var isRuleComplete = function isRuleComplete(_ref20) {
|
|
580
|
+
var rule = _ref20.rule,
|
|
581
|
+
schema = _ref20.schema;
|
|
526
582
|
return isTriggerSatisfied({
|
|
527
583
|
rule: rule,
|
|
528
584
|
schema: schema
|
|
529
585
|
}) && hasRequiredConditions({
|
|
530
586
|
rule: rule,
|
|
531
587
|
schema: schema
|
|
532
|
-
}) && hasAction(rule)
|
|
588
|
+
}) && hasAction(rule) && !hasUnansweredStep({
|
|
589
|
+
rule: rule,
|
|
590
|
+
schema: schema
|
|
591
|
+
});
|
|
533
592
|
};
|
|
534
|
-
var scopeOptionFor = function scopeOptionFor(
|
|
593
|
+
var scopeOptionFor = function scopeOptionFor(_ref21) {
|
|
535
594
|
var _item$value, _schema$scope;
|
|
536
|
-
var schema =
|
|
537
|
-
item =
|
|
595
|
+
var schema = _ref21.schema,
|
|
596
|
+
item = _ref21.item;
|
|
538
597
|
var value = (_item$value = item === null || item === void 0 ? void 0 : item.value) !== null && _item$value !== void 0 ? _item$value : item;
|
|
539
598
|
return ((schema === null || schema === void 0 || (_schema$scope = schema.scope) === null || _schema$scope === void 0 ? void 0 : _schema$scope.options) || []).find(function (candidate) {
|
|
540
599
|
var _candidate$value2;
|
|
541
600
|
return ((_candidate$value2 = candidate.value) !== null && _candidate$value2 !== void 0 ? _candidate$value2 : candidate.id) === value;
|
|
542
601
|
});
|
|
543
602
|
};
|
|
544
|
-
var scopePhoneFields = function scopePhoneFields(
|
|
545
|
-
var
|
|
546
|
-
var schema =
|
|
547
|
-
item =
|
|
548
|
-
return (
|
|
603
|
+
var scopePhoneFields = function scopePhoneFields(_ref22) {
|
|
604
|
+
var _ref23, _item$phoneFields, _scopeOptionFor;
|
|
605
|
+
var schema = _ref22.schema,
|
|
606
|
+
item = _ref22.item;
|
|
607
|
+
return (_ref23 = (_item$phoneFields = item === null || item === void 0 ? void 0 : item.phoneFields) !== null && _item$phoneFields !== void 0 ? _item$phoneFields : (_scopeOptionFor = scopeOptionFor({
|
|
549
608
|
schema: schema,
|
|
550
609
|
item: item
|
|
551
|
-
})) === null || _scopeOptionFor === void 0 ? void 0 : _scopeOptionFor.phoneFields) !== null &&
|
|
610
|
+
})) === null || _scopeOptionFor === void 0 ? void 0 : _scopeOptionFor.phoneFields) !== null && _ref23 !== void 0 ? _ref23 : null;
|
|
552
611
|
};
|
|
553
|
-
var effectiveScopePhoneField = function effectiveScopePhoneField(
|
|
554
|
-
var schema =
|
|
555
|
-
item =
|
|
612
|
+
var effectiveScopePhoneField = function effectiveScopePhoneField(_ref24) {
|
|
613
|
+
var schema = _ref24.schema,
|
|
614
|
+
item = _ref24.item;
|
|
556
615
|
if (item !== null && item !== void 0 && item.phoneField) return item.phoneField;
|
|
557
616
|
var phoneFields = scopePhoneFields({
|
|
558
617
|
schema: schema,
|
|
@@ -560,14 +619,14 @@ var effectiveScopePhoneField = function effectiveScopePhoneField(_ref20) {
|
|
|
560
619
|
});
|
|
561
620
|
return (phoneFields === null || phoneFields === void 0 ? void 0 : phoneFields.length) === 1 ? phoneFields[0].value : undefined;
|
|
562
621
|
};
|
|
563
|
-
var invalidScopeIndexes = function invalidScopeIndexes(
|
|
622
|
+
var invalidScopeIndexes = function invalidScopeIndexes(_ref25) {
|
|
564
623
|
var _scope$requiresPhone;
|
|
565
|
-
var rule =
|
|
566
|
-
schema =
|
|
624
|
+
var rule = _ref25.rule,
|
|
625
|
+
schema = _ref25.schema;
|
|
567
626
|
var scope = schema === null || schema === void 0 ? void 0 : schema.scope;
|
|
568
627
|
if (!(scope !== null && scope !== void 0 && scope.enabled) || !((_scope$requiresPhone = scope.requiresPhone) !== null && _scope$requiresPhone !== void 0 && _scope$requiresPhone.call(scope, (rule === null || rule === void 0 ? void 0 : rule.actions) || []))) return [];
|
|
569
628
|
return ((rule === null || rule === void 0 ? void 0 : rule.scope) || []).reduce(function (indexes, item, index) {
|
|
570
|
-
var
|
|
629
|
+
var _ref26, _item$hasPhoneField;
|
|
571
630
|
var option = scopeOptionFor({
|
|
572
631
|
schema: schema,
|
|
573
632
|
item: item
|
|
@@ -576,15 +635,15 @@ var invalidScopeIndexes = function invalidScopeIndexes(_ref21) {
|
|
|
576
635
|
schema: schema,
|
|
577
636
|
item: item
|
|
578
637
|
});
|
|
579
|
-
var hasPhoneField = (
|
|
638
|
+
var hasPhoneField = (_ref26 = (_item$hasPhoneField = item === null || item === void 0 ? void 0 : item.hasPhoneField) !== null && _item$hasPhoneField !== void 0 ? _item$hasPhoneField : option === null || option === void 0 ? void 0 : option.hasPhoneField) !== null && _ref26 !== void 0 ? _ref26 : phoneFields ? phoneFields.length > 0 : undefined;
|
|
580
639
|
if (hasPhoneField === false) indexes.push(index);
|
|
581
640
|
return indexes;
|
|
582
641
|
}, []);
|
|
583
642
|
};
|
|
584
|
-
var invalidScopePhoneFieldIndexes = function invalidScopePhoneFieldIndexes(
|
|
643
|
+
var invalidScopePhoneFieldIndexes = function invalidScopePhoneFieldIndexes(_ref27) {
|
|
585
644
|
var _scope$requiresPhone2;
|
|
586
|
-
var rule =
|
|
587
|
-
schema =
|
|
645
|
+
var rule = _ref27.rule,
|
|
646
|
+
schema = _ref27.schema;
|
|
588
647
|
var scope = schema === null || schema === void 0 ? void 0 : schema.scope;
|
|
589
648
|
if (!(scope !== null && scope !== void 0 && scope.enabled) || !((_scope$requiresPhone2 = scope.requiresPhone) !== null && _scope$requiresPhone2 !== void 0 && _scope$requiresPhone2.call(scope, (rule === null || rule === void 0 ? void 0 : rule.actions) || []))) return [];
|
|
590
649
|
return ((rule === null || rule === void 0 ? void 0 : rule.scope) || []).reduce(function (indexes, item, index) {
|
|
@@ -621,9 +680,9 @@ var minutesToParts = function minutesToParts(minutes) {
|
|
|
621
680
|
unit: "minutes"
|
|
622
681
|
};
|
|
623
682
|
};
|
|
624
|
-
var partsToMinutes = function partsToMinutes(
|
|
625
|
-
var value =
|
|
626
|
-
unit =
|
|
683
|
+
var partsToMinutes = function partsToMinutes(_ref28) {
|
|
684
|
+
var value = _ref28.value,
|
|
685
|
+
unit = _ref28.unit;
|
|
627
686
|
return (
|
|
628
687
|
// eslint-disable-next-line security/detect-object-injection
|
|
629
688
|
(Number(value) || 0) * (UNIT_MINUTES[unit] || 1)
|
|
@@ -673,15 +732,49 @@ var joinTypeFor = function joinTypeFor(mode) {
|
|
|
673
732
|
var recipientStorageField = function recipientStorageField(field) {
|
|
674
733
|
return field === RECIPIENT_STORAGE_FIELDS.emails ? RECIPIENT_STORAGE_FIELDS.emails : RECIPIENT_STORAGE_FIELDS.value;
|
|
675
734
|
};
|
|
735
|
+
|
|
736
|
+
// Which metadata fields the recipient pane renders, and therefore owns: no
|
|
737
|
+
// other pane may block Continue on them. Canvas and ConfigPane both ask here
|
|
738
|
+
// so the two lists cannot drift apart.
|
|
739
|
+
var recipientOwnedFields = function recipientOwnedFields(_ref29) {
|
|
740
|
+
var _actions$actionForNam2, _action$recipient2, _actions$renderRecipi, _actions$renderRecipi2, _actions$optionForNam, _actions$optionForCha;
|
|
741
|
+
var schema = _ref29.schema,
|
|
742
|
+
action = _ref29.action,
|
|
743
|
+
name = _ref29.name;
|
|
744
|
+
var actions = (schema === null || schema === void 0 ? void 0 : schema.actions) || {};
|
|
745
|
+
var resolved = ((_actions$actionForNam2 = actions.actionForName) === null || _actions$actionForNam2 === void 0 ? void 0 : _actions$actionForNam2.call(actions, action === null || action === void 0 ? void 0 : action.name)) || {};
|
|
746
|
+
var channel = (action === null || action === void 0 ? void 0 : action.channel) || resolved.channel;
|
|
747
|
+
// A recipient the host implies from the action name counts just as much as
|
|
748
|
+
// one the user picked, or the pane it owns cannot be excluded.
|
|
749
|
+
var recipient = (_action$recipient2 = action === null || action === void 0 ? void 0 : action.recipient) !== null && _action$recipient2 !== void 0 ? _action$recipient2 : resolved.recipient;
|
|
750
|
+
var rendersEmails = !!((_actions$renderRecipi = actions.renderRecipientEditor) !== null && _actions$renderRecipi !== void 0 && _actions$renderRecipi.call(actions, {
|
|
751
|
+
channel: channel,
|
|
752
|
+
name: name,
|
|
753
|
+
action: action
|
|
754
|
+
})) || !!((_actions$renderRecipi2 = actions.renderRecipientField) !== null && _actions$renderRecipi2 !== void 0 && _actions$renderRecipi2.call(actions, {
|
|
755
|
+
channel: channel,
|
|
756
|
+
name: name,
|
|
757
|
+
action: action,
|
|
758
|
+
recipient: recipient
|
|
759
|
+
}));
|
|
760
|
+
var recipientConfig = (actions.options || []).flatMap(function (option) {
|
|
761
|
+
return option.recipients || [];
|
|
762
|
+
}).concat(actions.recipients || []).find(function (item) {
|
|
763
|
+
var _item$value2;
|
|
764
|
+
return ((_item$value2 = item.value) !== null && _item$value2 !== void 0 ? _item$value2 : item.id) === recipient;
|
|
765
|
+
});
|
|
766
|
+
var flatOption = ((_actions$optionForNam = actions.optionForName) === null || _actions$optionForNam === void 0 ? void 0 : _actions$optionForNam.call(actions, action === null || action === void 0 ? void 0 : action.name)) || ((_actions$optionForCha = actions.optionForChannel) === null || _actions$optionForCha === void 0 ? void 0 : _actions$optionForCha.call(actions, channel));
|
|
767
|
+
return [].concat(_toConsumableArray(rendersEmails ? [RECIPIENT_STORAGE_FIELDS.emails] : []), _toConsumableArray(recipientConfig !== null && recipientConfig !== void 0 && recipientConfig.field ? [recipientStorageField(recipientConfig.field)] : []), _toConsumableArray((flatOption === null || flatOption === void 0 ? void 0 : flatOption.type) === SMS_TO_NUMBERS ? [RECIPIENT_STORAGE_FIELDS.phoneNumbers] : []));
|
|
768
|
+
};
|
|
676
769
|
var modeFromJoinType = function modeFromJoinType(joinType) {
|
|
677
770
|
return joinType === JOIN_TYPE.or ? CONDITION_MODE.OR : CONDITION_MODE.AND;
|
|
678
771
|
};
|
|
679
772
|
|
|
680
773
|
// eslint-disable-next-line security/detect-object-injection
|
|
681
|
-
var valueAt = function valueAt(
|
|
774
|
+
var valueAt = function valueAt(_ref30) {
|
|
682
775
|
var _values$key;
|
|
683
|
-
var values =
|
|
684
|
-
key =
|
|
776
|
+
var values = _ref30.values,
|
|
777
|
+
key = _ref30.key;
|
|
685
778
|
return values === null || values === void 0 || (_values$key = values[key]) === null || _values$key === void 0 ? void 0 : _values$key.value;
|
|
686
779
|
};
|
|
687
780
|
var asArray = function asArray(maybeArray) {
|
|
@@ -704,11 +797,11 @@ var fieldKeysFromSchema = function fieldKeysFromSchema() {
|
|
|
704
797
|
};
|
|
705
798
|
var valuesToRuleModel = function valuesToRuleModel() {
|
|
706
799
|
var _valueAt, _conditions$;
|
|
707
|
-
var
|
|
708
|
-
|
|
709
|
-
values =
|
|
710
|
-
|
|
711
|
-
schema =
|
|
800
|
+
var _ref31 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
801
|
+
_ref31$values = _ref31.values,
|
|
802
|
+
values = _ref31$values === void 0 ? {} : _ref31$values,
|
|
803
|
+
_ref31$schema = _ref31.schema,
|
|
804
|
+
schema = _ref31$schema === void 0 ? {} : _ref31$schema;
|
|
712
805
|
var keys = fieldKeysFromSchema(schema);
|
|
713
806
|
var conditions = asArray(valueAt({
|
|
714
807
|
values: values,
|
|
@@ -752,42 +845,42 @@ var valuesToRuleModel = function valuesToRuleModel() {
|
|
|
752
845
|
}))
|
|
753
846
|
};
|
|
754
847
|
};
|
|
755
|
-
var setTriggers = function setTriggers(
|
|
756
|
-
var schema =
|
|
757
|
-
triggers =
|
|
848
|
+
var setTriggers = function setTriggers(_ref32) {
|
|
849
|
+
var schema = _ref32.schema,
|
|
850
|
+
triggers = _ref32.triggers;
|
|
758
851
|
return {
|
|
759
852
|
path: "".concat(fieldKeysFromSchema(schema).triggers, ".value"),
|
|
760
853
|
value: triggers
|
|
761
854
|
};
|
|
762
855
|
};
|
|
763
|
-
var setPerformer = function setPerformer(
|
|
764
|
-
var schema =
|
|
765
|
-
performer =
|
|
856
|
+
var setPerformer = function setPerformer(_ref33) {
|
|
857
|
+
var schema = _ref33.schema,
|
|
858
|
+
performer = _ref33.performer;
|
|
766
859
|
return {
|
|
767
860
|
path: "".concat(fieldKeysFromSchema(schema).performer, ".value"),
|
|
768
861
|
value: performer
|
|
769
862
|
};
|
|
770
863
|
};
|
|
771
|
-
var setActions = function setActions(
|
|
772
|
-
var schema =
|
|
773
|
-
actions =
|
|
864
|
+
var setActions = function setActions(_ref34) {
|
|
865
|
+
var schema = _ref34.schema,
|
|
866
|
+
actions = _ref34.actions;
|
|
774
867
|
return {
|
|
775
868
|
path: "".concat(fieldKeysFromSchema(schema).actions, ".value"),
|
|
776
869
|
value: actions
|
|
777
870
|
};
|
|
778
871
|
};
|
|
779
|
-
var setConditions = function setConditions(
|
|
780
|
-
var schema =
|
|
781
|
-
conditions =
|
|
872
|
+
var setConditions = function setConditions(_ref35) {
|
|
873
|
+
var schema = _ref35.schema,
|
|
874
|
+
conditions = _ref35.conditions;
|
|
782
875
|
return {
|
|
783
876
|
path: "".concat(fieldKeysFromSchema(schema).conditions, ".value"),
|
|
784
877
|
value: conditions
|
|
785
878
|
};
|
|
786
879
|
};
|
|
787
|
-
var setConditionMode = function setConditionMode(
|
|
788
|
-
var schema =
|
|
789
|
-
conditions =
|
|
790
|
-
joinType =
|
|
880
|
+
var setConditionMode = function setConditionMode(_ref36) {
|
|
881
|
+
var schema = _ref36.schema,
|
|
882
|
+
conditions = _ref36.conditions,
|
|
883
|
+
joinType = _ref36.joinType;
|
|
791
884
|
return setConditions({
|
|
792
885
|
schema: schema,
|
|
793
886
|
conditions: conditions.map(function (condition) {
|
|
@@ -795,34 +888,34 @@ var setConditionMode = function setConditionMode(_ref31) {
|
|
|
795
888
|
})
|
|
796
889
|
});
|
|
797
890
|
};
|
|
798
|
-
var setDelay = function setDelay(
|
|
799
|
-
var schema =
|
|
800
|
-
delay =
|
|
891
|
+
var setDelay = function setDelay(_ref37) {
|
|
892
|
+
var schema = _ref37.schema,
|
|
893
|
+
delay = _ref37.delay;
|
|
801
894
|
return {
|
|
802
895
|
path: "".concat(fieldKeysFromSchema(schema).delay, ".value"),
|
|
803
896
|
value: delay !== null && delay !== void 0 ? delay : {}
|
|
804
897
|
};
|
|
805
898
|
};
|
|
806
|
-
var setActive = function setActive(
|
|
807
|
-
var schema =
|
|
808
|
-
active =
|
|
899
|
+
var setActive = function setActive(_ref38) {
|
|
900
|
+
var schema = _ref38.schema,
|
|
901
|
+
active = _ref38.active;
|
|
809
902
|
return {
|
|
810
903
|
path: "".concat(fieldKeysFromSchema(schema).status, ".value"),
|
|
811
904
|
value: active ? STATUS_KEYS.ENABLED : STATUS_KEYS.DISABLED
|
|
812
905
|
};
|
|
813
906
|
};
|
|
814
|
-
var setScope = function setScope(
|
|
815
|
-
var schema =
|
|
816
|
-
scope =
|
|
907
|
+
var setScope = function setScope(_ref39) {
|
|
908
|
+
var schema = _ref39.schema,
|
|
909
|
+
scope = _ref39.scope;
|
|
817
910
|
return {
|
|
818
911
|
path: "".concat(fieldKeysFromSchema(schema).scope, ".value"),
|
|
819
912
|
value: scope
|
|
820
913
|
};
|
|
821
914
|
};
|
|
822
|
-
var removeArrayItem = function removeArrayItem(
|
|
823
|
-
var values =
|
|
824
|
-
fieldKey =
|
|
825
|
-
index =
|
|
915
|
+
var removeArrayItem = function removeArrayItem(_ref40) {
|
|
916
|
+
var values = _ref40.values,
|
|
917
|
+
fieldKey = _ref40.fieldKey,
|
|
918
|
+
index = _ref40.index;
|
|
826
919
|
var list = asArray(valueAt({
|
|
827
920
|
values: values,
|
|
828
921
|
key: fieldKey
|
|
@@ -849,9 +942,9 @@ var removeArrayItem = function removeArrayItem(_ref35) {
|
|
|
849
942
|
}
|
|
850
943
|
return result;
|
|
851
944
|
};
|
|
852
|
-
var clearArrayItems = function clearArrayItems(
|
|
853
|
-
var values =
|
|
854
|
-
fieldKey =
|
|
945
|
+
var clearArrayItems = function clearArrayItems(_ref41) {
|
|
946
|
+
var values = _ref41.values,
|
|
947
|
+
fieldKey = _ref41.fieldKey;
|
|
855
948
|
var list = asArray(valueAt({
|
|
856
949
|
values: values,
|
|
857
950
|
key: fieldKey
|
|
@@ -1429,7 +1522,8 @@ var ActionRow = function ActionRow(_ref) {
|
|
|
1429
1522
|
configValuePlaceholder = _actionParts.configValuePlaceholder,
|
|
1430
1523
|
paramKind = _actionParts.paramKind,
|
|
1431
1524
|
valueNoun = _actionParts.valueNoun,
|
|
1432
|
-
valueNounPlural = _actionParts.valueNounPlural
|
|
1525
|
+
valueNounPlural = _actionParts.valueNounPlural,
|
|
1526
|
+
steps = _actionParts.steps;
|
|
1433
1527
|
|
|
1434
1528
|
// A separator-less action still needs a value slot when the host declares a
|
|
1435
1529
|
// placeholder for it, otherwise its chosen value never reaches the canvas.
|
|
@@ -1511,6 +1605,32 @@ var ActionRow = function ActionRow(_ref) {
|
|
|
1511
1605
|
children: recipient ? String(recipientLabel).toLowerCase() : t("neetoRules.builder.selectRecipient")
|
|
1512
1606
|
})]
|
|
1513
1607
|
}, "recipient") : null;
|
|
1608
|
+
var stepTokens = steps.map(function (step) {
|
|
1609
|
+
var stepLabel = stepLabelOf({
|
|
1610
|
+
action: action,
|
|
1611
|
+
step: step
|
|
1612
|
+
});
|
|
1613
|
+
var token = {
|
|
1614
|
+
type: BUILDER_ANCHORS.ACTION_STEP,
|
|
1615
|
+
index: index,
|
|
1616
|
+
stepKey: step.key
|
|
1617
|
+
};
|
|
1618
|
+
return /*#__PURE__*/jsxRuntime.jsxs(react.Fragment, {
|
|
1619
|
+
children: [step.separator && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
1620
|
+
className: "mb-fixed",
|
|
1621
|
+
children: step.separator
|
|
1622
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Token, {
|
|
1623
|
+
active: isActive(token),
|
|
1624
|
+
dataTestid: "action-step-".concat(step.key, "-").concat(index),
|
|
1625
|
+
invalid: isInvalid(token),
|
|
1626
|
+
state: stepLabel ? TOKEN_STATE.FILLED : TOKEN_STATE.MUTED,
|
|
1627
|
+
onClick: handleToken && function () {
|
|
1628
|
+
return handleToken(token);
|
|
1629
|
+
},
|
|
1630
|
+
children: (step.preserveCase ? stepLabel : sentencify(stepLabel)) || sentencify(step.placeholder)
|
|
1631
|
+
})]
|
|
1632
|
+
}, "step-".concat(step.key));
|
|
1633
|
+
});
|
|
1514
1634
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1515
1635
|
className: classNames("mb-row mb-row-draggable", {
|
|
1516
1636
|
clearing: clearing
|
|
@@ -1584,7 +1704,7 @@ var ActionRow = function ActionRow(_ref) {
|
|
|
1584
1704
|
size: 14
|
|
1585
1705
|
}), configLabel]
|
|
1586
1706
|
})]
|
|
1587
|
-
}), recipientSeparator ? [recipientToken, configToken] : [configToken, recipientToken]]
|
|
1707
|
+
}), recipientSeparator ? [recipientToken, configToken] : [configToken, recipientToken], stepTokens]
|
|
1588
1708
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1589
1709
|
className: "mb-row-actions",
|
|
1590
1710
|
children: [handleAddAction && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
|
|
@@ -1878,6 +1998,7 @@ var WhenBlock = function WhenBlock(_ref) {
|
|
|
1878
1998
|
});
|
|
1879
1999
|
};
|
|
1880
2000
|
|
|
2001
|
+
var _excluded = ["type"];
|
|
1881
2002
|
function ownKeys$5(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1882
2003
|
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1883
2004
|
var usePaneCascade = function usePaneCascade(schema) {
|
|
@@ -1905,12 +2026,13 @@ var usePaneCascade = function usePaneCascade(schema) {
|
|
|
1905
2026
|
var openPane = react.useCallback(function (token) {
|
|
1906
2027
|
var type = TOKEN_TO_PANEL_TYPE[token === null || token === void 0 ? void 0 : token.type];
|
|
1907
2028
|
if (!type) return;
|
|
2029
|
+
var anchor = token.type,
|
|
2030
|
+
rest = _objectWithoutProperties(token, _excluded);
|
|
1908
2031
|
openType({
|
|
1909
2032
|
type: type,
|
|
1910
|
-
data: {
|
|
1911
|
-
anchor:
|
|
1912
|
-
|
|
1913
|
-
}
|
|
2033
|
+
data: _objectSpread$5({
|
|
2034
|
+
anchor: anchor
|
|
2035
|
+
}, rest)
|
|
1914
2036
|
});
|
|
1915
2037
|
}, [openType]);
|
|
1916
2038
|
return {
|
|
@@ -2031,6 +2153,52 @@ var triggerValue = function triggerValue(option) {
|
|
|
2031
2153
|
var _ref, _option$eventValue;
|
|
2032
2154
|
return (_ref = (_option$eventValue = option.eventValue) !== null && _option$eventValue !== void 0 ? _option$eventValue : option.value) !== null && _ref !== void 0 ? _ref : option.id;
|
|
2033
2155
|
};
|
|
2156
|
+
var stepAt = function stepAt(_ref2) {
|
|
2157
|
+
var schema = _ref2.schema,
|
|
2158
|
+
rule = _ref2.rule,
|
|
2159
|
+
index = _ref2.index,
|
|
2160
|
+
stepKey = _ref2.stepKey;
|
|
2161
|
+
return actionStepsOf({
|
|
2162
|
+
schema: schema,
|
|
2163
|
+
action: actionAt({
|
|
2164
|
+
rule: rule,
|
|
2165
|
+
index: index
|
|
2166
|
+
})
|
|
2167
|
+
}).find(function (step) {
|
|
2168
|
+
return step.key === stepKey;
|
|
2169
|
+
});
|
|
2170
|
+
};
|
|
2171
|
+
|
|
2172
|
+
// Panes hand off in sentence order — config, recipient, then each host step —
|
|
2173
|
+
// so every "what comes next" question resolves through this one list.
|
|
2174
|
+
var stepTargetAfter = function stepTargetAfter(_ref3) {
|
|
2175
|
+
var schema = _ref3.schema,
|
|
2176
|
+
rule = _ref3.rule,
|
|
2177
|
+
index = _ref3.index,
|
|
2178
|
+
stepKey = _ref3.stepKey;
|
|
2179
|
+
var steps = actionStepsOf({
|
|
2180
|
+
schema: schema,
|
|
2181
|
+
action: actionAt({
|
|
2182
|
+
rule: rule,
|
|
2183
|
+
index: index
|
|
2184
|
+
})
|
|
2185
|
+
});
|
|
2186
|
+
var at = stepKey ? steps.findIndex(function (step) {
|
|
2187
|
+
return step.key === stepKey;
|
|
2188
|
+
}) : -1;
|
|
2189
|
+
// An unknown key means the step is gone from under the pane; restarting the
|
|
2190
|
+
// cascade at the first step would be worse than ending it.
|
|
2191
|
+
if (stepKey && at === -1) return null;
|
|
2192
|
+
var next = steps[at + 1];
|
|
2193
|
+
return next ? {
|
|
2194
|
+
type: BUILDER_PANEL_TYPES.ACTION_STEP,
|
|
2195
|
+
data: {
|
|
2196
|
+
index: index,
|
|
2197
|
+
stepKey: next.key,
|
|
2198
|
+
anchor: BUILDER_ANCHORS.ACTION_STEP
|
|
2199
|
+
}
|
|
2200
|
+
} : null;
|
|
2201
|
+
};
|
|
2034
2202
|
var optionValue = function optionValue(option) {
|
|
2035
2203
|
var _option$value;
|
|
2036
2204
|
return (_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : option.id;
|
|
@@ -2056,9 +2224,9 @@ var groupByCategory = function groupByCategory(options) {
|
|
|
2056
2224
|
});
|
|
2057
2225
|
return groups;
|
|
2058
2226
|
};
|
|
2059
|
-
var conditionAt = function conditionAt(
|
|
2060
|
-
var rule =
|
|
2061
|
-
index =
|
|
2227
|
+
var conditionAt = function conditionAt(_ref4) {
|
|
2228
|
+
var rule = _ref4.rule,
|
|
2229
|
+
index = _ref4.index;
|
|
2062
2230
|
return (
|
|
2063
2231
|
// eslint-disable-next-line security/detect-object-injection
|
|
2064
2232
|
rule.conditions[index] || {}
|
|
@@ -2066,63 +2234,63 @@ var conditionAt = function conditionAt(_ref2) {
|
|
|
2066
2234
|
};
|
|
2067
2235
|
|
|
2068
2236
|
// eslint-disable-next-line security/detect-object-injection
|
|
2069
|
-
var actionAt = function actionAt(
|
|
2070
|
-
var rule =
|
|
2071
|
-
index =
|
|
2237
|
+
var actionAt = function actionAt(_ref5) {
|
|
2238
|
+
var rule = _ref5.rule,
|
|
2239
|
+
index = _ref5.index;
|
|
2072
2240
|
return rule.actions[index] || {};
|
|
2073
2241
|
};
|
|
2074
2242
|
|
|
2075
2243
|
// eslint-disable-next-line security/detect-object-injection
|
|
2076
|
-
var scopeItemAt = function scopeItemAt(
|
|
2244
|
+
var scopeItemAt = function scopeItemAt(_ref6) {
|
|
2077
2245
|
var _rule$scope;
|
|
2078
|
-
var rule =
|
|
2079
|
-
index =
|
|
2246
|
+
var rule = _ref6.rule,
|
|
2247
|
+
index = _ref6.index;
|
|
2080
2248
|
return ((_rule$scope = rule.scope) === null || _rule$scope === void 0 ? void 0 : _rule$scope[index]) || {};
|
|
2081
2249
|
};
|
|
2082
2250
|
var scopeItemLabel = function scopeItemLabel(item) {
|
|
2083
2251
|
return (item === null || item === void 0 ? void 0 : item.label) || (item === null || item === void 0 ? void 0 : item.name) || (item === null || item === void 0 ? void 0 : item.value) || String(item !== null && item !== void 0 ? item : "");
|
|
2084
2252
|
};
|
|
2085
|
-
var findField = function findField(
|
|
2253
|
+
var findField = function findField(_ref7) {
|
|
2086
2254
|
var _schema$conditions;
|
|
2087
|
-
var schema =
|
|
2088
|
-
value =
|
|
2255
|
+
var schema = _ref7.schema,
|
|
2256
|
+
value = _ref7.value;
|
|
2089
2257
|
return (((_schema$conditions = schema.conditions) === null || _schema$conditions === void 0 ? void 0 : _schema$conditions.fields) || []).find(function (field) {
|
|
2090
2258
|
return optionValue(field) === value;
|
|
2091
2259
|
});
|
|
2092
2260
|
};
|
|
2093
|
-
var findActionOption = function findActionOption(
|
|
2261
|
+
var findActionOption = function findActionOption(_ref8) {
|
|
2094
2262
|
var _schema$actions;
|
|
2095
|
-
var schema =
|
|
2096
|
-
name =
|
|
2263
|
+
var schema = _ref8.schema,
|
|
2264
|
+
name = _ref8.name;
|
|
2097
2265
|
return (((_schema$actions = schema.actions) === null || _schema$actions === void 0 ? void 0 : _schema$actions.options) || []).find(function (option) {
|
|
2098
2266
|
return optionValue(option) === name;
|
|
2099
2267
|
});
|
|
2100
2268
|
};
|
|
2101
|
-
var channelOf = function channelOf(
|
|
2269
|
+
var channelOf = function channelOf(_ref9) {
|
|
2102
2270
|
var _schema$actions2, _schema$actions2$acti;
|
|
2103
|
-
var schema =
|
|
2104
|
-
action =
|
|
2271
|
+
var schema = _ref9.schema,
|
|
2272
|
+
action = _ref9.action;
|
|
2105
2273
|
return (action === null || action === void 0 ? void 0 : action.channel) || ((_schema$actions2 = schema.actions) === null || _schema$actions2 === void 0 || (_schema$actions2$acti = _schema$actions2.actionForName) === null || _schema$actions2$acti === void 0 || (_schema$actions2$acti = _schema$actions2$acti.call(_schema$actions2, action === null || action === void 0 ? void 0 : action.name)) === null || _schema$actions2$acti === void 0 ? void 0 : _schema$actions2$acti.channel);
|
|
2106
2274
|
};
|
|
2107
|
-
var recipientOf = function recipientOf(
|
|
2275
|
+
var recipientOf = function recipientOf(_ref0) {
|
|
2108
2276
|
var _action$recipient, _schema$actions3, _schema$actions3$acti;
|
|
2109
|
-
var schema =
|
|
2110
|
-
action =
|
|
2277
|
+
var schema = _ref0.schema,
|
|
2278
|
+
action = _ref0.action;
|
|
2111
2279
|
return (_action$recipient = action === null || action === void 0 ? void 0 : action.recipient) !== null && _action$recipient !== void 0 ? _action$recipient : (_schema$actions3 = schema.actions) === null || _schema$actions3 === void 0 || (_schema$actions3$acti = _schema$actions3.actionForName) === null || _schema$actions3$acti === void 0 || (_schema$actions3$acti = _schema$actions3$acti.call(_schema$actions3, action === null || action === void 0 ? void 0 : action.name)) === null || _schema$actions3$acti === void 0 ? void 0 : _schema$actions3$acti.recipient;
|
|
2112
2280
|
};
|
|
2113
|
-
var channelMetaOf = function channelMetaOf(
|
|
2281
|
+
var channelMetaOf = function channelMetaOf(_ref1) {
|
|
2114
2282
|
var _schema$actions4;
|
|
2115
|
-
var schema =
|
|
2116
|
-
action =
|
|
2283
|
+
var schema = _ref1.schema,
|
|
2284
|
+
action = _ref1.action;
|
|
2117
2285
|
return ((_schema$actions4 = schema.actions) === null || _schema$actions4 === void 0 || (_schema$actions4 = _schema$actions4.channelMeta) === null || _schema$actions4 === void 0 ? void 0 : _schema$actions4[channelOf({
|
|
2118
2286
|
schema: schema,
|
|
2119
2287
|
action: action
|
|
2120
2288
|
})]) || {};
|
|
2121
2289
|
};
|
|
2122
|
-
var actionHasConfig = function actionHasConfig(
|
|
2290
|
+
var actionHasConfig = function actionHasConfig(_ref10) {
|
|
2123
2291
|
var _schema$actions5, _schema$actions6;
|
|
2124
|
-
var schema =
|
|
2125
|
-
action =
|
|
2292
|
+
var schema = _ref10.schema,
|
|
2293
|
+
action = _ref10.action;
|
|
2126
2294
|
var meta = channelMetaOf({
|
|
2127
2295
|
schema: schema,
|
|
2128
2296
|
action: action
|
|
@@ -2136,10 +2304,10 @@ var actionHasConfig = function actionHasConfig(_ref0) {
|
|
|
2136
2304
|
if ((_schema$actions5 = schema.actions) !== null && _schema$actions5 !== void 0 && _schema$actions5.hasConfig) return schema.actions.hasConfig(action);
|
|
2137
2305
|
return !!((_schema$actions6 = schema.actions) !== null && _schema$actions6 !== void 0 && _schema$actions6.renderConfig);
|
|
2138
2306
|
};
|
|
2139
|
-
var recipientsFor = function recipientsFor(
|
|
2307
|
+
var recipientsFor = function recipientsFor(_ref11) {
|
|
2140
2308
|
var _schema$actions7, _schema$actions8;
|
|
2141
|
-
var schema =
|
|
2142
|
-
action =
|
|
2309
|
+
var schema = _ref11.schema,
|
|
2310
|
+
action = _ref11.action;
|
|
2143
2311
|
var channel = channelOf({
|
|
2144
2312
|
schema: schema,
|
|
2145
2313
|
action: action
|
|
@@ -2154,11 +2322,11 @@ var recipientsFor = function recipientsFor(_ref1) {
|
|
|
2154
2322
|
if (option !== null && option !== void 0 && option.recipients) return option.recipients;
|
|
2155
2323
|
return ((_schema$actions8 = schema.actions) === null || _schema$actions8 === void 0 ? void 0 : _schema$actions8.recipients) || [];
|
|
2156
2324
|
};
|
|
2157
|
-
var nextTriggers = function nextTriggers(
|
|
2325
|
+
var nextTriggers = function nextTriggers(_ref12) {
|
|
2158
2326
|
var _schema$triggers;
|
|
2159
|
-
var schema =
|
|
2160
|
-
rule =
|
|
2161
|
-
value =
|
|
2327
|
+
var schema = _ref12.schema,
|
|
2328
|
+
rule = _ref12.rule,
|
|
2329
|
+
value = _ref12.value;
|
|
2162
2330
|
if ((_schema$triggers = schema.triggers) !== null && _schema$triggers !== void 0 && _schema$triggers.multi) {
|
|
2163
2331
|
var names = ramda.pluck("name", rule.triggers);
|
|
2164
2332
|
return names.includes(value) ? neetoCist.removeBy({
|
|
@@ -2171,12 +2339,12 @@ var nextTriggers = function nextTriggers(_ref10) {
|
|
|
2171
2339
|
name: value
|
|
2172
2340
|
})];
|
|
2173
2341
|
};
|
|
2174
|
-
var nextConditionAt = function nextConditionAt(
|
|
2342
|
+
var nextConditionAt = function nextConditionAt(_ref13) {
|
|
2175
2343
|
var _field$allowMatching;
|
|
2176
|
-
var schema =
|
|
2177
|
-
rule =
|
|
2178
|
-
index =
|
|
2179
|
-
value =
|
|
2344
|
+
var schema = _ref13.schema,
|
|
2345
|
+
rule = _ref13.rule,
|
|
2346
|
+
index = _ref13.index,
|
|
2347
|
+
value = _ref13.value;
|
|
2180
2348
|
var field = findField({
|
|
2181
2349
|
schema: schema,
|
|
2182
2350
|
value: value
|
|
@@ -2195,12 +2363,12 @@ var nextConditionAt = function nextConditionAt(_ref11) {
|
|
|
2195
2363
|
metadata: {}
|
|
2196
2364
|
});
|
|
2197
2365
|
};
|
|
2198
|
-
var nextActionAt = function nextActionAt(
|
|
2366
|
+
var nextActionAt = function nextActionAt(_ref14) {
|
|
2199
2367
|
var _schema$actions9;
|
|
2200
|
-
var schema =
|
|
2201
|
-
rule =
|
|
2202
|
-
index =
|
|
2203
|
-
value =
|
|
2368
|
+
var schema = _ref14.schema,
|
|
2369
|
+
rule = _ref14.rule,
|
|
2370
|
+
index = _ref14.index,
|
|
2371
|
+
value = _ref14.value;
|
|
2204
2372
|
if (!((_schema$actions9 = schema.actions) !== null && _schema$actions9 !== void 0 && _schema$actions9.resolveName)) {
|
|
2205
2373
|
var option = findActionOption({
|
|
2206
2374
|
schema: schema,
|
|
@@ -2258,11 +2426,11 @@ var nextActionAt = function nextActionAt(_ref12) {
|
|
|
2258
2426
|
metadata: channelChanged ? {} : prev.metadata
|
|
2259
2427
|
});
|
|
2260
2428
|
};
|
|
2261
|
-
var appendScopeItem = function appendScopeItem(
|
|
2429
|
+
var appendScopeItem = function appendScopeItem(_ref15) {
|
|
2262
2430
|
var _sc$requiresPhone;
|
|
2263
|
-
var schema =
|
|
2264
|
-
rule =
|
|
2265
|
-
value =
|
|
2431
|
+
var schema = _ref15.schema,
|
|
2432
|
+
rule = _ref15.rule,
|
|
2433
|
+
value = _ref15.value;
|
|
2266
2434
|
var sc = schema.scope || {};
|
|
2267
2435
|
var option = (sc.options || []).find(function (candidate) {
|
|
2268
2436
|
return optionValue(candidate) === value;
|
|
@@ -2279,12 +2447,12 @@ var appendScopeItem = function appendScopeItem(_ref13) {
|
|
|
2279
2447
|
phoneField: phoneFields[0].value
|
|
2280
2448
|
}) : option;
|
|
2281
2449
|
};
|
|
2282
|
-
var nextActionRecipientAt = function nextActionRecipientAt(
|
|
2450
|
+
var nextActionRecipientAt = function nextActionRecipientAt(_ref16) {
|
|
2283
2451
|
var _schema$actions1;
|
|
2284
|
-
var schema =
|
|
2285
|
-
rule =
|
|
2286
|
-
index =
|
|
2287
|
-
value =
|
|
2452
|
+
var schema = _ref16.schema,
|
|
2453
|
+
rule = _ref16.rule,
|
|
2454
|
+
index = _ref16.index,
|
|
2455
|
+
value = _ref16.value;
|
|
2288
2456
|
var prev = actionAt({
|
|
2289
2457
|
rule: rule,
|
|
2290
2458
|
index: index
|
|
@@ -2301,12 +2469,13 @@ var nextActionRecipientAt = function nextActionRecipientAt(_ref14) {
|
|
|
2301
2469
|
}) : value
|
|
2302
2470
|
});
|
|
2303
2471
|
};
|
|
2304
|
-
var descriptorFor = function descriptorFor(
|
|
2472
|
+
var descriptorFor = function descriptorFor(_ref17) {
|
|
2305
2473
|
var _schema$actor2;
|
|
2306
|
-
var anchor =
|
|
2307
|
-
schema =
|
|
2308
|
-
rule =
|
|
2309
|
-
index =
|
|
2474
|
+
var anchor = _ref17.anchor,
|
|
2475
|
+
schema = _ref17.schema,
|
|
2476
|
+
rule = _ref17.rule,
|
|
2477
|
+
index = _ref17.index,
|
|
2478
|
+
stepKey = _ref17.stepKey;
|
|
2310
2479
|
switch (anchor) {
|
|
2311
2480
|
case BUILDER_ANCHORS.TRIGGER_ADD:
|
|
2312
2481
|
case BUILDER_ANCHORS.TRIGGER_REPLACE:
|
|
@@ -2502,6 +2671,29 @@ var descriptorFor = function descriptorFor(_ref15) {
|
|
|
2502
2671
|
cascade: true
|
|
2503
2672
|
};
|
|
2504
2673
|
}
|
|
2674
|
+
case BUILDER_ANCHORS.ACTION_STEP:
|
|
2675
|
+
{
|
|
2676
|
+
var _action = actionAt({
|
|
2677
|
+
rule: rule,
|
|
2678
|
+
index: index
|
|
2679
|
+
});
|
|
2680
|
+
var step = stepAt({
|
|
2681
|
+
schema: schema,
|
|
2682
|
+
rule: rule,
|
|
2683
|
+
index: index,
|
|
2684
|
+
stepKey: stepKey
|
|
2685
|
+
}) || {};
|
|
2686
|
+
return {
|
|
2687
|
+
title: step.title || i18next.t("neetoRules.builder.panes.stepTitle"),
|
|
2688
|
+
subtitle: step.subtitle,
|
|
2689
|
+
options: normalizeOptions(step.options),
|
|
2690
|
+
selectedValues: [stepValueOf({
|
|
2691
|
+
action: _action,
|
|
2692
|
+
step: step
|
|
2693
|
+
})],
|
|
2694
|
+
cascade: true
|
|
2695
|
+
};
|
|
2696
|
+
}
|
|
2505
2697
|
case BUILDER_ANCHORS.SCOPE:
|
|
2506
2698
|
{
|
|
2507
2699
|
var _sc$requiresPhone2;
|
|
@@ -2571,13 +2763,14 @@ var descriptorFor = function descriptorFor(_ref15) {
|
|
|
2571
2763
|
};
|
|
2572
2764
|
}
|
|
2573
2765
|
};
|
|
2574
|
-
var commitFor = function commitFor(
|
|
2575
|
-
var anchor =
|
|
2576
|
-
schema =
|
|
2577
|
-
rule =
|
|
2578
|
-
index =
|
|
2579
|
-
|
|
2580
|
-
|
|
2766
|
+
var commitFor = function commitFor(_ref18) {
|
|
2767
|
+
var anchor = _ref18.anchor,
|
|
2768
|
+
schema = _ref18.schema,
|
|
2769
|
+
rule = _ref18.rule,
|
|
2770
|
+
index = _ref18.index,
|
|
2771
|
+
stepKey = _ref18.stepKey,
|
|
2772
|
+
value = _ref18.value,
|
|
2773
|
+
helpers = _ref18.helpers;
|
|
2581
2774
|
var setTriggers = helpers.setTriggers,
|
|
2582
2775
|
setPerformer = helpers.setPerformer,
|
|
2583
2776
|
setConditionMode = helpers.setConditionMode,
|
|
@@ -2648,6 +2841,11 @@ var commitFor = function commitFor(_ref16) {
|
|
|
2648
2841
|
}));
|
|
2649
2842
|
return "stay";
|
|
2650
2843
|
}
|
|
2844
|
+
case BUILDER_ANCHORS.ACTION_STEP:
|
|
2845
|
+
{
|
|
2846
|
+
setFieldValue("".concat(fieldKeys.actions, ".value.").concat(index, ".metadata.").concat(stepKey), value);
|
|
2847
|
+
return "stay";
|
|
2848
|
+
}
|
|
2651
2849
|
case BUILDER_ANCHORS.SCOPE:
|
|
2652
2850
|
{
|
|
2653
2851
|
var key = fieldKeys.scope;
|
|
@@ -2677,13 +2875,14 @@ var commitFor = function commitFor(_ref16) {
|
|
|
2677
2875
|
return "close";
|
|
2678
2876
|
}
|
|
2679
2877
|
};
|
|
2680
|
-
var continueTargetFor = function continueTargetFor(
|
|
2878
|
+
var continueTargetFor = function continueTargetFor(_ref19) {
|
|
2681
2879
|
var _schema$actor3;
|
|
2682
|
-
var anchor =
|
|
2683
|
-
schema =
|
|
2684
|
-
rule =
|
|
2685
|
-
index =
|
|
2686
|
-
|
|
2880
|
+
var anchor = _ref19.anchor,
|
|
2881
|
+
schema = _ref19.schema,
|
|
2882
|
+
rule = _ref19.rule,
|
|
2883
|
+
index = _ref19.index,
|
|
2884
|
+
stepKey = _ref19.stepKey,
|
|
2885
|
+
configPending = _ref19.configPending;
|
|
2687
2886
|
switch (anchor) {
|
|
2688
2887
|
case BUILDER_ANCHORS.TRIGGER_ADD:
|
|
2689
2888
|
case BUILDER_ANCHORS.TRIGGER_REPLACE:
|
|
@@ -2742,56 +2941,74 @@ var continueTargetFor = function continueTargetFor(_ref17) {
|
|
|
2742
2941
|
|
|
2743
2942
|
// Reached here only because the action has no config yet — its name is
|
|
2744
2943
|
// still unresolved — so the recipient pane owes us that step afterwards.
|
|
2745
|
-
|
|
2944
|
+
if (channelMetaOf({
|
|
2746
2945
|
schema: schema,
|
|
2747
2946
|
action: action
|
|
2748
|
-
}).needsRecipient
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2947
|
+
}).needsRecipient) {
|
|
2948
|
+
return {
|
|
2949
|
+
type: BUILDER_PANEL_TYPES.RECIPIENT,
|
|
2950
|
+
data: {
|
|
2951
|
+
index: index,
|
|
2952
|
+
anchor: BUILDER_ANCHORS.ACTION_RECIPIENT,
|
|
2953
|
+
configPending: true
|
|
2954
|
+
}
|
|
2955
|
+
};
|
|
2956
|
+
}
|
|
2957
|
+
return stepTargetAfter({
|
|
2958
|
+
schema: schema,
|
|
2959
|
+
rule: rule,
|
|
2960
|
+
index: index
|
|
2961
|
+
});
|
|
2756
2962
|
}
|
|
2757
2963
|
case BUILDER_ANCHORS.ACTION_RECIPIENT:
|
|
2758
2964
|
{
|
|
2759
|
-
// Only chain
|
|
2760
|
-
// the config pane or from the token means
|
|
2761
|
-
var
|
|
2965
|
+
// Only chain back to config when it was skipped on the way in; arriving
|
|
2966
|
+
// from the config pane or from the token means config is already done.
|
|
2967
|
+
var _action2 = actionAt({
|
|
2762
2968
|
rule: rule,
|
|
2763
2969
|
index: index
|
|
2764
2970
|
});
|
|
2765
2971
|
return configPending && actionHasConfig({
|
|
2766
2972
|
schema: schema,
|
|
2767
|
-
action:
|
|
2973
|
+
action: _action2
|
|
2768
2974
|
}) ? {
|
|
2769
2975
|
type: BUILDER_PANEL_TYPES.ACTION_CONFIG,
|
|
2770
2976
|
data: {
|
|
2771
2977
|
index: index,
|
|
2772
2978
|
anchor: BUILDER_ANCHORS.ACTION_CONFIG
|
|
2773
2979
|
}
|
|
2774
|
-
} :
|
|
2980
|
+
} : stepTargetAfter({
|
|
2981
|
+
schema: schema,
|
|
2982
|
+
rule: rule,
|
|
2983
|
+
index: index
|
|
2984
|
+
});
|
|
2775
2985
|
}
|
|
2986
|
+
case BUILDER_ANCHORS.ACTION_STEP:
|
|
2987
|
+
return stepTargetAfter({
|
|
2988
|
+
schema: schema,
|
|
2989
|
+
rule: rule,
|
|
2990
|
+
index: index,
|
|
2991
|
+
stepKey: stepKey
|
|
2992
|
+
});
|
|
2776
2993
|
default:
|
|
2777
2994
|
return null;
|
|
2778
2995
|
}
|
|
2779
2996
|
};
|
|
2780
|
-
var replaceAt = function replaceAt(
|
|
2781
|
-
var list =
|
|
2782
|
-
index =
|
|
2783
|
-
item =
|
|
2997
|
+
var replaceAt = function replaceAt(_ref20) {
|
|
2998
|
+
var list = _ref20.list,
|
|
2999
|
+
index = _ref20.index,
|
|
3000
|
+
item = _ref20.item;
|
|
2784
3001
|
var next = _toConsumableArray(list);
|
|
2785
3002
|
// eslint-disable-next-line security/detect-object-injection
|
|
2786
3003
|
next[index] = item;
|
|
2787
3004
|
return next;
|
|
2788
3005
|
};
|
|
2789
|
-
var applyPreview = function applyPreview(
|
|
2790
|
-
var rule =
|
|
2791
|
-
schema =
|
|
2792
|
-
anchor =
|
|
2793
|
-
index =
|
|
2794
|
-
value =
|
|
3006
|
+
var applyPreview = function applyPreview(_ref21) {
|
|
3007
|
+
var rule = _ref21.rule,
|
|
3008
|
+
schema = _ref21.schema,
|
|
3009
|
+
anchor = _ref21.anchor,
|
|
3010
|
+
index = _ref21.index,
|
|
3011
|
+
value = _ref21.value;
|
|
2795
3012
|
switch (anchor) {
|
|
2796
3013
|
case BUILDER_ANCHORS.TRIGGER_ADD:
|
|
2797
3014
|
case BUILDER_ANCHORS.TRIGGER_REPLACE:
|
|
@@ -2975,33 +3192,25 @@ var Canvas = function Canvas(_ref) {
|
|
|
2975
3192
|
});
|
|
2976
3193
|
};
|
|
2977
3194
|
var matchesInvalid = function matchesInvalid(_ref4) {
|
|
2978
|
-
var _schema$actions, _schema$actions$actio, _schema$actions2, _schema$actions2$rend, _schema$actions3, _schema$actions3$rend, _schema$actions4, _schema$actions4$opti, _schema$actions5, _schema$actions5$opti, _schema$actions6, _schema$actions7;
|
|
2979
3195
|
var type = _ref4.type,
|
|
2980
|
-
index = _ref4.index
|
|
3196
|
+
index = _ref4.index,
|
|
3197
|
+
stepKey = _ref4.stepKey;
|
|
2981
3198
|
var conditionMeta = "".concat(fieldKeys.conditions, ".value.").concat(index, ".metadata");
|
|
2982
3199
|
var actionMeta = "".concat(fieldKeys.actions, ".value.").concat(index, ".metadata");
|
|
2983
3200
|
// eslint-disable-next-line security/detect-object-injection
|
|
2984
3201
|
var actionItem = rule.actions[index] || {};
|
|
2985
|
-
var
|
|
2986
|
-
|
|
2987
|
-
channel: channel,
|
|
2988
|
-
name: actionMeta,
|
|
2989
|
-
action: actionItem
|
|
2990
|
-
}));
|
|
2991
|
-
var hasRecipientField = !!((_schema$actions3 = schema.actions) !== null && _schema$actions3 !== void 0 && (_schema$actions3$rend = _schema$actions3.renderRecipientField) !== null && _schema$actions3$rend !== void 0 && _schema$actions3$rend.call(_schema$actions3, {
|
|
2992
|
-
channel: channel,
|
|
2993
|
-
recipient: actionItem.recipient,
|
|
2994
|
-
name: actionMeta,
|
|
3202
|
+
var steps = actionStepsOf({
|
|
3203
|
+
schema: schema,
|
|
2995
3204
|
action: actionItem
|
|
2996
|
-
}));
|
|
2997
|
-
var flatOption = ((_schema$actions4 = schema.actions) === null || _schema$actions4 === void 0 || (_schema$actions4$opti = _schema$actions4.optionForName) === null || _schema$actions4$opti === void 0 ? void 0 : _schema$actions4$opti.call(_schema$actions4, actionItem.name)) || ((_schema$actions5 = schema.actions) === null || _schema$actions5 === void 0 || (_schema$actions5$opti = _schema$actions5.optionForChannel) === null || _schema$actions5$opti === void 0 ? void 0 : _schema$actions5$opti.call(_schema$actions5, channel));
|
|
2998
|
-
var recipientConfig = [].concat(_toConsumableArray((((_schema$actions6 = schema.actions) === null || _schema$actions6 === void 0 ? void 0 : _schema$actions6.options) || []).flatMap(function (option) {
|
|
2999
|
-
return option.recipients || [];
|
|
3000
|
-
})), _toConsumableArray(((_schema$actions7 = schema.actions) === null || _schema$actions7 === void 0 ? void 0 : _schema$actions7.recipients) || [])).find(function (item) {
|
|
3001
|
-
var _item$value;
|
|
3002
|
-
return ((_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : item.id) === actionItem.recipient;
|
|
3003
3205
|
});
|
|
3004
|
-
var
|
|
3206
|
+
var stepKeys = steps.map(function (step) {
|
|
3207
|
+
return step.key;
|
|
3208
|
+
});
|
|
3209
|
+
var recipientFields = recipientOwnedFields({
|
|
3210
|
+
schema: schema,
|
|
3211
|
+
action: actionItem,
|
|
3212
|
+
name: actionMeta
|
|
3213
|
+
});
|
|
3005
3214
|
switch (type) {
|
|
3006
3215
|
case BUILDER_ANCHORS.TRIGGER_ACTOR:
|
|
3007
3216
|
{
|
|
@@ -3032,8 +3241,20 @@ var Canvas = function Canvas(_ref) {
|
|
|
3032
3241
|
case BUILDER_ANCHORS.ACTION_CONFIG:
|
|
3033
3242
|
return hasErrorAt({
|
|
3034
3243
|
prefix: actionMeta,
|
|
3035
|
-
exclude: recipientFields
|
|
3244
|
+
exclude: [].concat(_toConsumableArray(recipientFields), _toConsumableArray(stepKeys))
|
|
3036
3245
|
});
|
|
3246
|
+
case BUILDER_ANCHORS.ACTION_STEP:
|
|
3247
|
+
{
|
|
3248
|
+
var step = steps.find(function (item) {
|
|
3249
|
+
return item.key === stepKey;
|
|
3250
|
+
});
|
|
3251
|
+
return hasErrorAt({
|
|
3252
|
+
prefix: "".concat(actionMeta, ".").concat(stepKey)
|
|
3253
|
+
}) || !!(step !== null && step !== void 0 && step.required) && !stepValueOf({
|
|
3254
|
+
action: actionItem,
|
|
3255
|
+
step: step
|
|
3256
|
+
});
|
|
3257
|
+
}
|
|
3037
3258
|
case BUILDER_ANCHORS.ACTION_RECIPIENT:
|
|
3038
3259
|
return hasErrorAt({
|
|
3039
3260
|
prefix: "".concat(fieldKeys.actions, ".value.").concat(index, ".name")
|
|
@@ -3665,7 +3886,8 @@ var ConfigPane = function ConfigPane(_ref) {
|
|
|
3665
3886
|
mediumLabel = _actionParts.mediumLabel,
|
|
3666
3887
|
needsRecipient = _actionParts.needsRecipient,
|
|
3667
3888
|
configTitle = _actionParts.configTitle,
|
|
3668
|
-
configSubtitle = _actionParts.configSubtitle
|
|
3889
|
+
configSubtitle = _actionParts.configSubtitle,
|
|
3890
|
+
steps = _actionParts.steps;
|
|
3669
3891
|
var name = "".concat(base, ".metadata");
|
|
3670
3892
|
var flatOption = ((_schema$actions = schema.actions) === null || _schema$actions === void 0 || (_schema$actions$optio = _schema$actions.optionForName) === null || _schema$actions$optio === void 0 ? void 0 : _schema$actions$optio.call(_schema$actions, action.name)) || ((_schema$actions2 = schema.actions) === null || _schema$actions2 === void 0 || (_schema$actions2$opti = _schema$actions2.optionForChannel) === null || _schema$actions2$opti === void 0 ? void 0 : _schema$actions2$opti.call(_schema$actions2, channel)) || option;
|
|
3671
3893
|
|
|
@@ -3719,11 +3941,21 @@ var ConfigPane = function ConfigPane(_ref) {
|
|
|
3719
3941
|
}) || (option === null || option === void 0 ? void 0 : option.label) || t("neetoRules.builder.setUpAction");
|
|
3720
3942
|
var handleContinue = /*#__PURE__*/function () {
|
|
3721
3943
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
3944
|
+
var owned, next;
|
|
3722
3945
|
return _regenerator().w(function (_context) {
|
|
3723
3946
|
while (1) switch (_context.n) {
|
|
3724
3947
|
case 0:
|
|
3948
|
+
// A pane only answers for what it renders: the recipient pane owns its
|
|
3949
|
+
// storage fields and each step owns its key, so neither blocks Continue.
|
|
3950
|
+
owned = [].concat(_toConsumableArray(recipientOwnedFields({
|
|
3951
|
+
schema: schema,
|
|
3952
|
+
action: action,
|
|
3953
|
+
name: name
|
|
3954
|
+
})), _toConsumableArray(steps.map(function (step) {
|
|
3955
|
+
return step.key;
|
|
3956
|
+
})));
|
|
3725
3957
|
_context.n = 1;
|
|
3726
|
-
return validate(
|
|
3958
|
+
return validate(owned);
|
|
3727
3959
|
case 1:
|
|
3728
3960
|
if (_context.v) {
|
|
3729
3961
|
_context.n = 2;
|
|
@@ -3731,17 +3963,18 @@ var ConfigPane = function ConfigPane(_ref) {
|
|
|
3731
3963
|
}
|
|
3732
3964
|
return _context.a(2);
|
|
3733
3965
|
case 2:
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
}
|
|
3966
|
+
next = shouldAdvanceToRecipient ? {
|
|
3967
|
+
type: BUILDER_PANEL_TYPES.RECIPIENT,
|
|
3968
|
+
data: {
|
|
3969
|
+
index: index$1,
|
|
3970
|
+
anchor: BUILDER_ANCHORS.ACTION_RECIPIENT
|
|
3971
|
+
}
|
|
3972
|
+
} : stepTargetAfter({
|
|
3973
|
+
schema: schema,
|
|
3974
|
+
rule: rule,
|
|
3975
|
+
index: index$1
|
|
3976
|
+
});
|
|
3977
|
+
if (next) openType(next);else closePane();
|
|
3745
3978
|
case 3:
|
|
3746
3979
|
return _context.a(2);
|
|
3747
3980
|
}
|
|
@@ -4142,6 +4375,7 @@ var OptionsPane = function OptionsPane(_ref) {
|
|
|
4142
4375
|
var schema = _ref.schema,
|
|
4143
4376
|
anchor = _ref.anchor,
|
|
4144
4377
|
index$1 = _ref.index,
|
|
4378
|
+
stepKey = _ref.stepKey,
|
|
4145
4379
|
_ref$belowContent = _ref.belowContent,
|
|
4146
4380
|
belowContent = _ref$belowContent === void 0 ? null : _ref$belowContent,
|
|
4147
4381
|
_ref$configPending = _ref.configPending,
|
|
@@ -4186,9 +4420,10 @@ var OptionsPane = function OptionsPane(_ref) {
|
|
|
4186
4420
|
anchor: anchor,
|
|
4187
4421
|
schema: schema,
|
|
4188
4422
|
rule: rule,
|
|
4189
|
-
index: index$1
|
|
4423
|
+
index: index$1,
|
|
4424
|
+
stepKey: stepKey
|
|
4190
4425
|
});
|
|
4191
|
-
}, [anchor, schema, rule, index$1]),
|
|
4426
|
+
}, [anchor, schema, rule, index$1, stepKey]),
|
|
4192
4427
|
title = _useMemo.title,
|
|
4193
4428
|
subtitle = _useMemo.subtitle,
|
|
4194
4429
|
multi = _useMemo.multi,
|
|
@@ -4223,6 +4458,7 @@ var OptionsPane = function OptionsPane(_ref) {
|
|
|
4223
4458
|
schema: schema,
|
|
4224
4459
|
rule: rule,
|
|
4225
4460
|
index: index$1,
|
|
4461
|
+
stepKey: stepKey,
|
|
4226
4462
|
value: value,
|
|
4227
4463
|
helpers: helpers
|
|
4228
4464
|
});
|
|
@@ -4252,6 +4488,7 @@ var OptionsPane = function OptionsPane(_ref) {
|
|
|
4252
4488
|
schema: schema,
|
|
4253
4489
|
rule: rule,
|
|
4254
4490
|
index: index$1,
|
|
4491
|
+
stepKey: stepKey,
|
|
4255
4492
|
configPending: configPending
|
|
4256
4493
|
});
|
|
4257
4494
|
if (target) openType({
|
|
@@ -4825,9 +5062,11 @@ var BUILDER_PANEL_TYPE_CONFIG_MAP = (_BUILDER_PANEL_TYPE_C = {}, _defineProperty
|
|
|
4825
5062
|
component: ValuePane
|
|
4826
5063
|
}), BUILDER_PANEL_TYPES.ACTION_CONFIG, {
|
|
4827
5064
|
component: ConfigPane
|
|
4828
|
-
}), BUILDER_PANEL_TYPES.
|
|
5065
|
+
}), BUILDER_PANEL_TYPES.ACTION_STEP, {
|
|
5066
|
+
component: OptionsPane
|
|
5067
|
+
}), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_BUILDER_PANEL_TYPE_C, BUILDER_PANEL_TYPES.DELAY, {
|
|
4829
5068
|
component: DelayPane
|
|
4830
|
-
}),
|
|
5069
|
+
}), BUILDER_PANEL_TYPES.LEAD_TIME, {
|
|
4831
5070
|
component: LeadTimePane
|
|
4832
5071
|
}), BUILDER_PANEL_TYPES.NAME, {
|
|
4833
5072
|
component: NamePane
|