@bigbinary/neeto-rules-frontend 2.8.8 → 2.8.9
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/en.json +1 -0
- package/dist/.ready +1 -1
- package/dist/cjs/v2/NeetoRulesBuilder.js +160 -126
- package/dist/cjs/v2/NeetoRulesBuilder.js.map +1 -1
- package/dist/v2/NeetoRulesBuilder.js +160 -126
- package/dist/v2/NeetoRulesBuilder.js.map +1 -1
- package/package.json +7 -7
|
@@ -2234,11 +2234,23 @@ var triggerValue = function triggerValue(option) {
|
|
|
2234
2234
|
var _ref, _option$eventValue;
|
|
2235
2235
|
return (_ref = (_option$eventValue = option.eventValue) !== null && _option$eventValue !== void 0 ? _option$eventValue : option.value) !== null && _ref !== void 0 ? _ref : option.id;
|
|
2236
2236
|
};
|
|
2237
|
-
|
|
2237
|
+
|
|
2238
|
+
// Triggers from different groups cannot be combined in one rule.
|
|
2239
|
+
var activeTriggerGroup = function activeTriggerGroup(_ref2) {
|
|
2240
|
+
var _schema$triggers;
|
|
2238
2241
|
var schema = _ref2.schema,
|
|
2239
|
-
rule = _ref2.rule
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
+
rule = _ref2.rule;
|
|
2243
|
+
var names = pluck("name", rule.triggers);
|
|
2244
|
+
var selected = (((_schema$triggers = schema.triggers) === null || _schema$triggers === void 0 ? void 0 : _schema$triggers.options) || []).find(function (option) {
|
|
2245
|
+
return option.group && names.includes(triggerValue(option));
|
|
2246
|
+
});
|
|
2247
|
+
return selected === null || selected === void 0 ? void 0 : selected.group;
|
|
2248
|
+
};
|
|
2249
|
+
var stepAt = function stepAt(_ref3) {
|
|
2250
|
+
var schema = _ref3.schema,
|
|
2251
|
+
rule = _ref3.rule,
|
|
2252
|
+
index = _ref3.index,
|
|
2253
|
+
stepKey = _ref3.stepKey;
|
|
2242
2254
|
return actionStepsOf({
|
|
2243
2255
|
schema: schema,
|
|
2244
2256
|
action: actionAt({
|
|
@@ -2252,11 +2264,11 @@ var stepAt = function stepAt(_ref2) {
|
|
|
2252
2264
|
|
|
2253
2265
|
// Panes hand off in sentence order — config, recipient, then each host step —
|
|
2254
2266
|
// so every "what comes next" question resolves through this one list.
|
|
2255
|
-
var stepTargetAfter = function stepTargetAfter(
|
|
2256
|
-
var schema =
|
|
2257
|
-
rule =
|
|
2258
|
-
index =
|
|
2259
|
-
stepKey =
|
|
2267
|
+
var stepTargetAfter = function stepTargetAfter(_ref4) {
|
|
2268
|
+
var schema = _ref4.schema,
|
|
2269
|
+
rule = _ref4.rule,
|
|
2270
|
+
index = _ref4.index,
|
|
2271
|
+
stepKey = _ref4.stepKey;
|
|
2260
2272
|
var steps = actionStepsOf({
|
|
2261
2273
|
schema: schema,
|
|
2262
2274
|
action: actionAt({
|
|
@@ -2305,9 +2317,9 @@ var groupByCategory = function groupByCategory(options) {
|
|
|
2305
2317
|
});
|
|
2306
2318
|
return groups;
|
|
2307
2319
|
};
|
|
2308
|
-
var conditionAt = function conditionAt(
|
|
2309
|
-
var rule =
|
|
2310
|
-
index =
|
|
2320
|
+
var conditionAt = function conditionAt(_ref5) {
|
|
2321
|
+
var rule = _ref5.rule,
|
|
2322
|
+
index = _ref5.index;
|
|
2311
2323
|
return (
|
|
2312
2324
|
// eslint-disable-next-line security/detect-object-injection
|
|
2313
2325
|
rule.conditions[index] || {}
|
|
@@ -2315,63 +2327,63 @@ var conditionAt = function conditionAt(_ref4) {
|
|
|
2315
2327
|
};
|
|
2316
2328
|
|
|
2317
2329
|
// eslint-disable-next-line security/detect-object-injection
|
|
2318
|
-
var actionAt = function actionAt(
|
|
2319
|
-
var rule =
|
|
2320
|
-
index =
|
|
2330
|
+
var actionAt = function actionAt(_ref6) {
|
|
2331
|
+
var rule = _ref6.rule,
|
|
2332
|
+
index = _ref6.index;
|
|
2321
2333
|
return rule.actions[index] || {};
|
|
2322
2334
|
};
|
|
2323
2335
|
|
|
2324
2336
|
// eslint-disable-next-line security/detect-object-injection
|
|
2325
|
-
var scopeItemAt = function scopeItemAt(
|
|
2337
|
+
var scopeItemAt = function scopeItemAt(_ref7) {
|
|
2326
2338
|
var _rule$scope;
|
|
2327
|
-
var rule =
|
|
2328
|
-
index =
|
|
2339
|
+
var rule = _ref7.rule,
|
|
2340
|
+
index = _ref7.index;
|
|
2329
2341
|
return ((_rule$scope = rule.scope) === null || _rule$scope === void 0 ? void 0 : _rule$scope[index]) || {};
|
|
2330
2342
|
};
|
|
2331
2343
|
var scopeItemLabel = function scopeItemLabel(item) {
|
|
2332
2344
|
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 : "");
|
|
2333
2345
|
};
|
|
2334
|
-
var findField = function findField(
|
|
2346
|
+
var findField = function findField(_ref8) {
|
|
2335
2347
|
var _schema$conditions;
|
|
2336
|
-
var schema =
|
|
2337
|
-
value =
|
|
2348
|
+
var schema = _ref8.schema,
|
|
2349
|
+
value = _ref8.value;
|
|
2338
2350
|
return (((_schema$conditions = schema.conditions) === null || _schema$conditions === void 0 ? void 0 : _schema$conditions.fields) || []).find(function (field) {
|
|
2339
2351
|
return optionValue(field) === value;
|
|
2340
2352
|
});
|
|
2341
2353
|
};
|
|
2342
|
-
var findActionOption = function findActionOption(
|
|
2354
|
+
var findActionOption = function findActionOption(_ref9) {
|
|
2343
2355
|
var _schema$actions;
|
|
2344
|
-
var schema =
|
|
2345
|
-
name =
|
|
2356
|
+
var schema = _ref9.schema,
|
|
2357
|
+
name = _ref9.name;
|
|
2346
2358
|
return (((_schema$actions = schema.actions) === null || _schema$actions === void 0 ? void 0 : _schema$actions.options) || []).find(function (option) {
|
|
2347
2359
|
return optionValue(option) === name;
|
|
2348
2360
|
});
|
|
2349
2361
|
};
|
|
2350
|
-
var channelOf = function channelOf(
|
|
2362
|
+
var channelOf = function channelOf(_ref0) {
|
|
2351
2363
|
var _schema$actions2, _schema$actions2$acti;
|
|
2352
|
-
var schema =
|
|
2353
|
-
action =
|
|
2364
|
+
var schema = _ref0.schema,
|
|
2365
|
+
action = _ref0.action;
|
|
2354
2366
|
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);
|
|
2355
2367
|
};
|
|
2356
|
-
var recipientOf = function recipientOf(
|
|
2368
|
+
var recipientOf = function recipientOf(_ref1) {
|
|
2357
2369
|
var _action$recipient, _schema$actions3, _schema$actions3$acti;
|
|
2358
|
-
var schema =
|
|
2359
|
-
action =
|
|
2370
|
+
var schema = _ref1.schema,
|
|
2371
|
+
action = _ref1.action;
|
|
2360
2372
|
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;
|
|
2361
2373
|
};
|
|
2362
|
-
var channelMetaOf = function channelMetaOf(
|
|
2374
|
+
var channelMetaOf = function channelMetaOf(_ref10) {
|
|
2363
2375
|
var _schema$actions4;
|
|
2364
|
-
var schema =
|
|
2365
|
-
action =
|
|
2376
|
+
var schema = _ref10.schema,
|
|
2377
|
+
action = _ref10.action;
|
|
2366
2378
|
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({
|
|
2367
2379
|
schema: schema,
|
|
2368
2380
|
action: action
|
|
2369
2381
|
})]) || {};
|
|
2370
2382
|
};
|
|
2371
|
-
var actionHasConfig = function actionHasConfig(
|
|
2383
|
+
var actionHasConfig = function actionHasConfig(_ref11) {
|
|
2372
2384
|
var _schema$actions5, _schema$actions6;
|
|
2373
|
-
var schema =
|
|
2374
|
-
action =
|
|
2385
|
+
var schema = _ref11.schema,
|
|
2386
|
+
action = _ref11.action;
|
|
2375
2387
|
var meta = channelMetaOf({
|
|
2376
2388
|
schema: schema,
|
|
2377
2389
|
action: action
|
|
@@ -2385,10 +2397,10 @@ var actionHasConfig = function actionHasConfig(_ref10) {
|
|
|
2385
2397
|
if ((_schema$actions5 = schema.actions) !== null && _schema$actions5 !== void 0 && _schema$actions5.hasConfig) return schema.actions.hasConfig(action);
|
|
2386
2398
|
return !!((_schema$actions6 = schema.actions) !== null && _schema$actions6 !== void 0 && _schema$actions6.renderConfig);
|
|
2387
2399
|
};
|
|
2388
|
-
var recipientsFor = function recipientsFor(
|
|
2400
|
+
var recipientsFor = function recipientsFor(_ref12) {
|
|
2389
2401
|
var _schema$actions7, _schema$actions8;
|
|
2390
|
-
var schema =
|
|
2391
|
-
action =
|
|
2402
|
+
var schema = _ref12.schema,
|
|
2403
|
+
action = _ref12.action;
|
|
2392
2404
|
var channel = channelOf({
|
|
2393
2405
|
schema: schema,
|
|
2394
2406
|
action: action
|
|
@@ -2405,10 +2417,10 @@ var recipientsFor = function recipientsFor(_ref11) {
|
|
|
2405
2417
|
};
|
|
2406
2418
|
|
|
2407
2419
|
// Each action runs once per rule, so hide recipients another row already uses.
|
|
2408
|
-
var availableRecipients = function availableRecipients(
|
|
2409
|
-
var schema =
|
|
2410
|
-
rule =
|
|
2411
|
-
index =
|
|
2420
|
+
var availableRecipients = function availableRecipients(_ref13) {
|
|
2421
|
+
var schema = _ref13.schema,
|
|
2422
|
+
rule = _ref13.rule,
|
|
2423
|
+
index = _ref13.index;
|
|
2412
2424
|
var action = actionAt({
|
|
2413
2425
|
rule: rule,
|
|
2414
2426
|
index: index
|
|
@@ -2434,12 +2446,12 @@ var availableRecipients = function availableRecipients(_ref12) {
|
|
|
2434
2446
|
return !name || !usedNames.includes(name);
|
|
2435
2447
|
});
|
|
2436
2448
|
};
|
|
2437
|
-
var nextTriggers = function nextTriggers(
|
|
2438
|
-
var _schema$
|
|
2439
|
-
var schema =
|
|
2440
|
-
rule =
|
|
2441
|
-
value =
|
|
2442
|
-
if ((_schema$
|
|
2449
|
+
var nextTriggers = function nextTriggers(_ref14) {
|
|
2450
|
+
var _schema$triggers2;
|
|
2451
|
+
var schema = _ref14.schema,
|
|
2452
|
+
rule = _ref14.rule,
|
|
2453
|
+
value = _ref14.value;
|
|
2454
|
+
if ((_schema$triggers2 = schema.triggers) !== null && _schema$triggers2 !== void 0 && _schema$triggers2.multi) {
|
|
2443
2455
|
var names = pluck("name", rule.triggers);
|
|
2444
2456
|
return names.includes(value) ? removeBy({
|
|
2445
2457
|
name: value
|
|
@@ -2451,12 +2463,12 @@ var nextTriggers = function nextTriggers(_ref13) {
|
|
|
2451
2463
|
name: value
|
|
2452
2464
|
})];
|
|
2453
2465
|
};
|
|
2454
|
-
var nextConditionAt = function nextConditionAt(
|
|
2466
|
+
var nextConditionAt = function nextConditionAt(_ref15) {
|
|
2455
2467
|
var _field$allowMatching;
|
|
2456
|
-
var schema =
|
|
2457
|
-
rule =
|
|
2458
|
-
index =
|
|
2459
|
-
value =
|
|
2468
|
+
var schema = _ref15.schema,
|
|
2469
|
+
rule = _ref15.rule,
|
|
2470
|
+
index = _ref15.index,
|
|
2471
|
+
value = _ref15.value;
|
|
2460
2472
|
var field = findField({
|
|
2461
2473
|
schema: schema,
|
|
2462
2474
|
value: value
|
|
@@ -2475,12 +2487,12 @@ var nextConditionAt = function nextConditionAt(_ref14) {
|
|
|
2475
2487
|
metadata: {}
|
|
2476
2488
|
});
|
|
2477
2489
|
};
|
|
2478
|
-
var nextActionAt = function nextActionAt(
|
|
2490
|
+
var nextActionAt = function nextActionAt(_ref16) {
|
|
2479
2491
|
var _schema$actions0;
|
|
2480
|
-
var schema =
|
|
2481
|
-
rule =
|
|
2482
|
-
index =
|
|
2483
|
-
value =
|
|
2492
|
+
var schema = _ref16.schema,
|
|
2493
|
+
rule = _ref16.rule,
|
|
2494
|
+
index = _ref16.index,
|
|
2495
|
+
value = _ref16.value;
|
|
2484
2496
|
if (!((_schema$actions0 = schema.actions) !== null && _schema$actions0 !== void 0 && _schema$actions0.resolveName)) {
|
|
2485
2497
|
var option = findActionOption({
|
|
2486
2498
|
schema: schema,
|
|
@@ -2538,11 +2550,11 @@ var nextActionAt = function nextActionAt(_ref15) {
|
|
|
2538
2550
|
metadata: channelChanged ? {} : prev.metadata
|
|
2539
2551
|
});
|
|
2540
2552
|
};
|
|
2541
|
-
var appendScopeItem = function appendScopeItem(
|
|
2553
|
+
var appendScopeItem = function appendScopeItem(_ref17) {
|
|
2542
2554
|
var _sc$requiresPhone;
|
|
2543
|
-
var schema =
|
|
2544
|
-
rule =
|
|
2545
|
-
value =
|
|
2555
|
+
var schema = _ref17.schema,
|
|
2556
|
+
rule = _ref17.rule,
|
|
2557
|
+
value = _ref17.value;
|
|
2546
2558
|
var sc = schema.scope || {};
|
|
2547
2559
|
var option = (sc.options || []).find(function (candidate) {
|
|
2548
2560
|
return optionValue(candidate) === value;
|
|
@@ -2559,12 +2571,12 @@ var appendScopeItem = function appendScopeItem(_ref16) {
|
|
|
2559
2571
|
phoneField: phoneFields[0].value
|
|
2560
2572
|
}) : option;
|
|
2561
2573
|
};
|
|
2562
|
-
var nextActionRecipientAt = function nextActionRecipientAt(
|
|
2574
|
+
var nextActionRecipientAt = function nextActionRecipientAt(_ref18) {
|
|
2563
2575
|
var _schema$actions10;
|
|
2564
|
-
var schema =
|
|
2565
|
-
rule =
|
|
2566
|
-
index =
|
|
2567
|
-
value =
|
|
2576
|
+
var schema = _ref18.schema,
|
|
2577
|
+
rule = _ref18.rule,
|
|
2578
|
+
index = _ref18.index,
|
|
2579
|
+
value = _ref18.value;
|
|
2568
2580
|
var prev = actionAt({
|
|
2569
2581
|
rule: rule,
|
|
2570
2582
|
index: index
|
|
@@ -2581,32 +2593,39 @@ var nextActionRecipientAt = function nextActionRecipientAt(_ref17) {
|
|
|
2581
2593
|
}) : value
|
|
2582
2594
|
});
|
|
2583
2595
|
};
|
|
2584
|
-
var descriptorFor = function descriptorFor(
|
|
2596
|
+
var descriptorFor = function descriptorFor(_ref19) {
|
|
2585
2597
|
var _schema$actor2;
|
|
2586
|
-
var anchor =
|
|
2587
|
-
schema =
|
|
2588
|
-
rule =
|
|
2589
|
-
index =
|
|
2590
|
-
stepKey =
|
|
2598
|
+
var anchor = _ref19.anchor,
|
|
2599
|
+
schema = _ref19.schema,
|
|
2600
|
+
rule = _ref19.rule,
|
|
2601
|
+
index = _ref19.index,
|
|
2602
|
+
stepKey = _ref19.stepKey;
|
|
2591
2603
|
switch (anchor) {
|
|
2592
2604
|
case BUILDER_ANCHORS.TRIGGER_ADD:
|
|
2593
2605
|
case BUILDER_ANCHORS.TRIGGER_REPLACE:
|
|
2594
2606
|
{
|
|
2595
|
-
var _schema$
|
|
2596
|
-
var multi = !!((_schema$
|
|
2607
|
+
var _schema$triggers3, _schema$actor, _schema$triggers4;
|
|
2608
|
+
var multi = !!((_schema$triggers3 = schema.triggers) !== null && _schema$triggers3 !== void 0 && _schema$triggers3.multi);
|
|
2597
2609
|
var isReplace = anchor === BUILDER_ANCHORS.TRIGGER_REPLACE;
|
|
2598
2610
|
var triggerTitle = isReplace ? multi && t("neetoRules.builder.panes.changeTriggers") || t("neetoRules.builder.panes.changeTrigger") : multi && t("neetoRules.builder.panes.whenEllipsis") || t("neetoRules.builder.panes.addTrigger");
|
|
2611
|
+
var group = activeTriggerGroup({
|
|
2612
|
+
schema: schema,
|
|
2613
|
+
rule: rule
|
|
2614
|
+
});
|
|
2599
2615
|
var triggerSubtitle = multi && t("neetoRules.builder.panes.triggerSubtitleMulti") || (isReplace ? t("neetoRules.builder.panes.triggerSubtitleReplace") : t("neetoRules.builder.panes.triggerSubtitleAdd"));
|
|
2600
2616
|
return {
|
|
2601
2617
|
title: triggerTitle,
|
|
2602
2618
|
subtitle: triggerSubtitle,
|
|
2603
2619
|
multi: multi,
|
|
2604
2620
|
cascade: !!((_schema$actor = schema.actor) !== null && _schema$actor !== void 0 && _schema$actor.enabled),
|
|
2605
|
-
options: (((_schema$
|
|
2621
|
+
options: (((_schema$triggers4 = schema.triggers) === null || _schema$triggers4 === void 0 ? void 0 : _schema$triggers4.options) || []).map(function (option) {
|
|
2622
|
+
var isLocked = multi && !!group && !!option.group && option.group !== group;
|
|
2606
2623
|
return {
|
|
2607
2624
|
label: option.paneLabel || option.label,
|
|
2608
2625
|
value: triggerValue(option),
|
|
2609
|
-
category: option.category
|
|
2626
|
+
category: option.category,
|
|
2627
|
+
disabled: isLocked,
|
|
2628
|
+
disabledTooltip: isLocked && (schema.triggers.groupDisabledTooltip || t("neetoRules.builder.panes.triggerGroupDisabled"))
|
|
2610
2629
|
};
|
|
2611
2630
|
}),
|
|
2612
2631
|
selectedValues: pluck("name", rule.triggers)
|
|
@@ -2876,14 +2895,14 @@ var descriptorFor = function descriptorFor(_ref18) {
|
|
|
2876
2895
|
};
|
|
2877
2896
|
}
|
|
2878
2897
|
};
|
|
2879
|
-
var commitFor = function commitFor(
|
|
2880
|
-
var anchor =
|
|
2881
|
-
schema =
|
|
2882
|
-
rule =
|
|
2883
|
-
index =
|
|
2884
|
-
stepKey =
|
|
2885
|
-
value =
|
|
2886
|
-
helpers =
|
|
2898
|
+
var commitFor = function commitFor(_ref20) {
|
|
2899
|
+
var anchor = _ref20.anchor,
|
|
2900
|
+
schema = _ref20.schema,
|
|
2901
|
+
rule = _ref20.rule,
|
|
2902
|
+
index = _ref20.index,
|
|
2903
|
+
stepKey = _ref20.stepKey,
|
|
2904
|
+
value = _ref20.value,
|
|
2905
|
+
helpers = _ref20.helpers;
|
|
2887
2906
|
var setTriggers = helpers.setTriggers,
|
|
2888
2907
|
setPerformer = helpers.setPerformer,
|
|
2889
2908
|
setConditionMode = helpers.setConditionMode,
|
|
@@ -2893,21 +2912,15 @@ var commitFor = function commitFor(_ref19) {
|
|
|
2893
2912
|
case BUILDER_ANCHORS.TRIGGER_ADD:
|
|
2894
2913
|
case BUILDER_ANCHORS.TRIGGER_REPLACE:
|
|
2895
2914
|
{
|
|
2896
|
-
var _schema$
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
}]));
|
|
2904
|
-
return "stay";
|
|
2905
|
-
}
|
|
2906
|
-
setTriggers([_objectSpread$6(_objectSpread$6({}, rule.triggers[0]), {}, {
|
|
2907
|
-
name: value
|
|
2908
|
-
})]);
|
|
2915
|
+
var _schema$triggers5;
|
|
2916
|
+
var triggers = nextTriggers({
|
|
2917
|
+
schema: schema,
|
|
2918
|
+
rule: rule,
|
|
2919
|
+
value: value
|
|
2920
|
+
});
|
|
2921
|
+
setTriggers(triggers);
|
|
2909
2922
|
var leadTime = (_schema$triggers5 = schema.triggers) === null || _schema$triggers5 === void 0 ? void 0 : _schema$triggers5.leadTime;
|
|
2910
|
-
if (leadTime !== null && leadTime !== void 0 && leadTime.fieldKey && (leadTime.appliesTo || []).includes(value) && !rule.leadTime) {
|
|
2923
|
+
if (leadTime !== null && leadTime !== void 0 && leadTime.fieldKey && (leadTime.appliesTo || []).includes(value) && pluck("name", triggers).includes(value) && !rule.leadTime) {
|
|
2911
2924
|
var _leadTime$default;
|
|
2912
2925
|
// eslint-disable-next-line @bigbinary/neeto/use-common-constants
|
|
2913
2926
|
setFieldValue("".concat(leadTime.fieldKey, ".value"), (_leadTime$default = leadTime["default"]) !== null && _leadTime$default !== void 0 ? _leadTime$default : 10);
|
|
@@ -2988,14 +3001,14 @@ var commitFor = function commitFor(_ref19) {
|
|
|
2988
3001
|
return "close";
|
|
2989
3002
|
}
|
|
2990
3003
|
};
|
|
2991
|
-
var continueTargetFor = function continueTargetFor(
|
|
3004
|
+
var continueTargetFor = function continueTargetFor(_ref21) {
|
|
2992
3005
|
var _schema$actor3;
|
|
2993
|
-
var anchor =
|
|
2994
|
-
schema =
|
|
2995
|
-
rule =
|
|
2996
|
-
index =
|
|
2997
|
-
stepKey =
|
|
2998
|
-
configPending =
|
|
3006
|
+
var anchor = _ref21.anchor,
|
|
3007
|
+
schema = _ref21.schema,
|
|
3008
|
+
rule = _ref21.rule,
|
|
3009
|
+
index = _ref21.index,
|
|
3010
|
+
stepKey = _ref21.stepKey,
|
|
3011
|
+
configPending = _ref21.configPending;
|
|
2999
3012
|
switch (anchor) {
|
|
3000
3013
|
case BUILDER_ANCHORS.TRIGGER_ADD:
|
|
3001
3014
|
case BUILDER_ANCHORS.TRIGGER_REPLACE:
|
|
@@ -3107,26 +3120,27 @@ var continueTargetFor = function continueTargetFor(_ref20) {
|
|
|
3107
3120
|
return null;
|
|
3108
3121
|
}
|
|
3109
3122
|
};
|
|
3110
|
-
var replaceAt = function replaceAt(
|
|
3111
|
-
var list =
|
|
3112
|
-
index =
|
|
3113
|
-
item =
|
|
3123
|
+
var replaceAt = function replaceAt(_ref22) {
|
|
3124
|
+
var list = _ref22.list,
|
|
3125
|
+
index = _ref22.index,
|
|
3126
|
+
item = _ref22.item;
|
|
3114
3127
|
var next = _toConsumableArray(list);
|
|
3115
3128
|
// eslint-disable-next-line security/detect-object-injection
|
|
3116
3129
|
next[index] = item;
|
|
3117
3130
|
return next;
|
|
3118
3131
|
};
|
|
3119
|
-
var applyPreview = function applyPreview(
|
|
3120
|
-
var rule =
|
|
3121
|
-
schema =
|
|
3122
|
-
anchor =
|
|
3123
|
-
index =
|
|
3124
|
-
value =
|
|
3132
|
+
var applyPreview = function applyPreview(_ref23) {
|
|
3133
|
+
var rule = _ref23.rule,
|
|
3134
|
+
schema = _ref23.schema,
|
|
3135
|
+
anchor = _ref23.anchor,
|
|
3136
|
+
index = _ref23.index,
|
|
3137
|
+
value = _ref23.value;
|
|
3125
3138
|
switch (anchor) {
|
|
3126
3139
|
case BUILDER_ANCHORS.TRIGGER_ADD:
|
|
3127
3140
|
case BUILDER_ANCHORS.TRIGGER_REPLACE:
|
|
3128
|
-
|
|
3129
|
-
|
|
3141
|
+
{
|
|
3142
|
+
var _schema$triggers6, _leadTime$default2;
|
|
3143
|
+
var triggers = Array.isArray(value) ? value.map(function (name) {
|
|
3130
3144
|
return {
|
|
3131
3145
|
name: name
|
|
3132
3146
|
};
|
|
@@ -3134,8 +3148,18 @@ var applyPreview = function applyPreview(_ref22) {
|
|
|
3134
3148
|
schema: schema,
|
|
3135
3149
|
rule: rule,
|
|
3136
3150
|
value: value
|
|
3137
|
-
})
|
|
3138
|
-
|
|
3151
|
+
});
|
|
3152
|
+
var leadTime = (_schema$triggers6 = schema.triggers) === null || _schema$triggers6 === void 0 ? void 0 : _schema$triggers6.leadTime;
|
|
3153
|
+
var needsDefaultLeadTime = !!(leadTime !== null && leadTime !== void 0 && leadTime.fieldKey) && !rule.leadTime && triggers.some(function (_ref24) {
|
|
3154
|
+
var name = _ref24.name;
|
|
3155
|
+
return (leadTime.appliesTo || []).includes(name);
|
|
3156
|
+
});
|
|
3157
|
+
return _objectSpread$6(_objectSpread$6({}, rule), {}, {
|
|
3158
|
+
triggers: triggers
|
|
3159
|
+
}, needsDefaultLeadTime && {
|
|
3160
|
+
leadTime: (_leadTime$default2 = leadTime["default"]) !== null && _leadTime$default2 !== void 0 ? _leadTime$default2 : 10
|
|
3161
|
+
});
|
|
3162
|
+
}
|
|
3139
3163
|
case BUILDER_ANCHORS.TRIGGER_ACTOR:
|
|
3140
3164
|
return _objectSpread$6(_objectSpread$6({}, rule), {}, {
|
|
3141
3165
|
performer: value
|
|
@@ -4660,6 +4684,8 @@ var OptionsPane = function OptionsPane(_ref) {
|
|
|
4660
4684
|
return selectedValues.includes(optionValue) ? selectedValues.filter(isNot(optionValue)) : [].concat(_toConsumableArray(selectedValues.filter(Boolean)), [optionValue]);
|
|
4661
4685
|
};
|
|
4662
4686
|
var previewHandlers = function previewHandlers(optionValue) {
|
|
4687
|
+
var isDisabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4688
|
+
if (isDisabled) return {};
|
|
4663
4689
|
var value = multi ? multiCandidate(optionValue) : optionValue;
|
|
4664
4690
|
return {
|
|
4665
4691
|
onMouseEnter: function onMouseEnter() {
|
|
@@ -4734,7 +4760,15 @@ var OptionsPane = function OptionsPane(_ref) {
|
|
|
4734
4760
|
var popover = option.disabledPopover || (isNodeReason ? {
|
|
4735
4761
|
description: reason
|
|
4736
4762
|
} : null);
|
|
4737
|
-
if (!Icon && !isTextReason && !popover)
|
|
4763
|
+
if (!Icon && !isTextReason && !popover) {
|
|
4764
|
+
return option.disabled && option.disabledTooltip ? /*#__PURE__*/jsx(Tooltip, {
|
|
4765
|
+
content: option.disabledTooltip,
|
|
4766
|
+
position: "top",
|
|
4767
|
+
children: /*#__PURE__*/jsx("span", {
|
|
4768
|
+
children: option.label
|
|
4769
|
+
})
|
|
4770
|
+
}) : option.label;
|
|
4771
|
+
}
|
|
4738
4772
|
return /*#__PURE__*/jsxs("span", {
|
|
4739
4773
|
className: "mb-pane-option",
|
|
4740
4774
|
children: [Icon && /*#__PURE__*/jsx(Icon, {
|
|
@@ -4802,13 +4836,13 @@ var OptionsPane = function OptionsPane(_ref) {
|
|
|
4802
4836
|
checked: isSelected(option.value),
|
|
4803
4837
|
disabled: option.disabled,
|
|
4804
4838
|
label: optionLabel(option),
|
|
4805
|
-
labelProps: previewHandlers(option.value),
|
|
4839
|
+
labelProps: previewHandlers(option.value, option.disabled),
|
|
4806
4840
|
onCheckedChange: function onCheckedChange() {
|
|
4807
4841
|
return handleSelect(option.value);
|
|
4808
4842
|
}
|
|
4809
4843
|
}, option.icon || option.disabledReason ? {
|
|
4810
4844
|
dataTestid: option.value
|
|
4811
|
-
} : {}), previewHandlers(option.value)), option.value);
|
|
4845
|
+
} : {}), previewHandlers(option.value, option.disabled)), option.value);
|
|
4812
4846
|
})]
|
|
4813
4847
|
}, category || "_uncategorized");
|
|
4814
4848
|
})
|
|
@@ -4829,11 +4863,11 @@ var OptionsPane = function OptionsPane(_ref) {
|
|
|
4829
4863
|
return /*#__PURE__*/jsx(RadioGroup.Item, _objectSpread$3(_objectSpread$3({
|
|
4830
4864
|
disabled: option.disabled,
|
|
4831
4865
|
label: optionLabel(option),
|
|
4832
|
-
labelProps: previewHandlers(option.value),
|
|
4866
|
+
labelProps: previewHandlers(option.value, option.disabled),
|
|
4833
4867
|
value: option.value
|
|
4834
4868
|
}, option.icon || option.disabledReason ? {
|
|
4835
4869
|
"data-testid": option.value
|
|
4836
|
-
} : {}), previewHandlers(option.value)), option.value);
|
|
4870
|
+
} : {}), previewHandlers(option.value, option.disabled)), option.value);
|
|
4837
4871
|
})));
|
|
4838
4872
|
}).filter(Boolean)
|
|
4839
4873
|
});
|