@bigbinary/neeto-rules-frontend 2.7.0 → 2.7.1

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 @@ import Down from '@bigbinary/neeto-icons/Down';
13
13
  import Up from '@bigbinary/neeto-icons/Up';
14
14
  import Button from '@bigbinary/neetoui/Button';
15
15
  import { pluck } from 'ramda';
16
- import { g as getSeparator, a as getDateTimeFormattedValue } from './utils-CfCq6Ltz.js';
16
+ import { g as getSeparator, a as getDateTimeFormattedValue } from './utils-DeqHhpwQ.js';
17
17
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
18
18
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
19
19
  import Tooltip from '@bigbinary/neetoui/Tooltip';
@@ -13,7 +13,7 @@ var Header = require('@bigbinary/neeto-molecules/Header');
13
13
  var Spinner = require('@bigbinary/neetoui/Spinner');
14
14
  var ActionBlock = require('@bigbinary/neetoui/formik/ActionBlock');
15
15
  var reactI18next = require('react-i18next');
16
- var index = require('../index-C8o4tdnQ.js');
16
+ var index = require('../index-Df_k2p4V.js');
17
17
  var useCustomDataStore = require('../useCustomDataStore-DxFx8aCf.js');
18
18
  var useUtilityStore = require('../useUtilityStore-C_U20IMX.js');
19
19
  var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
@@ -30,9 +30,12 @@ var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
30
30
  var Search = require('@bigbinary/neeto-icons/Search');
31
31
  var Input = require('@bigbinary/neetoui/Input');
32
32
  var Typography = require('@bigbinary/neetoui/Typography');
33
+ var utils = require('@bigbinary/neeto-commons-frontend/utils');
33
34
  var Checkbox = require('@bigbinary/neetoui/Checkbox');
35
+ var DatePicker = require('@bigbinary/neetoui/DatePicker');
34
36
  var Radio = require('@bigbinary/neetoui/Radio');
35
37
  var Textarea = require('@bigbinary/neetoui/Textarea');
38
+ var utils$1 = require('../utils-B3roKiff.js');
36
39
  var Input$1 = require('@bigbinary/neetoui/formik/Input');
37
40
  var Select = require('@bigbinary/neetoui/formik/Select');
38
41
  var Select$1 = require('@bigbinary/neetoui/Select');
@@ -58,10 +61,6 @@ require('@monaco-editor/react');
58
61
  require('@bigbinary/neeto-icons/Help');
59
62
  require('@bigbinary/neeto-molecules/DynamicVariables');
60
63
  require('@bigbinary/neetoui/Label');
61
- require('@bigbinary/neeto-commons-frontend/utils');
62
- require('@bigbinary/neetoui/DatePicker');
63
- require('../utils-B3roKiff.js');
64
- require('@bigbinary/neeto-commons-frontend/initializers');
65
64
  require('@bigbinary/neetoui/formik/MultiEmailInput');
66
65
  require('@bigbinary/neeto-editor/FormikEditor');
67
66
  require('@bigbinary/neeto-icons/Refresh');
@@ -73,6 +72,7 @@ require('@bigbinary/neeto-molecules/PhoneNumber');
73
72
  require('@bigbinary/neetoui/Tag');
74
73
  require('react-select');
75
74
  require('../constants-BjXYr8nk.js');
75
+ require('@bigbinary/neeto-commons-frontend/initializers');
76
76
  require('@bigbinary/neetoui/TimePicker');
77
77
  require('@bigbinary/neeto-editor/utils');
78
78
  require('zustand');
@@ -3038,6 +3038,25 @@ var Canvas = function Canvas(_ref) {
3038
3038
  });
3039
3039
  };
3040
3040
 
3041
+ var ACTION_CONFIG_TYPES = {
3042
+ emailChannel: "emailChannel",
3043
+ multiSelect: "multiSelect",
3044
+ dropdown: "dropdown",
3045
+ note: "note",
3046
+ textarea: "textarea",
3047
+ number: "number",
3048
+ text: "text",
3049
+ regex: "regex",
3050
+ decimal: "decimal",
3051
+ date: "date"
3052
+ };
3053
+ var CONDITION_VALUE_TYPES = {
3054
+ multiSelect: "multi-select",
3055
+ multiSelectCreate: "multi-select-create",
3056
+ number: "number",
3057
+ email: "email"
3058
+ };
3059
+
3041
3060
  var restoreTokens = function restoreTokens(text) {
3042
3061
  return text ? text.replace(/\[\[/g, "{{").replace(/\]\]/g, "}}") : text;
3043
3062
  };
@@ -3087,7 +3106,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3087
3106
  className: "mb-pane-empty",
3088
3107
  children: t("neetoRules.builder.noMatches")
3089
3108
  });
3090
- if (type === "emailChannel") {
3109
+ if (type === ACTION_CONFIG_TYPES.emailChannel) {
3091
3110
  var _getIn, _action$metadata;
3092
3111
  var subjectPath = "".concat(name, ".subject");
3093
3112
  var bodyPath = "".concat(name, ".body");
@@ -3116,7 +3135,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3116
3135
  }), hintBlock]
3117
3136
  });
3118
3137
  }
3119
- if (type === "multiSelect") {
3138
+ if (type === ACTION_CONFIG_TYPES.multiSelect) {
3120
3139
  if (ramda.isEmpty(options)) return noOptionsMessage();
3121
3140
  var current = formik.getIn(values, valuePath) || [];
3122
3141
  var filtered = filterOptions(options);
@@ -3141,7 +3160,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3141
3160
  })]
3142
3161
  });
3143
3162
  }
3144
- if (type === "dropdown") {
3163
+ if (type === ACTION_CONFIG_TYPES.dropdown) {
3145
3164
  if (ramda.isEmpty(options)) return noOptionsMessage();
3146
3165
  var _current = formik.getIn(values, valuePath);
3147
3166
  var _filtered = filterOptions(options);
@@ -3167,7 +3186,7 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3167
3186
  })
3168
3187
  });
3169
3188
  }
3170
- if (type === "note") {
3189
+ if (type === ACTION_CONFIG_TYPES.note) {
3171
3190
  var _action$metadata2;
3172
3191
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
3173
3192
  className: "flex flex-col gap-2",
@@ -3181,9 +3200,9 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3181
3200
  }), hintBlock]
3182
3201
  });
3183
3202
  }
3184
- if (type === "textarea" || type === "number") {
3203
+ if (type === ACTION_CONFIG_TYPES.textarea || type === ACTION_CONFIG_TYPES.number) {
3185
3204
  var _getIn2, _getIn3;
3186
- return type === "number" ? /*#__PURE__*/jsxRuntime.jsx(Input, {
3205
+ return type === ACTION_CONFIG_TYPES.number ? /*#__PURE__*/jsxRuntime.jsx(Input, {
3187
3206
  required: true,
3188
3207
  error: fieldError(valuePath),
3189
3208
  label: t("neetoRules.builder.config.value"),
@@ -3211,6 +3230,46 @@ var ActionConfigFields = function ActionConfigFields(_ref) {
3211
3230
  }
3212
3231
  });
3213
3232
  }
3233
+ if (type === ACTION_CONFIG_TYPES.text || type === ACTION_CONFIG_TYPES.regex || type === ACTION_CONFIG_TYPES.decimal) {
3234
+ var _getIn4;
3235
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
3236
+ className: "flex flex-col gap-2",
3237
+ children: [/*#__PURE__*/jsxRuntime.jsx(Input, {
3238
+ required: true,
3239
+ error: fieldError(valuePath),
3240
+ label: t("neetoRules.builder.config.value"),
3241
+ placeholder: option === null || option === void 0 ? void 0 : option.valuePlaceholder,
3242
+ size: "large",
3243
+ value: (_getIn4 = formik.getIn(values, valuePath)) !== null && _getIn4 !== void 0 ? _getIn4 : "",
3244
+ onBlur: function onBlur() {
3245
+ return setFieldTouched(valuePath, true);
3246
+ },
3247
+ onChange: function onChange(event) {
3248
+ return setFieldValue(valuePath, event.target.value);
3249
+ }
3250
+ }), hintBlock]
3251
+ });
3252
+ }
3253
+ if (type === ACTION_CONFIG_TYPES.date) {
3254
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
3255
+ className: "flex flex-col gap-2",
3256
+ children: [/*#__PURE__*/jsxRuntime.jsx(DatePicker, {
3257
+ required: true,
3258
+ error: fieldError(valuePath),
3259
+ label: t("neetoRules.builder.config.value"),
3260
+ type: "date",
3261
+ value: formik.getIn(values, valuePath) || "",
3262
+ onBlur: function onBlur() {
3263
+ return setFieldTouched(valuePath, true);
3264
+ },
3265
+ onChange: function onChange(date) {
3266
+ return setFieldValue(valuePath,
3267
+ // eslint-disable-next-line @bigbinary/neeto/use-standard-date-time-formats
3268
+ date ? utils.dayjs(date).format(utils$1.DATE_FORMAT) : "");
3269
+ }
3270
+ }), hintBlock]
3271
+ });
3272
+ }
3214
3273
  return /*#__PURE__*/jsxRuntime.jsx(Typography, {
3215
3274
  style: "body2",
3216
3275
  children: t("neetoRules.builder.noConfig")
@@ -4190,7 +4249,7 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
4190
4249
  className: "mb-pane-empty",
4191
4250
  children: t("neetoRules.builder.noMatches")
4192
4251
  });
4193
- if (type === "multi-select" && neetoCist.isNotEmpty(enumOptions)) {
4252
+ if (type === CONDITION_VALUE_TYPES.multiSelect && neetoCist.isNotEmpty(enumOptions)) {
4194
4253
  var current = formik.getIn(values, valuesPath) || [];
4195
4254
  var filtered = filterOptions(enumOptions);
4196
4255
  if (term && ramda.isEmpty(filtered)) return noMatches;
@@ -4214,7 +4273,7 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
4214
4273
  })]
4215
4274
  });
4216
4275
  }
4217
- if (type === "multi-select") {
4276
+ if (type === CONDITION_VALUE_TYPES.multiSelect) {
4218
4277
  return /*#__PURE__*/jsxRuntime.jsx(Typography, {
4219
4278
  className: "neeto-ui-text-gray-500",
4220
4279
  style: "body2",
@@ -4223,7 +4282,7 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
4223
4282
  }) : t("neetoRules.builder.config.noOptions")
4224
4283
  });
4225
4284
  }
4226
- if (type === "multi-select-create") {
4285
+ if (type === CONDITION_VALUE_TYPES.multiSelectCreate) {
4227
4286
  var _current = formik.getIn(values, valuesPath) || [];
4228
4287
  return /*#__PURE__*/jsxRuntime.jsx(Select$1, {
4229
4288
  autoFocus: true,
@@ -4265,7 +4324,7 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
4265
4324
  })
4266
4325
  });
4267
4326
  }
4268
- if (valueType === "number") {
4327
+ if (valueType === CONDITION_VALUE_TYPES.number) {
4269
4328
  var _getIn;
4270
4329
  return /*#__PURE__*/jsxRuntime.jsx(Input, {
4271
4330
  autoFocus: true,
@@ -4289,8 +4348,8 @@ var ConditionValueFields = function ConditionValueFields(_ref) {
4289
4348
  label: t("neetoRules.common.value"),
4290
4349
  name: valuePath,
4291
4350
  size: "large",
4292
- type: valueType === "email" ? "email" : "text",
4293
- placeholder: (field === null || field === void 0 ? void 0 : field.placeholder) || (valueType === "email" ? t("neetoRules.builder.config.exampleEmail") : undefined)
4351
+ type: valueType === CONDITION_VALUE_TYPES.email ? "email" : "text",
4352
+ placeholder: (field === null || field === void 0 ? void 0 : field.placeholder) || (valueType === CONDITION_VALUE_TYPES.email ? t("neetoRules.builder.config.exampleEmail") : undefined)
4294
4353
  });
4295
4354
  };
4296
4355