@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.js
CHANGED
|
@@ -160,6 +160,24 @@ var Title = function Title(_ref) {
|
|
|
160
160
|
});
|
|
161
161
|
};
|
|
162
162
|
|
|
163
|
+
var PREVIEW_CONDITION_LIMIT = 3;
|
|
164
|
+
var ACTION_TYPE = {
|
|
165
|
+
TEXT: "text",
|
|
166
|
+
NUMBER: "number",
|
|
167
|
+
DECIMAL: "decimal",
|
|
168
|
+
REGEX: "regex",
|
|
169
|
+
DATE: "date",
|
|
170
|
+
EMAIL: "email",
|
|
171
|
+
EMAIL_TO: "emailTo",
|
|
172
|
+
EMAIL_TO_IDS: "emailToIds",
|
|
173
|
+
SMS_TO_NUMBERS: "smsToNumbers",
|
|
174
|
+
MULTI_SELECT: "multiSelect",
|
|
175
|
+
SEND_TO_API: "sendToApi",
|
|
176
|
+
DROPDOWN: "dropdown",
|
|
177
|
+
MULTISELECT: "multiSelect"
|
|
178
|
+
};
|
|
179
|
+
var TEXT_FIELDS = [ACTION_TYPE.TEXT, ACTION_TYPE.NUMBER, ACTION_TYPE.DECIMAL, ACTION_TYPE.REGEX, ACTION_TYPE.DATE];
|
|
180
|
+
|
|
163
181
|
var MultiSelectValues = function MultiSelectValues(_ref) {
|
|
164
182
|
var separator = _ref.separator,
|
|
165
183
|
values = _ref.values;
|
|
@@ -188,6 +206,48 @@ var getEntityDisplayValue = function getEntityDisplayValue(entitiy, entitiyOptio
|
|
|
188
206
|
value: entitiy.metadata.value
|
|
189
207
|
}, entitiyOption.dropdownOptions)) === null || _findBy === void 0 || (_findBy = _findBy.label) === null || _findBy === void 0 ? void 0 : _findBy.toLowerCase();
|
|
190
208
|
};
|
|
209
|
+
var getActionDisplayValue = function getActionDisplayValue(action, actionOption) {
|
|
210
|
+
var displayValueData = {
|
|
211
|
+
displayValue: null,
|
|
212
|
+
isBulk: false
|
|
213
|
+
};
|
|
214
|
+
if (TEXT_FIELDS.includes(actionOption.type)) {
|
|
215
|
+
var _action$metadata$valu;
|
|
216
|
+
displayValueData.displayValue = (_action$metadata$valu = action.metadata.value) === null || _action$metadata$valu === void 0 ? void 0 : _action$metadata$valu.toLowerCase();
|
|
217
|
+
return displayValueData;
|
|
218
|
+
}
|
|
219
|
+
switch (actionOption.type) {
|
|
220
|
+
case ACTION_TYPE.DROPDOWN:
|
|
221
|
+
{
|
|
222
|
+
displayValueData.displayValue = getEntityDisplayValue(action, actionOption);
|
|
223
|
+
return displayValueData;
|
|
224
|
+
}
|
|
225
|
+
case ACTION_TYPE.EMAIL_TO_IDS:
|
|
226
|
+
{
|
|
227
|
+
displayValueData.isBulk = true;
|
|
228
|
+
displayValueData.displayValue = action.metadata.emails;
|
|
229
|
+
return displayValueData;
|
|
230
|
+
}
|
|
231
|
+
case ACTION_TYPE.EMAIL_TO:
|
|
232
|
+
{
|
|
233
|
+
displayValueData.displayValue = action.displayValue;
|
|
234
|
+
return displayValueData;
|
|
235
|
+
}
|
|
236
|
+
case ACTION_TYPE.SMS_TO_NUMBERS:
|
|
237
|
+
{
|
|
238
|
+
displayValueData.isBulk = true;
|
|
239
|
+
displayValueData.displayValue = action.metadata.phoneNumbers;
|
|
240
|
+
return displayValueData;
|
|
241
|
+
}
|
|
242
|
+
case ACTION_TYPE.SEND_TO_API:
|
|
243
|
+
{
|
|
244
|
+
displayValueData.displayValue = action.metadata.endpoint;
|
|
245
|
+
return displayValueData;
|
|
246
|
+
}
|
|
247
|
+
default:
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
};
|
|
191
251
|
|
|
192
252
|
var ActionsDetail = function ActionsDetail(_ref) {
|
|
193
253
|
var actions = _ref.actions;
|
|
@@ -205,9 +265,26 @@ var ActionsDetail = function ActionsDetail(_ref) {
|
|
|
205
265
|
}) : t("neetoRules.common.then");
|
|
206
266
|
};
|
|
207
267
|
var renderActionValues = function renderActionValues(action, actionOption) {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
268
|
+
var _actionOption$separat, _getActionDisplayValu;
|
|
269
|
+
var commonSeperator = actionOption.type === ACTION_TYPE.SEND_TO_API ? t("neetoRules.common.at") : t("neetoRules.common.to");
|
|
270
|
+
var separator = (actionOption === null || actionOption === void 0 || (_actionOption$separat = actionOption.separator) === null || _actionOption$separat === void 0 ? void 0 : _actionOption$separat.toLowerCase()) || commonSeperator;
|
|
271
|
+
var _ref2 = (_getActionDisplayValu = getActionDisplayValue(action, actionOption)) !== null && _getActionDisplayValu !== void 0 ? _getActionDisplayValu : {},
|
|
272
|
+
displayValue = _ref2.displayValue,
|
|
273
|
+
isBulk = _ref2.isBulk;
|
|
274
|
+
if (actionOption.type === ACTION_TYPE.MULTISELECT) {
|
|
275
|
+
var values = pluck("label", actionOption.dropdownOptions.filter(function (_ref3) {
|
|
276
|
+
var value = _ref3.value;
|
|
277
|
+
return action.metadata.value.includes(value);
|
|
278
|
+
}));
|
|
279
|
+
return /*#__PURE__*/jsx$1(MultiSelectValues, {
|
|
280
|
+
values: values,
|
|
281
|
+
separator: t("neetoRules.common.and", {
|
|
282
|
+
what: ""
|
|
283
|
+
})
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
if (!displayValue) return null;
|
|
287
|
+
if (!isBulk) {
|
|
211
288
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
212
289
|
children: [/*#__PURE__*/jsx$1(Typography, {
|
|
213
290
|
className: "neeto-ui-text-gray-700",
|
|
@@ -218,23 +295,20 @@ var ActionsDetail = function ActionsDetail(_ref) {
|
|
|
218
295
|
className: "neeto-ui-text-gray-800",
|
|
219
296
|
style: "h5",
|
|
220
297
|
weight: "semibold",
|
|
221
|
-
children:
|
|
298
|
+
children: displayValue === null || displayValue === void 0 ? void 0 : displayValue.toLowerCase()
|
|
222
299
|
})]
|
|
223
300
|
});
|
|
224
301
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
return null;
|
|
302
|
+
return displayValue.map(function (value, index) {
|
|
303
|
+
return /*#__PURE__*/jsxs("div", {
|
|
304
|
+
className: "mr-1 flex",
|
|
305
|
+
children: [/*#__PURE__*/jsx$1(Typography, {
|
|
306
|
+
style: "h5",
|
|
307
|
+
weight: "semibold",
|
|
308
|
+
children: value
|
|
309
|
+
}, index), index !== displayValue.length - 1 && ", "]
|
|
310
|
+
}, index);
|
|
311
|
+
});
|
|
238
312
|
};
|
|
239
313
|
var renderAction = function renderAction(action) {
|
|
240
314
|
var actionOption = findBy({
|
|
@@ -279,10 +353,68 @@ var ActionsDetail = function ActionsDetail(_ref) {
|
|
|
279
353
|
});
|
|
280
354
|
};
|
|
281
355
|
|
|
356
|
+
var OPERATORS$1 = {
|
|
357
|
+
or: "or_operator",
|
|
358
|
+
and: "and_operator"
|
|
359
|
+
};
|
|
360
|
+
var OPERATOR_LABELS = {
|
|
361
|
+
or_operator: t$5("neetoRules.operators.or"),
|
|
362
|
+
and_operator: t$5("neetoRules.operators.and")
|
|
363
|
+
};
|
|
364
|
+
var VERB_LABELS = {
|
|
365
|
+
is: t$5("neetoRules.conditionVerbs.is"),
|
|
366
|
+
is_not: t$5("neetoRules.conditionVerbs.isNot"),
|
|
367
|
+
contains: t$5("neetoRules.conditionVerbs.contains"),
|
|
368
|
+
does_not_contain: t$5("neetoRules.conditionVerbs.doesNotContain"),
|
|
369
|
+
contains_any_of: t$5("neetoRules.conditionVerbs.containsAnyOf"),
|
|
370
|
+
contains_all_of: t$5("neetoRules.conditionVerbs.containsAllOf"),
|
|
371
|
+
contains_none_of: t$5("neetoRules.conditionVerbs.containsNoneOf"),
|
|
372
|
+
starts_with: t$5("neetoRules.conditionVerbs.startsWith"),
|
|
373
|
+
ends_with: t$5("neetoRules.conditionVerbs.endsWith"),
|
|
374
|
+
less_than: t$5("neetoRules.conditionVerbs.lessThan"),
|
|
375
|
+
greater_than: t$5("neetoRules.conditionVerbs.greaterThan"),
|
|
376
|
+
any_time: t$5("neetoRules.conditionVerbs.anyTime"),
|
|
377
|
+
during: t$5("neetoRules.conditionVerbs.during"),
|
|
378
|
+
not_during: t$5("neetoRules.conditionVerbs.notDuring"),
|
|
379
|
+
any_of: t$5("neetoRules.conditionVerbs.anyOf"),
|
|
380
|
+
none_of: t$5("neetoRules.conditionVerbs.noneOf"),
|
|
381
|
+
is_before: t$5("neetoRules.conditionVerbs.isBefore"),
|
|
382
|
+
is_after: t$5("neetoRules.conditionVerbs.isAfter")
|
|
383
|
+
};
|
|
384
|
+
var CONDITION_VALUE_TYPES = {
|
|
385
|
+
text: "text",
|
|
386
|
+
number: "number",
|
|
387
|
+
decimal: "decimal",
|
|
388
|
+
url: "url",
|
|
389
|
+
email: "email",
|
|
390
|
+
dropdown: "dropdown",
|
|
391
|
+
multiSelect: "multi-select",
|
|
392
|
+
multiSelectCreate: "multi-select-create",
|
|
393
|
+
date: "date",
|
|
394
|
+
regex: "regex",
|
|
395
|
+
textarea: "textarea"
|
|
396
|
+
};
|
|
397
|
+
var INPUT_FIELD_TYPES = ["email", "text", "number", "decimal", "url", "regex"];
|
|
398
|
+
var MAXIMUM_OPTION_LENGTH$3 = 7;
|
|
399
|
+
|
|
400
|
+
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; }
|
|
401
|
+
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; }
|
|
282
402
|
var ConditionsDetail = function ConditionsDetail(_ref) {
|
|
283
403
|
var conditions = _ref.conditions,
|
|
284
404
|
conditionOptions = _ref.conditionOptions,
|
|
285
|
-
conditionVerbs = _ref.conditionVerbs
|
|
405
|
+
_ref$conditionVerbs = _ref.conditionVerbs,
|
|
406
|
+
conditionVerbs = _ref$conditionVerbs === void 0 ? {} : _ref$conditionVerbs,
|
|
407
|
+
_ref$hasEvent = _ref.hasEvent,
|
|
408
|
+
hasEvent = _ref$hasEvent === void 0 ? true : _ref$hasEvent;
|
|
409
|
+
var _useState = useState(false),
|
|
410
|
+
_useState2 = _slicedToArray$1(_useState, 2),
|
|
411
|
+
viewMore = _useState2[0],
|
|
412
|
+
setViewMore = _useState2[1];
|
|
413
|
+
var _useTranslation = useTranslation(),
|
|
414
|
+
t = _useTranslation.t;
|
|
415
|
+
var conditionsList = conditions.value;
|
|
416
|
+
var allConditions = viewMore && conditionsList.length > PREVIEW_CONDITION_LIMIT ? conditionsList : conditionsList.slice(0, PREVIEW_CONDITION_LIMIT);
|
|
417
|
+
var allConditionVerbs = _objectSpread$p(_objectSpread$p({}, VERB_LABELS), conditionVerbs);
|
|
286
418
|
var getLogicOperator = function getLogicOperator(joinType) {
|
|
287
419
|
return joinType === "or_operator" ? "or" : "and";
|
|
288
420
|
};
|
|
@@ -303,7 +435,7 @@ var ConditionsDetail = function ConditionsDetail(_ref) {
|
|
|
303
435
|
}));
|
|
304
436
|
return /*#__PURE__*/jsx$1(MultiSelectValues, {
|
|
305
437
|
values: values,
|
|
306
|
-
separator: t
|
|
438
|
+
separator: t("neetoRules.common.or")
|
|
307
439
|
});
|
|
308
440
|
}
|
|
309
441
|
if (conditionOption.type === "dropdown") {
|
|
@@ -317,12 +449,12 @@ var ConditionsDetail = function ConditionsDetail(_ref) {
|
|
|
317
449
|
return null;
|
|
318
450
|
};
|
|
319
451
|
var renderCondition = function renderCondition(condition) {
|
|
320
|
-
var
|
|
452
|
+
var _allConditionVerbs$co;
|
|
321
453
|
var conditionOption = findBy({
|
|
322
454
|
value: condition.field
|
|
323
455
|
}, conditionOptions);
|
|
324
456
|
if (!conditionOption) return null;
|
|
325
|
-
var conditionVerb = (
|
|
457
|
+
var conditionVerb = (_allConditionVerbs$co = allConditionVerbs[condition.verb]) === null || _allConditionVerbs$co === void 0 ? void 0 : _allConditionVerbs$co.toLowerCase();
|
|
326
458
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
327
459
|
children: [/*#__PURE__*/jsx$1(Typography, {
|
|
328
460
|
className: "neeto-ui-text-gray-800",
|
|
@@ -337,31 +469,46 @@ var ConditionsDetail = function ConditionsDetail(_ref) {
|
|
|
337
469
|
}), renderConditionValues(condition, conditionOption)]
|
|
338
470
|
});
|
|
339
471
|
};
|
|
340
|
-
return /*#__PURE__*/
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
472
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
473
|
+
children: [/*#__PURE__*/jsx$1("div", {
|
|
474
|
+
className: "mt-2",
|
|
475
|
+
children: allConditions.map(function (condition, index) {
|
|
476
|
+
return /*#__PURE__*/jsxs("div", {
|
|
477
|
+
className: "mb-2 flex flex-wrap gap-x-2 gap-y-2",
|
|
478
|
+
children: [!index && hasEvent && /*#__PURE__*/jsx$1(Typography, {
|
|
479
|
+
className: "neeto-ui-text-gray-700",
|
|
480
|
+
style: "h5",
|
|
481
|
+
weight: "normal",
|
|
482
|
+
children: t("neetoRules.common.and", {
|
|
483
|
+
what: ""
|
|
484
|
+
})
|
|
485
|
+
}), !!index && /*#__PURE__*/jsx$1(Typography, {
|
|
486
|
+
className: "neeto-ui-text-gray-800",
|
|
487
|
+
style: "h5",
|
|
488
|
+
weight: "semibold",
|
|
489
|
+
children: getLogicOperator(condition.joinType)
|
|
490
|
+
}), /*#__PURE__*/jsx$1(Typography, {
|
|
491
|
+
className: "neeto-ui-text-gray-700",
|
|
492
|
+
style: "h5",
|
|
493
|
+
weight: "normal",
|
|
494
|
+
children: t("neetoRules.common.when")
|
|
495
|
+
}), renderCondition(condition)]
|
|
496
|
+
}, condition.id);
|
|
497
|
+
})
|
|
498
|
+
}), conditionsList.length > 3 && /*#__PURE__*/jsx$1("div", {
|
|
499
|
+
className: "mt-3 w-full",
|
|
500
|
+
children: /*#__PURE__*/jsx$1(Button, {
|
|
501
|
+
icon: !viewMore ? Down : Up,
|
|
502
|
+
size: "small",
|
|
503
|
+
style: "link",
|
|
504
|
+
label: !viewMore ? t("neetoRules.common.viewMore") : t("neetoRules.common.viewLess"),
|
|
505
|
+
onClick: function onClick() {
|
|
506
|
+
return setViewMore(function (prevState) {
|
|
507
|
+
return !prevState;
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
})
|
|
511
|
+
})]
|
|
365
512
|
});
|
|
366
513
|
};
|
|
367
514
|
|
|
@@ -370,21 +517,17 @@ var EventsDetail = function EventsDetail(_ref) {
|
|
|
370
517
|
var events = _ref.events,
|
|
371
518
|
performer = _ref.performer,
|
|
372
519
|
conditions = _ref.conditions;
|
|
373
|
-
var
|
|
374
|
-
|
|
375
|
-
viewMore = _useState2[0],
|
|
376
|
-
setViewMore = _useState2[1];
|
|
520
|
+
var _useTranslation = useTranslation(),
|
|
521
|
+
t = _useTranslation.t;
|
|
377
522
|
var eventNames = pluck("name", events.value);
|
|
378
523
|
var allEvents = events.eventOptions.filter(function (event) {
|
|
379
524
|
return eventNames === null || eventNames === void 0 ? void 0 : eventNames.includes(event.value);
|
|
380
525
|
});
|
|
381
|
-
var conditionsList = conditions.value;
|
|
382
|
-
var allConditions = viewMore && conditionsList.length > 3 ? conditionsList : conditionsList.slice(0, 3);
|
|
383
526
|
var currentPerformer = findBy({
|
|
384
527
|
value: performer.value
|
|
385
528
|
}, performer.options);
|
|
386
529
|
return /*#__PURE__*/jsxs(Title, {
|
|
387
|
-
title: t
|
|
530
|
+
title: t("neetoRules.common.when"),
|
|
388
531
|
children: [/*#__PURE__*/jsxs("div", {
|
|
389
532
|
className: "flex flex-wrap gap-x-2 gap-y-2",
|
|
390
533
|
children: [allEvents.map(function (event, index) {
|
|
@@ -394,12 +537,12 @@ var EventsDetail = function EventsDetail(_ref) {
|
|
|
394
537
|
className: "neeto-ui-text-gray-700 my-auto",
|
|
395
538
|
style: "h5",
|
|
396
539
|
weight: "normal",
|
|
397
|
-
children: t
|
|
540
|
+
children: t("neetoRules.common.when")
|
|
398
541
|
}), !!index && /*#__PURE__*/jsx$1(Typography, {
|
|
399
542
|
className: "neeto-ui-text-gray-700 my-auto",
|
|
400
543
|
style: "h5",
|
|
401
544
|
weight: "normal",
|
|
402
|
-
children: t
|
|
545
|
+
children: t("neetoRules.common.or")
|
|
403
546
|
}), /*#__PURE__*/jsx$1(Typography, {
|
|
404
547
|
className: "neeto-ui-text-gray-800",
|
|
405
548
|
style: "h5",
|
|
@@ -411,7 +554,7 @@ var EventsDetail = function EventsDetail(_ref) {
|
|
|
411
554
|
className: "neeto-ui-text-gray-700",
|
|
412
555
|
style: "h5",
|
|
413
556
|
weight: "normal",
|
|
414
|
-
children: t
|
|
557
|
+
children: t("neetoRules.common.by")
|
|
415
558
|
}), /*#__PURE__*/jsx$1(Typography, {
|
|
416
559
|
className: "neeto-ui-text-gray-800",
|
|
417
560
|
style: "h5",
|
|
@@ -419,30 +562,18 @@ var EventsDetail = function EventsDetail(_ref) {
|
|
|
419
562
|
children: currentPerformer === null || currentPerformer === void 0 || (_currentPerformer$lab = currentPerformer.label) === null || _currentPerformer$lab === void 0 ? void 0 : _currentPerformer$lab.toLowerCase()
|
|
420
563
|
})]
|
|
421
564
|
}), /*#__PURE__*/jsx$1(ConditionsDetail, {
|
|
565
|
+
conditions: conditions,
|
|
422
566
|
conditionOptions: conditions.conditionOptions,
|
|
423
|
-
conditionVerbs: conditions.verbs
|
|
424
|
-
conditions: allConditions
|
|
425
|
-
}), conditionsList.length > 3 && /*#__PURE__*/jsx$1("div", {
|
|
426
|
-
className: "mt-3 w-full",
|
|
427
|
-
children: /*#__PURE__*/jsx$1(Button, {
|
|
428
|
-
icon: !viewMore ? Down : Up,
|
|
429
|
-
size: "small",
|
|
430
|
-
style: "link",
|
|
431
|
-
label: !viewMore ? t$5("neetoRules.common.viewMore") : t$5("neetoRules.common.viewLess"),
|
|
432
|
-
onClick: function onClick() {
|
|
433
|
-
return setViewMore(function (prevState) {
|
|
434
|
-
return !prevState;
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
})
|
|
567
|
+
conditionVerbs: conditions.verbs
|
|
438
568
|
})]
|
|
439
569
|
});
|
|
440
570
|
};
|
|
441
571
|
|
|
442
572
|
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; }
|
|
443
573
|
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; }
|
|
444
|
-
var RulePreview = function
|
|
445
|
-
var
|
|
574
|
+
var RulePreview = withT(function (_ref) {
|
|
575
|
+
var t = _ref.t,
|
|
576
|
+
isLoading = _ref.isLoading,
|
|
446
577
|
ruleDetails = _ref.ruleDetails,
|
|
447
578
|
isOpen = _ref.isOpen,
|
|
448
579
|
onClose = _ref.onClose,
|
|
@@ -485,10 +616,18 @@ var RulePreview = function RulePreview(_ref) {
|
|
|
485
616
|
children: ruleDetails.entity.value
|
|
486
617
|
})]
|
|
487
618
|
})]
|
|
488
|
-
}), /*#__PURE__*/jsx$1(EventsDetail, {
|
|
619
|
+
}), ruleDetails.events && isNotEmpty(ruleDetails.events) ? /*#__PURE__*/jsx$1(EventsDetail, {
|
|
489
620
|
conditions: ruleDetails.conditions,
|
|
490
621
|
events: ruleDetails.events,
|
|
491
622
|
performer: ruleDetails.performer
|
|
623
|
+
}) : /*#__PURE__*/jsx$1(Title, {
|
|
624
|
+
title: t("neetoRules.common.when"),
|
|
625
|
+
children: /*#__PURE__*/jsx$1(ConditionsDetail, {
|
|
626
|
+
conditionOptions: ruleDetails.conditions.conditionOptions,
|
|
627
|
+
conditionVerbs: ruleDetails.conditions.verbs,
|
|
628
|
+
conditions: ruleDetails.conditions,
|
|
629
|
+
hasEvent: false
|
|
630
|
+
})
|
|
492
631
|
}), /*#__PURE__*/jsx$1(ActionsDetail, {
|
|
493
632
|
actions: ruleDetails.actions
|
|
494
633
|
})]
|
|
@@ -496,7 +635,7 @@ var RulePreview = function RulePreview(_ref) {
|
|
|
496
635
|
})]
|
|
497
636
|
})
|
|
498
637
|
});
|
|
499
|
-
};
|
|
638
|
+
});
|
|
500
639
|
|
|
501
640
|
function _typeof$2(o) {
|
|
502
641
|
"@babel/helpers - typeof";
|
|
@@ -9886,52 +10025,8 @@ var DEFAULT_RULE_ACTION = {
|
|
|
9886
10025
|
};
|
|
9887
10026
|
var EDITOR_ADDONS = ["code-block", "block-quote", "image-upload"];
|
|
9888
10027
|
var EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
9889
|
-
var MAXIMUM_OPTION_LENGTH$3 = 7;
|
|
9890
|
-
var ACTION_INPUT_TYPES = ["text", "number", "decimal", "regex"];
|
|
9891
|
-
|
|
9892
|
-
var OPERATORS$1 = {
|
|
9893
|
-
or: "or_operator",
|
|
9894
|
-
and: "and_operator"
|
|
9895
|
-
};
|
|
9896
|
-
var OPERATOR_LABELS = {
|
|
9897
|
-
or_operator: t$5("neetoRules.operators.or"),
|
|
9898
|
-
and_operator: t$5("neetoRules.operators.and")
|
|
9899
|
-
};
|
|
9900
|
-
var VERB_LABELS = {
|
|
9901
|
-
is: t$5("neetoRules.conditionVerbs.is"),
|
|
9902
|
-
is_not: t$5("neetoRules.conditionVerbs.isNot"),
|
|
9903
|
-
contains: t$5("neetoRules.conditionVerbs.contains"),
|
|
9904
|
-
does_not_contain: t$5("neetoRules.conditionVerbs.doesNotContain"),
|
|
9905
|
-
contains_any_of: t$5("neetoRules.conditionVerbs.containsAnyOf"),
|
|
9906
|
-
contains_all_of: t$5("neetoRules.conditionVerbs.containsAllOf"),
|
|
9907
|
-
contains_none_of: t$5("neetoRules.conditionVerbs.containsNoneOf"),
|
|
9908
|
-
starts_with: t$5("neetoRules.conditionVerbs.startsWith"),
|
|
9909
|
-
ends_with: t$5("neetoRules.conditionVerbs.endsWith"),
|
|
9910
|
-
less_than: t$5("neetoRules.conditionVerbs.lessThan"),
|
|
9911
|
-
greater_than: t$5("neetoRules.conditionVerbs.greaterThan"),
|
|
9912
|
-
any_time: t$5("neetoRules.conditionVerbs.anyTime"),
|
|
9913
|
-
during: t$5("neetoRules.conditionVerbs.during"),
|
|
9914
|
-
not_during: t$5("neetoRules.conditionVerbs.notDuring"),
|
|
9915
|
-
any_of: t$5("neetoRules.conditionVerbs.anyOf"),
|
|
9916
|
-
none_of: t$5("neetoRules.conditionVerbs.noneOf"),
|
|
9917
|
-
is_before: t$5("neetoRules.conditionVerbs.isBefore"),
|
|
9918
|
-
is_after: t$5("neetoRules.conditionVerbs.isAfter")
|
|
9919
|
-
};
|
|
9920
|
-
var CONDITION_VALUE_TYPES = {
|
|
9921
|
-
text: "text",
|
|
9922
|
-
number: "number",
|
|
9923
|
-
decimal: "decimal",
|
|
9924
|
-
url: "url",
|
|
9925
|
-
email: "email",
|
|
9926
|
-
dropdown: "dropdown",
|
|
9927
|
-
multiSelect: "multi-select",
|
|
9928
|
-
multiSelectCreate: "multi-select-create",
|
|
9929
|
-
date: "date",
|
|
9930
|
-
regex: "regex",
|
|
9931
|
-
textarea: "textarea"
|
|
9932
|
-
};
|
|
9933
|
-
var INPUT_FIELD_TYPES = ["email", "text", "number", "decimal", "url", "regex"];
|
|
9934
10028
|
var MAXIMUM_OPTION_LENGTH$2 = 7;
|
|
10029
|
+
var ACTION_INPUT_TYPES = ["text", "number", "decimal", "regex"];
|
|
9935
10030
|
|
|
9936
10031
|
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; }
|
|
9937
10032
|
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; }
|
|
@@ -11015,7 +11110,7 @@ var DropdownField$1 = function DropdownField(_ref) {
|
|
|
11015
11110
|
onClose: handleClose,
|
|
11016
11111
|
children: /*#__PURE__*/jsxs(Menu$a, {
|
|
11017
11112
|
className: "max-h-60 max-w-2xl p-3",
|
|
11018
|
-
children: [dropdownOptions.length > MAXIMUM_OPTION_LENGTH$
|
|
11113
|
+
children: [dropdownOptions.length > MAXIMUM_OPTION_LENGTH$2 && /*#__PURE__*/jsx$1(Input$2, {
|
|
11019
11114
|
autoFocus: true,
|
|
11020
11115
|
className: "mb-1",
|
|
11021
11116
|
"data-cy": "search-text-field",
|
|
@@ -11029,7 +11124,7 @@ var DropdownField$1 = function DropdownField(_ref) {
|
|
|
11029
11124
|
return e.stopPropagation();
|
|
11030
11125
|
}
|
|
11031
11126
|
}), /*#__PURE__*/jsx$1(OptionsWrapper, {
|
|
11032
|
-
hasScroll: dropdownOptions.length > MAXIMUM_OPTION_LENGTH$
|
|
11127
|
+
hasScroll: dropdownOptions.length > MAXIMUM_OPTION_LENGTH$2,
|
|
11033
11128
|
children: searchedOptions.map(function (option, idx) {
|
|
11034
11129
|
return /*#__PURE__*/jsx$1(MenuItem$9.Button, {
|
|
11035
11130
|
"data-cy": "".concat(joinHyphenCase(option.label), "-menu-item"),
|
|
@@ -11663,7 +11758,7 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
11663
11758
|
onClose: handleClose,
|
|
11664
11759
|
children: /*#__PURE__*/jsxs(Menu$9, {
|
|
11665
11760
|
className: "max-h-60 max-w-2xl p-3",
|
|
11666
|
-
children: [dropDownOptions.length > MAXIMUM_OPTION_LENGTH$
|
|
11761
|
+
children: [dropDownOptions.length > MAXIMUM_OPTION_LENGTH$2 && /*#__PURE__*/jsx$1(Input$2, {
|
|
11667
11762
|
autoFocus: true,
|
|
11668
11763
|
className: "mb-1",
|
|
11669
11764
|
"data-cy": "search-text-field",
|
|
@@ -11674,7 +11769,7 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
11674
11769
|
return setSearchTerm(e.target.value);
|
|
11675
11770
|
}
|
|
11676
11771
|
}), /*#__PURE__*/jsx$1(OptionsWrapper, {
|
|
11677
|
-
hasScroll: dropDownOptions.length > MAXIMUM_OPTION_LENGTH$
|
|
11772
|
+
hasScroll: dropDownOptions.length > MAXIMUM_OPTION_LENGTH$2,
|
|
11678
11773
|
children: searchedOptions.map(function (option, idx) {
|
|
11679
11774
|
return /*#__PURE__*/jsx$1(MenuItem$8.Button, {
|
|
11680
11775
|
"data-cy": "".concat(joinHyphenCase(option.label), "-menu-item"),
|
|
@@ -20358,7 +20453,7 @@ var DropdownField = function DropdownField(_ref) {
|
|
|
20358
20453
|
onClose: handleClose,
|
|
20359
20454
|
children: /*#__PURE__*/jsxs(Menu$6, {
|
|
20360
20455
|
className: "max-h-60 max-w-2xl p-3",
|
|
20361
|
-
children: [options.length > MAXIMUM_OPTION_LENGTH$
|
|
20456
|
+
children: [options.length > MAXIMUM_OPTION_LENGTH$3 && /*#__PURE__*/jsx$1(Input$2, {
|
|
20362
20457
|
autoFocus: true,
|
|
20363
20458
|
className: "mb-1",
|
|
20364
20459
|
"data-cy": "search-text-field",
|
|
@@ -20372,7 +20467,7 @@ var DropdownField = function DropdownField(_ref) {
|
|
|
20372
20467
|
return e.stopPropagation();
|
|
20373
20468
|
}
|
|
20374
20469
|
}), /*#__PURE__*/jsx$1(OptionsWrapper, {
|
|
20375
|
-
hasScroll: options.length > MAXIMUM_OPTION_LENGTH$
|
|
20470
|
+
hasScroll: options.length > MAXIMUM_OPTION_LENGTH$3,
|
|
20376
20471
|
children: searchedOptions.map(function (option, idx) {
|
|
20377
20472
|
return /*#__PURE__*/jsx$1(MenuItem$6.Button, {
|
|
20378
20473
|
"data-cy": "".concat(joinHyphenCase(option.label), "-menu-item"),
|
|
@@ -20480,7 +20575,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
20480
20575
|
onClose: handleClose,
|
|
20481
20576
|
children: /*#__PURE__*/jsxs(Menu$5, {
|
|
20482
20577
|
className: "max-h-60 max-w-2xl p-3",
|
|
20483
|
-
children: [options.length > MAXIMUM_OPTION_LENGTH$
|
|
20578
|
+
children: [options.length > MAXIMUM_OPTION_LENGTH$3 && /*#__PURE__*/jsx$1(Input$2, {
|
|
20484
20579
|
autoFocus: true,
|
|
20485
20580
|
className: "mb-1",
|
|
20486
20581
|
"data-cy": "search-text-field",
|
|
@@ -20494,7 +20589,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
20494
20589
|
return e.stopPropagation();
|
|
20495
20590
|
}
|
|
20496
20591
|
}), /*#__PURE__*/jsx$1(OptionsWrapper, {
|
|
20497
|
-
hasScroll: options.length > MAXIMUM_OPTION_LENGTH$
|
|
20592
|
+
hasScroll: options.length > MAXIMUM_OPTION_LENGTH$3,
|
|
20498
20593
|
children: searchedOptions.map(function (option, idx) {
|
|
20499
20594
|
return /*#__PURE__*/jsx$1(MenuItem$5.Button, {
|
|
20500
20595
|
"data-cy": "".concat(joinHyphenCase(option.label), "-menu-item"),
|
|
@@ -20654,7 +20749,7 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
20654
20749
|
onClose: handleClose,
|
|
20655
20750
|
children: /*#__PURE__*/jsxs(Menu$4, {
|
|
20656
20751
|
className: "max-h-60 max-w-2xl p-3",
|
|
20657
|
-
children: [dropDownOptions.length > MAXIMUM_OPTION_LENGTH$
|
|
20752
|
+
children: [dropDownOptions.length > MAXIMUM_OPTION_LENGTH$3 && /*#__PURE__*/jsx$1(Input$2, {
|
|
20658
20753
|
autoFocus: true,
|
|
20659
20754
|
className: "mb-1",
|
|
20660
20755
|
"data-cy": "search-text-field",
|
|
@@ -20665,7 +20760,7 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
20665
20760
|
return setSearchTerm(e.target.value);
|
|
20666
20761
|
}
|
|
20667
20762
|
}), /*#__PURE__*/jsx$1(OptionsWrapper, {
|
|
20668
|
-
hasScroll: dropDownOptions.length > MAXIMUM_OPTION_LENGTH$
|
|
20763
|
+
hasScroll: dropDownOptions.length > MAXIMUM_OPTION_LENGTH$3,
|
|
20669
20764
|
children: searchedOptions.map(function (option, idx) {
|
|
20670
20765
|
return /*#__PURE__*/jsx$1(MenuItem$4.Button, {
|
|
20671
20766
|
"data-cy": "".concat(joinHyphenCase(option.label), "-menu-item"),
|