@bigbinary/neeto-rules-frontend 2.9.3 → 2.9.4

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';
@@ -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
 
@@ -2694,10 +2695,13 @@ var descriptorFor = function descriptorFor(_ref19) {
2694
2695
  }) : t("neetoRules.builder.panes.operatorSubtitle"),
2695
2696
  cascade: true,
2696
2697
  options: verbs.map(function (verb) {
2698
+ var _schema$conditions3;
2697
2699
  return {
2698
2700
  // eslint-disable-next-line security/detect-object-injection
2699
2701
  label: labels[verb] || humanize(verb),
2700
- value: verb
2702
+ value: verb,
2703
+ // eslint-disable-next-line security/detect-object-injection
2704
+ 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
2705
  };
2702
2706
  }),
2703
2707
  selectedValues: [conditionAt({
@@ -2712,10 +2716,12 @@ var descriptorFor = function descriptorFor(_ref19) {
2712
2716
  subtitle: t("neetoRules.builder.panes.connectorSubtitle"),
2713
2717
  options: [{
2714
2718
  label: t("neetoRules.builder.panes.connectorAndOption"),
2715
- value: CONDITION_MODE.AND
2719
+ value: CONDITION_MODE.AND,
2720
+ dataTestid: "and"
2716
2721
  }, {
2717
2722
  label: t("neetoRules.builder.panes.connectorOrOption"),
2718
- value: CONDITION_MODE.OR
2723
+ value: CONDITION_MODE.OR,
2724
+ dataTestid: "or"
2719
2725
  }],
2720
2726
  selectedValues: [rule.conditionMode]
2721
2727
  };
@@ -3677,7 +3683,7 @@ var CONDITION_VALUE_TYPES = {
3677
3683
  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
3684
  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
3685
  var EmailChannelFields = function EmailChannelFields(_ref) {
3680
- var _getIn, _getIn2, _action$metadata;
3686
+ var _getIn, _option$recipientData, _getIn2, _action$metadata;
3681
3687
  var name = _ref.name,
3682
3688
  option = _ref.option,
3683
3689
  action = _ref.action,
@@ -3743,6 +3749,7 @@ var EmailChannelFields = function EmailChannelFields(_ref) {
3743
3749
  placeholder: option === null || option === void 0 ? void 0 : option.valuePlaceholder,
3744
3750
  size: "large",
3745
3751
  value: (_getIn = getIn(values, valuePath)) !== null && _getIn !== void 0 ? _getIn : undefined,
3752
+ 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
3753
  label: (option === null || option === void 0 ? void 0 : option.recipientLabel) || t("neetoRules.builder.config.recipient"),
3747
3754
  onBlur: function onBlur() {
3748
3755
  return setFieldTouched(valuePath, true);
@@ -3756,6 +3763,7 @@ var EmailChannelFields = function EmailChannelFields(_ref) {
3756
3763
  onChange: handleTemplateChange
3757
3764
  }), !(option !== null && option !== void 0 && option.hideSubject) && /*#__PURE__*/jsx(Input, {
3758
3765
  required: true,
3766
+ dataTestId: "subject",
3759
3767
  error: fieldError(subjectPath),
3760
3768
  label: t("neetoRules.builder.config.subject"),
3761
3769
  placeholder: t("neetoRules.builder.config.subjectPlaceholder"),
@@ -3771,6 +3779,7 @@ var EmailChannelFields = function EmailChannelFields(_ref) {
3771
3779
  editorRef: editorRef,
3772
3780
  required: true,
3773
3781
  label: t("neetoRules.builder.config.body"),
3782
+ labelDataTestid: "body-editor-label",
3774
3783
  name: bodyPath,
3775
3784
  placeholder: t("neetoRules.builder.config.bodyPlaceholder"),
3776
3785
  value: action === null || action === void 0 || (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.body,
@@ -3863,6 +3872,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3863
3872
  children: [filtered.map(function (item) {
3864
3873
  return /*#__PURE__*/jsx(Checkbox, {
3865
3874
  checked: current.includes(item.value),
3875
+ dataTestId: item.dataTestid,
3866
3876
  label: item.label,
3867
3877
  onCheckedChange: function onCheckedChange() {
3868
3878
  return toggle(item.value);
@@ -3892,6 +3902,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3892
3902
  },
3893
3903
  children: _filtered.map(function (item) {
3894
3904
  return /*#__PURE__*/jsx(RadioGroup.Item, {
3905
+ dataTestId: item.dataTestid,
3895
3906
  label: item.label,
3896
3907
  value: String(item.value)
3897
3908
  }, item.value);
@@ -3913,6 +3924,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3913
3924
  children: [/*#__PURE__*/jsx(EditorAction, {
3914
3925
  required: true,
3915
3926
  label: t("neetoRules.builder.config.note"),
3927
+ labelDataTestid: "note-editor-label",
3916
3928
  name: valuePath,
3917
3929
  placeholder: t("neetoRules.builder.config.bodyPlaceholder"),
3918
3930
  value: action === null || action === void 0 || (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.value,
@@ -3924,6 +3936,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3924
3936
  var _getIn, _getIn2;
3925
3937
  return type === ACTION_CONFIG_TYPES.number ? /*#__PURE__*/jsx(Input, {
3926
3938
  required: true,
3939
+ dataTestId: "value",
3927
3940
  error: fieldError(valuePath),
3928
3941
  label: t("neetoRules.builder.config.value"),
3929
3942
  size: "large",
@@ -3937,6 +3950,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3937
3950
  }
3938
3951
  }) : /*#__PURE__*/jsx(Textarea, {
3939
3952
  required: true,
3953
+ dataTestId: "message",
3940
3954
  error: fieldError(valuePath),
3941
3955
  label: t("neetoRules.builder.config.message"),
3942
3956
  rows: 5,
@@ -3956,6 +3970,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3956
3970
  className: "flex flex-col gap-2",
3957
3971
  children: [/*#__PURE__*/jsx(Input, {
3958
3972
  required: true,
3973
+ dataTestId: "value",
3959
3974
  error: fieldError(valuePath),
3960
3975
  label: t("neetoRules.builder.config.value"),
3961
3976
  placeholder: option === null || option === void 0 ? void 0 : option.valuePlaceholder,
@@ -3975,6 +3990,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3975
3990
  className: "flex flex-col gap-2",
3976
3991
  children: [/*#__PURE__*/jsx(DatePicker, {
3977
3992
  required: true,
3993
+ dataTestId: "value",
3978
3994
  error: fieldError(valuePath),
3979
3995
  label: t("neetoRules.builder.config.value"),
3980
3996
  type: "date",
@@ -4579,6 +4595,7 @@ var NamePane = function NamePane(_ref) {
4579
4595
  children: /*#__PURE__*/jsx(Input$1, {
4580
4596
  autoFocus: true,
4581
4597
  required: true,
4598
+ dataTestId: "name",
4582
4599
  label: t("neetoRules.common.name"),
4583
4600
  name: "".concat(fieldKeys.name, ".value"),
4584
4601
  placeholder: t("neetoRules.builder.nameYourAutomation"),
@@ -4954,6 +4971,7 @@ var RecipientField = function RecipientField(_ref) {
4954
4971
  var _current = getIn(values, _path) || [];
4955
4972
  return /*#__PURE__*/jsx(MultiEmailInput, {
4956
4973
  required: true,
4974
+ dataTestId: "email-addresses",
4957
4975
  error: fieldError(_path),
4958
4976
  label: t("neetoRules.builder.config.emailAddresses"),
4959
4977
  placeholder: t("neetoRules.builder.config.emailPlaceholder"),
@@ -4979,6 +4997,7 @@ var RecipientField = function RecipientField(_ref) {
4979
4997
  options: options,
4980
4998
  placeholder: placeholder,
4981
4999
  required: true,
5000
+ dataTestId: "recipient",
4982
5001
  error: fieldError(path),
4983
5002
  label: t("neetoRules.builder.config.recipient"),
4984
5003
  size: "large",
@@ -5181,6 +5200,7 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
5181
5200
  children: [filtered.map(function (option) {
5182
5201
  return /*#__PURE__*/jsx(Checkbox, {
5183
5202
  checked: current.includes(option.value),
5203
+ dataTestId: option.dataTestid,
5184
5204
  label: option.label,
5185
5205
  onCheckedChange: function onCheckedChange() {
5186
5206
  return toggle(option.value);
@@ -5209,6 +5229,7 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
5209
5229
  isCreatable: true,
5210
5230
  isMulti: true,
5211
5231
  required: true,
5232
+ dataTestId: "keywords",
5212
5233
  error: fieldError(valuesPath),
5213
5234
  label: t("neetoRules.builder.config.keywords"),
5214
5235
  placeholder: t("neetoRules.builder.config.keywordsPlaceholder"),
@@ -5235,6 +5256,7 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
5235
5256
  },
5236
5257
  children: _filtered.map(function (option) {
5237
5258
  return /*#__PURE__*/jsx(RadioGroup.Item, {
5259
+ dataTestId: option.dataTestid,
5238
5260
  label: String(option.label).toLowerCase(),
5239
5261
  value: String(option.value)
5240
5262
  }, option.value);
@@ -5277,9 +5299,11 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
5277
5299
  onChange: handleChange
5278
5300
  };
5279
5301
  return dateTimeType === DATE_TIME_TYPES.time ? /*#__PURE__*/jsx(TimePicker, _objectSpread$2(_objectSpread$2({}, pickerProps), {}, {
5302
+ dataTestId: "select-time",
5280
5303
  format: "24",
5281
5304
  label: t("neetoRules.form.selectTime")
5282
5305
  })) : /*#__PURE__*/jsx(DatePicker, _objectSpread$2(_objectSpread$2({}, pickerProps), {}, {
5306
+ dataTestId: "select-date",
5283
5307
  label: t("neetoRules.form.selectDate"),
5284
5308
  showTime: field === null || field === void 0 ? void 0 : field.showTime,
5285
5309
  timeFormat: "HH:mm",
@@ -5291,6 +5315,7 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
5291
5315
  return /*#__PURE__*/jsx(Input, {
5292
5316
  autoFocus: true,
5293
5317
  required: true,
5318
+ dataTestId: "value",
5294
5319
  error: fieldError(valuePath),
5295
5320
  label: t("neetoRules.common.value"),
5296
5321
  size: "large",
@@ -5307,6 +5332,7 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
5307
5332
  return /*#__PURE__*/jsx(Input$1, {
5308
5333
  autoFocus: true,
5309
5334
  required: true,
5335
+ dataTestId: "value",
5310
5336
  label: t("neetoRules.common.value"),
5311
5337
  name: valuePath,
5312
5338
  size: "large",