@bigbinary/neeto-rules-frontend 0.7.1 → 0.7.3
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 +2 -1
- package/dist/index.cjs.js +225 -130
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +225 -130
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs.js
CHANGED
|
@@ -211,6 +211,24 @@ var Title = function Title(_ref) {
|
|
|
211
211
|
});
|
|
212
212
|
};
|
|
213
213
|
|
|
214
|
+
var PREVIEW_CONDITION_LIMIT = 3;
|
|
215
|
+
var ACTION_TYPE = {
|
|
216
|
+
TEXT: "text",
|
|
217
|
+
NUMBER: "number",
|
|
218
|
+
DECIMAL: "decimal",
|
|
219
|
+
REGEX: "regex",
|
|
220
|
+
DATE: "date",
|
|
221
|
+
EMAIL: "email",
|
|
222
|
+
EMAIL_TO: "emailTo",
|
|
223
|
+
EMAIL_TO_IDS: "emailToIds",
|
|
224
|
+
SMS_TO_NUMBERS: "smsToNumbers",
|
|
225
|
+
MULTI_SELECT: "multiSelect",
|
|
226
|
+
SEND_TO_API: "sendToApi",
|
|
227
|
+
DROPDOWN: "dropdown",
|
|
228
|
+
MULTISELECT: "multiSelect"
|
|
229
|
+
};
|
|
230
|
+
var TEXT_FIELDS = [ACTION_TYPE.TEXT, ACTION_TYPE.NUMBER, ACTION_TYPE.DECIMAL, ACTION_TYPE.REGEX, ACTION_TYPE.DATE];
|
|
231
|
+
|
|
214
232
|
var MultiSelectValues = function MultiSelectValues(_ref) {
|
|
215
233
|
var separator = _ref.separator,
|
|
216
234
|
values = _ref.values;
|
|
@@ -239,6 +257,48 @@ var getEntityDisplayValue = function getEntityDisplayValue(entitiy, entitiyOptio
|
|
|
239
257
|
value: entitiy.metadata.value
|
|
240
258
|
}, entitiyOption.dropdownOptions)) === null || _findBy === void 0 || (_findBy = _findBy.label) === null || _findBy === void 0 ? void 0 : _findBy.toLowerCase();
|
|
241
259
|
};
|
|
260
|
+
var getActionDisplayValue = function getActionDisplayValue(action, actionOption) {
|
|
261
|
+
var displayValueData = {
|
|
262
|
+
displayValue: null,
|
|
263
|
+
isBulk: false
|
|
264
|
+
};
|
|
265
|
+
if (TEXT_FIELDS.includes(actionOption.type)) {
|
|
266
|
+
var _action$metadata$valu;
|
|
267
|
+
displayValueData.displayValue = (_action$metadata$valu = action.metadata.value) === null || _action$metadata$valu === void 0 ? void 0 : _action$metadata$valu.toLowerCase();
|
|
268
|
+
return displayValueData;
|
|
269
|
+
}
|
|
270
|
+
switch (actionOption.type) {
|
|
271
|
+
case ACTION_TYPE.DROPDOWN:
|
|
272
|
+
{
|
|
273
|
+
displayValueData.displayValue = getEntityDisplayValue(action, actionOption);
|
|
274
|
+
return displayValueData;
|
|
275
|
+
}
|
|
276
|
+
case ACTION_TYPE.EMAIL_TO_IDS:
|
|
277
|
+
{
|
|
278
|
+
displayValueData.isBulk = true;
|
|
279
|
+
displayValueData.displayValue = action.metadata.emails;
|
|
280
|
+
return displayValueData;
|
|
281
|
+
}
|
|
282
|
+
case ACTION_TYPE.EMAIL_TO:
|
|
283
|
+
{
|
|
284
|
+
displayValueData.displayValue = action.displayValue;
|
|
285
|
+
return displayValueData;
|
|
286
|
+
}
|
|
287
|
+
case ACTION_TYPE.SMS_TO_NUMBERS:
|
|
288
|
+
{
|
|
289
|
+
displayValueData.isBulk = true;
|
|
290
|
+
displayValueData.displayValue = action.metadata.phoneNumbers;
|
|
291
|
+
return displayValueData;
|
|
292
|
+
}
|
|
293
|
+
case ACTION_TYPE.SEND_TO_API:
|
|
294
|
+
{
|
|
295
|
+
displayValueData.displayValue = action.metadata.endpoint;
|
|
296
|
+
return displayValueData;
|
|
297
|
+
}
|
|
298
|
+
default:
|
|
299
|
+
return null;
|
|
300
|
+
}
|
|
301
|
+
};
|
|
242
302
|
|
|
243
303
|
var ActionsDetail = function ActionsDetail(_ref) {
|
|
244
304
|
var actions = _ref.actions;
|
|
@@ -256,9 +316,26 @@ var ActionsDetail = function ActionsDetail(_ref) {
|
|
|
256
316
|
}) : t("neetoRules.common.then");
|
|
257
317
|
};
|
|
258
318
|
var renderActionValues = function renderActionValues(action, actionOption) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
319
|
+
var _actionOption$separat, _getActionDisplayValu;
|
|
320
|
+
var commonSeperator = actionOption.type === ACTION_TYPE.SEND_TO_API ? t("neetoRules.common.at") : t("neetoRules.common.to");
|
|
321
|
+
var separator = (actionOption === null || actionOption === void 0 || (_actionOption$separat = actionOption.separator) === null || _actionOption$separat === void 0 ? void 0 : _actionOption$separat.toLowerCase()) || commonSeperator;
|
|
322
|
+
var _ref2 = (_getActionDisplayValu = getActionDisplayValue(action, actionOption)) !== null && _getActionDisplayValu !== void 0 ? _getActionDisplayValu : {},
|
|
323
|
+
displayValue = _ref2.displayValue,
|
|
324
|
+
isBulk = _ref2.isBulk;
|
|
325
|
+
if (actionOption.type === ACTION_TYPE.MULTISELECT) {
|
|
326
|
+
var values = ramda.pluck("label", actionOption.dropdownOptions.filter(function (_ref3) {
|
|
327
|
+
var value = _ref3.value;
|
|
328
|
+
return action.metadata.value.includes(value);
|
|
329
|
+
}));
|
|
330
|
+
return /*#__PURE__*/jsxRuntime.jsx(MultiSelectValues, {
|
|
331
|
+
values: values,
|
|
332
|
+
separator: t("neetoRules.common.and", {
|
|
333
|
+
what: ""
|
|
334
|
+
})
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
if (!displayValue) return null;
|
|
338
|
+
if (!isBulk) {
|
|
262
339
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
263
340
|
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
264
341
|
className: "neeto-ui-text-gray-700",
|
|
@@ -269,23 +346,20 @@ var ActionsDetail = function ActionsDetail(_ref) {
|
|
|
269
346
|
className: "neeto-ui-text-gray-800",
|
|
270
347
|
style: "h5",
|
|
271
348
|
weight: "semibold",
|
|
272
|
-
children:
|
|
349
|
+
children: displayValue === null || displayValue === void 0 ? void 0 : displayValue.toLowerCase()
|
|
273
350
|
})]
|
|
274
351
|
});
|
|
275
352
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
return null;
|
|
353
|
+
return displayValue.map(function (value, index) {
|
|
354
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
355
|
+
className: "mr-1 flex",
|
|
356
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
357
|
+
style: "h5",
|
|
358
|
+
weight: "semibold",
|
|
359
|
+
children: value
|
|
360
|
+
}, index), index !== displayValue.length - 1 && ", "]
|
|
361
|
+
}, index);
|
|
362
|
+
});
|
|
289
363
|
};
|
|
290
364
|
var renderAction = function renderAction(action) {
|
|
291
365
|
var actionOption = neetoCist.findBy({
|
|
@@ -330,10 +404,68 @@ var ActionsDetail = function ActionsDetail(_ref) {
|
|
|
330
404
|
});
|
|
331
405
|
};
|
|
332
406
|
|
|
407
|
+
var OPERATORS$1 = {
|
|
408
|
+
or: "or_operator",
|
|
409
|
+
and: "and_operator"
|
|
410
|
+
};
|
|
411
|
+
var OPERATOR_LABELS = {
|
|
412
|
+
or_operator: i18next.t("neetoRules.operators.or"),
|
|
413
|
+
and_operator: i18next.t("neetoRules.operators.and")
|
|
414
|
+
};
|
|
415
|
+
var VERB_LABELS = {
|
|
416
|
+
is: i18next.t("neetoRules.conditionVerbs.is"),
|
|
417
|
+
is_not: i18next.t("neetoRules.conditionVerbs.isNot"),
|
|
418
|
+
contains: i18next.t("neetoRules.conditionVerbs.contains"),
|
|
419
|
+
does_not_contain: i18next.t("neetoRules.conditionVerbs.doesNotContain"),
|
|
420
|
+
contains_any_of: i18next.t("neetoRules.conditionVerbs.containsAnyOf"),
|
|
421
|
+
contains_all_of: i18next.t("neetoRules.conditionVerbs.containsAllOf"),
|
|
422
|
+
contains_none_of: i18next.t("neetoRules.conditionVerbs.containsNoneOf"),
|
|
423
|
+
starts_with: i18next.t("neetoRules.conditionVerbs.startsWith"),
|
|
424
|
+
ends_with: i18next.t("neetoRules.conditionVerbs.endsWith"),
|
|
425
|
+
less_than: i18next.t("neetoRules.conditionVerbs.lessThan"),
|
|
426
|
+
greater_than: i18next.t("neetoRules.conditionVerbs.greaterThan"),
|
|
427
|
+
any_time: i18next.t("neetoRules.conditionVerbs.anyTime"),
|
|
428
|
+
during: i18next.t("neetoRules.conditionVerbs.during"),
|
|
429
|
+
not_during: i18next.t("neetoRules.conditionVerbs.notDuring"),
|
|
430
|
+
any_of: i18next.t("neetoRules.conditionVerbs.anyOf"),
|
|
431
|
+
none_of: i18next.t("neetoRules.conditionVerbs.noneOf"),
|
|
432
|
+
is_before: i18next.t("neetoRules.conditionVerbs.isBefore"),
|
|
433
|
+
is_after: i18next.t("neetoRules.conditionVerbs.isAfter")
|
|
434
|
+
};
|
|
435
|
+
var CONDITION_VALUE_TYPES = {
|
|
436
|
+
text: "text",
|
|
437
|
+
number: "number",
|
|
438
|
+
decimal: "decimal",
|
|
439
|
+
url: "url",
|
|
440
|
+
email: "email",
|
|
441
|
+
dropdown: "dropdown",
|
|
442
|
+
multiSelect: "multi-select",
|
|
443
|
+
multiSelectCreate: "multi-select-create",
|
|
444
|
+
date: "date",
|
|
445
|
+
regex: "regex",
|
|
446
|
+
textarea: "textarea"
|
|
447
|
+
};
|
|
448
|
+
var INPUT_FIELD_TYPES = ["email", "text", "number", "decimal", "url", "regex"];
|
|
449
|
+
var MAXIMUM_OPTION_LENGTH$3 = 7;
|
|
450
|
+
|
|
451
|
+
function ownKeys$r(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; }
|
|
452
|
+
function _objectSpread$p(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$r(Object(t), !0).forEach(function (r) { _defineProperty$2(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$r(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
333
453
|
var ConditionsDetail = function ConditionsDetail(_ref) {
|
|
334
454
|
var conditions = _ref.conditions,
|
|
335
455
|
conditionOptions = _ref.conditionOptions,
|
|
336
|
-
conditionVerbs = _ref.conditionVerbs
|
|
456
|
+
_ref$conditionVerbs = _ref.conditionVerbs,
|
|
457
|
+
conditionVerbs = _ref$conditionVerbs === void 0 ? {} : _ref$conditionVerbs,
|
|
458
|
+
_ref$hasEvent = _ref.hasEvent,
|
|
459
|
+
hasEvent = _ref$hasEvent === void 0 ? true : _ref$hasEvent;
|
|
460
|
+
var _useState = React.useState(false),
|
|
461
|
+
_useState2 = _slicedToArray$1(_useState, 2),
|
|
462
|
+
viewMore = _useState2[0],
|
|
463
|
+
setViewMore = _useState2[1];
|
|
464
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
465
|
+
t = _useTranslation.t;
|
|
466
|
+
var conditionsList = conditions.value;
|
|
467
|
+
var allConditions = viewMore && conditionsList.length > PREVIEW_CONDITION_LIMIT ? conditionsList : conditionsList.slice(0, PREVIEW_CONDITION_LIMIT);
|
|
468
|
+
var allConditionVerbs = _objectSpread$p(_objectSpread$p({}, VERB_LABELS), conditionVerbs);
|
|
337
469
|
var getLogicOperator = function getLogicOperator(joinType) {
|
|
338
470
|
return joinType === "or_operator" ? "or" : "and";
|
|
339
471
|
};
|
|
@@ -354,7 +486,7 @@ var ConditionsDetail = function ConditionsDetail(_ref) {
|
|
|
354
486
|
}));
|
|
355
487
|
return /*#__PURE__*/jsxRuntime.jsx(MultiSelectValues, {
|
|
356
488
|
values: values,
|
|
357
|
-
separator:
|
|
489
|
+
separator: t("neetoRules.common.or")
|
|
358
490
|
});
|
|
359
491
|
}
|
|
360
492
|
if (conditionOption.type === "dropdown") {
|
|
@@ -368,12 +500,12 @@ var ConditionsDetail = function ConditionsDetail(_ref) {
|
|
|
368
500
|
return null;
|
|
369
501
|
};
|
|
370
502
|
var renderCondition = function renderCondition(condition) {
|
|
371
|
-
var
|
|
503
|
+
var _allConditionVerbs$co;
|
|
372
504
|
var conditionOption = neetoCist.findBy({
|
|
373
505
|
value: condition.field
|
|
374
506
|
}, conditionOptions);
|
|
375
507
|
if (!conditionOption) return null;
|
|
376
|
-
var conditionVerb = (
|
|
508
|
+
var conditionVerb = (_allConditionVerbs$co = allConditionVerbs[condition.verb]) === null || _allConditionVerbs$co === void 0 ? void 0 : _allConditionVerbs$co.toLowerCase();
|
|
377
509
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
378
510
|
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
379
511
|
className: "neeto-ui-text-gray-800",
|
|
@@ -388,31 +520,46 @@ var ConditionsDetail = function ConditionsDetail(_ref) {
|
|
|
388
520
|
}), renderConditionValues(condition, conditionOption)]
|
|
389
521
|
});
|
|
390
522
|
};
|
|
391
|
-
return /*#__PURE__*/jsxRuntime.
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
523
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
524
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
525
|
+
className: "mt-2",
|
|
526
|
+
children: allConditions.map(function (condition, index) {
|
|
527
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
528
|
+
className: "mb-2 flex flex-wrap gap-x-2 gap-y-2",
|
|
529
|
+
children: [!index && hasEvent && /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
530
|
+
className: "neeto-ui-text-gray-700",
|
|
531
|
+
style: "h5",
|
|
532
|
+
weight: "normal",
|
|
533
|
+
children: t("neetoRules.common.and", {
|
|
534
|
+
what: ""
|
|
535
|
+
})
|
|
536
|
+
}), !!index && /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
537
|
+
className: "neeto-ui-text-gray-800",
|
|
538
|
+
style: "h5",
|
|
539
|
+
weight: "semibold",
|
|
540
|
+
children: getLogicOperator(condition.joinType)
|
|
541
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
542
|
+
className: "neeto-ui-text-gray-700",
|
|
543
|
+
style: "h5",
|
|
544
|
+
weight: "normal",
|
|
545
|
+
children: t("neetoRules.common.when")
|
|
546
|
+
}), renderCondition(condition)]
|
|
547
|
+
}, condition.id);
|
|
548
|
+
})
|
|
549
|
+
}), conditionsList.length > 3 && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
550
|
+
className: "mt-3 w-full",
|
|
551
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
552
|
+
icon: !viewMore ? neetoIcons.Down : neetoIcons.Up,
|
|
553
|
+
size: "small",
|
|
554
|
+
style: "link",
|
|
555
|
+
label: !viewMore ? t("neetoRules.common.viewMore") : t("neetoRules.common.viewLess"),
|
|
556
|
+
onClick: function onClick() {
|
|
557
|
+
return setViewMore(function (prevState) {
|
|
558
|
+
return !prevState;
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
})
|
|
562
|
+
})]
|
|
416
563
|
});
|
|
417
564
|
};
|
|
418
565
|
|
|
@@ -421,21 +568,17 @@ var EventsDetail = function EventsDetail(_ref) {
|
|
|
421
568
|
var events = _ref.events,
|
|
422
569
|
performer = _ref.performer,
|
|
423
570
|
conditions = _ref.conditions;
|
|
424
|
-
var
|
|
425
|
-
|
|
426
|
-
viewMore = _useState2[0],
|
|
427
|
-
setViewMore = _useState2[1];
|
|
571
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
572
|
+
t = _useTranslation.t;
|
|
428
573
|
var eventNames = ramda.pluck("name", events.value);
|
|
429
574
|
var allEvents = events.eventOptions.filter(function (event) {
|
|
430
575
|
return eventNames === null || eventNames === void 0 ? void 0 : eventNames.includes(event.value);
|
|
431
576
|
});
|
|
432
|
-
var conditionsList = conditions.value;
|
|
433
|
-
var allConditions = viewMore && conditionsList.length > 3 ? conditionsList : conditionsList.slice(0, 3);
|
|
434
577
|
var currentPerformer = neetoCist.findBy({
|
|
435
578
|
value: performer.value
|
|
436
579
|
}, performer.options);
|
|
437
580
|
return /*#__PURE__*/jsxRuntime.jsxs(Title, {
|
|
438
|
-
title:
|
|
581
|
+
title: t("neetoRules.common.when"),
|
|
439
582
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
440
583
|
className: "flex flex-wrap gap-x-2 gap-y-2",
|
|
441
584
|
children: [allEvents.map(function (event, index) {
|
|
@@ -445,12 +588,12 @@ var EventsDetail = function EventsDetail(_ref) {
|
|
|
445
588
|
className: "neeto-ui-text-gray-700 my-auto",
|
|
446
589
|
style: "h5",
|
|
447
590
|
weight: "normal",
|
|
448
|
-
children:
|
|
591
|
+
children: t("neetoRules.common.when")
|
|
449
592
|
}), !!index && /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
450
593
|
className: "neeto-ui-text-gray-700 my-auto",
|
|
451
594
|
style: "h5",
|
|
452
595
|
weight: "normal",
|
|
453
|
-
children:
|
|
596
|
+
children: t("neetoRules.common.or")
|
|
454
597
|
}), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
455
598
|
className: "neeto-ui-text-gray-800",
|
|
456
599
|
style: "h5",
|
|
@@ -462,7 +605,7 @@ var EventsDetail = function EventsDetail(_ref) {
|
|
|
462
605
|
className: "neeto-ui-text-gray-700",
|
|
463
606
|
style: "h5",
|
|
464
607
|
weight: "normal",
|
|
465
|
-
children:
|
|
608
|
+
children: t("neetoRules.common.by")
|
|
466
609
|
}), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
467
610
|
className: "neeto-ui-text-gray-800",
|
|
468
611
|
style: "h5",
|
|
@@ -470,30 +613,18 @@ var EventsDetail = function EventsDetail(_ref) {
|
|
|
470
613
|
children: currentPerformer === null || currentPerformer === void 0 || (_currentPerformer$lab = currentPerformer.label) === null || _currentPerformer$lab === void 0 ? void 0 : _currentPerformer$lab.toLowerCase()
|
|
471
614
|
})]
|
|
472
615
|
}), /*#__PURE__*/jsxRuntime.jsx(ConditionsDetail, {
|
|
616
|
+
conditions: conditions,
|
|
473
617
|
conditionOptions: conditions.conditionOptions,
|
|
474
|
-
conditionVerbs: conditions.verbs
|
|
475
|
-
conditions: allConditions
|
|
476
|
-
}), conditionsList.length > 3 && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
477
|
-
className: "mt-3 w-full",
|
|
478
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
479
|
-
icon: !viewMore ? neetoIcons.Down : neetoIcons.Up,
|
|
480
|
-
size: "small",
|
|
481
|
-
style: "link",
|
|
482
|
-
label: !viewMore ? i18next.t("neetoRules.common.viewMore") : i18next.t("neetoRules.common.viewLess"),
|
|
483
|
-
onClick: function onClick() {
|
|
484
|
-
return setViewMore(function (prevState) {
|
|
485
|
-
return !prevState;
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
})
|
|
618
|
+
conditionVerbs: conditions.verbs
|
|
489
619
|
})]
|
|
490
620
|
});
|
|
491
621
|
};
|
|
492
622
|
|
|
493
623
|
function ownKeys$q(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; }
|
|
494
624
|
function _objectSpread$o(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$q(Object(t), !0).forEach(function (r) { _defineProperty$2(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$q(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
495
|
-
var RulePreview = function
|
|
496
|
-
var
|
|
625
|
+
var RulePreview = reactUtils.withT(function (_ref) {
|
|
626
|
+
var t = _ref.t,
|
|
627
|
+
isLoading = _ref.isLoading,
|
|
497
628
|
ruleDetails = _ref.ruleDetails,
|
|
498
629
|
isOpen = _ref.isOpen,
|
|
499
630
|
onClose = _ref.onClose,
|
|
@@ -536,10 +667,18 @@ var RulePreview = function RulePreview(_ref) {
|
|
|
536
667
|
children: ruleDetails.entity.value
|
|
537
668
|
})]
|
|
538
669
|
})]
|
|
539
|
-
}), /*#__PURE__*/jsxRuntime.jsx(EventsDetail, {
|
|
670
|
+
}), ruleDetails.events && neetoCist.isNotEmpty(ruleDetails.events) ? /*#__PURE__*/jsxRuntime.jsx(EventsDetail, {
|
|
540
671
|
conditions: ruleDetails.conditions,
|
|
541
672
|
events: ruleDetails.events,
|
|
542
673
|
performer: ruleDetails.performer
|
|
674
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(Title, {
|
|
675
|
+
title: t("neetoRules.common.when"),
|
|
676
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ConditionsDetail, {
|
|
677
|
+
conditionOptions: ruleDetails.conditions.conditionOptions,
|
|
678
|
+
conditionVerbs: ruleDetails.conditions.verbs,
|
|
679
|
+
conditions: ruleDetails.conditions,
|
|
680
|
+
hasEvent: false
|
|
681
|
+
})
|
|
543
682
|
}), /*#__PURE__*/jsxRuntime.jsx(ActionsDetail, {
|
|
544
683
|
actions: ruleDetails.actions
|
|
545
684
|
})]
|
|
@@ -547,7 +686,7 @@ var RulePreview = function RulePreview(_ref) {
|
|
|
547
686
|
})]
|
|
548
687
|
})
|
|
549
688
|
});
|
|
550
|
-
};
|
|
689
|
+
});
|
|
551
690
|
|
|
552
691
|
function _typeof$2(o) {
|
|
553
692
|
"@babel/helpers - typeof";
|
|
@@ -9937,52 +10076,8 @@ var DEFAULT_RULE_ACTION = {
|
|
|
9937
10076
|
};
|
|
9938
10077
|
var EDITOR_ADDONS = ["code-block", "block-quote", "image-upload"];
|
|
9939
10078
|
var EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
9940
|
-
var MAXIMUM_OPTION_LENGTH$3 = 7;
|
|
9941
|
-
var ACTION_INPUT_TYPES = ["text", "number", "decimal", "regex"];
|
|
9942
|
-
|
|
9943
|
-
var OPERATORS$1 = {
|
|
9944
|
-
or: "or_operator",
|
|
9945
|
-
and: "and_operator"
|
|
9946
|
-
};
|
|
9947
|
-
var OPERATOR_LABELS = {
|
|
9948
|
-
or_operator: i18next.t("neetoRules.operators.or"),
|
|
9949
|
-
and_operator: i18next.t("neetoRules.operators.and")
|
|
9950
|
-
};
|
|
9951
|
-
var VERB_LABELS = {
|
|
9952
|
-
is: i18next.t("neetoRules.conditionVerbs.is"),
|
|
9953
|
-
is_not: i18next.t("neetoRules.conditionVerbs.isNot"),
|
|
9954
|
-
contains: i18next.t("neetoRules.conditionVerbs.contains"),
|
|
9955
|
-
does_not_contain: i18next.t("neetoRules.conditionVerbs.doesNotContain"),
|
|
9956
|
-
contains_any_of: i18next.t("neetoRules.conditionVerbs.containsAnyOf"),
|
|
9957
|
-
contains_all_of: i18next.t("neetoRules.conditionVerbs.containsAllOf"),
|
|
9958
|
-
contains_none_of: i18next.t("neetoRules.conditionVerbs.containsNoneOf"),
|
|
9959
|
-
starts_with: i18next.t("neetoRules.conditionVerbs.startsWith"),
|
|
9960
|
-
ends_with: i18next.t("neetoRules.conditionVerbs.endsWith"),
|
|
9961
|
-
less_than: i18next.t("neetoRules.conditionVerbs.lessThan"),
|
|
9962
|
-
greater_than: i18next.t("neetoRules.conditionVerbs.greaterThan"),
|
|
9963
|
-
any_time: i18next.t("neetoRules.conditionVerbs.anyTime"),
|
|
9964
|
-
during: i18next.t("neetoRules.conditionVerbs.during"),
|
|
9965
|
-
not_during: i18next.t("neetoRules.conditionVerbs.notDuring"),
|
|
9966
|
-
any_of: i18next.t("neetoRules.conditionVerbs.anyOf"),
|
|
9967
|
-
none_of: i18next.t("neetoRules.conditionVerbs.noneOf"),
|
|
9968
|
-
is_before: i18next.t("neetoRules.conditionVerbs.isBefore"),
|
|
9969
|
-
is_after: i18next.t("neetoRules.conditionVerbs.isAfter")
|
|
9970
|
-
};
|
|
9971
|
-
var CONDITION_VALUE_TYPES = {
|
|
9972
|
-
text: "text",
|
|
9973
|
-
number: "number",
|
|
9974
|
-
decimal: "decimal",
|
|
9975
|
-
url: "url",
|
|
9976
|
-
email: "email",
|
|
9977
|
-
dropdown: "dropdown",
|
|
9978
|
-
multiSelect: "multi-select",
|
|
9979
|
-
multiSelectCreate: "multi-select-create",
|
|
9980
|
-
date: "date",
|
|
9981
|
-
regex: "regex",
|
|
9982
|
-
textarea: "textarea"
|
|
9983
|
-
};
|
|
9984
|
-
var INPUT_FIELD_TYPES = ["email", "text", "number", "decimal", "url", "regex"];
|
|
9985
10079
|
var MAXIMUM_OPTION_LENGTH$2 = 7;
|
|
10080
|
+
var ACTION_INPUT_TYPES = ["text", "number", "decimal", "regex"];
|
|
9986
10081
|
|
|
9987
10082
|
function ownKeys$l(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; }
|
|
9988
10083
|
function _objectSpread$k(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$l(Object(t), !0).forEach(function (r) { _defineProperty$2(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$l(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -11066,7 +11161,7 @@ var DropdownField$1 = function DropdownField(_ref) {
|
|
|
11066
11161
|
onClose: handleClose,
|
|
11067
11162
|
children: /*#__PURE__*/jsxRuntime.jsxs(Menu$a, {
|
|
11068
11163
|
className: "max-h-60 max-w-2xl p-3",
|
|
11069
|
-
children: [dropdownOptions.length > MAXIMUM_OPTION_LENGTH$
|
|
11164
|
+
children: [dropdownOptions.length > MAXIMUM_OPTION_LENGTH$2 && /*#__PURE__*/jsxRuntime.jsx(Input__default["default"], {
|
|
11070
11165
|
autoFocus: true,
|
|
11071
11166
|
className: "mb-1",
|
|
11072
11167
|
"data-cy": "search-text-field",
|
|
@@ -11080,7 +11175,7 @@ var DropdownField$1 = function DropdownField(_ref) {
|
|
|
11080
11175
|
return e.stopPropagation();
|
|
11081
11176
|
}
|
|
11082
11177
|
}), /*#__PURE__*/jsxRuntime.jsx(OptionsWrapper, {
|
|
11083
|
-
hasScroll: dropdownOptions.length > MAXIMUM_OPTION_LENGTH$
|
|
11178
|
+
hasScroll: dropdownOptions.length > MAXIMUM_OPTION_LENGTH$2,
|
|
11084
11179
|
children: searchedOptions.map(function (option, idx) {
|
|
11085
11180
|
return /*#__PURE__*/jsxRuntime.jsx(MenuItem$9.Button, {
|
|
11086
11181
|
"data-cy": "".concat(utils.joinHyphenCase(option.label), "-menu-item"),
|
|
@@ -11714,7 +11809,7 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
11714
11809
|
onClose: handleClose,
|
|
11715
11810
|
children: /*#__PURE__*/jsxRuntime.jsxs(Menu$9, {
|
|
11716
11811
|
className: "max-h-60 max-w-2xl p-3",
|
|
11717
|
-
children: [dropDownOptions.length > MAXIMUM_OPTION_LENGTH$
|
|
11812
|
+
children: [dropDownOptions.length > MAXIMUM_OPTION_LENGTH$2 && /*#__PURE__*/jsxRuntime.jsx(Input__default["default"], {
|
|
11718
11813
|
autoFocus: true,
|
|
11719
11814
|
className: "mb-1",
|
|
11720
11815
|
"data-cy": "search-text-field",
|
|
@@ -11725,7 +11820,7 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
11725
11820
|
return setSearchTerm(e.target.value);
|
|
11726
11821
|
}
|
|
11727
11822
|
}), /*#__PURE__*/jsxRuntime.jsx(OptionsWrapper, {
|
|
11728
|
-
hasScroll: dropDownOptions.length > MAXIMUM_OPTION_LENGTH$
|
|
11823
|
+
hasScroll: dropDownOptions.length > MAXIMUM_OPTION_LENGTH$2,
|
|
11729
11824
|
children: searchedOptions.map(function (option, idx) {
|
|
11730
11825
|
return /*#__PURE__*/jsxRuntime.jsx(MenuItem$8.Button, {
|
|
11731
11826
|
"data-cy": "".concat(utils.joinHyphenCase(option.label), "-menu-item"),
|
|
@@ -20409,7 +20504,7 @@ var DropdownField = function DropdownField(_ref) {
|
|
|
20409
20504
|
onClose: handleClose,
|
|
20410
20505
|
children: /*#__PURE__*/jsxRuntime.jsxs(Menu$6, {
|
|
20411
20506
|
className: "max-h-60 max-w-2xl p-3",
|
|
20412
|
-
children: [options.length > MAXIMUM_OPTION_LENGTH$
|
|
20507
|
+
children: [options.length > MAXIMUM_OPTION_LENGTH$3 && /*#__PURE__*/jsxRuntime.jsx(Input__default["default"], {
|
|
20413
20508
|
autoFocus: true,
|
|
20414
20509
|
className: "mb-1",
|
|
20415
20510
|
"data-cy": "search-text-field",
|
|
@@ -20423,7 +20518,7 @@ var DropdownField = function DropdownField(_ref) {
|
|
|
20423
20518
|
return e.stopPropagation();
|
|
20424
20519
|
}
|
|
20425
20520
|
}), /*#__PURE__*/jsxRuntime.jsx(OptionsWrapper, {
|
|
20426
|
-
hasScroll: options.length > MAXIMUM_OPTION_LENGTH$
|
|
20521
|
+
hasScroll: options.length > MAXIMUM_OPTION_LENGTH$3,
|
|
20427
20522
|
children: searchedOptions.map(function (option, idx) {
|
|
20428
20523
|
return /*#__PURE__*/jsxRuntime.jsx(MenuItem$6.Button, {
|
|
20429
20524
|
"data-cy": "".concat(utils.joinHyphenCase(option.label), "-menu-item"),
|
|
@@ -20531,7 +20626,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
20531
20626
|
onClose: handleClose,
|
|
20532
20627
|
children: /*#__PURE__*/jsxRuntime.jsxs(Menu$5, {
|
|
20533
20628
|
className: "max-h-60 max-w-2xl p-3",
|
|
20534
|
-
children: [options.length > MAXIMUM_OPTION_LENGTH$
|
|
20629
|
+
children: [options.length > MAXIMUM_OPTION_LENGTH$3 && /*#__PURE__*/jsxRuntime.jsx(Input__default["default"], {
|
|
20535
20630
|
autoFocus: true,
|
|
20536
20631
|
className: "mb-1",
|
|
20537
20632
|
"data-cy": "search-text-field",
|
|
@@ -20545,7 +20640,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
20545
20640
|
return e.stopPropagation();
|
|
20546
20641
|
}
|
|
20547
20642
|
}), /*#__PURE__*/jsxRuntime.jsx(OptionsWrapper, {
|
|
20548
|
-
hasScroll: options.length > MAXIMUM_OPTION_LENGTH$
|
|
20643
|
+
hasScroll: options.length > MAXIMUM_OPTION_LENGTH$3,
|
|
20549
20644
|
children: searchedOptions.map(function (option, idx) {
|
|
20550
20645
|
return /*#__PURE__*/jsxRuntime.jsx(MenuItem$5.Button, {
|
|
20551
20646
|
"data-cy": "".concat(utils.joinHyphenCase(option.label), "-menu-item"),
|
|
@@ -20705,7 +20800,7 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
20705
20800
|
onClose: handleClose,
|
|
20706
20801
|
children: /*#__PURE__*/jsxRuntime.jsxs(Menu$4, {
|
|
20707
20802
|
className: "max-h-60 max-w-2xl p-3",
|
|
20708
|
-
children: [dropDownOptions.length > MAXIMUM_OPTION_LENGTH$
|
|
20803
|
+
children: [dropDownOptions.length > MAXIMUM_OPTION_LENGTH$3 && /*#__PURE__*/jsxRuntime.jsx(Input__default["default"], {
|
|
20709
20804
|
autoFocus: true,
|
|
20710
20805
|
className: "mb-1",
|
|
20711
20806
|
"data-cy": "search-text-field",
|
|
@@ -20716,7 +20811,7 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
20716
20811
|
return setSearchTerm(e.target.value);
|
|
20717
20812
|
}
|
|
20718
20813
|
}), /*#__PURE__*/jsxRuntime.jsx(OptionsWrapper, {
|
|
20719
|
-
hasScroll: dropDownOptions.length > MAXIMUM_OPTION_LENGTH$
|
|
20814
|
+
hasScroll: dropDownOptions.length > MAXIMUM_OPTION_LENGTH$3,
|
|
20720
20815
|
children: searchedOptions.map(function (option, idx) {
|
|
20721
20816
|
return /*#__PURE__*/jsxRuntime.jsx(MenuItem$4.Button, {
|
|
20722
20817
|
"data-cy": "".concat(utils.joinHyphenCase(option.label), "-menu-item"),
|