@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.
@@ -13,7 +13,7 @@ var neetoCist = require('@bigbinary/neeto-cist');
13
13
  var Container = require('@bigbinary/neeto-molecules/v2/Container');
14
14
  var Header = require('@bigbinary/neeto-molecules/v2/Header');
15
15
  var reactI18next = require('react-i18next');
16
- var index = require('../../index-D7d7coUX.js');
16
+ var index = require('../../index-B_8d4J93.js');
17
17
  var useCustomDataStore = require('../../useCustomDataStore-DPmWkEhs.js');
18
18
  var useUtilityStore = require('../../useUtilityStore-gtPhFvpI.js');
19
19
  var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
@@ -86,19 +86,20 @@ var UNIT_MINUTES = {
86
86
  };
87
87
 
88
88
  /* eslint-disable @bigbinary/neeto/hard-coded-strings-should-be-localized */
89
- /* eslint-disable @bigbinary/neeto/neetocommons-tips */
90
89
  var TIME_UNITS = [{
91
90
  label: "minutes",
92
- value: "minutes"
91
+ value: "minutes",
92
+ dataTestId: "minutes"
93
93
  }, {
94
94
  label: "hours",
95
- value: "hours"
95
+ value: "hours",
96
+ dataTestId: "hours"
96
97
  }, {
97
98
  label: "days",
98
- value: "days"
99
+ value: "days",
100
+ dataTestId: "days"
99
101
  }];
100
102
  /* eslint-enable @bigbinary/neeto/hard-coded-strings-should-be-localized */
101
- /* eslint-enable @bigbinary/neeto/neetocommons-tips */
102
103
 
103
104
  var LEAD_TIME_UNITS = TIME_UNITS;
104
105
 
@@ -1514,6 +1515,7 @@ var ScopeRow = function ScopeRow(_ref2) {
1514
1515
  children: meeting
1515
1516
  }), singlePhoneFieldLabel && /*#__PURE__*/jsxRuntime.jsxs("span", {
1516
1517
  className: "mb-fixed",
1518
+ "data-testid": "scope-phone-field-fixed-".concat(index),
1517
1519
  children: [usingLabel, " ", singlePhoneFieldLabel]
1518
1520
  }), hasPhoneFieldChoice && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
1519
1521
  children: [/*#__PURE__*/jsxRuntime.jsx("span", {
@@ -2646,6 +2648,7 @@ var descriptorFor = function descriptorFor(_ref19) {
2646
2648
  value: triggerValue(option),
2647
2649
  dataTestid: option.dataTestid,
2648
2650
  category: option.category,
2651
+ infoTooltip: option.infoTooltip,
2649
2652
  disabled: isLocked,
2650
2653
  disabledTooltip: isLocked && (schema.triggers.groupDisabledTooltip || i18next.t("neetoRules.builder.panes.triggerGroupDisabled"))
2651
2654
  };
@@ -2715,10 +2718,13 @@ var descriptorFor = function descriptorFor(_ref19) {
2715
2718
  }) : i18next.t("neetoRules.builder.panes.operatorSubtitle"),
2716
2719
  cascade: true,
2717
2720
  options: verbs.map(function (verb) {
2721
+ var _schema$conditions3;
2718
2722
  return {
2719
2723
  // eslint-disable-next-line security/detect-object-injection
2720
2724
  label: labels[verb] || humanize(verb),
2721
- value: verb
2725
+ value: verb,
2726
+ // eslint-disable-next-line security/detect-object-injection
2727
+ 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]
2722
2728
  };
2723
2729
  }),
2724
2730
  selectedValues: [conditionAt({
@@ -2733,10 +2739,12 @@ var descriptorFor = function descriptorFor(_ref19) {
2733
2739
  subtitle: i18next.t("neetoRules.builder.panes.connectorSubtitle"),
2734
2740
  options: [{
2735
2741
  label: i18next.t("neetoRules.builder.panes.connectorAndOption"),
2736
- value: CONDITION_MODE.AND
2742
+ value: CONDITION_MODE.AND,
2743
+ dataTestid: "and"
2737
2744
  }, {
2738
2745
  label: i18next.t("neetoRules.builder.panes.connectorOrOption"),
2739
- value: CONDITION_MODE.OR
2746
+ value: CONDITION_MODE.OR,
2747
+ dataTestid: "or"
2740
2748
  }],
2741
2749
  selectedValues: [rule.conditionMode]
2742
2750
  };
@@ -3698,7 +3706,7 @@ var CONDITION_VALUE_TYPES = {
3698
3706
  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; }
3699
3707
  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; }
3700
3708
  var EmailChannelFields = function EmailChannelFields(_ref) {
3701
- var _getIn, _getIn2, _action$metadata;
3709
+ var _getIn, _option$recipientData, _getIn2, _action$metadata;
3702
3710
  var name = _ref.name,
3703
3711
  option = _ref.option,
3704
3712
  action = _ref.action,
@@ -3764,6 +3772,7 @@ var EmailChannelFields = function EmailChannelFields(_ref) {
3764
3772
  placeholder: option === null || option === void 0 ? void 0 : option.valuePlaceholder,
3765
3773
  size: "large",
3766
3774
  value: (_getIn = formik.getIn(values, valuePath)) !== null && _getIn !== void 0 ? _getIn : undefined,
3775
+ 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",
3767
3776
  label: (option === null || option === void 0 ? void 0 : option.recipientLabel) || t("neetoRules.builder.config.recipient"),
3768
3777
  onBlur: function onBlur() {
3769
3778
  return setFieldTouched(valuePath, true);
@@ -3777,6 +3786,7 @@ var EmailChannelFields = function EmailChannelFields(_ref) {
3777
3786
  onChange: handleTemplateChange
3778
3787
  }), !(option !== null && option !== void 0 && option.hideSubject) && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Input, {
3779
3788
  required: true,
3789
+ dataTestId: "subject",
3780
3790
  error: fieldError(subjectPath),
3781
3791
  label: t("neetoRules.builder.config.subject"),
3782
3792
  placeholder: t("neetoRules.builder.config.subjectPlaceholder"),
@@ -3792,6 +3802,7 @@ var EmailChannelFields = function EmailChannelFields(_ref) {
3792
3802
  editorRef: editorRef,
3793
3803
  required: true,
3794
3804
  label: t("neetoRules.builder.config.body"),
3805
+ labelDataTestid: "body-editor-label",
3795
3806
  name: bodyPath,
3796
3807
  placeholder: t("neetoRules.builder.config.bodyPlaceholder"),
3797
3808
  value: action === null || action === void 0 || (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.body,
@@ -3884,6 +3895,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3884
3895
  children: [filtered.map(function (item) {
3885
3896
  return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Checkbox, {
3886
3897
  checked: current.includes(item.value),
3898
+ dataTestId: item.dataTestid,
3887
3899
  label: item.label,
3888
3900
  onCheckedChange: function onCheckedChange() {
3889
3901
  return toggle(item.value);
@@ -3913,6 +3925,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3913
3925
  },
3914
3926
  children: _filtered.map(function (item) {
3915
3927
  return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.RadioGroup.Item, {
3928
+ dataTestId: item.dataTestid,
3916
3929
  label: item.label,
3917
3930
  value: String(item.value)
3918
3931
  }, item.value);
@@ -3934,6 +3947,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3934
3947
  children: [/*#__PURE__*/jsxRuntime.jsx(index.EditorAction, {
3935
3948
  required: true,
3936
3949
  label: t("neetoRules.builder.config.note"),
3950
+ labelDataTestid: "note-editor-label",
3937
3951
  name: valuePath,
3938
3952
  placeholder: t("neetoRules.builder.config.bodyPlaceholder"),
3939
3953
  value: action === null || action === void 0 || (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.value,
@@ -3945,6 +3959,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3945
3959
  var _getIn, _getIn2;
3946
3960
  return type === ACTION_CONFIG_TYPES.number ? /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Input, {
3947
3961
  required: true,
3962
+ dataTestId: "value",
3948
3963
  error: fieldError(valuePath),
3949
3964
  label: t("neetoRules.builder.config.value"),
3950
3965
  size: "large",
@@ -3958,6 +3973,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3958
3973
  }
3959
3974
  }) : /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Textarea, {
3960
3975
  required: true,
3976
+ dataTestId: "message",
3961
3977
  error: fieldError(valuePath),
3962
3978
  label: t("neetoRules.builder.config.message"),
3963
3979
  rows: 5,
@@ -3977,6 +3993,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3977
3993
  className: "flex flex-col gap-2",
3978
3994
  children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Input, {
3979
3995
  required: true,
3996
+ dataTestId: "value",
3980
3997
  error: fieldError(valuePath),
3981
3998
  label: t("neetoRules.builder.config.value"),
3982
3999
  placeholder: option === null || option === void 0 ? void 0 : option.valuePlaceholder,
@@ -3996,6 +4013,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3996
4013
  className: "flex flex-col gap-2",
3997
4014
  children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.DatePicker, {
3998
4015
  required: true,
4016
+ dataTestId: "value",
3999
4017
  error: fieldError(valuePath),
4000
4018
  label: t("neetoRules.builder.config.value"),
4001
4019
  type: "date",
@@ -4600,6 +4618,7 @@ var NamePane = function NamePane(_ref) {
4600
4618
  children: /*#__PURE__*/jsxRuntime.jsx(formik$1.Input, {
4601
4619
  autoFocus: true,
4602
4620
  required: true,
4621
+ dataTestId: "name",
4603
4622
  label: t("neetoRules.common.name"),
4604
4623
  name: "".concat(fieldKeys.name, ".value"),
4605
4624
  placeholder: t("neetoRules.builder.nameYourAutomation"),
@@ -4790,20 +4809,19 @@ var OptionsPane = function OptionsPane(_ref) {
4790
4809
  var popover = option.disabledPopover || (isNodeReason ? {
4791
4810
  description: reason
4792
4811
  } : null);
4793
- if (!Icon && !isTextReason && !popover) {
4794
- return option.disabled && option.disabledTooltip ? /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Tooltip, {
4795
- content: option.disabledTooltip,
4796
- position: "top",
4797
- children: /*#__PURE__*/jsxRuntime.jsx("span", {
4798
- children: option.label
4799
- })
4800
- }) : option.label;
4801
- }
4812
+ var label = option.disabled && option.disabledTooltip && !isTextReason && !popover ? /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Tooltip, {
4813
+ content: option.disabledTooltip,
4814
+ position: "top",
4815
+ children: /*#__PURE__*/jsxRuntime.jsx("span", {
4816
+ children: option.label
4817
+ })
4818
+ }) : option.label;
4819
+ if (!Icon && !isTextReason && !popover && !option.infoTooltip) return label;
4802
4820
  return /*#__PURE__*/jsxRuntime.jsxs("span", {
4803
4821
  className: "mb-pane-option",
4804
4822
  children: [Icon && /*#__PURE__*/jsxRuntime.jsx(Icon, {
4805
4823
  size: 20
4806
- }), option.label, popover && /*#__PURE__*/jsxRuntime.jsxs(neetoAtoms.Popover, {
4824
+ }), label, popover && /*#__PURE__*/jsxRuntime.jsxs(neetoAtoms.Popover, {
4807
4825
  position: "top",
4808
4826
  trigger: /*#__PURE__*/jsxRuntime.jsx("span", {
4809
4827
  className: "mb-pane-info",
@@ -4825,6 +4843,23 @@ var OptionsPane = function OptionsPane(_ref) {
4825
4843
  size: "sm",
4826
4844
  variant: "link"
4827
4845
  }))]
4846
+ }), !popover && option.infoTooltip && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Tooltip, {
4847
+ content: option.infoTooltip,
4848
+ position: "top",
4849
+ sideOffset: 8,
4850
+ children: /*#__PURE__*/jsxRuntime.jsx("span", {
4851
+ "aria-label": option.infoTooltip,
4852
+ className: "mb-pane-info",
4853
+ "data-testid": "".concat(option.value, "-info"),
4854
+ role: "img",
4855
+ tabIndex: 0,
4856
+ onClick: function onClick(event) {
4857
+ return event.preventDefault();
4858
+ },
4859
+ children: /*#__PURE__*/jsxRuntime.jsx(Info, {
4860
+ size: 14
4861
+ })
4862
+ })
4828
4863
  }), !popover && reason && isTextReason && (option.disabledTooltip ? /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Tooltip, {
4829
4864
  content: option.disabledTooltip,
4830
4865
  position: "top",
@@ -4883,12 +4918,13 @@ var OptionsPane = function OptionsPane(_ref) {
4883
4918
  items = _ref4[1];
4884
4919
  return /*#__PURE__*/jsxRuntime.jsxs(react.Fragment, {
4885
4920
  children: [renderGroupHeader(category), items.map(function (option) {
4921
+ var _option$dataTestid;
4886
4922
  return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Checkbox, _objectSpread$3({
4887
4923
  checked: isSelected(option.value),
4888
- dataTestId: option.dataTestid,
4889
4924
  disabled: option.disabled,
4890
4925
  label: optionLabel(option),
4891
4926
  labelProps: previewHandlers(option.value, option.disabled),
4927
+ dataTestId: (_option$dataTestid = option.dataTestid) !== null && _option$dataTestid !== void 0 ? _option$dataTestid : utils.hyphenize(option.label) || undefined,
4892
4928
  onCheckedChange: function onCheckedChange() {
4893
4929
  return handleSelect(option.value);
4894
4930
  }
@@ -4975,6 +5011,7 @@ var RecipientField = function RecipientField(_ref) {
4975
5011
  var _current = formik.getIn(values, _path) || [];
4976
5012
  return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.MultiEmailInput, {
4977
5013
  required: true,
5014
+ dataTestId: "email-addresses",
4978
5015
  error: fieldError(_path),
4979
5016
  label: t("neetoRules.builder.config.emailAddresses"),
4980
5017
  placeholder: t("neetoRules.builder.config.emailPlaceholder"),
@@ -5000,6 +5037,7 @@ var RecipientField = function RecipientField(_ref) {
5000
5037
  options: options,
5001
5038
  placeholder: placeholder,
5002
5039
  required: true,
5040
+ dataTestId: "recipient",
5003
5041
  error: fieldError(path),
5004
5042
  label: t("neetoRules.builder.config.recipient"),
5005
5043
  size: "large",
@@ -5202,6 +5240,7 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
5202
5240
  children: [filtered.map(function (option) {
5203
5241
  return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Checkbox, {
5204
5242
  checked: current.includes(option.value),
5243
+ dataTestId: option.dataTestid,
5205
5244
  label: option.label,
5206
5245
  onCheckedChange: function onCheckedChange() {
5207
5246
  return toggle(option.value);
@@ -5230,6 +5269,7 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
5230
5269
  isCreatable: true,
5231
5270
  isMulti: true,
5232
5271
  required: true,
5272
+ dataTestId: "keywords",
5233
5273
  error: fieldError(valuesPath),
5234
5274
  label: t("neetoRules.builder.config.keywords"),
5235
5275
  placeholder: t("neetoRules.builder.config.keywordsPlaceholder"),
@@ -5256,6 +5296,7 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
5256
5296
  },
5257
5297
  children: _filtered.map(function (option) {
5258
5298
  return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.RadioGroup.Item, {
5299
+ dataTestId: option.dataTestid,
5259
5300
  label: String(option.label).toLowerCase(),
5260
5301
  value: String(option.value)
5261
5302
  }, option.value);
@@ -5298,9 +5339,11 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
5298
5339
  onChange: handleChange
5299
5340
  };
5300
5341
  return dateTimeType === utils$1.DATE_TIME_TYPES.time ? /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.TimePicker, _objectSpread$2(_objectSpread$2({}, pickerProps), {}, {
5342
+ dataTestId: "select-time",
5301
5343
  format: "24",
5302
5344
  label: t("neetoRules.form.selectTime")
5303
5345
  })) : /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.DatePicker, _objectSpread$2(_objectSpread$2({}, pickerProps), {}, {
5346
+ dataTestId: "select-date",
5304
5347
  label: t("neetoRules.form.selectDate"),
5305
5348
  showTime: field === null || field === void 0 ? void 0 : field.showTime,
5306
5349
  timeFormat: "HH:mm",
@@ -5312,6 +5355,7 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
5312
5355
  return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Input, {
5313
5356
  autoFocus: true,
5314
5357
  required: true,
5358
+ dataTestId: "value",
5315
5359
  error: fieldError(valuePath),
5316
5360
  label: t("neetoRules.common.value"),
5317
5361
  size: "large",
@@ -5328,6 +5372,7 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
5328
5372
  return /*#__PURE__*/jsxRuntime.jsx(formik$1.Input, {
5329
5373
  autoFocus: true,
5330
5374
  required: true,
5375
+ dataTestId: "value",
5331
5376
  label: t("neetoRules.common.value"),
5332
5377
  name: valuePath,
5333
5378
  size: "large",