@bigbinary/neeto-rules-frontend 2.5.15-beta-7 → 2.5.15-beta-9
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/README.md +45 -0
- package/app/javascript/src/translations/en.json +4 -1
- package/dist/NeetoRules.js +6 -26
- package/dist/NeetoRules.js.map +1 -1
- package/dist/NeetoRulesForm.js +410 -109
- package/dist/NeetoRulesForm.js.map +1 -1
- package/dist/RulePreview.js +4 -8
- package/dist/RulePreview.js.map +1 -1
- package/dist/cjs/NeetoRules.js +5 -25
- package/dist/cjs/NeetoRules.js.map +1 -1
- package/dist/cjs/NeetoRulesForm.js +407 -106
- package/dist/cjs/NeetoRulesForm.js.map +1 -1
- package/dist/cjs/RulePreview.js +4 -8
- package/dist/cjs/RulePreview.js.map +1 -1
- package/dist/cjs/index.js +4 -4
- package/dist/index.js +4 -4
- package/dist/{useUtilityStore-y6y2o_xQ.js → useUtilityStore-BcSUEW_u.js} +7 -1
- package/dist/useUtilityStore-BcSUEW_u.js.map +1 -0
- package/dist/{useUtilityStore-BFuftXo4.js → useUtilityStore-DhJI92iM.js} +7 -1
- package/dist/useUtilityStore-DhJI92iM.js.map +1 -0
- package/package.json +12 -12
- package/types.d.ts +10 -0
- package/dist/useUtilityStore-BFuftXo4.js.map +0 -1
- package/dist/useUtilityStore-y6y2o_xQ.js.map +0 -1
package/dist/NeetoRulesForm.js
CHANGED
|
@@ -3,30 +3,32 @@ import _objectDestructuringEmpty from '@babel/runtime/helpers/objectDestructurin
|
|
|
3
3
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
4
4
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
5
5
|
import { shallow } from 'zustand/shallow';
|
|
6
|
-
import { useRef, useEffect, createElement, forwardRef, useState, useMemo, memo, Fragment as Fragment$1 } from 'react';
|
|
6
|
+
import { useRef, useEffect, createElement, useCallback, forwardRef, useState, useMemo, memo, Fragment as Fragment$1 } from 'react';
|
|
7
7
|
import { useFormikContext, useField, FieldArray, ErrorMessage, Formik, Form as Form$1 } from 'formik';
|
|
8
|
-
import { findBy, noop, isNotEmpty, isPresent, hyphenate, renameKeys, nullSafe, toLabelAndValue, removeBy, isNotPresent } from '@bigbinary/neeto-cist';
|
|
8
|
+
import { findBy, noop, isNotEmpty, isPresent, hyphenate, renameKeys, notEqualsDeep, nullSafe, toLabelAndValue, removeBy, isNotPresent } from '@bigbinary/neeto-cist';
|
|
9
9
|
import Plus from '@bigbinary/neeto-icons/Plus';
|
|
10
10
|
import Delete from '@bigbinary/neeto-icons/Delete';
|
|
11
11
|
import Refresh from '@bigbinary/neeto-icons/Refresh';
|
|
12
12
|
import Button from '@bigbinary/neetoui/Button';
|
|
13
13
|
import { useTranslation, Trans } from 'react-i18next';
|
|
14
|
-
import { u as useUtilityStore, g as getSeparator } from './useUtilityStore-
|
|
14
|
+
import { u as useUtilityStore, g as getSeparator } from './useUtilityStore-BcSUEW_u.js';
|
|
15
15
|
import classNames from 'classnames';
|
|
16
16
|
import Typography from '@bigbinary/neetoui/Typography';
|
|
17
|
-
import { assocPath, pluck, identity, isEmpty, mergeDeepLeft, isNotNil, whereAny,
|
|
17
|
+
import { assocPath, pluck, identity, isEmpty, mergeDeepLeft, isNotNil, whereAny, reject, equals, unless, path, omit, useWith, split, when, is, trim, eqBy, F, values, isNil, without, append, pipe, filter, uniq, join, map, assoc, mergeLeft, includes, test } from 'ramda';
|
|
18
|
+
import { t as t$1 } from 'i18next';
|
|
19
|
+
import * as yup from 'yup';
|
|
18
20
|
import Radio from '@bigbinary/neetoui/formik/Radio';
|
|
19
21
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
20
22
|
import { manager } from '@bigbinary/neetoui/managers';
|
|
21
23
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
22
24
|
import Collapse from '@bigbinary/neeto-icons/Collapse';
|
|
23
|
-
import { t as t$1 } from 'i18next';
|
|
24
25
|
import Left from '@bigbinary/neeto-icons/Left';
|
|
25
26
|
import Textarea from '@bigbinary/neetoui/formik/Textarea';
|
|
26
27
|
import Input$1 from '@bigbinary/neetoui/formik/Input';
|
|
27
28
|
import Switch from '@bigbinary/neetoui/formik/Switch';
|
|
28
29
|
import { withT, useStateWithDependency, useDebounce } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
29
30
|
import Editor from '@monaco-editor/react';
|
|
31
|
+
import Help from '@bigbinary/neeto-icons/Help';
|
|
30
32
|
import DynamicVariables from '@bigbinary/neeto-molecules/DynamicVariables';
|
|
31
33
|
import Label from '@bigbinary/neetoui/Label';
|
|
32
34
|
import Select from '@bigbinary/neetoui/Select';
|
|
@@ -45,7 +47,6 @@ import _toArray from '@babel/runtime/helpers/toArray';
|
|
|
45
47
|
import { isPhoneNumberValid } from '@bigbinary/neeto-molecules/PhoneNumber';
|
|
46
48
|
import Tag from '@bigbinary/neetoui/Tag';
|
|
47
49
|
import { components } from 'react-select';
|
|
48
|
-
import * as yup from 'yup';
|
|
49
50
|
import { O as OPERATORS$1, V as VERB_LABELS, I as INPUT_FIELD_TYPES, C as CONDITION_VALUE_TYPES, F as FIELDS_WITH_OPTIONS$1 } from './constants-DghBXpIM.js';
|
|
50
51
|
import Radio$1 from '@bigbinary/neetoui/Radio';
|
|
51
52
|
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
@@ -58,7 +59,6 @@ import Tooltip from '@bigbinary/neetoui/Tooltip';
|
|
|
58
59
|
import Container from '@bigbinary/neeto-molecules/Container';
|
|
59
60
|
import NeetoHeader from '@bigbinary/neeto-molecules/Header';
|
|
60
61
|
import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
|
|
61
|
-
import Help from '@bigbinary/neeto-icons/Help';
|
|
62
62
|
import Switch$1 from '@bigbinary/neetoui/Switch';
|
|
63
63
|
import { u as useCustomDataStore } from './useCustomDataStore-B1qHMIGJ.js';
|
|
64
64
|
import _typeof from '@babel/runtime/helpers/typeof';
|
|
@@ -66,7 +66,7 @@ import 'zustand';
|
|
|
66
66
|
|
|
67
67
|
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
68
68
|
|
|
69
|
-
var css = ".neeto-
|
|
69
|
+
var css = ".neeto-rules-main-content__container{height:100dvh!important}.neeto-rules-main-card .neeto-ui-btn.underline{text-align:left}.neeto-rules-side-panel{flex-grow:0;flex-shrink:0}.neeto-rules-side-panel--small{width:320px}@media (min-width:1024px){.neeto-rules-side-panel--small{width:380px}}.neeto-rules-side-panel--large{width:380px}@media (min-width:1024px){.neeto-rules-side-panel--large{width:480px}}.neeto-rules-json-editor__wrapper{height:35vh;padding-bottom:2rem;position:relative}.neeto-rules-json-editor__editor{height:100%}.neeto-rules-json-editor__dynamic-variables{position:absolute;right:1rem;top:1rem;z-index:10}[data-tippy-root]{z-index:99999!important}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3NyYy9zdHlsZXNoZWV0cy9jb21wb25lbnRzL19sYXlvdXQuc2NzcyIsImFwcC9qYXZhc2NyaXB0L3NyYy9zdHlsZXNoZWV0cy9tYWluLnNjc3MiLCJhcHAvamF2YXNjcmlwdC9zcmMvc3R5bGVzaGVldHMvY29tcG9uZW50cy9fcGFuZS5zY3NzIiwiYXBwL2phdmFzY3JpcHQvc3JjL3N0eWxlc2hlZXRzL2NvbXBvbmVudHMvX2pzb24tZWRpdG9yLnNjc3MiLCJhcHAvamF2YXNjcmlwdC9zcmMvc3R5bGVzaGVldHMvY29tcG9uZW50cy9fZHJvcGRvd24uc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxxQ0FDRSx1QkNDRixDREVBLCtDQUNFLGVDQ0YsQ0NOQSx3QkFFRSxXQUFBLENBREEsYURVRixDQ1BFLCtCQUNFLFdEU0osQ0NQSSwwQkFIRiwrQkFJSSxXRFVKLENBQ0YsQ0NQRSwrQkFDRSxXRFNKLENDUEksMEJBSEYsK0JBSUksV0RVSixDQUNGLENFMUJFLGtDQUVFLFdBQUEsQ0FDQSxtQkFBQSxDQUZBLGlCRitCSixDRTFCRSxpQ0FDRSxXRjRCSixDRXpCRSw0Q0FDRSxpQkFBQSxDQUVBLFVBQUEsQ0FEQSxRQUFBLENBRUEsVUYyQkosQ0cxQ0Esa0JBQ0UsdUJINkNGIiwic291cmNlc0NvbnRlbnQiOlsiLm5lZXRvLXJ1bGVzLW1haW4tY29udGVudF9fY29udGFpbmVyIHtcbiAgaGVpZ2h0OiAxMDBkdmggIWltcG9ydGFudDtcbn1cblxuLm5lZXRvLXJ1bGVzLW1haW4tY2FyZCAubmVldG8tdWktYnRuLnVuZGVybGluZSB7XG4gIHRleHQtYWxpZ246IGxlZnQ7XG59IiwiLm5lZXRvLXJ1bGVzLW1haW4tY29udGVudF9fY29udGFpbmVyIHtcbiAgaGVpZ2h0OiAxMDBkdmggIWltcG9ydGFudDtcbn1cblxuLm5lZXRvLXJ1bGVzLW1haW4tY2FyZCAubmVldG8tdWktYnRuLnVuZGVybGluZSB7XG4gIHRleHQtYWxpZ246IGxlZnQ7XG59XG5cbi5uZWV0by1ydWxlcy1zaWRlLXBhbmVsIHtcbiAgZmxleC1zaHJpbms6IDA7XG4gIGZsZXgtZ3JvdzogMDtcbn1cbi5uZWV0by1ydWxlcy1zaWRlLXBhbmVsLS1zbWFsbCB7XG4gIHdpZHRoOiAzMjBweDtcbn1cbkBtZWRpYSAobWluLXdpZHRoOiAxMDI0cHgpIHtcbiAgLm5lZXRvLXJ1bGVzLXNpZGUtcGFuZWwtLXNtYWxsIHtcbiAgICB3aWR0aDogMzgwcHg7XG4gIH1cbn1cbi5uZWV0by1ydWxlcy1zaWRlLXBhbmVsLS1sYXJnZSB7XG4gIHdpZHRoOiAzODBweDtcbn1cbkBtZWRpYSAobWluLXdpZHRoOiAxMDI0cHgpIHtcbiAgLm5lZXRvLXJ1bGVzLXNpZGUtcGFuZWwtLWxhcmdlIHtcbiAgICB3aWR0aDogNDgwcHg7XG4gIH1cbn1cblxuLm5lZXRvLXJ1bGVzLWpzb24tZWRpdG9yX193cmFwcGVyIHtcbiAgcG9zaXRpb246IHJlbGF0aXZlO1xuICBoZWlnaHQ6IDM1dmg7XG4gIHBhZGRpbmctYm90dG9tOiAycmVtO1xufVxuLm5lZXRvLXJ1bGVzLWpzb24tZWRpdG9yX19lZGl0b3Ige1xuICBoZWlnaHQ6IDEwMCU7XG59XG4ubmVldG8tcnVsZXMtanNvbi1lZGl0b3JfX2R5bmFtaWMtdmFyaWFibGVzIHtcbiAgcG9zaXRpb246IGFic29sdXRlO1xuICB0b3A6IDFyZW07XG4gIHJpZ2h0OiAxcmVtO1xuICB6LWluZGV4OiAxMDtcbn1cblxuW2RhdGEtdGlwcHktcm9vdF0ge1xuICB6LWluZGV4OiA5OTk5OSAhaW1wb3J0YW50O1xufSIsIi5uZWV0by1ydWxlcy1zaWRlLXBhbmVsIHtcbiAgZmxleC1zaHJpbms6IDA7XG4gIGZsZXgtZ3JvdzogMDtcblxuICAmLS1zbWFsbCB7XG4gICAgd2lkdGg6IDMyMHB4O1xuXG4gICAgQG1lZGlhIChtaW4td2lkdGg6IDEwMjRweCkge1xuICAgICAgd2lkdGg6IDM4MHB4O1xuICAgIH1cbiAgfVxuXG4gICYtLWxhcmdlIHtcbiAgICB3aWR0aDogMzgwcHg7XG5cbiAgICBAbWVkaWEgKG1pbi13aWR0aDogMTAyNHB4KSB7XG4gICAgICB3aWR0aDogNDgwcHg7XG4gICAgfVxuICB9XG59IiwiLm5lZXRvLXJ1bGVzLWpzb24tZWRpdG9yIHtcbiAgJl9fd3JhcHBlciB7XG4gICAgcG9zaXRpb246IHJlbGF0aXZlO1xuICAgIGhlaWdodDogMzV2aDtcbiAgICBwYWRkaW5nLWJvdHRvbTogMnJlbTtcbiAgfVxuXG4gICZfX2VkaXRvciB7XG4gICAgaGVpZ2h0OiAxMDAlO1xuICB9XG5cbiAgJl9fZHluYW1pYy12YXJpYWJsZXMge1xuICAgIHBvc2l0aW9uOiBhYnNvbHV0ZTtcbiAgICB0b3A6IDFyZW07XG4gICAgcmlnaHQ6IDFyZW07XG4gICAgei1pbmRleDogMTA7XG4gIH1cbn1cbiIsIltkYXRhLXRpcHB5LXJvb3RdIHtcbiAgei1pbmRleDogOTk5OTkgIWltcG9ydGFudDtcbn1cbiJdfQ== */";
|
|
70
70
|
n(css,{});
|
|
71
71
|
|
|
72
72
|
var useActiveField = function useActiveField(name) {
|
|
@@ -175,9 +175,9 @@ var Header = function Header(_ref) {
|
|
|
175
175
|
});
|
|
176
176
|
};
|
|
177
177
|
|
|
178
|
-
var _excluded$
|
|
179
|
-
function ownKeys$
|
|
180
|
-
function _objectSpread$
|
|
178
|
+
var _excluded$f = ["component"];
|
|
179
|
+
function ownKeys$u(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; }
|
|
180
|
+
function _objectSpread$u(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$u(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$u(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
181
181
|
var Panel = function Panel() {
|
|
182
182
|
var _useUtilityStore = useUtilityStore(function (store) {
|
|
183
183
|
return {
|
|
@@ -198,17 +198,17 @@ var Panel = function Panel() {
|
|
|
198
198
|
Object.assign(data, panelState.data);
|
|
199
199
|
}
|
|
200
200
|
var Component = config.component,
|
|
201
|
-
paneProps = _objectWithoutProperties(config, _excluded$
|
|
201
|
+
paneProps = _objectWithoutProperties(config, _excluded$f);
|
|
202
202
|
var isOpen = !!panelState.type;
|
|
203
203
|
var hasOverlays = manager.hasOverlays();
|
|
204
204
|
var panelSize = {
|
|
205
205
|
small: "neeto-rules-side-panel--small",
|
|
206
206
|
large: "neeto-rules-side-panel--large"
|
|
207
207
|
}[panelState.size] || "neeto-rules-side-panel--small";
|
|
208
|
-
return /*#__PURE__*/jsx("div", _objectSpread$
|
|
208
|
+
return /*#__PURE__*/jsx("div", _objectSpread$u(_objectSpread$u({
|
|
209
209
|
className: classNames("neeto-rules-side-panel neeto-ui-border-gray-300 transition-width neeto-ui-bg-white ml-auto flex h-screen max-h-full flex-col overflow-y-auto border-l duration-300 ease-in-out", _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, panelSize, isOpen), "w-0 overflow-hidden", !isOpen), "absolute", hasOverlays), "right-0", hasOverlays))
|
|
210
210
|
}, paneProps), {}, {
|
|
211
|
-
children: /*#__PURE__*/jsx(Component, _objectSpread$
|
|
211
|
+
children: /*#__PURE__*/jsx(Component, _objectSpread$u(_objectSpread$u({}, data), {}, {
|
|
212
212
|
onClose: resetPanelState
|
|
213
213
|
}), panelState.type)
|
|
214
214
|
}));
|
|
@@ -272,6 +272,11 @@ var DEFAULT_RULE_ACTION = {
|
|
|
272
272
|
var EDITOR_ADDONS = ["code-block", "block-quote", "image-upload"];
|
|
273
273
|
var EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
274
274
|
var ACTION_INPUT_TYPES = ["text", "number", "decimal", "regex"];
|
|
275
|
+
var DEFAULT_HELP_POPOVER_PROPS = {
|
|
276
|
+
helpLinkProps: {
|
|
277
|
+
label: t$1("neetoRules.labels.viewHelpArticle")
|
|
278
|
+
}
|
|
279
|
+
};
|
|
275
280
|
|
|
276
281
|
var getFieldDetails$1 = function getFieldDetails(fieldValue) {
|
|
277
282
|
var actionOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
@@ -553,7 +558,9 @@ var LongTextField = function LongTextField(_ref2) {
|
|
|
553
558
|
_ref2$selectedField = _ref2.selectedField,
|
|
554
559
|
selectedField = _ref2$selectedField === void 0 ? {} : _ref2$selectedField,
|
|
555
560
|
_ref2$shouldAutoFocus = _ref2.shouldAutoFocus,
|
|
556
|
-
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus
|
|
561
|
+
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus,
|
|
562
|
+
_ref2$required = _ref2.required,
|
|
563
|
+
required = _ref2$required === void 0 ? false : _ref2$required;
|
|
557
564
|
var _useActiveField2 = useActiveField(name, {
|
|
558
565
|
shouldAutoFocus: shouldAutoFocus
|
|
559
566
|
}),
|
|
@@ -563,8 +570,8 @@ var LongTextField = function LongTextField(_ref2) {
|
|
|
563
570
|
return /*#__PURE__*/jsx(Textarea, {
|
|
564
571
|
name: name,
|
|
565
572
|
ref: ref,
|
|
573
|
+
required: required,
|
|
566
574
|
rows: rows,
|
|
567
|
-
required: true,
|
|
568
575
|
className: "w-full",
|
|
569
576
|
onFocus: setFieldActive
|
|
570
577
|
});
|
|
@@ -588,7 +595,13 @@ var EDITOR_CONFIG = {
|
|
|
588
595
|
scrollBeyondLastLine: false,
|
|
589
596
|
autoIndent: "full"
|
|
590
597
|
};
|
|
591
|
-
var API_REQUEST_FIELDS =
|
|
598
|
+
var API_REQUEST_FIELDS = {
|
|
599
|
+
TEMPLATE_ID: "templateId",
|
|
600
|
+
ENDPOINT: "endpoint",
|
|
601
|
+
BODY: "body",
|
|
602
|
+
ENABLE_CUSTOM_HEADERS: "enableCustomHeaders",
|
|
603
|
+
CUSTOM_HEADERS: "customHeaders"
|
|
604
|
+
};
|
|
592
605
|
|
|
593
606
|
var addOption = function addOption(arrayHelpers) {
|
|
594
607
|
return arrayHelpers.push(CUSTOM_HEADERS_INITIAL_VALUE);
|
|
@@ -609,9 +622,72 @@ var hasKeyOrValue = whereAny({
|
|
|
609
622
|
var formatCustomFields = function formatCustomFields(customFields) {
|
|
610
623
|
return isPresent(customFields) ? customFields : [CUSTOM_HEADERS_INITIAL_VALUE];
|
|
611
624
|
};
|
|
625
|
+
var rejectEmptyKeyValuePairs = reject(whereAny({
|
|
626
|
+
key: isEmpty,
|
|
627
|
+
value: isEmpty
|
|
628
|
+
}));
|
|
629
|
+
var areHeadersSame = function areHeadersSame(enableCustomHeaders, customHeaders) {
|
|
630
|
+
var template = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
631
|
+
var templateHasCustomHeaders = template.enableCustomHeaders,
|
|
632
|
+
templateHeaders = template.customHeaders;
|
|
633
|
+
if (!enableCustomHeaders && !templateHasCustomHeaders) return true;
|
|
634
|
+
if (enableCustomHeaders !== templateHasCustomHeaders) return false;
|
|
635
|
+
return equals(customHeaders, templateHeaders);
|
|
636
|
+
};
|
|
637
|
+
var isBodyAvailable = function isBodyAvailable(body) {
|
|
638
|
+
try {
|
|
639
|
+
var data = JSON.parse(body);
|
|
640
|
+
return isPresent(data);
|
|
641
|
+
} catch (_unused) {
|
|
642
|
+
return false;
|
|
643
|
+
}
|
|
644
|
+
};
|
|
645
|
+
var formatTemplateValues = function formatTemplateValues(key, template) {
|
|
646
|
+
switch (key) {
|
|
647
|
+
case API_REQUEST_FIELDS.CUSTOM_HEADERS:
|
|
648
|
+
return formatCustomFields(template[key]);
|
|
649
|
+
case API_REQUEST_FIELDS.TEMPLATE_ID:
|
|
650
|
+
return template.id;
|
|
651
|
+
default:
|
|
652
|
+
return template[key];
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
var sanitizeHelpPopoverProps = unless(path(["helpLinkProps", "href"]), omit(["helpLinkProps"]));
|
|
657
|
+
var setEditorContent = function setEditorContent(ref, content) {
|
|
658
|
+
if (!ref.current) return;
|
|
659
|
+
ref.current.editor.commands.setContent(content);
|
|
660
|
+
};
|
|
661
|
+
var mergeRefs = function mergeRefs() {
|
|
662
|
+
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
663
|
+
refs[_key] = arguments[_key];
|
|
664
|
+
}
|
|
665
|
+
return function (node) {
|
|
666
|
+
refs.forEach(function (ref) {
|
|
667
|
+
if (typeof ref === "function") ref(node);else if (ref !== null) ref.current = node;
|
|
668
|
+
});
|
|
669
|
+
};
|
|
670
|
+
};
|
|
612
671
|
|
|
613
672
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
614
673
|
var dotPath = useWith(path, [split(".")]);
|
|
674
|
+
var areValuesEqual = function areValuesEqual(value1, value2) {
|
|
675
|
+
var normalize = when(is(String), trim);
|
|
676
|
+
return eqBy(normalize, value1, value2);
|
|
677
|
+
};
|
|
678
|
+
var buildHelpPopoverProps = function buildHelpPopoverProps(popoverProps) {
|
|
679
|
+
var combinedProps = mergeDeepLeft(popoverProps, DEFAULT_HELP_POPOVER_PROPS);
|
|
680
|
+
return sanitizeHelpPopoverProps(combinedProps);
|
|
681
|
+
};
|
|
682
|
+
var withHelpPopover = function withHelpPopover(helpPopoverProps) {
|
|
683
|
+
return isPresent(helpPopoverProps) ? {
|
|
684
|
+
labelProps: {
|
|
685
|
+
helpIconProps: {
|
|
686
|
+
popoverProps: buildHelpPopoverProps(helpPopoverProps)
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
} : {};
|
|
690
|
+
};
|
|
615
691
|
|
|
616
692
|
var KeyValuePairsField = withT(function (_ref) {
|
|
617
693
|
var t = _ref.t,
|
|
@@ -670,9 +746,13 @@ var KeyValuePairsField = withT(function (_ref) {
|
|
|
670
746
|
});
|
|
671
747
|
});
|
|
672
748
|
|
|
749
|
+
function ownKeys$t(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; }
|
|
750
|
+
function _objectSpread$t(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$t(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$t(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
673
751
|
var CustomHeaders = function CustomHeaders(_ref) {
|
|
674
752
|
var name = _ref.name,
|
|
675
|
-
onFocus = _ref.onFocus
|
|
753
|
+
onFocus = _ref.onFocus,
|
|
754
|
+
_ref$helpPopoverProps = _ref.helpPopoverProps,
|
|
755
|
+
helpPopoverProps = _ref$helpPopoverProps === void 0 ? {} : _ref$helpPopoverProps;
|
|
676
756
|
var _useFormikContext = useFormikContext(),
|
|
677
757
|
values = _useFormikContext.values,
|
|
678
758
|
setFieldValue = _useFormikContext.setFieldValue;
|
|
@@ -691,27 +771,31 @@ var CustomHeaders = function CustomHeaders(_ref) {
|
|
|
691
771
|
var label = t("neetoRules.labels.includeHeaders");
|
|
692
772
|
return /*#__PURE__*/jsxs("div", {
|
|
693
773
|
className: "flex flex-col space-y-4 mb-4",
|
|
694
|
-
children: [/*#__PURE__*/jsx(Switch, {
|
|
774
|
+
children: [/*#__PURE__*/jsx(Switch, _objectSpread$t({
|
|
695
775
|
label: label,
|
|
696
776
|
onFocus: onFocus,
|
|
697
777
|
"data-cy": "neeto-rules-api-fields-".concat(hyphenate(label), "-switch"),
|
|
698
778
|
name: switchName,
|
|
699
779
|
onChange: handleChange
|
|
700
|
-
}), isCustomHeadersEnabled && /*#__PURE__*/jsx(KeyValuePairsField, {
|
|
780
|
+
}, withHelpPopover(helpPopoverProps))), isCustomHeadersEnabled && /*#__PURE__*/jsx(KeyValuePairsField, {
|
|
701
781
|
onFocus: onFocus,
|
|
702
782
|
entity: t("neetoRules.labels.headers"),
|
|
703
|
-
name:
|
|
783
|
+
name: keyValuePairsFieldName
|
|
704
784
|
})]
|
|
705
785
|
});
|
|
706
786
|
};
|
|
707
787
|
|
|
788
|
+
function ownKeys$s(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; }
|
|
789
|
+
function _objectSpread$s(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$s(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$s(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
708
790
|
var JsonEditor = function JsonEditor(_ref) {
|
|
709
791
|
var name = _ref.name,
|
|
710
792
|
onFocus = _ref.onFocus,
|
|
711
793
|
_ref$initialValue = _ref.initialValue,
|
|
712
794
|
initialValue = _ref$initialValue === void 0 ? "{}" : _ref$initialValue,
|
|
713
795
|
_ref$variables = _ref.variables,
|
|
714
|
-
variables = _ref$variables === void 0 ? [] : _ref$variables
|
|
796
|
+
variables = _ref$variables === void 0 ? [] : _ref$variables,
|
|
797
|
+
_ref$helpPopoverProps = _ref.helpPopoverProps,
|
|
798
|
+
helpPopoverProps = _ref$helpPopoverProps === void 0 ? {} : _ref$helpPopoverProps;
|
|
715
799
|
var editorRef = useRef(null);
|
|
716
800
|
var completionProviderRef = useRef(null);
|
|
717
801
|
var _useField = useField(name),
|
|
@@ -800,12 +884,18 @@ var JsonEditor = function JsonEditor(_ref) {
|
|
|
800
884
|
};
|
|
801
885
|
}, []);
|
|
802
886
|
return /*#__PURE__*/jsxs("div", {
|
|
803
|
-
className: "space-y-2
|
|
804
|
-
children: [/*#__PURE__*/jsx(Label, {
|
|
887
|
+
className: "space-y-2",
|
|
888
|
+
children: [/*#__PURE__*/jsx(Label, _objectSpread$s(_objectSpread$s({
|
|
805
889
|
required: true,
|
|
806
|
-
"data-cy": "api-field-body"
|
|
890
|
+
"data-cy": "api-field-body"
|
|
891
|
+
}, isPresent(helpPopoverProps) && {
|
|
892
|
+
helpIconProps: {
|
|
893
|
+
icon: Help,
|
|
894
|
+
popoverProps: buildHelpPopoverProps(helpPopoverProps)
|
|
895
|
+
}
|
|
896
|
+
}), {}, {
|
|
807
897
|
children: t("neetoRules.labels.body")
|
|
808
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
898
|
+
})), /*#__PURE__*/jsxs("div", {
|
|
809
899
|
className: "neeto-rules-json-editor__wrapper",
|
|
810
900
|
children: [/*#__PURE__*/jsx("div", {
|
|
811
901
|
className: "neeto-rules-json-editor__dynamic-variables",
|
|
@@ -831,6 +921,43 @@ var JsonEditor = function JsonEditor(_ref) {
|
|
|
831
921
|
});
|
|
832
922
|
};
|
|
833
923
|
|
|
924
|
+
var SaveAsTemplate = function SaveAsTemplate(_ref) {
|
|
925
|
+
var name = _ref.name,
|
|
926
|
+
_ref$className = _ref.className,
|
|
927
|
+
className = _ref$className === void 0 ? "" : _ref$className;
|
|
928
|
+
var _useFormikContext = useFormikContext(),
|
|
929
|
+
values = _useFormikContext.values,
|
|
930
|
+
setFieldValue = _useFormikContext.setFieldValue;
|
|
931
|
+
var _useTranslation = useTranslation(),
|
|
932
|
+
t = _useTranslation.t;
|
|
933
|
+
var switchName = "".concat(name, ".shouldSaveAsTemplate");
|
|
934
|
+
var templateName = "".concat(name, ".templateName");
|
|
935
|
+
var shouldSaveAsTemplate = dotPath(switchName, values);
|
|
936
|
+
var handleChange = function handleChange(_ref2) {
|
|
937
|
+
var checked = _ref2.target.checked;
|
|
938
|
+
if (!checked) {
|
|
939
|
+
setFieldValue(templateName, "");
|
|
940
|
+
}
|
|
941
|
+
setFieldValue(switchName, checked);
|
|
942
|
+
};
|
|
943
|
+
return /*#__PURE__*/jsxs("div", {
|
|
944
|
+
className: classNames(["flex flex-col space-y-4", className]),
|
|
945
|
+
children: [/*#__PURE__*/jsx(Switch, {
|
|
946
|
+
"data-cy": "neeto-rules-save-as-template-switch",
|
|
947
|
+
label: t("neetoRules.labels.saveAsTemplate"),
|
|
948
|
+
name: switchName,
|
|
949
|
+
onChange: handleChange
|
|
950
|
+
}), shouldSaveAsTemplate && /*#__PURE__*/jsx(Input$1, {
|
|
951
|
+
autoFocus: true,
|
|
952
|
+
required: true,
|
|
953
|
+
label: t("neetoRules.labels.templateName"),
|
|
954
|
+
name: templateName
|
|
955
|
+
})]
|
|
956
|
+
});
|
|
957
|
+
};
|
|
958
|
+
|
|
959
|
+
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; }
|
|
960
|
+
function _objectSpread$r(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(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; }
|
|
834
961
|
var SelectTemplateField = function SelectTemplateField(_ref) {
|
|
835
962
|
var selectedField = _ref.selectedField,
|
|
836
963
|
templates = _ref.templates,
|
|
@@ -851,7 +978,9 @@ var SelectTemplateField = function SelectTemplateField(_ref) {
|
|
|
851
978
|
}, templates);
|
|
852
979
|
onChange === null || onChange === void 0 || onChange(template);
|
|
853
980
|
};
|
|
854
|
-
|
|
981
|
+
var _ref2 = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.helpPopoverProps) || {},
|
|
982
|
+
helpPopoverProps = _ref2.template;
|
|
983
|
+
return /*#__PURE__*/jsx(Select, _objectSpread$r({
|
|
855
984
|
onFocus: onFocus,
|
|
856
985
|
isClearable: true,
|
|
857
986
|
isSearchable: true,
|
|
@@ -865,7 +994,35 @@ var SelectTemplateField = function SelectTemplateField(_ref) {
|
|
|
865
994
|
placeholder: t("neetoRules.placeholders.selectTemplate"),
|
|
866
995
|
value: selectedTemplate,
|
|
867
996
|
onChange: handleTemplateChange
|
|
868
|
-
});
|
|
997
|
+
}, withHelpPopover(helpPopoverProps)));
|
|
998
|
+
};
|
|
999
|
+
|
|
1000
|
+
var useHasFieldChanged = function useHasFieldChanged(name) {
|
|
1001
|
+
var _useFormikContext = useFormikContext(),
|
|
1002
|
+
values = _useFormikContext.values,
|
|
1003
|
+
initialValues = _useFormikContext.initialValues;
|
|
1004
|
+
var initialValue = dotPath(name, initialValues);
|
|
1005
|
+
var value = dotPath(name, values);
|
|
1006
|
+
return notEqualsDeep(initialValue, value);
|
|
1007
|
+
};
|
|
1008
|
+
|
|
1009
|
+
var useResetSaveAsTemplateOnHide = function useResetSaveAsTemplateOnHide(name, shouldShowSaveAsTemplate) {
|
|
1010
|
+
var _dotPath;
|
|
1011
|
+
var _useFormikContext = useFormikContext(),
|
|
1012
|
+
values = _useFormikContext.values,
|
|
1013
|
+
setFieldValue = _useFormikContext.setFieldValue;
|
|
1014
|
+
var currentValue = (_dotPath = dotPath(name, values)) !== null && _dotPath !== void 0 ? _dotPath : {};
|
|
1015
|
+
var isVisible = shouldShowSaveAsTemplate(currentValue);
|
|
1016
|
+
var wasVisibleRef = useRef(isVisible);
|
|
1017
|
+
useEffect(function () {
|
|
1018
|
+
var wasVisible = wasVisibleRef.current;
|
|
1019
|
+
if (wasVisible && !isVisible) {
|
|
1020
|
+
setFieldValue("".concat(name, ".shouldSaveAsTemplate"), false);
|
|
1021
|
+
setFieldValue("".concat(name, ".templateName"), "");
|
|
1022
|
+
}
|
|
1023
|
+
wasVisibleRef.current = isVisible;
|
|
1024
|
+
}, [isVisible, name, setFieldValue]);
|
|
1025
|
+
return isVisible;
|
|
869
1026
|
};
|
|
870
1027
|
|
|
871
1028
|
var Target$i = function Target(_ref) {
|
|
@@ -918,20 +1075,46 @@ var ApiFields = function ApiFields(_ref2) {
|
|
|
918
1075
|
t = _useTranslation2.t;
|
|
919
1076
|
var _useFormikContext = useFormikContext(),
|
|
920
1077
|
setFieldValue = _useFormikContext.setFieldValue,
|
|
921
|
-
|
|
1078
|
+
formValues = _useFormikContext.values;
|
|
922
1079
|
var _useActiveField2 = useActiveField(name, {
|
|
923
1080
|
shouldAutoFocus: shouldAutoFocus
|
|
924
1081
|
}),
|
|
925
1082
|
ref = _useActiveField2.ref,
|
|
926
1083
|
setFieldActive = _useActiveField2.setFieldActive;
|
|
927
|
-
var
|
|
1084
|
+
var _useUtilityStore = useUtilityStore(function (store) {
|
|
1085
|
+
return {
|
|
1086
|
+
isSaveAsTemplateEnabled: store["isSaveAsTemplateEnabled"]
|
|
1087
|
+
};
|
|
1088
|
+
}, shallow),
|
|
1089
|
+
isSaveAsTemplateEnabled = _useUtilityStore.isSaveAsTemplateEnabled;
|
|
1090
|
+
var hasFieldChanged = useHasFieldChanged(name);
|
|
1091
|
+
var templates = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.templates) || [];
|
|
1092
|
+
var shouldShowSaveAsTemplate = useCallback(function () {
|
|
1093
|
+
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1094
|
+
templateId = _ref3.templateId,
|
|
1095
|
+
endpoint = _ref3.endpoint,
|
|
1096
|
+
enableCustomHeaders = _ref3.enableCustomHeaders,
|
|
1097
|
+
_ref3$customHeaders = _ref3.customHeaders,
|
|
1098
|
+
customHeaders = _ref3$customHeaders === void 0 ? [CUSTOM_HEADERS_INITIAL_VALUE] : _ref3$customHeaders,
|
|
1099
|
+
body = _ref3.body;
|
|
1100
|
+
var template = findBy({
|
|
1101
|
+
id: templateId
|
|
1102
|
+
}, templates);
|
|
1103
|
+
var hasContent = isPresent(endpoint) || isPresent(rejectEmptyKeyValuePairs(customHeaders)) || isBodyAvailable(body);
|
|
1104
|
+
var isContentDifferentFromTemplate = !(areValuesEqual(template === null || template === void 0 ? void 0 : template.endpoint, endpoint) && areHeadersSame(enableCustomHeaders, customHeaders, template) && equals(template === null || template === void 0 ? void 0 : template.body, body));
|
|
1105
|
+
return hasContent && hasFieldChanged && isContentDifferentFromTemplate;
|
|
1106
|
+
}, [templates, hasFieldChanged]);
|
|
1107
|
+
var isSaveAsTemplateVisible = useResetSaveAsTemplateOnHide(name, isSaveAsTemplateEnabled ? shouldShowSaveAsTemplate : F);
|
|
928
1108
|
var isTemplateSelectionEnabled = isPresent(templates);
|
|
929
1109
|
var handleTemplateChange = function handleTemplateChange(template) {
|
|
930
|
-
API_REQUEST_FIELDS.forEach(function (key) {
|
|
931
|
-
var value = key
|
|
1110
|
+
values(API_REQUEST_FIELDS).forEach(function (key) {
|
|
1111
|
+
var value = formatTemplateValues(key, template);
|
|
932
1112
|
setFieldValue("".concat(name, ".").concat(key), value);
|
|
933
1113
|
});
|
|
934
1114
|
};
|
|
1115
|
+
var _ref4 = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.helpPopoverProps) || {},
|
|
1116
|
+
customHeadersHelpPopoverProps = _ref4.customHeaders,
|
|
1117
|
+
bodyHelpPopoverProps = _ref4.body;
|
|
935
1118
|
return /*#__PURE__*/jsxs("div", {
|
|
936
1119
|
className: "w-full",
|
|
937
1120
|
children: [isTemplateSelectionEnabled && /*#__PURE__*/jsx(SelectTemplateField, {
|
|
@@ -952,12 +1135,16 @@ var ApiFields = function ApiFields(_ref2) {
|
|
|
952
1135
|
onFocus: setFieldActive
|
|
953
1136
|
}), /*#__PURE__*/jsx(CustomHeaders, {
|
|
954
1137
|
name: name,
|
|
1138
|
+
helpPopoverProps: customHeadersHelpPopoverProps,
|
|
955
1139
|
onFocus: setFieldActive
|
|
956
1140
|
}), /*#__PURE__*/jsx(JsonEditor, {
|
|
957
|
-
|
|
1141
|
+
helpPopoverProps: bodyHelpPopoverProps,
|
|
1142
|
+
initialValue: dotPath("".concat(name, ".body"), formValues),
|
|
958
1143
|
name: "".concat(name, ".body"),
|
|
959
1144
|
variables: selectedField === null || selectedField === void 0 ? void 0 : selectedField.variables,
|
|
960
1145
|
onFocus: setFieldActive
|
|
1146
|
+
}), isSaveAsTemplateVisible && /*#__PURE__*/jsx(SaveAsTemplate, {
|
|
1147
|
+
name: name
|
|
961
1148
|
})]
|
|
962
1149
|
});
|
|
963
1150
|
};
|
|
@@ -1066,7 +1253,9 @@ var Target$g = function Target(_ref) {
|
|
|
1066
1253
|
var DateField$1 = function DateField(_ref2) {
|
|
1067
1254
|
var name = _ref2.name,
|
|
1068
1255
|
_ref2$shouldAutoFocus = _ref2.shouldAutoFocus,
|
|
1069
|
-
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus
|
|
1256
|
+
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus,
|
|
1257
|
+
_ref2$required = _ref2.required,
|
|
1258
|
+
required = _ref2$required === void 0 ? false : _ref2$required;
|
|
1070
1259
|
var _useTranslation2 = useTranslation(),
|
|
1071
1260
|
t = _useTranslation2.t;
|
|
1072
1261
|
var _useField3 = useField("".concat(name, ".value")),
|
|
@@ -1083,6 +1272,7 @@ var DateField$1 = function DateField(_ref2) {
|
|
|
1083
1272
|
setFieldActive = _useActiveField2.setFieldActive;
|
|
1084
1273
|
return /*#__PURE__*/jsx(DatePicker, {
|
|
1085
1274
|
ref: ref,
|
|
1275
|
+
required: required,
|
|
1086
1276
|
defaultValue: field.value,
|
|
1087
1277
|
label: t("neetoRules.form.selectDate"),
|
|
1088
1278
|
name: "".concat(name, ".value"),
|
|
@@ -1117,6 +1307,7 @@ var EmailIdFields = function EmailIdFields(_ref) {
|
|
|
1117
1307
|
children: /*#__PURE__*/jsx(MultiEmailInput, {
|
|
1118
1308
|
name: name,
|
|
1119
1309
|
onFocus: onFocus,
|
|
1310
|
+
required: true,
|
|
1120
1311
|
label: t("neetoRules.common.emailIds"),
|
|
1121
1312
|
placeholder: t("neetoRules.placeholders.emailField"),
|
|
1122
1313
|
ref: initialFocusRef,
|
|
@@ -1128,9 +1319,9 @@ var EmailIdFields = function EmailIdFields(_ref) {
|
|
|
1128
1319
|
});
|
|
1129
1320
|
};
|
|
1130
1321
|
|
|
1131
|
-
var _excluded$
|
|
1132
|
-
function ownKeys$
|
|
1133
|
-
function _objectSpread$
|
|
1322
|
+
var _excluded$e = ["autoFocus", "name", "value", "label", "variables", "addons", "editorRef", "defaults"];
|
|
1323
|
+
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; }
|
|
1324
|
+
function _objectSpread$q(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(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; }
|
|
1134
1325
|
var EditorAction = function EditorAction(_ref) {
|
|
1135
1326
|
var _ref$autoFocus = _ref.autoFocus,
|
|
1136
1327
|
autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus,
|
|
@@ -1145,7 +1336,7 @@ var EditorAction = function EditorAction(_ref) {
|
|
|
1145
1336
|
_ref$editorRef = _ref.editorRef,
|
|
1146
1337
|
editorRef = _ref$editorRef === void 0 ? null : _ref$editorRef,
|
|
1147
1338
|
defaults = _ref.defaults,
|
|
1148
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$
|
|
1339
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$e);
|
|
1149
1340
|
var _useStateWithDependen = useStateWithDependency(value, [name]),
|
|
1150
1341
|
_useStateWithDependen2 = _slicedToArray(_useStateWithDependen, 2),
|
|
1151
1342
|
editorData = _useStateWithDependen2[0],
|
|
@@ -1156,7 +1347,7 @@ var EditorAction = function EditorAction(_ref) {
|
|
|
1156
1347
|
useEffect(function () {
|
|
1157
1348
|
setFieldValue(name, editorData);
|
|
1158
1349
|
}, [debouncedValue]);
|
|
1159
|
-
return /*#__PURE__*/createElement(FormikEditor, _objectSpread$
|
|
1350
|
+
return /*#__PURE__*/createElement(FormikEditor, _objectSpread$q({
|
|
1160
1351
|
addons: addons,
|
|
1161
1352
|
autoFocus: autoFocus,
|
|
1162
1353
|
defaults: defaults,
|
|
@@ -1172,6 +1363,9 @@ var EditorAction = function EditorAction(_ref) {
|
|
|
1172
1363
|
}, otherProps));
|
|
1173
1364
|
};
|
|
1174
1365
|
|
|
1366
|
+
var _excluded$d = ["dropdownOptions", "name", "selectedField", "shouldAutoFocus", "className", "required"];
|
|
1367
|
+
function ownKeys$p(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; }
|
|
1368
|
+
function _objectSpread$p(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$p(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$p(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1175
1369
|
var Target$f = function Target(_ref) {
|
|
1176
1370
|
var _selectedOption$label;
|
|
1177
1371
|
var dropdownOptions = _ref.dropdownOptions,
|
|
@@ -1230,7 +1424,10 @@ var SelectField$2 = function SelectField(_ref2) {
|
|
|
1230
1424
|
selectedField = _ref2.selectedField,
|
|
1231
1425
|
_ref2$shouldAutoFocus = _ref2.shouldAutoFocus,
|
|
1232
1426
|
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus,
|
|
1233
|
-
className = _ref2.className
|
|
1427
|
+
className = _ref2.className,
|
|
1428
|
+
_ref2$required = _ref2.required,
|
|
1429
|
+
required = _ref2$required === void 0 ? false : _ref2$required,
|
|
1430
|
+
otherProps = _objectWithoutProperties(_ref2, _excluded$d);
|
|
1234
1431
|
var _useTranslation2 = useTranslation(),
|
|
1235
1432
|
t = _useTranslation2.t;
|
|
1236
1433
|
var _useField3 = useField(name),
|
|
@@ -1261,34 +1458,23 @@ var SelectField$2 = function SelectField(_ref2) {
|
|
|
1261
1458
|
setValue((_option$value = option === null || option === void 0 ? void 0 : option.value) !== null && _option$value !== void 0 ? _option$value : null);
|
|
1262
1459
|
setTouched(true);
|
|
1263
1460
|
};
|
|
1264
|
-
return /*#__PURE__*/jsx(Select$1, {
|
|
1461
|
+
return /*#__PURE__*/jsx(Select$1, _objectSpread$p(_objectSpread$p({}, _objectSpread$p({
|
|
1265
1462
|
className: className,
|
|
1266
1463
|
name: name,
|
|
1464
|
+
required: required
|
|
1465
|
+
}, otherProps)), {}, {
|
|
1267
1466
|
innerRef: ref,
|
|
1268
1467
|
label: defaultLabel,
|
|
1269
1468
|
options: dropdownOptions,
|
|
1270
1469
|
value: selectedOption,
|
|
1271
1470
|
onChange: handleSelectOption,
|
|
1272
1471
|
onFocus: setFieldActive
|
|
1273
|
-
});
|
|
1472
|
+
}));
|
|
1274
1473
|
};
|
|
1275
1474
|
SelectField$2.Target = Target$f;
|
|
1276
1475
|
|
|
1277
|
-
var
|
|
1278
|
-
|
|
1279
|
-
ref.current.editor.commands.setContent(content);
|
|
1280
|
-
};
|
|
1281
|
-
var mergeRefs = function mergeRefs() {
|
|
1282
|
-
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1283
|
-
refs[_key] = arguments[_key];
|
|
1284
|
-
}
|
|
1285
|
-
return function (node) {
|
|
1286
|
-
refs.forEach(function (ref) {
|
|
1287
|
-
if (typeof ref === "function") ref(node);else if (ref !== null) ref.current = node;
|
|
1288
|
-
});
|
|
1289
|
-
};
|
|
1290
|
-
};
|
|
1291
|
-
|
|
1476
|
+
function ownKeys$o(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; }
|
|
1477
|
+
function _objectSpread$o(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$o(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$o(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1292
1478
|
var Target$e = function Target(_ref) {
|
|
1293
1479
|
var selectedField = _ref.selectedField,
|
|
1294
1480
|
_ref$separatorIndex = _ref.separatorIndex,
|
|
@@ -1361,8 +1547,28 @@ var EmailFields = function EmailFields(_ref2) {
|
|
|
1361
1547
|
}),
|
|
1362
1548
|
initialFocusRef = _useActiveField2.ref,
|
|
1363
1549
|
setFieldActive = _useActiveField2.setFieldActive;
|
|
1550
|
+
var _useUtilityStore = useUtilityStore(function (store) {
|
|
1551
|
+
return {
|
|
1552
|
+
isSaveAsTemplateEnabled: store["isSaveAsTemplateEnabled"]
|
|
1553
|
+
};
|
|
1554
|
+
}, shallow),
|
|
1555
|
+
isSaveAsTemplateEnabled = _useUtilityStore.isSaveAsTemplateEnabled;
|
|
1556
|
+
var hasFieldChanged = useHasFieldChanged(name);
|
|
1364
1557
|
var templates = selectedField === null || selectedField === void 0 ? void 0 : selectedField.templates;
|
|
1365
1558
|
var isTemplateSelectionEnabled = isPresent(templates);
|
|
1559
|
+
var shouldShowSaveAsTemplate = useCallback(function () {
|
|
1560
|
+
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1561
|
+
templateId = _ref3.templateId,
|
|
1562
|
+
subject = _ref3.subject,
|
|
1563
|
+
body = _ref3.body;
|
|
1564
|
+
var template = findBy({
|
|
1565
|
+
id: templateId
|
|
1566
|
+
}, templates);
|
|
1567
|
+
var hasContent = isPresent(subject) || isPresent(body);
|
|
1568
|
+
var isContentDifferentFromTemplate = !(areValuesEqual(template === null || template === void 0 ? void 0 : template.subject, subject) && (template === null || template === void 0 ? void 0 : template.body) === body);
|
|
1569
|
+
return hasContent && hasFieldChanged && isContentDifferentFromTemplate;
|
|
1570
|
+
}, [templates, hasFieldChanged]);
|
|
1571
|
+
var isSaveAsTemplateVisible = useResetSaveAsTemplateOnHide(name, isSaveAsTemplateEnabled ? shouldShowSaveAsTemplate : F);
|
|
1366
1572
|
var isFirstFieldInForm = function isFirstFieldInForm(field) {
|
|
1367
1573
|
if (isTemplateSelectionEnabled) return false;
|
|
1368
1574
|
if (field === "emails") return true;
|
|
@@ -1370,22 +1576,26 @@ var EmailFields = function EmailFields(_ref2) {
|
|
|
1370
1576
|
return !isEmailIdField && selectedField.hideSubject;
|
|
1371
1577
|
};
|
|
1372
1578
|
var handleTemplateChange = function handleTemplateChange(template) {
|
|
1579
|
+
setFieldValue("".concat(name, ".templateId"), template.id);
|
|
1373
1580
|
setFieldValue("".concat(name, ".body"), template.body);
|
|
1374
1581
|
setEditorContent(editorRef, template.body);
|
|
1375
1582
|
if (selectedField.hideSubject) return;
|
|
1376
1583
|
setFieldValue("".concat(name, ".subject"), template.subject);
|
|
1377
1584
|
};
|
|
1585
|
+
var _ref4 = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.helpPopoverProps) || {},
|
|
1586
|
+
recipientFieldHelpPopoverProps = _ref4.recipientField;
|
|
1378
1587
|
return /*#__PURE__*/jsxs("div", {
|
|
1379
1588
|
className: "w-full",
|
|
1380
|
-
children: [showFieldSelection && /*#__PURE__*/createElement(SelectField$2, {
|
|
1589
|
+
children: [showFieldSelection && /*#__PURE__*/createElement(SelectField$2, _objectSpread$o({
|
|
1381
1590
|
index: index,
|
|
1382
1591
|
selectedField: selectedField,
|
|
1592
|
+
required: true,
|
|
1383
1593
|
shouldAutoFocus: true,
|
|
1384
1594
|
className: "mb-6",
|
|
1385
1595
|
dropdownOptions: fieldOptions,
|
|
1386
1596
|
key: "".concat(name, ".value"),
|
|
1387
1597
|
name: "".concat(name, ".value")
|
|
1388
|
-
}), isTemplateSelectionEnabled && /*#__PURE__*/jsx(SelectTemplateField, {
|
|
1598
|
+
}, withHelpPopover(recipientFieldHelpPopoverProps))), isTemplateSelectionEnabled && /*#__PURE__*/jsx(SelectTemplateField, {
|
|
1389
1599
|
initialFocusRef: initialFocusRef,
|
|
1390
1600
|
selectedField: selectedField,
|
|
1391
1601
|
templates: templates,
|
|
@@ -1397,6 +1607,7 @@ var EmailFields = function EmailFields(_ref2) {
|
|
|
1397
1607
|
initialFocusRef: isFirstFieldInForm("emails") ? initialFocusRef : null,
|
|
1398
1608
|
onFocus: setFieldActive
|
|
1399
1609
|
}), !selectedField.hideSubject && /*#__PURE__*/jsx(Input$1, {
|
|
1610
|
+
required: true,
|
|
1400
1611
|
className: "mb-4",
|
|
1401
1612
|
"data-cy": "email-action-subject-text-field",
|
|
1402
1613
|
label: t("neetoRules.labels.subject"),
|
|
@@ -1405,12 +1616,16 @@ var EmailFields = function EmailFields(_ref2) {
|
|
|
1405
1616
|
type: "text",
|
|
1406
1617
|
onFocus: setFieldActive
|
|
1407
1618
|
}), /*#__PURE__*/jsx(EditorAction, {
|
|
1619
|
+
required: true,
|
|
1408
1620
|
label: t("neetoRules.labels.body"),
|
|
1409
1621
|
name: "".concat(name, ".body"),
|
|
1410
1622
|
value: (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.body,
|
|
1411
1623
|
variables: selectedField === null || selectedField === void 0 ? void 0 : selectedField.variables,
|
|
1412
1624
|
editorRef: isFirstFieldInForm("body") ? mergeRefs(editorRef, initialFocusRef) : editorRef,
|
|
1413
1625
|
onFocus: setFieldActive
|
|
1626
|
+
}), isSaveAsTemplateVisible && /*#__PURE__*/jsx(SaveAsTemplate, {
|
|
1627
|
+
name: name,
|
|
1628
|
+
className: "mt-4"
|
|
1414
1629
|
})]
|
|
1415
1630
|
});
|
|
1416
1631
|
};
|
|
@@ -1460,7 +1675,9 @@ var Target$d = function Target(_ref) {
|
|
|
1460
1675
|
var Input = function Input(_ref2) {
|
|
1461
1676
|
var name = _ref2.name,
|
|
1462
1677
|
_ref2$shouldAutoFocus = _ref2.shouldAutoFocus,
|
|
1463
|
-
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus
|
|
1678
|
+
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus,
|
|
1679
|
+
_ref2$required = _ref2.required,
|
|
1680
|
+
required = _ref2$required === void 0 ? false : _ref2$required;
|
|
1464
1681
|
var _useTranslation2 = useTranslation(),
|
|
1465
1682
|
t = _useTranslation2.t;
|
|
1466
1683
|
var _useActiveField2 = useActiveField(name, {
|
|
@@ -1470,6 +1687,7 @@ var Input = function Input(_ref2) {
|
|
|
1470
1687
|
setFieldActive = _useActiveField2.setFieldActive;
|
|
1471
1688
|
return /*#__PURE__*/jsx(Input$1, {
|
|
1472
1689
|
ref: ref,
|
|
1690
|
+
required: required,
|
|
1473
1691
|
className: "my-auto",
|
|
1474
1692
|
label: t("neetoRules.labels.value"),
|
|
1475
1693
|
name: "".concat(name, ".value"),
|
|
@@ -1510,8 +1728,8 @@ var SHORTCUTS = {
|
|
|
1510
1728
|
};
|
|
1511
1729
|
|
|
1512
1730
|
var _excluded$c = ["value", "nullable", "className", "handleSubmit", "handleCancel"];
|
|
1513
|
-
function ownKeys$
|
|
1514
|
-
function _objectSpread$
|
|
1731
|
+
function ownKeys$n(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; }
|
|
1732
|
+
function _objectSpread$n(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$n(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$n(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1515
1733
|
var InlineInput = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
1516
1734
|
var _props$value = props.value,
|
|
1517
1735
|
value = _props$value === void 0 ? "" : _props$value,
|
|
@@ -1549,8 +1767,9 @@ var InlineInput = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1549
1767
|
return /*#__PURE__*/jsx("div", {
|
|
1550
1768
|
className: classNames("flex flex-grow", _defineProperty({}, className, className)),
|
|
1551
1769
|
ref: inputWrapperRef,
|
|
1552
|
-
children: /*#__PURE__*/jsx(Input$2, _objectSpread$
|
|
1770
|
+
children: /*#__PURE__*/jsx(Input$2, _objectSpread$n(_objectSpread$n({
|
|
1553
1771
|
autoFocus: true,
|
|
1772
|
+
required: true,
|
|
1554
1773
|
className: "neeto-planner-inline-input",
|
|
1555
1774
|
"data-cy": "inline-input-field",
|
|
1556
1775
|
value: inputValue,
|
|
@@ -1716,10 +1935,9 @@ var Target$b = function Target(_ref) {
|
|
|
1716
1935
|
var _useTranslation = useTranslation(),
|
|
1717
1936
|
t = _useTranslation.t;
|
|
1718
1937
|
var _useField = useField(name),
|
|
1719
|
-
_useField2 = _slicedToArray(_useField,
|
|
1720
|
-
field = _useField2[0]
|
|
1721
|
-
_useField2[1];
|
|
1722
|
-
var meta = _useField2[2];
|
|
1938
|
+
_useField2 = _slicedToArray(_useField, 2),
|
|
1939
|
+
field = _useField2[0],
|
|
1940
|
+
meta = _useField2[1];
|
|
1723
1941
|
var _useActiveField = useActiveField(name),
|
|
1724
1942
|
isFieldActive = _useActiveField.isFieldActive,
|
|
1725
1943
|
setFieldActive = _useActiveField.setFieldActive;
|
|
@@ -1790,7 +2008,9 @@ var MultiSelect$1 = function MultiSelect(_ref2) {
|
|
|
1790
2008
|
name = _ref2.name,
|
|
1791
2009
|
selectedField = _ref2.selectedField,
|
|
1792
2010
|
_ref2$shouldAutoFocus = _ref2.shouldAutoFocus,
|
|
1793
|
-
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus
|
|
2011
|
+
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus,
|
|
2012
|
+
_ref2$required = _ref2.required,
|
|
2013
|
+
required = _ref2$required === void 0 ? false : _ref2$required;
|
|
1794
2014
|
var _useTranslation2 = useTranslation(),
|
|
1795
2015
|
t = _useTranslation2.t;
|
|
1796
2016
|
var _useActiveField2 = useActiveField(name, {
|
|
@@ -1820,6 +2040,7 @@ var MultiSelect$1 = function MultiSelect(_ref2) {
|
|
|
1820
2040
|
className: "space-y-3",
|
|
1821
2041
|
children: /*#__PURE__*/jsx(Select$1, {
|
|
1822
2042
|
name: name,
|
|
2043
|
+
required: required,
|
|
1823
2044
|
isMulti: true,
|
|
1824
2045
|
innerRef: ref,
|
|
1825
2046
|
label: defaultLabel,
|
|
@@ -1843,10 +2064,9 @@ var Target$a = function Target(_ref) {
|
|
|
1843
2064
|
var _useTranslation = useTranslation(),
|
|
1844
2065
|
t = _useTranslation.t;
|
|
1845
2066
|
var _useField = useField(name),
|
|
1846
|
-
_useField2 = _slicedToArray(_useField,
|
|
1847
|
-
field = _useField2[0]
|
|
1848
|
-
_useField2[1];
|
|
1849
|
-
var meta = _useField2[2];
|
|
2067
|
+
_useField2 = _slicedToArray(_useField, 2),
|
|
2068
|
+
field = _useField2[0],
|
|
2069
|
+
meta = _useField2[1];
|
|
1850
2070
|
var _useActiveField = useActiveField(name),
|
|
1851
2071
|
isFieldActive = _useActiveField.isFieldActive,
|
|
1852
2072
|
setFieldActive = _useActiveField.setFieldActive;
|
|
@@ -1917,7 +2137,9 @@ var MultiSelectCheckbox$1 = function MultiSelectCheckbox(_ref2) {
|
|
|
1917
2137
|
dropdownOptions = _ref2$dropdownOptions === void 0 ? [] : _ref2$dropdownOptions,
|
|
1918
2138
|
name = _ref2.name,
|
|
1919
2139
|
_ref2$shouldAutoFocus = _ref2.shouldAutoFocus,
|
|
1920
|
-
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus
|
|
2140
|
+
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus,
|
|
2141
|
+
_ref2$required = _ref2.required,
|
|
2142
|
+
required = _ref2$required === void 0 ? false : _ref2$required;
|
|
1921
2143
|
var _useTranslation2 = useTranslation(),
|
|
1922
2144
|
t = _useTranslation2.t;
|
|
1923
2145
|
var _useActiveField2 = useActiveField(name, {
|
|
@@ -1941,6 +2163,7 @@ var MultiSelectCheckbox$1 = function MultiSelectCheckbox(_ref2) {
|
|
|
1941
2163
|
return /*#__PURE__*/jsxs("div", {
|
|
1942
2164
|
className: "space-y-3",
|
|
1943
2165
|
children: [/*#__PURE__*/jsx(Label, {
|
|
2166
|
+
required: required,
|
|
1944
2167
|
children: defaultLabel
|
|
1945
2168
|
}), isNotEmpty(dropdownOptions) ? dropdownOptions.map(function (option) {
|
|
1946
2169
|
return /*#__PURE__*/createElement(Checkbox, {
|
|
@@ -2029,6 +2252,7 @@ var NoteField = function NoteField(_ref2) {
|
|
|
2029
2252
|
ref: ref,
|
|
2030
2253
|
value: value,
|
|
2031
2254
|
variables: variables,
|
|
2255
|
+
required: true,
|
|
2032
2256
|
label: defaultLabel,
|
|
2033
2257
|
onFocus: setFieldActive
|
|
2034
2258
|
});
|
|
@@ -2094,7 +2318,9 @@ var RadioField$2 = function RadioField(_ref2) {
|
|
|
2094
2318
|
_ref2$className = _ref2.className,
|
|
2095
2319
|
className = _ref2$className === void 0 ? "" : _ref2$className,
|
|
2096
2320
|
_ref2$shouldAutoFocus = _ref2.shouldAutoFocus,
|
|
2097
|
-
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus
|
|
2321
|
+
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus,
|
|
2322
|
+
_ref2$required = _ref2.required,
|
|
2323
|
+
required = _ref2$required === void 0 ? false : _ref2$required;
|
|
2098
2324
|
var _useTranslation2 = useTranslation(),
|
|
2099
2325
|
t = _useTranslation2.t;
|
|
2100
2326
|
var _useField3 = useField(name),
|
|
@@ -2128,6 +2354,7 @@ var RadioField$2 = function RadioField(_ref2) {
|
|
|
2128
2354
|
return isNotEmpty(options) ? /*#__PURE__*/jsx(Radio, {
|
|
2129
2355
|
className: className,
|
|
2130
2356
|
name: name,
|
|
2357
|
+
required: required,
|
|
2131
2358
|
stacked: true,
|
|
2132
2359
|
label: defaultLabel,
|
|
2133
2360
|
value: selectedOption.value,
|
|
@@ -2187,8 +2414,8 @@ var formatErrorMessage = function formatErrorMessage(error) {
|
|
|
2187
2414
|
};
|
|
2188
2415
|
|
|
2189
2416
|
var _excluded$b = ["children"];
|
|
2190
|
-
function ownKeys$
|
|
2191
|
-
function _objectSpread$
|
|
2417
|
+
function ownKeys$m(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; }
|
|
2418
|
+
function _objectSpread$m(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$m(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$m(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2192
2419
|
var STYLES = {
|
|
2193
2420
|
border: {
|
|
2194
2421
|
"default": "1px solid rgb(var(--neeto-ui-gray-400))",
|
|
@@ -2200,8 +2427,8 @@ var STYLES = {
|
|
|
2200
2427
|
}
|
|
2201
2428
|
};
|
|
2202
2429
|
var MultiValueRemove = function MultiValueRemove(props) {
|
|
2203
|
-
return /*#__PURE__*/jsx(components.MultiValueRemove, _objectSpread$
|
|
2204
|
-
innerProps: _objectSpread$
|
|
2430
|
+
return /*#__PURE__*/jsx(components.MultiValueRemove, _objectSpread$m(_objectSpread$m({}, props), {}, {
|
|
2431
|
+
innerProps: _objectSpread$m(_objectSpread$m({}, props.innerProps), {}, _defineProperty({}, "data-cy", "".concat(dasherize(props.data.label), "-remove-icon"))),
|
|
2205
2432
|
children: /*#__PURE__*/jsx(Close, {
|
|
2206
2433
|
size: 16
|
|
2207
2434
|
})
|
|
@@ -2221,8 +2448,8 @@ var ValueContainer = function ValueContainer(_ref) {
|
|
|
2221
2448
|
firstChild = _children[0],
|
|
2222
2449
|
rest = _children.slice(1);
|
|
2223
2450
|
var shouldCollapse = !isFocused && value.length > visiblePhoneNumbersCount;
|
|
2224
|
-
return /*#__PURE__*/jsxs(components.ValueContainer, _objectSpread$
|
|
2225
|
-
innerProps: _objectSpread$
|
|
2451
|
+
return /*#__PURE__*/jsxs(components.ValueContainer, _objectSpread$m(_objectSpread$m({}, props), {}, {
|
|
2452
|
+
innerProps: _objectSpread$m(_objectSpread$m({}, props.innerProps), {}, _defineProperty({}, "data-cy", "multi-phone-number-input-container")),
|
|
2226
2453
|
children: [shouldCollapse ? firstChild.slice(0, visiblePhoneNumbersCount) : firstChild, shouldCollapse && /*#__PURE__*/jsx(Tag, {
|
|
2227
2454
|
style: "secondary",
|
|
2228
2455
|
label: t("neetoRules.labels.remainingItemsCount", {
|
|
@@ -2232,8 +2459,8 @@ var ValueContainer = function ValueContainer(_ref) {
|
|
|
2232
2459
|
}));
|
|
2233
2460
|
};
|
|
2234
2461
|
var ClearIndicator = function ClearIndicator(props) {
|
|
2235
|
-
return /*#__PURE__*/jsx(components.ClearIndicator, _objectSpread$
|
|
2236
|
-
innerProps: _objectSpread$
|
|
2462
|
+
return /*#__PURE__*/jsx(components.ClearIndicator, _objectSpread$m(_objectSpread$m({}, props), {}, {
|
|
2463
|
+
innerProps: _objectSpread$m(_objectSpread$m({}, props.innerProps), {}, _defineProperty({}, "data-cy", "clear-all-button")),
|
|
2237
2464
|
children: /*#__PURE__*/jsx(Close, {
|
|
2238
2465
|
className: "cursor-pointer",
|
|
2239
2466
|
size: 16
|
|
@@ -2251,7 +2478,7 @@ var CUSTOM_STYLES = {
|
|
|
2251
2478
|
input: assoc("overflow", "hidden"),
|
|
2252
2479
|
multiValue: function multiValue(styles, _ref2) {
|
|
2253
2480
|
var valid = _ref2.data.valid;
|
|
2254
|
-
return _objectSpread$
|
|
2481
|
+
return _objectSpread$m(_objectSpread$m({}, styles), {}, {
|
|
2255
2482
|
border: valid ? STYLES.border["default"] : STYLES.border.error,
|
|
2256
2483
|
color: valid ? STYLES.color["default"] : STYLES.color.error
|
|
2257
2484
|
});
|
|
@@ -2265,8 +2492,8 @@ var CUSTOM_COMPONENTS = {
|
|
|
2265
2492
|
};
|
|
2266
2493
|
|
|
2267
2494
|
var _excluded$a = ["value", "onChange", "error", "onBlur", "onFocus"];
|
|
2268
|
-
function ownKeys$
|
|
2269
|
-
function _objectSpread$
|
|
2495
|
+
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; }
|
|
2496
|
+
function _objectSpread$l(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(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; }
|
|
2270
2497
|
var MultiPhoneNumberInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
2271
2498
|
var _ref$value = _ref.value,
|
|
2272
2499
|
value = _ref$value === void 0 ? [] : _ref$value,
|
|
@@ -2327,7 +2554,7 @@ var MultiPhoneNumberInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
2327
2554
|
"data-cy": "".concat(dasherize(label), "-input-label"),
|
|
2328
2555
|
children: label
|
|
2329
2556
|
})
|
|
2330
|
-
}), /*#__PURE__*/jsx(CreatableSelect, _objectSpread$
|
|
2557
|
+
}), /*#__PURE__*/jsx(CreatableSelect, _objectSpread$l({
|
|
2331
2558
|
isMulti: true,
|
|
2332
2559
|
required: true,
|
|
2333
2560
|
classNamePrefix: "neeto-ui-react-select",
|
|
@@ -2338,7 +2565,7 @@ var MultiPhoneNumberInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
2338
2565
|
className: classNames("neeto-ui-react-select__container neeto-ui-react-select__container--medium neeto-ui-email-input__select", {
|
|
2339
2566
|
"neeto-ui-react-select__container--error": !!error
|
|
2340
2567
|
}),
|
|
2341
|
-
styles: _objectSpread$
|
|
2568
|
+
styles: _objectSpread$l(_objectSpread$l({}, CUSTOM_STYLES), {}, {
|
|
2342
2569
|
control: mergeLeft({
|
|
2343
2570
|
maxHeight: "200px",
|
|
2344
2571
|
overflowY: "auto"
|
|
@@ -2351,7 +2578,7 @@ var MultiPhoneNumberInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
2351
2578
|
setIsFocused(true);
|
|
2352
2579
|
_onFocus();
|
|
2353
2580
|
}
|
|
2354
|
-
}, _objectSpread$
|
|
2581
|
+
}, _objectSpread$l({
|
|
2355
2582
|
inputValue: inputValue,
|
|
2356
2583
|
isFocused: isFocused,
|
|
2357
2584
|
onChange: onChange,
|
|
@@ -2411,6 +2638,8 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
|
|
|
2411
2638
|
});
|
|
2412
2639
|
};
|
|
2413
2640
|
|
|
2641
|
+
function ownKeys$k(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; }
|
|
2642
|
+
function _objectSpread$k(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$k(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$k(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2414
2643
|
var Target$7 = function Target(_ref) {
|
|
2415
2644
|
var name = _ref.name,
|
|
2416
2645
|
_ref$separatorIndex = _ref.separatorIndex,
|
|
@@ -2482,11 +2711,29 @@ var SmsFields = function SmsFields(_ref2) {
|
|
|
2482
2711
|
}),
|
|
2483
2712
|
initialFocusRef = _useActiveField2.ref,
|
|
2484
2713
|
setFieldActive = _useActiveField2.setFieldActive;
|
|
2714
|
+
var _useUtilityStore = useUtilityStore(function (store) {
|
|
2715
|
+
return {
|
|
2716
|
+
isSaveAsTemplateEnabled: store["isSaveAsTemplateEnabled"]
|
|
2717
|
+
};
|
|
2718
|
+
}, shallow),
|
|
2719
|
+
isSaveAsTemplateEnabled = _useUtilityStore.isSaveAsTemplateEnabled;
|
|
2720
|
+
var hasFieldChanged = useHasFieldChanged(name);
|
|
2485
2721
|
var _useFormikContext = useFormikContext(),
|
|
2486
2722
|
setFieldValue = _useFormikContext.setFieldValue;
|
|
2487
|
-
var templates = selectedField === null || selectedField === void 0 ? void 0 : selectedField.templates;
|
|
2723
|
+
var templates = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.templates) || [];
|
|
2488
2724
|
var isTemplateSelectionEnabled = isPresent(templates);
|
|
2725
|
+
var shouldShowSaveAsTemplate = useCallback(function () {
|
|
2726
|
+
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
2727
|
+
templateId = _ref3.templateId,
|
|
2728
|
+
body = _ref3.body;
|
|
2729
|
+
var template = findBy({
|
|
2730
|
+
id: templateId
|
|
2731
|
+
}, templates);
|
|
2732
|
+
return isPresent(body) && hasFieldChanged && (template === null || template === void 0 ? void 0 : template.body) !== body;
|
|
2733
|
+
}, [templates, hasFieldChanged]);
|
|
2734
|
+
var isSaveAsTemplateVisible = useResetSaveAsTemplateOnHide(name, isSaveAsTemplateEnabled ? shouldShowSaveAsTemplate : F);
|
|
2489
2735
|
var handleTemplateChange = function handleTemplateChange(template) {
|
|
2736
|
+
setFieldValue("".concat(name, ".templateId"), template.id);
|
|
2490
2737
|
setFieldValue("".concat(name, ".body"), template.body);
|
|
2491
2738
|
setEditorContent(editorRef, template.body);
|
|
2492
2739
|
};
|
|
@@ -2494,9 +2741,11 @@ var SmsFields = function SmsFields(_ref2) {
|
|
|
2494
2741
|
if (isTemplateSelectionEnabled) return false;
|
|
2495
2742
|
return field === "phoneNumbers" ? true : !showPhoneNumberInput;
|
|
2496
2743
|
};
|
|
2744
|
+
var _ref4 = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.helpPopoverProps) || {},
|
|
2745
|
+
recipientFieldHelpPopoverProps = _ref4.recipientField;
|
|
2497
2746
|
return /*#__PURE__*/jsxs("div", {
|
|
2498
2747
|
className: "w-full",
|
|
2499
|
-
children: [showFieldSelection && /*#__PURE__*/createElement(SelectField$2, {
|
|
2748
|
+
children: [showFieldSelection && /*#__PURE__*/createElement(SelectField$2, _objectSpread$k({
|
|
2500
2749
|
index: index,
|
|
2501
2750
|
selectedField: selectedField,
|
|
2502
2751
|
shouldAutoFocus: true,
|
|
@@ -2504,7 +2753,7 @@ var SmsFields = function SmsFields(_ref2) {
|
|
|
2504
2753
|
dropdownOptions: fieldOptions,
|
|
2505
2754
|
key: "".concat(name, ".value"),
|
|
2506
2755
|
name: "".concat(name, ".value")
|
|
2507
|
-
}), isTemplateSelectionEnabled && /*#__PURE__*/jsx(SelectTemplateField, {
|
|
2756
|
+
}, withHelpPopover(recipientFieldHelpPopoverProps))), isTemplateSelectionEnabled && /*#__PURE__*/jsx(SelectTemplateField, {
|
|
2508
2757
|
initialFocusRef: initialFocusRef,
|
|
2509
2758
|
selectedField: selectedField,
|
|
2510
2759
|
templates: templates,
|
|
@@ -2525,6 +2774,9 @@ var SmsFields = function SmsFields(_ref2) {
|
|
|
2525
2774
|
variables: selectedField === null || selectedField === void 0 ? void 0 : selectedField.variables,
|
|
2526
2775
|
editorRef: isFirstFieldInForm("body") ? mergeRefs(editorRef, initialFocusRef) : editorRef,
|
|
2527
2776
|
onFocus: setFieldActive
|
|
2777
|
+
}), isSaveAsTemplateVisible && /*#__PURE__*/jsx(SaveAsTemplate, {
|
|
2778
|
+
name: name,
|
|
2779
|
+
className: "mt-4"
|
|
2528
2780
|
})]
|
|
2529
2781
|
});
|
|
2530
2782
|
};
|
|
@@ -2719,6 +2971,7 @@ var ActionSubItem = function ActionSubItem(_ref) {
|
|
|
2719
2971
|
}) : /*#__PURE__*/jsx(RadioField$2, {
|
|
2720
2972
|
index: index,
|
|
2721
2973
|
selectedField: selectedField,
|
|
2974
|
+
required: true,
|
|
2722
2975
|
shouldAutoFocus: true,
|
|
2723
2976
|
name: "".concat(name, ".value"),
|
|
2724
2977
|
options: valueOptions
|
|
@@ -2737,6 +2990,7 @@ var ActionSubItem = function ActionSubItem(_ref) {
|
|
|
2737
2990
|
}) : /*#__PURE__*/jsx(SelectField$2, {
|
|
2738
2991
|
index: index,
|
|
2739
2992
|
selectedField: selectedField,
|
|
2993
|
+
required: true,
|
|
2740
2994
|
shouldAutoFocus: true,
|
|
2741
2995
|
dropdownOptions: valueOptions,
|
|
2742
2996
|
name: "".concat(name, ".value")
|
|
@@ -2790,6 +3044,7 @@ var ActionSubItem = function ActionSubItem(_ref) {
|
|
|
2790
3044
|
}) : /*#__PURE__*/jsx(MultiSelect$1, {
|
|
2791
3045
|
index: index,
|
|
2792
3046
|
selectedField: selectedField,
|
|
3047
|
+
required: true,
|
|
2793
3048
|
shouldAutoFocus: true,
|
|
2794
3049
|
dropdownOptions: valueOptions,
|
|
2795
3050
|
name: "".concat(name, ".value")
|
|
@@ -2808,6 +3063,7 @@ var ActionSubItem = function ActionSubItem(_ref) {
|
|
|
2808
3063
|
}) : /*#__PURE__*/jsx(MultiSelectCheckbox$1, {
|
|
2809
3064
|
index: index,
|
|
2810
3065
|
selectedField: selectedField,
|
|
3066
|
+
required: true,
|
|
2811
3067
|
shouldAutoFocus: true,
|
|
2812
3068
|
dropdownOptions: valueOptions,
|
|
2813
3069
|
name: "".concat(name, ".value")
|
|
@@ -2826,6 +3082,7 @@ var ActionSubItem = function ActionSubItem(_ref) {
|
|
|
2826
3082
|
index: index,
|
|
2827
3083
|
name: name,
|
|
2828
3084
|
selectedField: selectedField,
|
|
3085
|
+
required: true,
|
|
2829
3086
|
shouldAutoFocus: true
|
|
2830
3087
|
});
|
|
2831
3088
|
}
|
|
@@ -2842,6 +3099,7 @@ var ActionSubItem = function ActionSubItem(_ref) {
|
|
|
2842
3099
|
index: index,
|
|
2843
3100
|
name: name,
|
|
2844
3101
|
selectedField: selectedField,
|
|
3102
|
+
required: true,
|
|
2845
3103
|
shouldAutoFocus: true
|
|
2846
3104
|
});
|
|
2847
3105
|
}
|
|
@@ -2859,6 +3117,7 @@ var ActionSubItem = function ActionSubItem(_ref) {
|
|
|
2859
3117
|
}) : /*#__PURE__*/jsx(LongTextField, {
|
|
2860
3118
|
index: index,
|
|
2861
3119
|
selectedField: selectedField,
|
|
3120
|
+
required: true,
|
|
2862
3121
|
shouldAutoFocus: true,
|
|
2863
3122
|
defaultLabel: t("neetoRules.labels.body"),
|
|
2864
3123
|
defaultSeparator: t("neetoRules.common.as"),
|
|
@@ -3021,7 +3280,9 @@ var DateField = function DateField(_ref2) {
|
|
|
3021
3280
|
var name = _ref2.name,
|
|
3022
3281
|
selectedField = _ref2.selectedField,
|
|
3023
3282
|
_ref2$shouldAutoFocus = _ref2.shouldAutoFocus,
|
|
3024
|
-
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus
|
|
3283
|
+
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus,
|
|
3284
|
+
_ref2$required = _ref2.required,
|
|
3285
|
+
required = _ref2$required === void 0 ? false : _ref2$required;
|
|
3025
3286
|
var _useTranslation2 = useTranslation(),
|
|
3026
3287
|
t = _useTranslation2.t;
|
|
3027
3288
|
var _useField3 = useField(name),
|
|
@@ -3045,6 +3306,7 @@ var DateField = function DateField(_ref2) {
|
|
|
3045
3306
|
};
|
|
3046
3307
|
return /*#__PURE__*/jsx(DatePicker, {
|
|
3047
3308
|
ref: ref,
|
|
3309
|
+
required: required,
|
|
3048
3310
|
defaultValue: field.value,
|
|
3049
3311
|
error: meta.touched && meta.error,
|
|
3050
3312
|
label: t("neetoRules.form.selectDate"),
|
|
@@ -3095,7 +3357,9 @@ var InputField$1 = function InputField(_ref2) {
|
|
|
3095
3357
|
var name = _ref2.name,
|
|
3096
3358
|
placeholder = _ref2.placeholder,
|
|
3097
3359
|
_ref2$shouldAutoFocus = _ref2.shouldAutoFocus,
|
|
3098
|
-
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus
|
|
3360
|
+
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus,
|
|
3361
|
+
_ref2$required = _ref2.required,
|
|
3362
|
+
required = _ref2$required === void 0 ? false : _ref2$required;
|
|
3099
3363
|
var _useField3 = useField(name),
|
|
3100
3364
|
_useField4 = _slicedToArray(_useField3, 3),
|
|
3101
3365
|
field = _useField4[0];
|
|
@@ -3110,6 +3374,7 @@ var InputField$1 = function InputField(_ref2) {
|
|
|
3110
3374
|
name: name,
|
|
3111
3375
|
placeholder: placeholder,
|
|
3112
3376
|
ref: ref,
|
|
3377
|
+
required: required,
|
|
3113
3378
|
label: placeholder,
|
|
3114
3379
|
value: field.value || "",
|
|
3115
3380
|
onFocus: setFieldActive,
|
|
@@ -3120,7 +3385,7 @@ var InputField$1 = function InputField(_ref2) {
|
|
|
3120
3385
|
};
|
|
3121
3386
|
InputField$1.Target = Target$5;
|
|
3122
3387
|
|
|
3123
|
-
var _excluded$9 = ["name", "dropdownOptions", "shouldAutoFocus"];
|
|
3388
|
+
var _excluded$9 = ["name", "dropdownOptions", "shouldAutoFocus", "required"];
|
|
3124
3389
|
function ownKeys$j(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; }
|
|
3125
3390
|
function _objectSpread$j(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$j(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$j(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3126
3391
|
var Target$4 = function Target(_ref) {
|
|
@@ -3187,6 +3452,8 @@ var MultiSelect = function MultiSelect(_ref2) {
|
|
|
3187
3452
|
dropdownOptions = _ref2.dropdownOptions,
|
|
3188
3453
|
_ref2$shouldAutoFocus = _ref2.shouldAutoFocus,
|
|
3189
3454
|
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus,
|
|
3455
|
+
_ref2$required = _ref2.required,
|
|
3456
|
+
required = _ref2$required === void 0 ? false : _ref2$required,
|
|
3190
3457
|
otherProps = _objectWithoutProperties(_ref2, _excluded$9);
|
|
3191
3458
|
var _useTranslation2 = useTranslation(),
|
|
3192
3459
|
t = _useTranslation2.t;
|
|
@@ -3213,6 +3480,7 @@ var MultiSelect = function MultiSelect(_ref2) {
|
|
|
3213
3480
|
className: "space-y-3",
|
|
3214
3481
|
children: /*#__PURE__*/jsx(Select$1, _objectSpread$j({
|
|
3215
3482
|
name: name,
|
|
3483
|
+
required: required,
|
|
3216
3484
|
isMulti: true,
|
|
3217
3485
|
innerRef: ref,
|
|
3218
3486
|
label: t("neetoRules.labels.selectValues"),
|
|
@@ -3225,7 +3493,7 @@ var MultiSelect = function MultiSelect(_ref2) {
|
|
|
3225
3493
|
};
|
|
3226
3494
|
MultiSelect.Target = Target$4;
|
|
3227
3495
|
|
|
3228
|
-
var _excluded$8 = ["name", "dropdownOptions", "shouldAutoFocus"];
|
|
3496
|
+
var _excluded$8 = ["name", "dropdownOptions", "shouldAutoFocus", "required"];
|
|
3229
3497
|
function ownKeys$i(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; }
|
|
3230
3498
|
function _objectSpread$i(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$i(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$i(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3231
3499
|
var Target$3 = function Target(_ref) {
|
|
@@ -3292,6 +3560,8 @@ var MultiSelectCheckbox = function MultiSelectCheckbox(_ref2) {
|
|
|
3292
3560
|
dropdownOptions = _ref2.dropdownOptions,
|
|
3293
3561
|
_ref2$shouldAutoFocus = _ref2.shouldAutoFocus,
|
|
3294
3562
|
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus,
|
|
3563
|
+
_ref2$required = _ref2.required,
|
|
3564
|
+
required = _ref2$required === void 0 ? false : _ref2$required,
|
|
3295
3565
|
otherProps = _objectWithoutProperties(_ref2, _excluded$8);
|
|
3296
3566
|
var _useTranslation2 = useTranslation(),
|
|
3297
3567
|
t = _useTranslation2.t;
|
|
@@ -3316,6 +3586,7 @@ var MultiSelectCheckbox = function MultiSelectCheckbox(_ref2) {
|
|
|
3316
3586
|
return /*#__PURE__*/jsxs("div", {
|
|
3317
3587
|
className: "space-y-3",
|
|
3318
3588
|
children: [/*#__PURE__*/jsx(Label, {
|
|
3589
|
+
required: required,
|
|
3319
3590
|
children: defaultLabel
|
|
3320
3591
|
}), /*#__PURE__*/jsx("div", {
|
|
3321
3592
|
className: "space-y-3",
|
|
@@ -3436,7 +3707,9 @@ var Target$2 = function Target(_ref) {
|
|
|
3436
3707
|
var MultiSelectCreate = function MultiSelectCreate(_ref2) {
|
|
3437
3708
|
var name = _ref2.name,
|
|
3438
3709
|
_ref2$shouldAutoFocus = _ref2.shouldAutoFocus,
|
|
3439
|
-
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus
|
|
3710
|
+
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus,
|
|
3711
|
+
_ref2$required = _ref2.required,
|
|
3712
|
+
required = _ref2$required === void 0 ? false : _ref2$required;
|
|
3440
3713
|
var _useTranslation2 = useTranslation(),
|
|
3441
3714
|
t = _useTranslation2.t;
|
|
3442
3715
|
var _useField3 = useField(name),
|
|
@@ -3458,6 +3731,7 @@ var MultiSelectCreate = function MultiSelectCreate(_ref2) {
|
|
|
3458
3731
|
};
|
|
3459
3732
|
return /*#__PURE__*/jsx(Select$1, {
|
|
3460
3733
|
name: name,
|
|
3734
|
+
required: required,
|
|
3461
3735
|
isCreateable: true,
|
|
3462
3736
|
isMulti: true,
|
|
3463
3737
|
className: "mt-4 w-full",
|
|
@@ -3473,7 +3747,7 @@ var MultiSelectCreate = function MultiSelectCreate(_ref2) {
|
|
|
3473
3747
|
MultiSelectCreate.Target = Target$2;
|
|
3474
3748
|
|
|
3475
3749
|
var _excluded$7 = ["name", "options", "placeholder", "onClick"],
|
|
3476
|
-
_excluded2 = ["name", "options", "handleOnChange", "shouldAutoFocus", "showLabel"];
|
|
3750
|
+
_excluded2 = ["name", "options", "handleOnChange", "shouldAutoFocus", "showLabel", "required"];
|
|
3477
3751
|
function ownKeys$h(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; }
|
|
3478
3752
|
function _objectSpread$h(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$h(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$h(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3479
3753
|
var Target$1 = function Target(_ref) {
|
|
@@ -3526,6 +3800,8 @@ var RadioField$1 = function RadioField(_ref2) {
|
|
|
3526
3800
|
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus,
|
|
3527
3801
|
_ref2$showLabel = _ref2.showLabel,
|
|
3528
3802
|
showLabel = _ref2$showLabel === void 0 ? true : _ref2$showLabel,
|
|
3803
|
+
_ref2$required = _ref2.required,
|
|
3804
|
+
required = _ref2$required === void 0 ? false : _ref2$required,
|
|
3529
3805
|
otherProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
3530
3806
|
var _useTranslation2 = useTranslation(),
|
|
3531
3807
|
t = _useTranslation2.t;
|
|
@@ -3553,6 +3829,7 @@ var RadioField$1 = function RadioField(_ref2) {
|
|
|
3553
3829
|
};
|
|
3554
3830
|
return /*#__PURE__*/jsx(Radio$1, _objectSpread$h(_objectSpread$h({
|
|
3555
3831
|
ref: ref,
|
|
3832
|
+
required: required,
|
|
3556
3833
|
stacked: true,
|
|
3557
3834
|
label: showLabel && t("neetoRules.labels.selectValue"),
|
|
3558
3835
|
value: selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value,
|
|
@@ -3619,7 +3896,9 @@ var SelectField$1 = function SelectField(_ref2) {
|
|
|
3619
3896
|
placeholder = _ref2.placeholder,
|
|
3620
3897
|
handleSelect = _ref2.handleSelect,
|
|
3621
3898
|
_ref2$shouldAutoFocus = _ref2.shouldAutoFocus,
|
|
3622
|
-
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus
|
|
3899
|
+
shouldAutoFocus = _ref2$shouldAutoFocus === void 0 ? false : _ref2$shouldAutoFocus,
|
|
3900
|
+
_ref2$required = _ref2.required,
|
|
3901
|
+
required = _ref2$required === void 0 ? false : _ref2$required;
|
|
3623
3902
|
var _useTranslation2 = useTranslation(),
|
|
3624
3903
|
t = _useTranslation2.t;
|
|
3625
3904
|
var _useField3 = useField(name),
|
|
@@ -3650,6 +3929,7 @@ var SelectField$1 = function SelectField(_ref2) {
|
|
|
3650
3929
|
};
|
|
3651
3930
|
return /*#__PURE__*/jsx(Select$1, {
|
|
3652
3931
|
name: name,
|
|
3932
|
+
required: required,
|
|
3653
3933
|
innerRef: ref,
|
|
3654
3934
|
label: placeholder || t("neetoRules.labels.selectValue"),
|
|
3655
3935
|
options: dropdownOptions,
|
|
@@ -3759,6 +4039,7 @@ var ValueField = function ValueField(_ref) {
|
|
|
3759
4039
|
onClick: onClick,
|
|
3760
4040
|
name: "".concat(name, ".value")
|
|
3761
4041
|
}) : /*#__PURE__*/jsx(InputField$1, {
|
|
4042
|
+
required: true,
|
|
3762
4043
|
name: "".concat(name, ".value"),
|
|
3763
4044
|
placeholder: t("neetoRules.common.value")
|
|
3764
4045
|
});
|
|
@@ -3771,6 +4052,7 @@ var ValueField = function ValueField(_ref) {
|
|
|
3771
4052
|
name: "".concat(name, ".value")
|
|
3772
4053
|
}) : /*#__PURE__*/jsx(LongTextField, {
|
|
3773
4054
|
index: index,
|
|
4055
|
+
required: true,
|
|
3774
4056
|
defaultLabel: t("neetoRules.labels.text"),
|
|
3775
4057
|
name: "".concat(name, ".value")
|
|
3776
4058
|
});
|
|
@@ -3783,6 +4065,7 @@ var ValueField = function ValueField(_ref) {
|
|
|
3783
4065
|
}) : /*#__PURE__*/jsx(RadioField$1, {
|
|
3784
4066
|
index: index,
|
|
3785
4067
|
options: options,
|
|
4068
|
+
required: true,
|
|
3786
4069
|
name: "".concat(name, ".value")
|
|
3787
4070
|
});
|
|
3788
4071
|
}
|
|
@@ -3793,6 +4076,7 @@ var ValueField = function ValueField(_ref) {
|
|
|
3793
4076
|
name: "".concat(name, ".value")
|
|
3794
4077
|
}) : /*#__PURE__*/jsx(SelectField$1, {
|
|
3795
4078
|
index: index,
|
|
4079
|
+
required: true,
|
|
3796
4080
|
dropdownOptions: options,
|
|
3797
4081
|
name: "".concat(name, ".value")
|
|
3798
4082
|
});
|
|
@@ -3803,6 +4087,7 @@ var ValueField = function ValueField(_ref) {
|
|
|
3803
4087
|
dropdownOptions: options,
|
|
3804
4088
|
name: "".concat(name, ".values")
|
|
3805
4089
|
}) : /*#__PURE__*/jsx(MultiSelect, {
|
|
4090
|
+
required: true,
|
|
3806
4091
|
dropdownOptions: options,
|
|
3807
4092
|
name: "".concat(name, ".values")
|
|
3808
4093
|
});
|
|
@@ -3813,6 +4098,7 @@ var ValueField = function ValueField(_ref) {
|
|
|
3813
4098
|
dropdownOptions: options,
|
|
3814
4099
|
name: "".concat(name, ".values")
|
|
3815
4100
|
}) : /*#__PURE__*/jsx(MultiSelectCheckbox, {
|
|
4101
|
+
required: true,
|
|
3816
4102
|
dropdownOptions: options,
|
|
3817
4103
|
name: "".concat(name, ".values")
|
|
3818
4104
|
});
|
|
@@ -3822,6 +4108,7 @@ var ValueField = function ValueField(_ref) {
|
|
|
3822
4108
|
onClick: onClick,
|
|
3823
4109
|
name: "".concat(name, ".values")
|
|
3824
4110
|
}) : /*#__PURE__*/jsx(MultiSelectCreate, {
|
|
4111
|
+
required: true,
|
|
3825
4112
|
name: "".concat(name, ".values")
|
|
3826
4113
|
});
|
|
3827
4114
|
}
|
|
@@ -3830,6 +4117,7 @@ var ValueField = function ValueField(_ref) {
|
|
|
3830
4117
|
onClick: onClick,
|
|
3831
4118
|
name: "".concat(name, ".value")
|
|
3832
4119
|
}) : /*#__PURE__*/jsx(DateField, {
|
|
4120
|
+
required: true,
|
|
3833
4121
|
name: "".concat(name, ".value"),
|
|
3834
4122
|
selectedField: field
|
|
3835
4123
|
});
|
|
@@ -3939,6 +4227,7 @@ var VerbAndValuePanel = function VerbAndValuePanel() {
|
|
|
3939
4227
|
children: /*#__PURE__*/jsxs("div", {
|
|
3940
4228
|
className: "flex flex-col space-y-4",
|
|
3941
4229
|
children: [/*#__PURE__*/jsx(SelectField$1, {
|
|
4230
|
+
required: true,
|
|
3942
4231
|
shouldAutoFocus: true,
|
|
3943
4232
|
dropdownOptions: verbOptions,
|
|
3944
4233
|
handleSelect: handleVerbChange,
|
|
@@ -4411,7 +4700,7 @@ var getConditionsSchema = function getConditionsSchema(element) {
|
|
|
4411
4700
|
if (selectedCondition !== null && selectedCondition !== void 0 && (_selectedCondition$no = selectedCondition.noValueForVerbs) !== null && _selectedCondition$no !== void 0 && _selectedCondition$no.includes(verb)) {
|
|
4412
4701
|
return yup.object();
|
|
4413
4702
|
}
|
|
4414
|
-
if ([CONDITION_VALUE_TYPES.date, CONDITION_VALUE_TYPES.radio, CONDITION_VALUE_TYPES.select].includes(type)) {
|
|
4703
|
+
if ([CONDITION_VALUE_TYPES.date, CONDITION_VALUE_TYPES.radio, CONDITION_VALUE_TYPES.dropdown, CONDITION_VALUE_TYPES.select].includes(type)) {
|
|
4415
4704
|
return yup.object().shape({
|
|
4416
4705
|
value: yup.string().required(t$1("neetoRules.validations.required.value"))
|
|
4417
4706
|
});
|
|
@@ -4506,7 +4795,8 @@ var getActionsSchema = function getActionsSchema(element, customData) {
|
|
|
4506
4795
|
body: yup.string().test("body", t$1("neetoRules.validations.required.body"), function (value) {
|
|
4507
4796
|
return !isEditorEmpty(value);
|
|
4508
4797
|
}),
|
|
4509
|
-
value: selectedAction.type === ACTION_TYPES.emailTo ? yup.string().required(t$1("neetoRules.validations.required.value")) : schema
|
|
4798
|
+
value: selectedAction.type === ACTION_TYPES.emailTo ? yup.string().required(t$1("neetoRules.validations.required.value")) : schema,
|
|
4799
|
+
templateName: TEMPLATE_NAME_VALIDATION_SCHEMA
|
|
4510
4800
|
});
|
|
4511
4801
|
} else if ([ACTION_TYPES.sms, ACTION_TYPES.smsToNumbers, ACTION_TYPES.smsTo].includes(selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type)) {
|
|
4512
4802
|
return yup.object({
|
|
@@ -4518,7 +4808,8 @@ var getActionsSchema = function getActionsSchema(element, customData) {
|
|
|
4518
4808
|
body: yup.string().test("body", t$1("neetoRules.validations.required.body"), function (value) {
|
|
4519
4809
|
return !isEditorEmpty(value);
|
|
4520
4810
|
}),
|
|
4521
|
-
value: selectedAction.type === ACTION_TYPES.smsTo ? yup.string().required(t$1("neetoRules.validations.required.value")) : schema
|
|
4811
|
+
value: selectedAction.type === ACTION_TYPES.smsTo ? yup.string().required(t$1("neetoRules.validations.required.value")) : schema,
|
|
4812
|
+
templateName: TEMPLATE_NAME_VALIDATION_SCHEMA
|
|
4522
4813
|
});
|
|
4523
4814
|
} else if (ACTION_TYPES.sendToApi === (selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type)) {
|
|
4524
4815
|
return yup.object({
|
|
@@ -4546,7 +4837,8 @@ var getActionsSchema = function getActionsSchema(element, customData) {
|
|
|
4546
4837
|
message: t$1("neetoRules.validations.invalidJsonBody")
|
|
4547
4838
|
});
|
|
4548
4839
|
}
|
|
4549
|
-
})
|
|
4840
|
+
}),
|
|
4841
|
+
templateName: TEMPLATE_NAME_VALIDATION_SCHEMA
|
|
4550
4842
|
});
|
|
4551
4843
|
} else if (ACTION_TYPES.multiSelect === (selectedAction === null || selectedAction === void 0 ? void 0 : selectedAction.type)) {
|
|
4552
4844
|
return yup.object({
|
|
@@ -4722,6 +5014,12 @@ var PANEL_TYPE_CONFIG_MAP = _defineProperty(_defineProperty(_defineProperty(_def
|
|
|
4722
5014
|
component: ActionSubItemPanel,
|
|
4723
5015
|
data: {}
|
|
4724
5016
|
});
|
|
5017
|
+
var TEMPLATE_NAME_VALIDATION_SCHEMA = yup.string().when("shouldSaveAsTemplate", {
|
|
5018
|
+
is: true,
|
|
5019
|
+
then: yup.string().trim().required(t$1("neetoRules.validations.required.entity", {
|
|
5020
|
+
entity: t$1("neetoRules.labels.templateName")
|
|
5021
|
+
}))
|
|
5022
|
+
});
|
|
4725
5023
|
|
|
4726
5024
|
function ownKeys$d(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; }
|
|
4727
5025
|
function _objectSpread$d(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$d(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$d(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -4906,7 +5204,9 @@ var Actions = function Actions(_ref) {
|
|
|
4906
5204
|
_ref$routeToSlackInte = _ref.routeToSlackIntegration,
|
|
4907
5205
|
routeToSlackIntegration = _ref$routeToSlackInte === void 0 ? "" : _ref$routeToSlackInte,
|
|
4908
5206
|
_ref$openPanel = _ref.openPanel,
|
|
4909
|
-
openPanel = _ref$openPanel === void 0 ? false : _ref$openPanel
|
|
5207
|
+
openPanel = _ref$openPanel === void 0 ? false : _ref$openPanel,
|
|
5208
|
+
_ref$isSaveAsTemplate = _ref.isSaveAsTemplateEnabled,
|
|
5209
|
+
isSaveAsTemplateEnabled = _ref$isSaveAsTemplate === void 0 ? false : _ref$isSaveAsTemplate;
|
|
4910
5210
|
var _useFormikContext = useFormikContext(),
|
|
4911
5211
|
values = _useFormikContext.values,
|
|
4912
5212
|
setFieldValue = _useFormikContext.setFieldValue;
|
|
@@ -4918,12 +5218,17 @@ var Actions = function Actions(_ref) {
|
|
|
4918
5218
|
setShouldOpenPanel = _useState2[1];
|
|
4919
5219
|
var _useUtilityStore = useUtilityStore(function (store) {
|
|
4920
5220
|
return {
|
|
4921
|
-
resetPanelState: store["resetPanelState"]
|
|
5221
|
+
resetPanelState: store["resetPanelState"],
|
|
5222
|
+
setIsSaveAsTemplateEnabled: store["setIsSaveAsTemplateEnabled"]
|
|
4922
5223
|
};
|
|
4923
5224
|
}, shallow),
|
|
4924
|
-
resetPanelState = _useUtilityStore.resetPanelState
|
|
5225
|
+
resetPanelState = _useUtilityStore.resetPanelState,
|
|
5226
|
+
setIsSaveAsTemplateEnabled = _useUtilityStore.setIsSaveAsTemplateEnabled;
|
|
4925
5227
|
var elementProps = data[name] || {};
|
|
4926
5228
|
var actions = values[name].value || [];
|
|
5229
|
+
useEffect(function () {
|
|
5230
|
+
setIsSaveAsTemplateEnabled(isSaveAsTemplateEnabled);
|
|
5231
|
+
}, [isSaveAsTemplateEnabled]);
|
|
4927
5232
|
var showButton = useMemo(function () {
|
|
4928
5233
|
var _actions;
|
|
4929
5234
|
return !!((_actions = actions[(actions === null || actions === void 0 ? void 0 : actions.length) - 1]) !== null && _actions !== void 0 && _actions.name) && elementProps.actionOptions.length !== actions.length && showAddButton;
|
|
@@ -6071,10 +6376,6 @@ var Form = function Form(_ref) {
|
|
|
6071
6376
|
data: initialValues,
|
|
6072
6377
|
label: t("neetoRules.common.name"),
|
|
6073
6378
|
name: "name"
|
|
6074
|
-
}), /*#__PURE__*/jsx(TextareaField, {
|
|
6075
|
-
data: initialValues,
|
|
6076
|
-
label: t("neetoRules.common.description"),
|
|
6077
|
-
name: "description"
|
|
6078
6379
|
}), showStatusSwitch && /*#__PURE__*/jsx(Status, {}), typeof _children === "function" ? _children === null || _children === void 0 ? void 0 : _children(_objectSpread$1({
|
|
6079
6380
|
values: values,
|
|
6080
6381
|
formattedValues: buildPayload(data, values),
|