@bigbinary/neeto-rules-frontend 2.7.26 → 2.7.27
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/dist/.ready +1 -1
- package/dist/NeetoRulesBuilder.js +2 -2
- package/dist/NeetoRulesForm.js +2 -2
- package/dist/cjs/NeetoRulesBuilder.js +2 -2
- package/dist/cjs/NeetoRulesForm.js +2 -2
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/v2/NeetoRulesBuilder.js +168 -116
- package/dist/cjs/v2/NeetoRulesBuilder.js.map +1 -1
- package/dist/cjs/v2/NeetoRulesForm.js +2 -2
- package/dist/cjs/v2/index.js +2 -2
- package/dist/{index-D76EZ1AZ.js → index-6HdKTEnP.js} +2 -2
- package/dist/{index-D76EZ1AZ.js.map → index-6HdKTEnP.js.map} +1 -1
- package/dist/{index-D1PW24Zw.js → index-BUcQsAbf.js} +2 -2
- package/dist/{index-D1PW24Zw.js.map → index-BUcQsAbf.js.map} +1 -1
- package/dist/{index-Br0dDuGK.js → index-DfYO62zW.js} +2 -2
- package/dist/{index-Br0dDuGK.js.map → index-DfYO62zW.js.map} +1 -1
- package/dist/{index-25TjDISc.js → index-Omo1J36W.js} +2 -2
- package/dist/{index-25TjDISc.js.map → index-Omo1J36W.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/keyboardShortcuts-CnEwhJom.js +96 -0
- package/dist/{keyboardShortcuts-CRInJJOU.js.map → keyboardShortcuts-CnEwhJom.js.map} +1 -1
- package/dist/keyboardShortcuts-CsMwT9YF.js +92 -0
- package/dist/{keyboardShortcuts-DwgF8Mcu.js.map → keyboardShortcuts-CsMwT9YF.js.map} +1 -1
- package/dist/v2/NeetoRulesBuilder.js +189 -137
- package/dist/v2/NeetoRulesBuilder.js.map +1 -1
- package/dist/v2/NeetoRulesForm.js +2 -2
- package/dist/v2/index.js +2 -2
- package/package.json +1 -1
- package/dist/keyboardShortcuts-CRInJJOU.js +0 -96
- package/dist/keyboardShortcuts-DwgF8Mcu.js +0 -92
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
4
|
var _objectDestructuringEmpty = require('@babel/runtime/helpers/objectDestructuringEmpty');
|
|
5
|
-
var keyboardShortcuts = require('../../keyboardShortcuts-
|
|
5
|
+
var keyboardShortcuts = require('../../keyboardShortcuts-CnEwhJom.js');
|
|
6
6
|
var shallow = require('zustand/shallow');
|
|
7
7
|
var react = require('react');
|
|
8
8
|
var neetoAtoms = require('@bigbinary/neeto-atoms');
|
|
@@ -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-BUcQsAbf.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');
|
|
@@ -23,6 +23,7 @@ var ramda = require('ramda');
|
|
|
23
23
|
var Delete = require('@bigbinary/neeto-icons/Delete');
|
|
24
24
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
25
25
|
var jsxRuntime = require('react/jsx-runtime');
|
|
26
|
+
var _typeof = require('@babel/runtime/helpers/typeof');
|
|
26
27
|
var i18next = require('i18next');
|
|
27
28
|
var yup = require('yup');
|
|
28
29
|
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
@@ -33,7 +34,6 @@ var utils$1 = require('../../utils-B3roKiff.js');
|
|
|
33
34
|
var Up = require('@bigbinary/neeto-icons/Up');
|
|
34
35
|
var Down = require('@bigbinary/neeto-icons/Down');
|
|
35
36
|
var Info = require('@bigbinary/neeto-icons/Info');
|
|
36
|
-
require('@babel/runtime/helpers/typeof');
|
|
37
37
|
require('../../useAutomationRulesApi-C1T2E1AN.js');
|
|
38
38
|
require('@tanstack/react-query');
|
|
39
39
|
require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
@@ -310,6 +310,22 @@ var Token = function Token(_ref) {
|
|
|
310
310
|
}));
|
|
311
311
|
};
|
|
312
312
|
|
|
313
|
+
var Values = function Values(_ref) {
|
|
314
|
+
var _ref$values = _ref.values,
|
|
315
|
+
values = _ref$values === void 0 ? [] : _ref$values,
|
|
316
|
+
connector = _ref.connector;
|
|
317
|
+
return values.map(function (value, index) {
|
|
318
|
+
return /*#__PURE__*/jsxRuntime.jsxs(react.Fragment, {
|
|
319
|
+
children: [index > 0 && " ", index > 0 && connector && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
320
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
321
|
+
className: "mb-tok-join",
|
|
322
|
+
children: connector
|
|
323
|
+
}), " "]
|
|
324
|
+
}), value]
|
|
325
|
+
}, "".concat(value, "-").concat(index));
|
|
326
|
+
});
|
|
327
|
+
};
|
|
328
|
+
|
|
313
329
|
function ownKeys$b(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; }
|
|
314
330
|
function _objectSpread$b(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$b(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$b(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
315
331
|
var humanize = function humanize(value) {
|
|
@@ -402,7 +418,32 @@ var conditionNeedsValue = function conditionNeedsValue(_ref7) {
|
|
|
402
418
|
});
|
|
403
419
|
return !((field === null || field === void 0 ? void 0 : field.noValueForVerbs) || []).includes(condition === null || condition === void 0 ? void 0 : condition.verb);
|
|
404
420
|
};
|
|
405
|
-
|
|
421
|
+
|
|
422
|
+
// A multi-value token stays one clickable phrase, but its "and"/"or" is
|
|
423
|
+
// connective tissue rather than part of any value, so the canvas keeps the
|
|
424
|
+
// connector out of the token's own styling.
|
|
425
|
+
var valueParts = function valueParts(raw) {
|
|
426
|
+
if (ramda.isNil(raw) || raw === "") return null;
|
|
427
|
+
if (Array.isArray(raw)) {
|
|
428
|
+
return ramda.isEmpty(raw) ? null : {
|
|
429
|
+
values: raw.map(String)
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
if (_typeof(raw) === "object") {
|
|
433
|
+
var values = Array.isArray(raw.values) ? raw.values.map(String) : [];
|
|
434
|
+
return ramda.isEmpty(values) ? null : {
|
|
435
|
+
values: values,
|
|
436
|
+
connector: raw.connector
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
return {
|
|
440
|
+
values: [String(raw)]
|
|
441
|
+
};
|
|
442
|
+
};
|
|
443
|
+
var joinValues = function joinValues(parts) {
|
|
444
|
+
return (parts === null || parts === void 0 ? void 0 : parts.values.join(parts.connector ? " ".concat(parts.connector, " ") : " ")) || "";
|
|
445
|
+
};
|
|
446
|
+
var conditionValueParts = function conditionValueParts(_ref8) {
|
|
406
447
|
var _ref9, _meta$value;
|
|
407
448
|
var schema = _ref8.schema,
|
|
408
449
|
condition = _ref8.condition;
|
|
@@ -422,23 +463,28 @@ var conditionValueLabel = function conditionValueLabel(_ref8) {
|
|
|
422
463
|
return ((_candidate$value = candidate.value) !== null && _candidate$value !== void 0 ? _candidate$value : candidate.id) === value;
|
|
423
464
|
});
|
|
424
465
|
var label = option ? (_ref0 = (_option$label = option.label) !== null && _option$label !== void 0 ? _option$label : option.value) !== null && _ref0 !== void 0 ? _ref0 : option.id : value;
|
|
425
|
-
return isEnum ? String(label).toLowerCase() : label;
|
|
466
|
+
return isEnum ? String(label).toLowerCase() : String(label);
|
|
426
467
|
};
|
|
427
468
|
var connector = String((condition === null || condition === void 0 ? void 0 : condition.verb) || "").includes(CONDITION_VERBS.ALL_OF) ? i18next.t("neetoRules.operators.and") : i18next.t("neetoRules.operators.or");
|
|
428
|
-
return Array.isArray(raw) ?
|
|
469
|
+
return Array.isArray(raw) ? {
|
|
470
|
+
values: raw.map(labelFor),
|
|
471
|
+
connector: connector
|
|
472
|
+
} : {
|
|
473
|
+
values: [labelFor(raw)]
|
|
474
|
+
};
|
|
429
475
|
};
|
|
430
|
-
var actionOption = function actionOption(
|
|
476
|
+
var actionOption = function actionOption(_ref10) {
|
|
431
477
|
var _schema$actions;
|
|
432
|
-
var schema =
|
|
433
|
-
name =
|
|
478
|
+
var schema = _ref10.schema,
|
|
479
|
+
name = _ref10.name;
|
|
434
480
|
return ((schema === null || schema === void 0 || (_schema$actions = schema.actions) === null || _schema$actions === void 0 ? void 0 : _schema$actions.options) || []).find(function (option) {
|
|
435
481
|
return option.value === name || option.id === name;
|
|
436
482
|
});
|
|
437
483
|
};
|
|
438
|
-
var channelOption = function channelOption(
|
|
484
|
+
var channelOption = function channelOption(_ref11) {
|
|
439
485
|
var _schema$actions2;
|
|
440
|
-
var schema =
|
|
441
|
-
channel =
|
|
486
|
+
var schema = _ref11.schema,
|
|
487
|
+
channel = _ref11.channel;
|
|
442
488
|
return ((schema === null || schema === void 0 || (_schema$actions2 = schema.actions) === null || _schema$actions2 === void 0 ? void 0 : _schema$actions2.options) || []).find(function (option) {
|
|
443
489
|
var _option$value;
|
|
444
490
|
return ((_option$value = option.value) !== null && _option$value !== void 0 ? _option$value : option.id) === channel;
|
|
@@ -450,24 +496,24 @@ var channelOption = function channelOption(_ref10) {
|
|
|
450
496
|
// Its key shares the action's metadata namespace, so declaring one is how a
|
|
451
497
|
// host hands a field to the step: whoever declares it owns it, and the config
|
|
452
498
|
// pane stops validating it.
|
|
453
|
-
var actionStepsOf = function actionStepsOf(
|
|
454
|
-
var schema =
|
|
455
|
-
action =
|
|
499
|
+
var actionStepsOf = function actionStepsOf(_ref12) {
|
|
500
|
+
var schema = _ref12.schema,
|
|
501
|
+
action = _ref12.action;
|
|
456
502
|
return actionParts({
|
|
457
503
|
schema: schema,
|
|
458
504
|
action: action
|
|
459
505
|
}).steps || [];
|
|
460
506
|
};
|
|
461
|
-
var stepValueOf = function stepValueOf(
|
|
507
|
+
var stepValueOf = function stepValueOf(_ref13) {
|
|
462
508
|
var _action$metadata;
|
|
463
|
-
var action =
|
|
464
|
-
step =
|
|
509
|
+
var action = _ref13.action,
|
|
510
|
+
step = _ref13.step;
|
|
465
511
|
return action === null || action === void 0 || (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata[step.key];
|
|
466
512
|
};
|
|
467
|
-
var stepLabelOf = function stepLabelOf(
|
|
513
|
+
var stepLabelOf = function stepLabelOf(_ref14) {
|
|
468
514
|
var _find;
|
|
469
|
-
var action =
|
|
470
|
-
step =
|
|
515
|
+
var action = _ref14.action,
|
|
516
|
+
step = _ref14.step;
|
|
471
517
|
var value = stepValueOf({
|
|
472
518
|
action: action,
|
|
473
519
|
step: step
|
|
@@ -477,10 +523,10 @@ var stepLabelOf = function stepLabelOf(_ref13) {
|
|
|
477
523
|
return ((_option$value2 = option.value) !== null && _option$value2 !== void 0 ? _option$value2 : option.id) === value;
|
|
478
524
|
})) === null || _find === void 0 ? void 0 : _find.label) || "";
|
|
479
525
|
};
|
|
480
|
-
var actionParts = function actionParts(
|
|
481
|
-
var _actions$actionForNam, _action$recipient, _actions$channelMeta, _find2, _find3,
|
|
482
|
-
var schema =
|
|
483
|
-
action =
|
|
526
|
+
var actionParts = function actionParts(_ref15) {
|
|
527
|
+
var _actions$actionForNam, _action$recipient, _actions$channelMeta, _find2, _find3, _actions$configValueL, _channelMeta$needsRec;
|
|
528
|
+
var schema = _ref15.schema,
|
|
529
|
+
action = _ref15.action;
|
|
484
530
|
var actions = (schema === null || schema === void 0 ? void 0 : schema.actions) || {};
|
|
485
531
|
var resolved = action !== null && action !== void 0 && action.channel ? {
|
|
486
532
|
channel: action.channel,
|
|
@@ -503,6 +549,10 @@ var actionParts = function actionParts(_ref14) {
|
|
|
503
549
|
return ((_recipient$value = recipient.value) !== null && _recipient$value !== void 0 ? _recipient$value : recipient.id) === recipientValue;
|
|
504
550
|
};
|
|
505
551
|
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;
|
|
552
|
+
|
|
553
|
+
// A host may answer with a plain string or with { values, connector } when
|
|
554
|
+
// the value reads as a list.
|
|
555
|
+
var configValueParts = valueParts((_actions$configValueL = actions.configValueLabel) === null || _actions$configValueL === void 0 ? void 0 : _actions$configValueL.call(actions, action));
|
|
506
556
|
return {
|
|
507
557
|
option: option,
|
|
508
558
|
channel: channel,
|
|
@@ -515,7 +565,8 @@ var actionParts = function actionParts(_ref14) {
|
|
|
515
565
|
icon: channelMeta.icon || (option === null || option === void 0 ? void 0 : option.icon),
|
|
516
566
|
needsRecipient: (_channelMeta$needsRec = channelMeta.needsRecipient) !== null && _channelMeta$needsRec !== void 0 ? _channelMeta$needsRec : option === null || option === void 0 ? void 0 : option.needsRecipient,
|
|
517
567
|
separator: channelMeta.separator || (option === null || option === void 0 ? void 0 : option.separator),
|
|
518
|
-
|
|
568
|
+
configValueParts: configValueParts,
|
|
569
|
+
configValue: joinValues(configValueParts),
|
|
519
570
|
configValuePlaceholder: channelMeta.valuePlaceholder || (option === null || option === void 0 ? void 0 : option.valuePlaceholder),
|
|
520
571
|
recipient: recipientValue,
|
|
521
572
|
recipientLabel: recipientLabel,
|
|
@@ -530,13 +581,13 @@ var actionParts = function actionParts(_ref14) {
|
|
|
530
581
|
// Which condition fields a host offers can depend on the rule — a trigger may
|
|
531
582
|
// only support a subset. Lookups deliberately keep using the full list so a
|
|
532
583
|
// field already on the rule still resolves after the offer narrows.
|
|
533
|
-
var offeredConditionFields = function offeredConditionFields(
|
|
534
|
-
var
|
|
535
|
-
var schema =
|
|
536
|
-
rule =
|
|
537
|
-
return (
|
|
584
|
+
var offeredConditionFields = function offeredConditionFields(_ref16) {
|
|
585
|
+
var _ref17, _schema$conditions$fi, _schema$conditions3, _schema$conditions3$f, _schema$conditions4;
|
|
586
|
+
var schema = _ref16.schema,
|
|
587
|
+
rule = _ref16.rule;
|
|
588
|
+
return (_ref17 = (_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, {
|
|
538
589
|
rule: rule
|
|
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 &&
|
|
590
|
+
})) !== 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 && _ref17 !== void 0 ? _ref17 : [];
|
|
540
591
|
};
|
|
541
592
|
var hasTrigger = function hasTrigger(rule) {
|
|
542
593
|
return !ramda.isEmpty((rule === null || rule === void 0 ? void 0 : rule.triggers) || []);
|
|
@@ -550,20 +601,20 @@ var isTriggerEnabled = function isTriggerEnabled(schema) {
|
|
|
550
601
|
var _schema$triggers2;
|
|
551
602
|
return (schema === null || schema === void 0 || (_schema$triggers2 = schema.triggers) === null || _schema$triggers2 === void 0 ? void 0 : _schema$triggers2.enabled) !== false;
|
|
552
603
|
};
|
|
553
|
-
var isTriggerSatisfied = function isTriggerSatisfied(
|
|
554
|
-
var rule = _ref17.rule,
|
|
555
|
-
schema = _ref17.schema;
|
|
556
|
-
return !isTriggerEnabled(schema) || hasTrigger(rule);
|
|
557
|
-
};
|
|
558
|
-
var hasRequiredConditions = function hasRequiredConditions(_ref18) {
|
|
559
|
-
var _schema$conditions5;
|
|
604
|
+
var isTriggerSatisfied = function isTriggerSatisfied(_ref18) {
|
|
560
605
|
var rule = _ref18.rule,
|
|
561
606
|
schema = _ref18.schema;
|
|
562
|
-
return (schema
|
|
607
|
+
return !isTriggerEnabled(schema) || hasTrigger(rule);
|
|
563
608
|
};
|
|
564
|
-
var
|
|
609
|
+
var hasRequiredConditions = function hasRequiredConditions(_ref19) {
|
|
610
|
+
var _schema$conditions5;
|
|
565
611
|
var rule = _ref19.rule,
|
|
566
612
|
schema = _ref19.schema;
|
|
613
|
+
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;
|
|
614
|
+
};
|
|
615
|
+
var hasUnansweredStep = function hasUnansweredStep(_ref20) {
|
|
616
|
+
var rule = _ref20.rule,
|
|
617
|
+
schema = _ref20.schema;
|
|
567
618
|
return ((rule === null || rule === void 0 ? void 0 : rule.actions) || []).some(function (action) {
|
|
568
619
|
return actionStepsOf({
|
|
569
620
|
schema: schema,
|
|
@@ -576,9 +627,9 @@ var hasUnansweredStep = function hasUnansweredStep(_ref19) {
|
|
|
576
627
|
});
|
|
577
628
|
});
|
|
578
629
|
};
|
|
579
|
-
var isRuleComplete = function isRuleComplete(
|
|
580
|
-
var rule =
|
|
581
|
-
schema =
|
|
630
|
+
var isRuleComplete = function isRuleComplete(_ref21) {
|
|
631
|
+
var rule = _ref21.rule,
|
|
632
|
+
schema = _ref21.schema;
|
|
582
633
|
return isTriggerSatisfied({
|
|
583
634
|
rule: rule,
|
|
584
635
|
schema: schema
|
|
@@ -590,28 +641,28 @@ var isRuleComplete = function isRuleComplete(_ref20) {
|
|
|
590
641
|
schema: schema
|
|
591
642
|
});
|
|
592
643
|
};
|
|
593
|
-
var scopeOptionFor = function scopeOptionFor(
|
|
644
|
+
var scopeOptionFor = function scopeOptionFor(_ref22) {
|
|
594
645
|
var _item$value, _schema$scope;
|
|
595
|
-
var schema =
|
|
596
|
-
item =
|
|
646
|
+
var schema = _ref22.schema,
|
|
647
|
+
item = _ref22.item;
|
|
597
648
|
var value = (_item$value = item === null || item === void 0 ? void 0 : item.value) !== null && _item$value !== void 0 ? _item$value : item;
|
|
598
649
|
return ((schema === null || schema === void 0 || (_schema$scope = schema.scope) === null || _schema$scope === void 0 ? void 0 : _schema$scope.options) || []).find(function (candidate) {
|
|
599
650
|
var _candidate$value2;
|
|
600
651
|
return ((_candidate$value2 = candidate.value) !== null && _candidate$value2 !== void 0 ? _candidate$value2 : candidate.id) === value;
|
|
601
652
|
});
|
|
602
653
|
};
|
|
603
|
-
var scopePhoneFields = function scopePhoneFields(
|
|
604
|
-
var
|
|
605
|
-
var schema =
|
|
606
|
-
item =
|
|
607
|
-
return (
|
|
654
|
+
var scopePhoneFields = function scopePhoneFields(_ref23) {
|
|
655
|
+
var _ref24, _item$phoneFields, _scopeOptionFor;
|
|
656
|
+
var schema = _ref23.schema,
|
|
657
|
+
item = _ref23.item;
|
|
658
|
+
return (_ref24 = (_item$phoneFields = item === null || item === void 0 ? void 0 : item.phoneFields) !== null && _item$phoneFields !== void 0 ? _item$phoneFields : (_scopeOptionFor = scopeOptionFor({
|
|
608
659
|
schema: schema,
|
|
609
660
|
item: item
|
|
610
|
-
})) === null || _scopeOptionFor === void 0 ? void 0 : _scopeOptionFor.phoneFields) !== null &&
|
|
661
|
+
})) === null || _scopeOptionFor === void 0 ? void 0 : _scopeOptionFor.phoneFields) !== null && _ref24 !== void 0 ? _ref24 : null;
|
|
611
662
|
};
|
|
612
|
-
var effectiveScopePhoneField = function effectiveScopePhoneField(
|
|
613
|
-
var schema =
|
|
614
|
-
item =
|
|
663
|
+
var effectiveScopePhoneField = function effectiveScopePhoneField(_ref25) {
|
|
664
|
+
var schema = _ref25.schema,
|
|
665
|
+
item = _ref25.item;
|
|
615
666
|
if (item !== null && item !== void 0 && item.phoneField) return item.phoneField;
|
|
616
667
|
var phoneFields = scopePhoneFields({
|
|
617
668
|
schema: schema,
|
|
@@ -619,14 +670,14 @@ var effectiveScopePhoneField = function effectiveScopePhoneField(_ref24) {
|
|
|
619
670
|
});
|
|
620
671
|
return (phoneFields === null || phoneFields === void 0 ? void 0 : phoneFields.length) === 1 ? phoneFields[0].value : undefined;
|
|
621
672
|
};
|
|
622
|
-
var invalidScopeIndexes = function invalidScopeIndexes(
|
|
673
|
+
var invalidScopeIndexes = function invalidScopeIndexes(_ref26) {
|
|
623
674
|
var _scope$requiresPhone;
|
|
624
|
-
var rule =
|
|
625
|
-
schema =
|
|
675
|
+
var rule = _ref26.rule,
|
|
676
|
+
schema = _ref26.schema;
|
|
626
677
|
var scope = schema === null || schema === void 0 ? void 0 : schema.scope;
|
|
627
678
|
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 [];
|
|
628
679
|
return ((rule === null || rule === void 0 ? void 0 : rule.scope) || []).reduce(function (indexes, item, index) {
|
|
629
|
-
var
|
|
680
|
+
var _ref27, _item$hasPhoneField;
|
|
630
681
|
var option = scopeOptionFor({
|
|
631
682
|
schema: schema,
|
|
632
683
|
item: item
|
|
@@ -635,15 +686,15 @@ var invalidScopeIndexes = function invalidScopeIndexes(_ref25) {
|
|
|
635
686
|
schema: schema,
|
|
636
687
|
item: item
|
|
637
688
|
});
|
|
638
|
-
var hasPhoneField = (
|
|
689
|
+
var hasPhoneField = (_ref27 = (_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 && _ref27 !== void 0 ? _ref27 : phoneFields ? phoneFields.length > 0 : undefined;
|
|
639
690
|
if (hasPhoneField === false) indexes.push(index);
|
|
640
691
|
return indexes;
|
|
641
692
|
}, []);
|
|
642
693
|
};
|
|
643
|
-
var invalidScopePhoneFieldIndexes = function invalidScopePhoneFieldIndexes(
|
|
694
|
+
var invalidScopePhoneFieldIndexes = function invalidScopePhoneFieldIndexes(_ref28) {
|
|
644
695
|
var _scope$requiresPhone2;
|
|
645
|
-
var rule =
|
|
646
|
-
schema =
|
|
696
|
+
var rule = _ref28.rule,
|
|
697
|
+
schema = _ref28.schema;
|
|
647
698
|
var scope = schema === null || schema === void 0 ? void 0 : schema.scope;
|
|
648
699
|
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 [];
|
|
649
700
|
return ((rule === null || rule === void 0 ? void 0 : rule.scope) || []).reduce(function (indexes, item, index) {
|
|
@@ -680,9 +731,9 @@ var minutesToParts = function minutesToParts(minutes) {
|
|
|
680
731
|
unit: "minutes"
|
|
681
732
|
};
|
|
682
733
|
};
|
|
683
|
-
var partsToMinutes = function partsToMinutes(
|
|
684
|
-
var value =
|
|
685
|
-
unit =
|
|
734
|
+
var partsToMinutes = function partsToMinutes(_ref29) {
|
|
735
|
+
var value = _ref29.value,
|
|
736
|
+
unit = _ref29.unit;
|
|
686
737
|
return (
|
|
687
738
|
// eslint-disable-next-line security/detect-object-injection
|
|
688
739
|
(Number(value) || 0) * (UNIT_MINUTES[unit] || 1)
|
|
@@ -736,11 +787,11 @@ var recipientStorageField = function recipientStorageField(field) {
|
|
|
736
787
|
// Which metadata fields the recipient pane renders, and therefore owns: no
|
|
737
788
|
// other pane may block Continue on them. Canvas and ConfigPane both ask here
|
|
738
789
|
// so the two lists cannot drift apart.
|
|
739
|
-
var recipientOwnedFields = function recipientOwnedFields(
|
|
790
|
+
var recipientOwnedFields = function recipientOwnedFields(_ref30) {
|
|
740
791
|
var _actions$actionForNam2, _action$recipient2, _actions$renderRecipi, _actions$renderRecipi2, _actions$optionForNam, _actions$optionForCha;
|
|
741
|
-
var schema =
|
|
742
|
-
action =
|
|
743
|
-
name =
|
|
792
|
+
var schema = _ref30.schema,
|
|
793
|
+
action = _ref30.action,
|
|
794
|
+
name = _ref30.name;
|
|
744
795
|
var actions = (schema === null || schema === void 0 ? void 0 : schema.actions) || {};
|
|
745
796
|
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
797
|
var channel = (action === null || action === void 0 ? void 0 : action.channel) || resolved.channel;
|
|
@@ -771,10 +822,10 @@ var modeFromJoinType = function modeFromJoinType(joinType) {
|
|
|
771
822
|
};
|
|
772
823
|
|
|
773
824
|
// eslint-disable-next-line security/detect-object-injection
|
|
774
|
-
var valueAt = function valueAt(
|
|
825
|
+
var valueAt = function valueAt(_ref31) {
|
|
775
826
|
var _values$key;
|
|
776
|
-
var values =
|
|
777
|
-
key =
|
|
827
|
+
var values = _ref31.values,
|
|
828
|
+
key = _ref31.key;
|
|
778
829
|
return values === null || values === void 0 || (_values$key = values[key]) === null || _values$key === void 0 ? void 0 : _values$key.value;
|
|
779
830
|
};
|
|
780
831
|
var asArray = function asArray(maybeArray) {
|
|
@@ -797,11 +848,11 @@ var fieldKeysFromSchema = function fieldKeysFromSchema() {
|
|
|
797
848
|
};
|
|
798
849
|
var valuesToRuleModel = function valuesToRuleModel() {
|
|
799
850
|
var _valueAt, _conditions$;
|
|
800
|
-
var
|
|
801
|
-
|
|
802
|
-
values =
|
|
803
|
-
|
|
804
|
-
schema =
|
|
851
|
+
var _ref32 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
852
|
+
_ref32$values = _ref32.values,
|
|
853
|
+
values = _ref32$values === void 0 ? {} : _ref32$values,
|
|
854
|
+
_ref32$schema = _ref32.schema,
|
|
855
|
+
schema = _ref32$schema === void 0 ? {} : _ref32$schema;
|
|
805
856
|
var keys = fieldKeysFromSchema(schema);
|
|
806
857
|
var conditions = asArray(valueAt({
|
|
807
858
|
values: values,
|
|
@@ -845,42 +896,42 @@ var valuesToRuleModel = function valuesToRuleModel() {
|
|
|
845
896
|
}))
|
|
846
897
|
};
|
|
847
898
|
};
|
|
848
|
-
var setTriggers = function setTriggers(
|
|
849
|
-
var schema =
|
|
850
|
-
triggers =
|
|
899
|
+
var setTriggers = function setTriggers(_ref33) {
|
|
900
|
+
var schema = _ref33.schema,
|
|
901
|
+
triggers = _ref33.triggers;
|
|
851
902
|
return {
|
|
852
903
|
path: "".concat(fieldKeysFromSchema(schema).triggers, ".value"),
|
|
853
904
|
value: triggers
|
|
854
905
|
};
|
|
855
906
|
};
|
|
856
|
-
var setPerformer = function setPerformer(
|
|
857
|
-
var schema =
|
|
858
|
-
performer =
|
|
907
|
+
var setPerformer = function setPerformer(_ref34) {
|
|
908
|
+
var schema = _ref34.schema,
|
|
909
|
+
performer = _ref34.performer;
|
|
859
910
|
return {
|
|
860
911
|
path: "".concat(fieldKeysFromSchema(schema).performer, ".value"),
|
|
861
912
|
value: performer
|
|
862
913
|
};
|
|
863
914
|
};
|
|
864
|
-
var setActions = function setActions(
|
|
865
|
-
var schema =
|
|
866
|
-
actions =
|
|
915
|
+
var setActions = function setActions(_ref35) {
|
|
916
|
+
var schema = _ref35.schema,
|
|
917
|
+
actions = _ref35.actions;
|
|
867
918
|
return {
|
|
868
919
|
path: "".concat(fieldKeysFromSchema(schema).actions, ".value"),
|
|
869
920
|
value: actions
|
|
870
921
|
};
|
|
871
922
|
};
|
|
872
|
-
var setConditions = function setConditions(
|
|
873
|
-
var schema =
|
|
874
|
-
conditions =
|
|
923
|
+
var setConditions = function setConditions(_ref36) {
|
|
924
|
+
var schema = _ref36.schema,
|
|
925
|
+
conditions = _ref36.conditions;
|
|
875
926
|
return {
|
|
876
927
|
path: "".concat(fieldKeysFromSchema(schema).conditions, ".value"),
|
|
877
928
|
value: conditions
|
|
878
929
|
};
|
|
879
930
|
};
|
|
880
|
-
var setConditionMode = function setConditionMode(
|
|
881
|
-
var schema =
|
|
882
|
-
conditions =
|
|
883
|
-
joinType =
|
|
931
|
+
var setConditionMode = function setConditionMode(_ref37) {
|
|
932
|
+
var schema = _ref37.schema,
|
|
933
|
+
conditions = _ref37.conditions,
|
|
934
|
+
joinType = _ref37.joinType;
|
|
884
935
|
return setConditions({
|
|
885
936
|
schema: schema,
|
|
886
937
|
conditions: conditions.map(function (condition) {
|
|
@@ -888,34 +939,34 @@ var setConditionMode = function setConditionMode(_ref36) {
|
|
|
888
939
|
})
|
|
889
940
|
});
|
|
890
941
|
};
|
|
891
|
-
var setDelay = function setDelay(
|
|
892
|
-
var schema =
|
|
893
|
-
delay =
|
|
942
|
+
var setDelay = function setDelay(_ref38) {
|
|
943
|
+
var schema = _ref38.schema,
|
|
944
|
+
delay = _ref38.delay;
|
|
894
945
|
return {
|
|
895
946
|
path: "".concat(fieldKeysFromSchema(schema).delay, ".value"),
|
|
896
947
|
value: delay !== null && delay !== void 0 ? delay : {}
|
|
897
948
|
};
|
|
898
949
|
};
|
|
899
|
-
var setActive = function setActive(
|
|
900
|
-
var schema =
|
|
901
|
-
active =
|
|
950
|
+
var setActive = function setActive(_ref39) {
|
|
951
|
+
var schema = _ref39.schema,
|
|
952
|
+
active = _ref39.active;
|
|
902
953
|
return {
|
|
903
954
|
path: "".concat(fieldKeysFromSchema(schema).status, ".value"),
|
|
904
955
|
value: active ? STATUS_KEYS.ENABLED : STATUS_KEYS.DISABLED
|
|
905
956
|
};
|
|
906
957
|
};
|
|
907
|
-
var setScope = function setScope(
|
|
908
|
-
var schema =
|
|
909
|
-
scope =
|
|
958
|
+
var setScope = function setScope(_ref40) {
|
|
959
|
+
var schema = _ref40.schema,
|
|
960
|
+
scope = _ref40.scope;
|
|
910
961
|
return {
|
|
911
962
|
path: "".concat(fieldKeysFromSchema(schema).scope, ".value"),
|
|
912
963
|
value: scope
|
|
913
964
|
};
|
|
914
965
|
};
|
|
915
|
-
var removeArrayItem = function removeArrayItem(
|
|
916
|
-
var values =
|
|
917
|
-
fieldKey =
|
|
918
|
-
index =
|
|
966
|
+
var removeArrayItem = function removeArrayItem(_ref41) {
|
|
967
|
+
var values = _ref41.values,
|
|
968
|
+
fieldKey = _ref41.fieldKey,
|
|
969
|
+
index = _ref41.index;
|
|
919
970
|
var list = asArray(valueAt({
|
|
920
971
|
values: values,
|
|
921
972
|
key: fieldKey
|
|
@@ -942,9 +993,9 @@ var removeArrayItem = function removeArrayItem(_ref40) {
|
|
|
942
993
|
}
|
|
943
994
|
return result;
|
|
944
995
|
};
|
|
945
|
-
var clearArrayItems = function clearArrayItems(
|
|
946
|
-
var values =
|
|
947
|
-
fieldKey =
|
|
996
|
+
var clearArrayItems = function clearArrayItems(_ref42) {
|
|
997
|
+
var values = _ref42.values,
|
|
998
|
+
fieldKey = _ref42.fieldKey;
|
|
948
999
|
var list = asArray(valueAt({
|
|
949
1000
|
values: values,
|
|
950
1001
|
key: fieldKey
|
|
@@ -1001,7 +1052,7 @@ var ConditionRow = function ConditionRow(_ref) {
|
|
|
1001
1052
|
return ((_field$value = field.value) !== null && _field$value !== void 0 ? _field$value : field.id) === (condition === null || condition === void 0 ? void 0 : condition.field);
|
|
1002
1053
|
});
|
|
1003
1054
|
var operatorPlaceholder = (conditionField === null || conditionField === void 0 ? void 0 : conditionField.operatorPlaceholder) || t("neetoRules.builder.selectOperator");
|
|
1004
|
-
var value =
|
|
1055
|
+
var value = conditionValueParts({
|
|
1005
1056
|
schema: schema,
|
|
1006
1057
|
condition: condition
|
|
1007
1058
|
});
|
|
@@ -1090,7 +1141,7 @@ var ConditionRow = function ConditionRow(_ref) {
|
|
|
1090
1141
|
index: index
|
|
1091
1142
|
});
|
|
1092
1143
|
},
|
|
1093
|
-
children: value
|
|
1144
|
+
children: value ? /*#__PURE__*/jsxRuntime.jsx(Values, _objectSpread$a({}, value)) : t("neetoRules.form.addValue")
|
|
1094
1145
|
})]
|
|
1095
1146
|
}) : /*#__PURE__*/jsxRuntime.jsx(Token, {
|
|
1096
1147
|
active: isActive({
|
|
@@ -1519,6 +1570,7 @@ var ActionRow = function ActionRow(_ref) {
|
|
|
1519
1570
|
recipientLabel = _actionParts.recipientLabel,
|
|
1520
1571
|
separator = _actionParts.separator,
|
|
1521
1572
|
configValue = _actionParts.configValue,
|
|
1573
|
+
configValueParts = _actionParts.configValueParts,
|
|
1522
1574
|
configValuePlaceholder = _actionParts.configValuePlaceholder,
|
|
1523
1575
|
paramKind = _actionParts.paramKind,
|
|
1524
1576
|
valueNoun = _actionParts.valueNoun,
|
|
@@ -1553,7 +1605,7 @@ var ActionRow = function ActionRow(_ref) {
|
|
|
1553
1605
|
configSeparator = _ref3[1];
|
|
1554
1606
|
var isConfigured = neetoCist.isNotEmpty(action === null || action === void 0 ? void 0 : action.metadata);
|
|
1555
1607
|
// A host that shows no value label still needs the token to read as filled.
|
|
1556
|
-
var configState =
|
|
1608
|
+
var configState = configValueParts || isConfigured ? TOKEN_STATE.FILLED : TOKEN_STATE.MUTED;
|
|
1557
1609
|
var _useClearingHover = useClearingHover(),
|
|
1558
1610
|
clearing = _useClearingHover.clearing,
|
|
1559
1611
|
clearingHoverProps = _useClearingHover.clearingHoverProps;
|
|
@@ -1578,7 +1630,7 @@ var ActionRow = function ActionRow(_ref) {
|
|
|
1578
1630
|
index: index
|
|
1579
1631
|
});
|
|
1580
1632
|
},
|
|
1581
|
-
children:
|
|
1633
|
+
children: configValueParts ? /*#__PURE__*/jsxRuntime.jsx(Values, _objectSpread$7({}, configValueParts)) : sentencify(configValuePlaceholder) || t("neetoRules.builder.selectFallback")
|
|
1582
1634
|
})]
|
|
1583
1635
|
}, "config") : null;
|
|
1584
1636
|
var recipientToken = needsRecipient ? /*#__PURE__*/jsxRuntime.jsxs(react.Fragment, {
|
|
@@ -1681,7 +1733,7 @@ var ActionRow = function ActionRow(_ref) {
|
|
|
1681
1733
|
index: index
|
|
1682
1734
|
});
|
|
1683
1735
|
},
|
|
1684
|
-
children:
|
|
1736
|
+
children: configValueParts ? /*#__PURE__*/jsxRuntime.jsx(Values, _objectSpread$7({}, configValueParts)) : sentencify(configValuePlaceholder) || paramPlaceholder
|
|
1685
1737
|
}) : configLabel && /*#__PURE__*/jsxRuntime.jsxs(Token, {
|
|
1686
1738
|
className: "mb-tok-medium",
|
|
1687
1739
|
dataTestid: "action-config-".concat(index),
|