@bigbinary/neeto-rules-frontend 2.9.3 → 2.9.5-beta1

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.
@@ -11,7 +11,7 @@ import { isNotEmpty, toLabelAndValue, removeBy, findBy, isPresent, isNot, noop }
11
11
  import Container from '@bigbinary/neeto-molecules/v2/Container';
12
12
  import Header from '@bigbinary/neeto-molecules/v2/Header';
13
13
  import { useTranslation } from 'react-i18next';
14
- import { r as useHasFieldChanged, s as areValuesEqual, t as useResetSaveAsTemplateOnHide, v as SelectTemplateField, E as EditorAction, w as SaveAsTemplate, x as setEditorContent, y as ApiFields, L as ListField, o as Panel, z as ErrorCallout, B as SmsFields, M as MIN_DELAY_VALUE, C as MAX_DELAY_VALUE, G as PhoneNumberField, l as formatData, u as usePollRuleName, T as TouchErrors, n as ScrollToErrorField, p as getValidationSchema, q as DEFAULT_INITIAL_VALUE, m as buildPayload } from '../index-KEm6XVbK.js';
14
+ import { r as useHasFieldChanged, s as areValuesEqual, t as useResetSaveAsTemplateOnHide, v as SelectTemplateField, E as EditorAction, w as SaveAsTemplate, x as setEditorContent, y as ApiFields, L as ListField, o as Panel, z as ErrorCallout, B as SmsFields, M as MIN_DELAY_VALUE, C as MAX_DELAY_VALUE, G as PhoneNumberField, l as formatData, u as usePollRuleName, T as TouchErrors, n as ScrollToErrorField, p as getValidationSchema, q as DEFAULT_INITIAL_VALUE, m as buildPayload } from '../index-Di9n5OiL.js';
15
15
  import { u as useCustomDataStore } from '../useCustomDataStore-CEbhXugO.js';
16
16
  import { u as useUtilityStore } from '../useUtilityStore-BVCulMEC.js';
17
17
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
@@ -28,7 +28,7 @@ import Info from '@bigbinary/neeto-icons/Info';
28
28
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
29
29
  import useHotkeys from '@bigbinary/neeto-hotkeys';
30
30
  import Search from '@bigbinary/neeto-icons/Search';
31
- import { dayjs } from '@bigbinary/neeto-commons-frontend/v2/utils';
31
+ import { dayjs, hyphenize } from '@bigbinary/neeto-commons-frontend/v2/utils';
32
32
  import { D as DATE_FORMAT, b as getDateTimeValue, d as DATE_TIME_TYPES, T as TIME_FORMAT, e as DATE_TIME_FORMAT } from '../utils-a-9NZPeQ.js';
33
33
  import Up from '@bigbinary/neeto-icons/Up';
34
34
  import Down from '@bigbinary/neeto-icons/Down';
@@ -65,19 +65,20 @@ var UNIT_MINUTES = {
65
65
  };
66
66
 
67
67
  /* eslint-disable @bigbinary/neeto/hard-coded-strings-should-be-localized */
68
- /* eslint-disable @bigbinary/neeto/neetocommons-tips */
69
68
  var TIME_UNITS = [{
70
69
  label: "minutes",
71
- value: "minutes"
70
+ value: "minutes",
71
+ dataTestId: "minutes"
72
72
  }, {
73
73
  label: "hours",
74
- value: "hours"
74
+ value: "hours",
75
+ dataTestId: "hours"
75
76
  }, {
76
77
  label: "days",
77
- value: "days"
78
+ value: "days",
79
+ dataTestId: "days"
78
80
  }];
79
81
  /* eslint-enable @bigbinary/neeto/hard-coded-strings-should-be-localized */
80
- /* eslint-enable @bigbinary/neeto/neetocommons-tips */
81
82
 
82
83
  var LEAD_TIME_UNITS = TIME_UNITS;
83
84
 
@@ -1493,6 +1494,7 @@ var ScopeRow = function ScopeRow(_ref2) {
1493
1494
  children: meeting
1494
1495
  }), singlePhoneFieldLabel && /*#__PURE__*/jsxs("span", {
1495
1496
  className: "mb-fixed",
1497
+ "data-testid": "scope-phone-field-fixed-".concat(index),
1496
1498
  children: [usingLabel, " ", singlePhoneFieldLabel]
1497
1499
  }), hasPhoneFieldChoice && /*#__PURE__*/jsxs(Fragment$1, {
1498
1500
  children: [/*#__PURE__*/jsx("span", {
@@ -2625,6 +2627,7 @@ var descriptorFor = function descriptorFor(_ref19) {
2625
2627
  value: triggerValue(option),
2626
2628
  dataTestid: option.dataTestid,
2627
2629
  category: option.category,
2630
+ infoTooltip: option.infoTooltip,
2628
2631
  disabled: isLocked,
2629
2632
  disabledTooltip: isLocked && (schema.triggers.groupDisabledTooltip || t("neetoRules.builder.panes.triggerGroupDisabled"))
2630
2633
  };
@@ -2694,10 +2697,13 @@ var descriptorFor = function descriptorFor(_ref19) {
2694
2697
  }) : t("neetoRules.builder.panes.operatorSubtitle"),
2695
2698
  cascade: true,
2696
2699
  options: verbs.map(function (verb) {
2700
+ var _schema$conditions3;
2697
2701
  return {
2698
2702
  // eslint-disable-next-line security/detect-object-injection
2699
2703
  label: labels[verb] || humanize(verb),
2700
- value: verb
2704
+ value: verb,
2705
+ // eslint-disable-next-line security/detect-object-injection
2706
+ dataTestid: (_schema$conditions3 = schema.conditions) === null || _schema$conditions3 === void 0 || (_schema$conditions3 = _schema$conditions3.operatorDataTestids) === null || _schema$conditions3 === void 0 ? void 0 : _schema$conditions3[verb]
2701
2707
  };
2702
2708
  }),
2703
2709
  selectedValues: [conditionAt({
@@ -2712,10 +2718,12 @@ var descriptorFor = function descriptorFor(_ref19) {
2712
2718
  subtitle: t("neetoRules.builder.panes.connectorSubtitle"),
2713
2719
  options: [{
2714
2720
  label: t("neetoRules.builder.panes.connectorAndOption"),
2715
- value: CONDITION_MODE.AND
2721
+ value: CONDITION_MODE.AND,
2722
+ dataTestid: "and"
2716
2723
  }, {
2717
2724
  label: t("neetoRules.builder.panes.connectorOrOption"),
2718
- value: CONDITION_MODE.OR
2725
+ value: CONDITION_MODE.OR,
2726
+ dataTestid: "or"
2719
2727
  }],
2720
2728
  selectedValues: [rule.conditionMode]
2721
2729
  };
@@ -3677,7 +3685,7 @@ var CONDITION_VALUE_TYPES = {
3677
3685
  function ownKeys$4(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; }
3678
3686
  function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3679
3687
  var EmailChannelFields = function EmailChannelFields(_ref) {
3680
- var _getIn, _getIn2, _action$metadata;
3688
+ var _getIn, _option$recipientData, _getIn2, _action$metadata;
3681
3689
  var name = _ref.name,
3682
3690
  option = _ref.option,
3683
3691
  action = _ref.action,
@@ -3743,6 +3751,7 @@ var EmailChannelFields = function EmailChannelFields(_ref) {
3743
3751
  placeholder: option === null || option === void 0 ? void 0 : option.valuePlaceholder,
3744
3752
  size: "large",
3745
3753
  value: (_getIn = getIn(values, valuePath)) !== null && _getIn !== void 0 ? _getIn : undefined,
3754
+ dataTestId: (_option$recipientData = option === null || option === void 0 ? void 0 : option.recipientDataTestid) !== null && _option$recipientData !== void 0 ? _option$recipientData : option !== null && option !== void 0 && option.recipientLabel ? undefined : "recipient",
3746
3755
  label: (option === null || option === void 0 ? void 0 : option.recipientLabel) || t("neetoRules.builder.config.recipient"),
3747
3756
  onBlur: function onBlur() {
3748
3757
  return setFieldTouched(valuePath, true);
@@ -3756,6 +3765,7 @@ var EmailChannelFields = function EmailChannelFields(_ref) {
3756
3765
  onChange: handleTemplateChange
3757
3766
  }), !(option !== null && option !== void 0 && option.hideSubject) && /*#__PURE__*/jsx(Input, {
3758
3767
  required: true,
3768
+ dataTestId: "subject",
3759
3769
  error: fieldError(subjectPath),
3760
3770
  label: t("neetoRules.builder.config.subject"),
3761
3771
  placeholder: t("neetoRules.builder.config.subjectPlaceholder"),
@@ -3771,6 +3781,7 @@ var EmailChannelFields = function EmailChannelFields(_ref) {
3771
3781
  editorRef: editorRef,
3772
3782
  required: true,
3773
3783
  label: t("neetoRules.builder.config.body"),
3784
+ labelDataTestid: "body-editor-label",
3774
3785
  name: bodyPath,
3775
3786
  placeholder: t("neetoRules.builder.config.bodyPlaceholder"),
3776
3787
  value: action === null || action === void 0 || (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.body,
@@ -3863,6 +3874,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3863
3874
  children: [filtered.map(function (item) {
3864
3875
  return /*#__PURE__*/jsx(Checkbox, {
3865
3876
  checked: current.includes(item.value),
3877
+ dataTestId: item.dataTestid,
3866
3878
  label: item.label,
3867
3879
  onCheckedChange: function onCheckedChange() {
3868
3880
  return toggle(item.value);
@@ -3892,6 +3904,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3892
3904
  },
3893
3905
  children: _filtered.map(function (item) {
3894
3906
  return /*#__PURE__*/jsx(RadioGroup.Item, {
3907
+ dataTestId: item.dataTestid,
3895
3908
  label: item.label,
3896
3909
  value: String(item.value)
3897
3910
  }, item.value);
@@ -3913,6 +3926,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3913
3926
  children: [/*#__PURE__*/jsx(EditorAction, {
3914
3927
  required: true,
3915
3928
  label: t("neetoRules.builder.config.note"),
3929
+ labelDataTestid: "note-editor-label",
3916
3930
  name: valuePath,
3917
3931
  placeholder: t("neetoRules.builder.config.bodyPlaceholder"),
3918
3932
  value: action === null || action === void 0 || (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.value,
@@ -3924,6 +3938,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3924
3938
  var _getIn, _getIn2;
3925
3939
  return type === ACTION_CONFIG_TYPES.number ? /*#__PURE__*/jsx(Input, {
3926
3940
  required: true,
3941
+ dataTestId: "value",
3927
3942
  error: fieldError(valuePath),
3928
3943
  label: t("neetoRules.builder.config.value"),
3929
3944
  size: "large",
@@ -3937,6 +3952,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3937
3952
  }
3938
3953
  }) : /*#__PURE__*/jsx(Textarea, {
3939
3954
  required: true,
3955
+ dataTestId: "message",
3940
3956
  error: fieldError(valuePath),
3941
3957
  label: t("neetoRules.builder.config.message"),
3942
3958
  rows: 5,
@@ -3956,6 +3972,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3956
3972
  className: "flex flex-col gap-2",
3957
3973
  children: [/*#__PURE__*/jsx(Input, {
3958
3974
  required: true,
3975
+ dataTestId: "value",
3959
3976
  error: fieldError(valuePath),
3960
3977
  label: t("neetoRules.builder.config.value"),
3961
3978
  placeholder: option === null || option === void 0 ? void 0 : option.valuePlaceholder,
@@ -3975,6 +3992,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3975
3992
  className: "flex flex-col gap-2",
3976
3993
  children: [/*#__PURE__*/jsx(DatePicker, {
3977
3994
  required: true,
3995
+ dataTestId: "value",
3978
3996
  error: fieldError(valuePath),
3979
3997
  label: t("neetoRules.builder.config.value"),
3980
3998
  type: "date",
@@ -4579,6 +4597,7 @@ var NamePane = function NamePane(_ref) {
4579
4597
  children: /*#__PURE__*/jsx(Input$1, {
4580
4598
  autoFocus: true,
4581
4599
  required: true,
4600
+ dataTestId: "name",
4582
4601
  label: t("neetoRules.common.name"),
4583
4602
  name: "".concat(fieldKeys.name, ".value"),
4584
4603
  placeholder: t("neetoRules.builder.nameYourAutomation"),
@@ -4769,20 +4788,19 @@ var OptionsPane = function OptionsPane(_ref) {
4769
4788
  var popover = option.disabledPopover || (isNodeReason ? {
4770
4789
  description: reason
4771
4790
  } : null);
4772
- if (!Icon && !isTextReason && !popover) {
4773
- return option.disabled && option.disabledTooltip ? /*#__PURE__*/jsx(Tooltip, {
4774
- content: option.disabledTooltip,
4775
- position: "top",
4776
- children: /*#__PURE__*/jsx("span", {
4777
- children: option.label
4778
- })
4779
- }) : option.label;
4780
- }
4791
+ var label = option.disabled && option.disabledTooltip && !isTextReason && !popover ? /*#__PURE__*/jsx(Tooltip, {
4792
+ content: option.disabledTooltip,
4793
+ position: "top",
4794
+ children: /*#__PURE__*/jsx("span", {
4795
+ children: option.label
4796
+ })
4797
+ }) : option.label;
4798
+ if (!Icon && !isTextReason && !popover && !option.infoTooltip) return label;
4781
4799
  return /*#__PURE__*/jsxs("span", {
4782
4800
  className: "mb-pane-option",
4783
4801
  children: [Icon && /*#__PURE__*/jsx(Icon, {
4784
4802
  size: 20
4785
- }), option.label, popover && /*#__PURE__*/jsxs(Popover, {
4803
+ }), label, popover && /*#__PURE__*/jsxs(Popover, {
4786
4804
  position: "top",
4787
4805
  trigger: /*#__PURE__*/jsx("span", {
4788
4806
  className: "mb-pane-info",
@@ -4804,6 +4822,23 @@ var OptionsPane = function OptionsPane(_ref) {
4804
4822
  size: "sm",
4805
4823
  variant: "link"
4806
4824
  }))]
4825
+ }), !popover && option.infoTooltip && /*#__PURE__*/jsx(Tooltip, {
4826
+ content: option.infoTooltip,
4827
+ position: "top",
4828
+ sideOffset: 8,
4829
+ children: /*#__PURE__*/jsx("span", {
4830
+ "aria-label": option.infoTooltip,
4831
+ className: "mb-pane-info",
4832
+ "data-testid": "".concat(option.value, "-info"),
4833
+ role: "img",
4834
+ tabIndex: 0,
4835
+ onClick: function onClick(event) {
4836
+ return event.preventDefault();
4837
+ },
4838
+ children: /*#__PURE__*/jsx(Info, {
4839
+ size: 14
4840
+ })
4841
+ })
4807
4842
  }), !popover && reason && isTextReason && (option.disabledTooltip ? /*#__PURE__*/jsx(Tooltip, {
4808
4843
  content: option.disabledTooltip,
4809
4844
  position: "top",
@@ -4862,12 +4897,13 @@ var OptionsPane = function OptionsPane(_ref) {
4862
4897
  items = _ref4[1];
4863
4898
  return /*#__PURE__*/jsxs(Fragment, {
4864
4899
  children: [renderGroupHeader(category), items.map(function (option) {
4900
+ var _option$dataTestid;
4865
4901
  return /*#__PURE__*/jsx(Checkbox, _objectSpread$3({
4866
4902
  checked: isSelected(option.value),
4867
- dataTestId: option.dataTestid,
4868
4903
  disabled: option.disabled,
4869
4904
  label: optionLabel(option),
4870
4905
  labelProps: previewHandlers(option.value, option.disabled),
4906
+ dataTestId: (_option$dataTestid = option.dataTestid) !== null && _option$dataTestid !== void 0 ? _option$dataTestid : hyphenize(option.label) || undefined,
4871
4907
  onCheckedChange: function onCheckedChange() {
4872
4908
  return handleSelect(option.value);
4873
4909
  }
@@ -4954,6 +4990,7 @@ var RecipientField = function RecipientField(_ref) {
4954
4990
  var _current = getIn(values, _path) || [];
4955
4991
  return /*#__PURE__*/jsx(MultiEmailInput, {
4956
4992
  required: true,
4993
+ dataTestId: "email-addresses",
4957
4994
  error: fieldError(_path),
4958
4995
  label: t("neetoRules.builder.config.emailAddresses"),
4959
4996
  placeholder: t("neetoRules.builder.config.emailPlaceholder"),
@@ -4979,6 +5016,7 @@ var RecipientField = function RecipientField(_ref) {
4979
5016
  options: options,
4980
5017
  placeholder: placeholder,
4981
5018
  required: true,
5019
+ dataTestId: "recipient",
4982
5020
  error: fieldError(path),
4983
5021
  label: t("neetoRules.builder.config.recipient"),
4984
5022
  size: "large",
@@ -5181,6 +5219,7 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
5181
5219
  children: [filtered.map(function (option) {
5182
5220
  return /*#__PURE__*/jsx(Checkbox, {
5183
5221
  checked: current.includes(option.value),
5222
+ dataTestId: option.dataTestid,
5184
5223
  label: option.label,
5185
5224
  onCheckedChange: function onCheckedChange() {
5186
5225
  return toggle(option.value);
@@ -5209,6 +5248,7 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
5209
5248
  isCreatable: true,
5210
5249
  isMulti: true,
5211
5250
  required: true,
5251
+ dataTestId: "keywords",
5212
5252
  error: fieldError(valuesPath),
5213
5253
  label: t("neetoRules.builder.config.keywords"),
5214
5254
  placeholder: t("neetoRules.builder.config.keywordsPlaceholder"),
@@ -5235,6 +5275,7 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
5235
5275
  },
5236
5276
  children: _filtered.map(function (option) {
5237
5277
  return /*#__PURE__*/jsx(RadioGroup.Item, {
5278
+ dataTestId: option.dataTestid,
5238
5279
  label: String(option.label).toLowerCase(),
5239
5280
  value: String(option.value)
5240
5281
  }, option.value);
@@ -5277,9 +5318,11 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
5277
5318
  onChange: handleChange
5278
5319
  };
5279
5320
  return dateTimeType === DATE_TIME_TYPES.time ? /*#__PURE__*/jsx(TimePicker, _objectSpread$2(_objectSpread$2({}, pickerProps), {}, {
5321
+ dataTestId: "select-time",
5280
5322
  format: "24",
5281
5323
  label: t("neetoRules.form.selectTime")
5282
5324
  })) : /*#__PURE__*/jsx(DatePicker, _objectSpread$2(_objectSpread$2({}, pickerProps), {}, {
5325
+ dataTestId: "select-date",
5283
5326
  label: t("neetoRules.form.selectDate"),
5284
5327
  showTime: field === null || field === void 0 ? void 0 : field.showTime,
5285
5328
  timeFormat: "HH:mm",
@@ -5291,6 +5334,7 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
5291
5334
  return /*#__PURE__*/jsx(Input, {
5292
5335
  autoFocus: true,
5293
5336
  required: true,
5337
+ dataTestId: "value",
5294
5338
  error: fieldError(valuePath),
5295
5339
  label: t("neetoRules.common.value"),
5296
5340
  size: "large",
@@ -5307,6 +5351,7 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
5307
5351
  return /*#__PURE__*/jsx(Input$1, {
5308
5352
  autoFocus: true,
5309
5353
  required: true,
5354
+ dataTestId: "value",
5310
5355
  label: t("neetoRules.common.value"),
5311
5356
  name: valuePath,
5312
5357
  size: "large",