@bigbinary/neeto-rules-frontend 0.3.6 → 0.3.7
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/dist/index.cjs.js +870 -867
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +870 -868
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/types.d.ts +70 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useRef, useEffect, useMemo, useState, memo } from 'react';
|
|
2
2
|
import { BrowserRouter } from 'react-router-dom';
|
|
3
|
+
import { shallow } from 'zustand/shallow';
|
|
3
4
|
import classNames from 'classnames';
|
|
4
5
|
import { useFormikContext, Formik, Form, useField, FieldArray, ErrorMessage } from 'formik';
|
|
5
6
|
import { findBy, noop, isNotEmpty, toLabelAndValue, removeBy } from '@bigbinary/neeto-cist';
|
|
@@ -7,13 +8,14 @@ import { ActionBlock, Textarea, MultiEmailInput, Input as Input$2, Select as Sel
|
|
|
7
8
|
import { t as t$1 } from 'i18next';
|
|
8
9
|
import * as yup from 'yup';
|
|
9
10
|
import { isEditorEmpty, FormikEditor } from '@bigbinary/neeto-editor';
|
|
11
|
+
import { withImmutableActions, useDebounce, useHotKeys } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
12
|
+
import { create } from 'zustand';
|
|
10
13
|
import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
|
|
11
14
|
import { Typography, Button, Pane, DatePicker, Dropdown as Dropdown$1, Input as Input$1, Checkbox, Select, Label } from '@bigbinary/neetoui';
|
|
12
15
|
import { useTranslation } from 'react-i18next';
|
|
13
16
|
import { Down, Up, Check, Search, Close, Delete, Plus, Refresh, Eye } from '@bigbinary/neeto-icons';
|
|
14
17
|
import { pluck, isNotNil, assocPath, toLower, isEmpty, isNil, without, append, pipe, partition } from 'ramda';
|
|
15
18
|
import { joinHyphenCase } from '@bigbinary/neeto-commons-frontend/utils';
|
|
16
|
-
import { useDebounce, useHotKeys } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
17
19
|
|
|
18
20
|
function _objectDestructuringEmpty(obj) {
|
|
19
21
|
if (obj == null) throw new TypeError("Cannot destructure " + obj);
|
|
@@ -89,594 +91,214 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
89
91
|
return target;
|
|
90
92
|
}
|
|
91
93
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
} catch (error) {
|
|
97
|
-
reject(error);
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
if (info.done) {
|
|
101
|
-
resolve(value);
|
|
102
|
-
} else {
|
|
103
|
-
Promise.resolve(value).then(_next, _throw);
|
|
104
|
-
}
|
|
94
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
95
|
+
|
|
96
|
+
function getDefaultExportFromCjs (x) {
|
|
97
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
105
98
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
99
|
+
|
|
100
|
+
var propTypes = {exports: {}};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
104
|
+
*
|
|
105
|
+
* This source code is licensed under the MIT license found in the
|
|
106
|
+
* LICENSE file in the root directory of this source tree.
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
110
|
+
|
|
111
|
+
var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
115
|
+
*
|
|
116
|
+
* This source code is licensed under the MIT license found in the
|
|
117
|
+
* LICENSE file in the root directory of this source tree.
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
121
|
+
|
|
122
|
+
function emptyFunction() {}
|
|
123
|
+
function emptyFunctionWithReset() {}
|
|
124
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
125
|
+
|
|
126
|
+
var factoryWithThrowingShims = function() {
|
|
127
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
128
|
+
if (secret === ReactPropTypesSecret) {
|
|
129
|
+
// It is still safe when called from React.
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
var err = new Error(
|
|
133
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
134
|
+
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
135
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
136
|
+
);
|
|
137
|
+
err.name = 'Invariant Violation';
|
|
138
|
+
throw err;
|
|
139
|
+
} shim.isRequired = shim;
|
|
140
|
+
function getShim() {
|
|
141
|
+
return shim;
|
|
142
|
+
} // Important!
|
|
143
|
+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
144
|
+
var ReactPropTypes = {
|
|
145
|
+
array: shim,
|
|
146
|
+
bigint: shim,
|
|
147
|
+
bool: shim,
|
|
148
|
+
func: shim,
|
|
149
|
+
number: shim,
|
|
150
|
+
object: shim,
|
|
151
|
+
string: shim,
|
|
152
|
+
symbol: shim,
|
|
153
|
+
|
|
154
|
+
any: shim,
|
|
155
|
+
arrayOf: getShim,
|
|
156
|
+
element: shim,
|
|
157
|
+
elementType: shim,
|
|
158
|
+
instanceOf: getShim,
|
|
159
|
+
node: shim,
|
|
160
|
+
objectOf: getShim,
|
|
161
|
+
oneOf: getShim,
|
|
162
|
+
oneOfType: getShim,
|
|
163
|
+
shape: getShim,
|
|
164
|
+
exact: getShim,
|
|
165
|
+
|
|
166
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
167
|
+
resetWarningCache: emptyFunction
|
|
120
168
|
};
|
|
169
|
+
|
|
170
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
171
|
+
|
|
172
|
+
return ReactPropTypes;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
177
|
+
*
|
|
178
|
+
* This source code is licensed under the MIT license found in the
|
|
179
|
+
* LICENSE file in the root directory of this source tree.
|
|
180
|
+
*/
|
|
181
|
+
|
|
182
|
+
{
|
|
183
|
+
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
184
|
+
// http://fb.me/prop-types-in-prod
|
|
185
|
+
propTypes.exports = factoryWithThrowingShims();
|
|
121
186
|
}
|
|
122
187
|
|
|
123
|
-
var
|
|
188
|
+
var propTypesExports = propTypes.exports;
|
|
189
|
+
var PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
|
|
124
190
|
|
|
125
|
-
function
|
|
126
|
-
|
|
191
|
+
function _arrayLikeToArray(arr, len) {
|
|
192
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
193
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
194
|
+
return arr2;
|
|
127
195
|
}
|
|
128
196
|
|
|
129
|
-
|
|
197
|
+
function _arrayWithoutHoles(arr) {
|
|
198
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
199
|
+
}
|
|
130
200
|
|
|
131
|
-
|
|
201
|
+
function _iterableToArray(iter) {
|
|
202
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
203
|
+
}
|
|
132
204
|
|
|
133
|
-
|
|
205
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
206
|
+
if (!o) return;
|
|
207
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
208
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
209
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
210
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
211
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
212
|
+
}
|
|
134
213
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
214
|
+
function _nonIterableSpread() {
|
|
215
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
216
|
+
}
|
|
138
217
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
143
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
|
|
144
|
-
}
|
|
145
|
-
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
146
|
-
} (_typeof));
|
|
218
|
+
function _toConsumableArray(arr) {
|
|
219
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
220
|
+
}
|
|
147
221
|
|
|
148
|
-
var
|
|
222
|
+
var ACTION_TYPES = {
|
|
223
|
+
emailToIds: "emailToIds",
|
|
224
|
+
email: "email",
|
|
225
|
+
emailTo: "emailTo",
|
|
226
|
+
dropdown: "dropdown",
|
|
227
|
+
list: "list",
|
|
228
|
+
multiSelect: "multiSelect",
|
|
229
|
+
note: "note",
|
|
230
|
+
text: "text",
|
|
231
|
+
number: "number",
|
|
232
|
+
decimal: "decimal",
|
|
233
|
+
regex: "regex",
|
|
234
|
+
textarea: "textarea",
|
|
235
|
+
date: "date",
|
|
236
|
+
longText: "longText"
|
|
237
|
+
};
|
|
238
|
+
var LIST_FIELD_TOOLTIP_PROPS = {
|
|
239
|
+
save: {
|
|
240
|
+
content: t$1("neetoRules.buttons.save"),
|
|
241
|
+
position: "top",
|
|
242
|
+
delay: 300
|
|
243
|
+
},
|
|
244
|
+
cancel: {
|
|
245
|
+
content: t$1("neetoRules.buttons.cancel"),
|
|
246
|
+
position: "top",
|
|
247
|
+
delay: 300
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
var DEFAULT_RULE_ACTION = {
|
|
251
|
+
name: "",
|
|
252
|
+
metadata: {}
|
|
253
|
+
};
|
|
254
|
+
var EDITOR_ADDONS = ["code-block", "block-quote", "image-upload"];
|
|
255
|
+
var EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
256
|
+
var MAXIMUM_OPTION_LENGTH$3 = 7;
|
|
257
|
+
var ACTION_INPUT_TYPES = ["text", "number", "decimal", "regex"];
|
|
149
258
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
return {
|
|
194
|
-
type: "normal",
|
|
195
|
-
arg: fn.call(obj, arg)
|
|
196
|
-
};
|
|
197
|
-
} catch (err) {
|
|
198
|
-
return {
|
|
199
|
-
type: "throw",
|
|
200
|
-
arg: err
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
exports.wrap = wrap;
|
|
205
|
-
var ContinueSentinel = {};
|
|
206
|
-
function Generator() {}
|
|
207
|
-
function GeneratorFunction() {}
|
|
208
|
-
function GeneratorFunctionPrototype() {}
|
|
209
|
-
var IteratorPrototype = {};
|
|
210
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
211
|
-
return this;
|
|
212
|
-
});
|
|
213
|
-
var getProto = Object.getPrototypeOf,
|
|
214
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
215
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
216
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
217
|
-
function defineIteratorMethods(prototype) {
|
|
218
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
219
|
-
define(prototype, method, function (arg) {
|
|
220
|
-
return this._invoke(method, arg);
|
|
221
|
-
});
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
225
|
-
function invoke(method, arg, resolve, reject) {
|
|
226
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
227
|
-
if ("throw" !== record.type) {
|
|
228
|
-
var result = record.arg,
|
|
229
|
-
value = result.value;
|
|
230
|
-
return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
231
|
-
invoke("next", value, resolve, reject);
|
|
232
|
-
}, function (err) {
|
|
233
|
-
invoke("throw", err, resolve, reject);
|
|
234
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
235
|
-
result.value = unwrapped, resolve(result);
|
|
236
|
-
}, function (error) {
|
|
237
|
-
return invoke("throw", error, resolve, reject);
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
reject(record.arg);
|
|
241
|
-
}
|
|
242
|
-
var previousPromise;
|
|
243
|
-
defineProperty(this, "_invoke", {
|
|
244
|
-
value: function value(method, arg) {
|
|
245
|
-
function callInvokeWithMethodAndArg() {
|
|
246
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
247
|
-
invoke(method, arg, resolve, reject);
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
function makeInvokeMethod(innerFn, self, context) {
|
|
255
|
-
var state = "suspendedStart";
|
|
256
|
-
return function (method, arg) {
|
|
257
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
258
|
-
if ("completed" === state) {
|
|
259
|
-
if ("throw" === method) throw arg;
|
|
260
|
-
return doneResult();
|
|
261
|
-
}
|
|
262
|
-
for (context.method = method, context.arg = arg;;) {
|
|
263
|
-
var delegate = context.delegate;
|
|
264
|
-
if (delegate) {
|
|
265
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
266
|
-
if (delegateResult) {
|
|
267
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
268
|
-
return delegateResult;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
272
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
273
|
-
context.dispatchException(context.arg);
|
|
274
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
275
|
-
state = "executing";
|
|
276
|
-
var record = tryCatch(innerFn, self, context);
|
|
277
|
-
if ("normal" === record.type) {
|
|
278
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
279
|
-
return {
|
|
280
|
-
value: record.arg,
|
|
281
|
-
done: context.done
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
289
|
-
var methodName = context.method,
|
|
290
|
-
method = delegate.iterator[methodName];
|
|
291
|
-
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
|
|
292
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
293
|
-
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
294
|
-
var info = record.arg;
|
|
295
|
-
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
296
|
-
}
|
|
297
|
-
function pushTryEntry(locs) {
|
|
298
|
-
var entry = {
|
|
299
|
-
tryLoc: locs[0]
|
|
300
|
-
};
|
|
301
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
302
|
-
}
|
|
303
|
-
function resetTryEntry(entry) {
|
|
304
|
-
var record = entry.completion || {};
|
|
305
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
306
|
-
}
|
|
307
|
-
function Context(tryLocsList) {
|
|
308
|
-
this.tryEntries = [{
|
|
309
|
-
tryLoc: "root"
|
|
310
|
-
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
311
|
-
}
|
|
312
|
-
function values(iterable) {
|
|
313
|
-
if (iterable) {
|
|
314
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
315
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
316
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
317
|
-
if (!isNaN(iterable.length)) {
|
|
318
|
-
var i = -1,
|
|
319
|
-
next = function next() {
|
|
320
|
-
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
321
|
-
return next.value = undefined, next.done = !0, next;
|
|
322
|
-
};
|
|
323
|
-
return next.next = next;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
return {
|
|
327
|
-
next: doneResult
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
function doneResult() {
|
|
331
|
-
return {
|
|
332
|
-
value: undefined,
|
|
333
|
-
done: !0
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
337
|
-
value: GeneratorFunctionPrototype,
|
|
338
|
-
configurable: !0
|
|
339
|
-
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
340
|
-
value: GeneratorFunction,
|
|
341
|
-
configurable: !0
|
|
342
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
343
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
344
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
345
|
-
}, exports.mark = function (genFun) {
|
|
346
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
347
|
-
}, exports.awrap = function (arg) {
|
|
348
|
-
return {
|
|
349
|
-
__await: arg
|
|
350
|
-
};
|
|
351
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
352
|
-
return this;
|
|
353
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
354
|
-
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
355
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
356
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
357
|
-
return result.done ? result.value : iter.next();
|
|
358
|
-
});
|
|
359
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
360
|
-
return this;
|
|
361
|
-
}), define(Gp, "toString", function () {
|
|
362
|
-
return "[object Generator]";
|
|
363
|
-
}), exports.keys = function (val) {
|
|
364
|
-
var object = Object(val),
|
|
365
|
-
keys = [];
|
|
366
|
-
for (var key in object) keys.push(key);
|
|
367
|
-
return keys.reverse(), function next() {
|
|
368
|
-
for (; keys.length;) {
|
|
369
|
-
var key = keys.pop();
|
|
370
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
371
|
-
}
|
|
372
|
-
return next.done = !0, next;
|
|
373
|
-
};
|
|
374
|
-
}, exports.values = values, Context.prototype = {
|
|
375
|
-
constructor: Context,
|
|
376
|
-
reset: function reset(skipTempReset) {
|
|
377
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
378
|
-
},
|
|
379
|
-
stop: function stop() {
|
|
380
|
-
this.done = !0;
|
|
381
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
382
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
383
|
-
return this.rval;
|
|
384
|
-
},
|
|
385
|
-
dispatchException: function dispatchException(exception) {
|
|
386
|
-
if (this.done) throw exception;
|
|
387
|
-
var context = this;
|
|
388
|
-
function handle(loc, caught) {
|
|
389
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
390
|
-
}
|
|
391
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
392
|
-
var entry = this.tryEntries[i],
|
|
393
|
-
record = entry.completion;
|
|
394
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
395
|
-
if (entry.tryLoc <= this.prev) {
|
|
396
|
-
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
397
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
398
|
-
if (hasCatch && hasFinally) {
|
|
399
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
400
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
401
|
-
} else if (hasCatch) {
|
|
402
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
403
|
-
} else {
|
|
404
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
405
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
},
|
|
410
|
-
abrupt: function abrupt(type, arg) {
|
|
411
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
412
|
-
var entry = this.tryEntries[i];
|
|
413
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
414
|
-
var finallyEntry = entry;
|
|
415
|
-
break;
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
419
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
420
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
421
|
-
},
|
|
422
|
-
complete: function complete(record, afterLoc) {
|
|
423
|
-
if ("throw" === record.type) throw record.arg;
|
|
424
|
-
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
425
|
-
},
|
|
426
|
-
finish: function finish(finallyLoc) {
|
|
427
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
428
|
-
var entry = this.tryEntries[i];
|
|
429
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
430
|
-
}
|
|
431
|
-
},
|
|
432
|
-
"catch": function _catch(tryLoc) {
|
|
433
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
434
|
-
var entry = this.tryEntries[i];
|
|
435
|
-
if (entry.tryLoc === tryLoc) {
|
|
436
|
-
var record = entry.completion;
|
|
437
|
-
if ("throw" === record.type) {
|
|
438
|
-
var thrown = record.arg;
|
|
439
|
-
resetTryEntry(entry);
|
|
440
|
-
}
|
|
441
|
-
return thrown;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
throw new Error("illegal catch attempt");
|
|
445
|
-
},
|
|
446
|
-
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
447
|
-
return this.delegate = {
|
|
448
|
-
iterator: values(iterable),
|
|
449
|
-
resultName: resultName,
|
|
450
|
-
nextLoc: nextLoc
|
|
451
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
452
|
-
}
|
|
453
|
-
}, exports;
|
|
454
|
-
}
|
|
455
|
-
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
456
|
-
} (regeneratorRuntime$1));
|
|
457
|
-
|
|
458
|
-
var regeneratorRuntimeExports = regeneratorRuntime$1.exports;
|
|
459
|
-
|
|
460
|
-
// TODO(Babel 8): Remove this file.
|
|
461
|
-
|
|
462
|
-
var runtime = regeneratorRuntimeExports();
|
|
463
|
-
var regenerator = runtime;
|
|
464
|
-
|
|
465
|
-
// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
|
|
466
|
-
try {
|
|
467
|
-
regeneratorRuntime = runtime;
|
|
468
|
-
} catch (accidentalStrictMode) {
|
|
469
|
-
if (typeof globalThis === "object") {
|
|
470
|
-
globalThis.regeneratorRuntime = runtime;
|
|
471
|
-
} else {
|
|
472
|
-
Function("r", "regeneratorRuntime = r")(runtime);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regenerator);
|
|
477
|
-
|
|
478
|
-
var propTypes = {exports: {}};
|
|
479
|
-
|
|
480
|
-
/**
|
|
481
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
482
|
-
*
|
|
483
|
-
* This source code is licensed under the MIT license found in the
|
|
484
|
-
* LICENSE file in the root directory of this source tree.
|
|
485
|
-
*/
|
|
486
|
-
|
|
487
|
-
var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
488
|
-
|
|
489
|
-
var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
490
|
-
|
|
491
|
-
/**
|
|
492
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
493
|
-
*
|
|
494
|
-
* This source code is licensed under the MIT license found in the
|
|
495
|
-
* LICENSE file in the root directory of this source tree.
|
|
496
|
-
*/
|
|
497
|
-
|
|
498
|
-
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
499
|
-
|
|
500
|
-
function emptyFunction() {}
|
|
501
|
-
function emptyFunctionWithReset() {}
|
|
502
|
-
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
503
|
-
|
|
504
|
-
var factoryWithThrowingShims = function() {
|
|
505
|
-
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
506
|
-
if (secret === ReactPropTypesSecret) {
|
|
507
|
-
// It is still safe when called from React.
|
|
508
|
-
return;
|
|
509
|
-
}
|
|
510
|
-
var err = new Error(
|
|
511
|
-
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
512
|
-
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
513
|
-
'Read more at http://fb.me/use-check-prop-types'
|
|
514
|
-
);
|
|
515
|
-
err.name = 'Invariant Violation';
|
|
516
|
-
throw err;
|
|
517
|
-
} shim.isRequired = shim;
|
|
518
|
-
function getShim() {
|
|
519
|
-
return shim;
|
|
520
|
-
} // Important!
|
|
521
|
-
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
522
|
-
var ReactPropTypes = {
|
|
523
|
-
array: shim,
|
|
524
|
-
bigint: shim,
|
|
525
|
-
bool: shim,
|
|
526
|
-
func: shim,
|
|
527
|
-
number: shim,
|
|
528
|
-
object: shim,
|
|
529
|
-
string: shim,
|
|
530
|
-
symbol: shim,
|
|
531
|
-
|
|
532
|
-
any: shim,
|
|
533
|
-
arrayOf: getShim,
|
|
534
|
-
element: shim,
|
|
535
|
-
elementType: shim,
|
|
536
|
-
instanceOf: getShim,
|
|
537
|
-
node: shim,
|
|
538
|
-
objectOf: getShim,
|
|
539
|
-
oneOf: getShim,
|
|
540
|
-
oneOfType: getShim,
|
|
541
|
-
shape: getShim,
|
|
542
|
-
exact: getShim,
|
|
543
|
-
|
|
544
|
-
checkPropTypes: emptyFunctionWithReset,
|
|
545
|
-
resetWarningCache: emptyFunction
|
|
546
|
-
};
|
|
547
|
-
|
|
548
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
549
|
-
|
|
550
|
-
return ReactPropTypes;
|
|
551
|
-
};
|
|
552
|
-
|
|
553
|
-
/**
|
|
554
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
555
|
-
*
|
|
556
|
-
* This source code is licensed under the MIT license found in the
|
|
557
|
-
* LICENSE file in the root directory of this source tree.
|
|
558
|
-
*/
|
|
559
|
-
|
|
560
|
-
{
|
|
561
|
-
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
562
|
-
// http://fb.me/prop-types-in-prod
|
|
563
|
-
propTypes.exports = factoryWithThrowingShims();
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
var propTypesExports = propTypes.exports;
|
|
567
|
-
var PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
|
|
568
|
-
|
|
569
|
-
function _arrayLikeToArray(arr, len) {
|
|
570
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
571
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
572
|
-
return arr2;
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
function _arrayWithoutHoles(arr) {
|
|
576
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
function _iterableToArray(iter) {
|
|
580
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
584
|
-
if (!o) return;
|
|
585
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
586
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
587
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
588
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
589
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
function _nonIterableSpread() {
|
|
593
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
function _toConsumableArray(arr) {
|
|
597
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
var ACTION_TYPES = {
|
|
601
|
-
emailToIds: "emailToIds",
|
|
602
|
-
email: "email",
|
|
603
|
-
emailTo: "emailTo",
|
|
604
|
-
dropdown: "dropdown",
|
|
605
|
-
list: "list",
|
|
606
|
-
multiSelect: "multiSelect",
|
|
607
|
-
note: "note",
|
|
608
|
-
text: "text",
|
|
609
|
-
number: "number",
|
|
610
|
-
decimal: "decimal",
|
|
611
|
-
regex: "regex",
|
|
612
|
-
textarea: "textarea",
|
|
613
|
-
date: "date",
|
|
614
|
-
longText: "longText"
|
|
615
|
-
};
|
|
616
|
-
var LIST_FIELD_TOOLTIP_PROPS = {
|
|
617
|
-
save: {
|
|
618
|
-
content: t$1("neetoRules.buttons.save"),
|
|
619
|
-
position: "top",
|
|
620
|
-
delay: 300
|
|
621
|
-
},
|
|
622
|
-
cancel: {
|
|
623
|
-
content: t$1("neetoRules.buttons.cancel"),
|
|
624
|
-
position: "top",
|
|
625
|
-
delay: 300
|
|
626
|
-
}
|
|
627
|
-
};
|
|
628
|
-
var DEFAULT_RULE_ACTION = {
|
|
629
|
-
name: "",
|
|
630
|
-
metadata: {}
|
|
631
|
-
};
|
|
632
|
-
var EDITOR_ADDONS = ["code-block", "block-quote", "image-upload"];
|
|
633
|
-
var EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
634
|
-
var MAXIMUM_OPTION_LENGTH$3 = 7;
|
|
635
|
-
var ACTION_INPUT_TYPES = ["text", "number", "decimal", "regex"];
|
|
636
|
-
|
|
637
|
-
var OPERATORS$1 = {
|
|
638
|
-
or: "or_operator",
|
|
639
|
-
and: "and_operator"
|
|
640
|
-
};
|
|
641
|
-
var OPERATOR_LABELS = {
|
|
642
|
-
or_operator: t$1("neetoRules.operators.or"),
|
|
643
|
-
and_operator: t$1("neetoRules.operators.and")
|
|
644
|
-
};
|
|
645
|
-
var VERB_LABELS = {
|
|
646
|
-
is: t$1("neetoRules.conditionVerbs.is"),
|
|
647
|
-
is_not: t$1("neetoRules.conditionVerbs.isNot"),
|
|
648
|
-
contains: t$1("neetoRules.conditionVerbs.contains"),
|
|
649
|
-
does_not_contain: t$1("neetoRules.conditionVerbs.doesNotContain"),
|
|
650
|
-
contains_any_of: t$1("neetoRules.conditionVerbs.containsAnyOf"),
|
|
651
|
-
contains_all_of: t$1("neetoRules.conditionVerbs.containsAllOf"),
|
|
652
|
-
contains_none_of: t$1("neetoRules.conditionVerbs.containsNoneOf"),
|
|
653
|
-
starts_with: t$1("neetoRules.conditionVerbs.startsWith"),
|
|
654
|
-
ends_with: t$1("neetoRules.conditionVerbs.endsWith"),
|
|
655
|
-
less_than: t$1("neetoRules.conditionVerbs.lessThan"),
|
|
656
|
-
greater_than: t$1("neetoRules.conditionVerbs.greaterThan"),
|
|
657
|
-
any_time: t$1("neetoRules.conditionVerbs.anyTime"),
|
|
658
|
-
during: t$1("neetoRules.conditionVerbs.during"),
|
|
659
|
-
not_during: t$1("neetoRules.conditionVerbs.notDuring"),
|
|
660
|
-
any_of: t$1("neetoRules.conditionVerbs.anyOf"),
|
|
661
|
-
none_of: t$1("neetoRules.conditionVerbs.noneOf"),
|
|
662
|
-
is_before: t$1("neetoRules.conditionVerbs.isBefore"),
|
|
663
|
-
is_after: t$1("neetoRules.conditionVerbs.isAfter")
|
|
664
|
-
};
|
|
665
|
-
var CONDITION_VALUE_TYPES = {
|
|
666
|
-
text: "text",
|
|
667
|
-
number: "number",
|
|
668
|
-
decimal: "decimal",
|
|
669
|
-
url: "url",
|
|
670
|
-
email: "email",
|
|
671
|
-
dropdown: "dropdown",
|
|
672
|
-
multiSelect: "multi-select",
|
|
673
|
-
multiSelectCreate: "multi-select-create",
|
|
674
|
-
date: "date",
|
|
675
|
-
regex: "regex",
|
|
676
|
-
textarea: "textarea"
|
|
677
|
-
};
|
|
678
|
-
var INPUT_FIELD_TYPES = ["email", "text", "number", "decimal", "url", "regex"];
|
|
679
|
-
var MAXIMUM_OPTION_LENGTH$2 = 7;
|
|
259
|
+
var OPERATORS$1 = {
|
|
260
|
+
or: "or_operator",
|
|
261
|
+
and: "and_operator"
|
|
262
|
+
};
|
|
263
|
+
var OPERATOR_LABELS = {
|
|
264
|
+
or_operator: t$1("neetoRules.operators.or"),
|
|
265
|
+
and_operator: t$1("neetoRules.operators.and")
|
|
266
|
+
};
|
|
267
|
+
var VERB_LABELS = {
|
|
268
|
+
is: t$1("neetoRules.conditionVerbs.is"),
|
|
269
|
+
is_not: t$1("neetoRules.conditionVerbs.isNot"),
|
|
270
|
+
contains: t$1("neetoRules.conditionVerbs.contains"),
|
|
271
|
+
does_not_contain: t$1("neetoRules.conditionVerbs.doesNotContain"),
|
|
272
|
+
contains_any_of: t$1("neetoRules.conditionVerbs.containsAnyOf"),
|
|
273
|
+
contains_all_of: t$1("neetoRules.conditionVerbs.containsAllOf"),
|
|
274
|
+
contains_none_of: t$1("neetoRules.conditionVerbs.containsNoneOf"),
|
|
275
|
+
starts_with: t$1("neetoRules.conditionVerbs.startsWith"),
|
|
276
|
+
ends_with: t$1("neetoRules.conditionVerbs.endsWith"),
|
|
277
|
+
less_than: t$1("neetoRules.conditionVerbs.lessThan"),
|
|
278
|
+
greater_than: t$1("neetoRules.conditionVerbs.greaterThan"),
|
|
279
|
+
any_time: t$1("neetoRules.conditionVerbs.anyTime"),
|
|
280
|
+
during: t$1("neetoRules.conditionVerbs.during"),
|
|
281
|
+
not_during: t$1("neetoRules.conditionVerbs.notDuring"),
|
|
282
|
+
any_of: t$1("neetoRules.conditionVerbs.anyOf"),
|
|
283
|
+
none_of: t$1("neetoRules.conditionVerbs.noneOf"),
|
|
284
|
+
is_before: t$1("neetoRules.conditionVerbs.isBefore"),
|
|
285
|
+
is_after: t$1("neetoRules.conditionVerbs.isAfter")
|
|
286
|
+
};
|
|
287
|
+
var CONDITION_VALUE_TYPES = {
|
|
288
|
+
text: "text",
|
|
289
|
+
number: "number",
|
|
290
|
+
decimal: "decimal",
|
|
291
|
+
url: "url",
|
|
292
|
+
email: "email",
|
|
293
|
+
dropdown: "dropdown",
|
|
294
|
+
multiSelect: "multi-select",
|
|
295
|
+
multiSelectCreate: "multi-select-create",
|
|
296
|
+
date: "date",
|
|
297
|
+
regex: "regex",
|
|
298
|
+
textarea: "textarea"
|
|
299
|
+
};
|
|
300
|
+
var INPUT_FIELD_TYPES = ["email", "text", "number", "decimal", "url", "regex"];
|
|
301
|
+
var MAXIMUM_OPTION_LENGTH$2 = 7;
|
|
680
302
|
|
|
681
303
|
function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
682
304
|
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$6(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -796,7 +418,7 @@ var getConditionsSchema = function getConditionsSchema(element) {
|
|
|
796
418
|
}))
|
|
797
419
|
});
|
|
798
420
|
};
|
|
799
|
-
var getActionsSchema = function getActionsSchema(element) {
|
|
421
|
+
var getActionsSchema = function getActionsSchema(element, customData) {
|
|
800
422
|
var actionOptions = element.actionOptions,
|
|
801
423
|
_element$componentPro5 = element.componentProps,
|
|
802
424
|
componentProps = _element$componentPro5 === void 0 ? {} : _element$componentPro5;
|
|
@@ -861,7 +483,7 @@ var getActionsSchema = function getActionsSchema(element) {
|
|
|
861
483
|
value: yup.string().required(t$1("neetoRules.validations.required.body"))
|
|
862
484
|
});
|
|
863
485
|
} else if (selectedAction !== null && selectedAction !== void 0 && selectedAction.component) {
|
|
864
|
-
return selectedAction.validation;
|
|
486
|
+
return typeof selectedAction.validation === "function" ? selectedAction.validation(customData) : selectedAction.validation;
|
|
865
487
|
}
|
|
866
488
|
return schema;
|
|
867
489
|
})
|
|
@@ -879,14 +501,14 @@ var getSchemaForArray = function getSchemaForArray(element) {
|
|
|
879
501
|
then: yup.array().min(1, t$1("neetoRules.validations.atLeastOneValue")).required(t$1("neetoRules.validations.atLeastOneValue"))
|
|
880
502
|
});
|
|
881
503
|
};
|
|
882
|
-
var getSchemaForElement = function getSchemaForElement(element) {
|
|
883
|
-
return VALIDATION_SCHEMA[element.type](element);
|
|
504
|
+
var getSchemaForElement = function getSchemaForElement(element, customData) {
|
|
505
|
+
return VALIDATION_SCHEMA[element.type](element, customData);
|
|
884
506
|
};
|
|
885
|
-
var getValidationSchema = function getValidationSchema(data) {
|
|
507
|
+
var getValidationSchema = function getValidationSchema(data, customData) {
|
|
886
508
|
var fieldKeys = Object.keys(data);
|
|
887
509
|
var schema = fieldKeys.reduce(function (acc, key) {
|
|
888
510
|
return _objectSpread$6(_objectSpread$6({}, acc), {}, _defineProperty({}, key, yup.object({
|
|
889
|
-
value: getSchemaForElement(data[key])
|
|
511
|
+
value: getSchemaForElement(data[key], customData)
|
|
890
512
|
})));
|
|
891
513
|
}, {});
|
|
892
514
|
return yup.object(schema);
|
|
@@ -944,6 +566,14 @@ var formatData = function formatData(data) {
|
|
|
944
566
|
}, {});
|
|
945
567
|
};
|
|
946
568
|
|
|
569
|
+
/** @type {import("neetocommons/react-utils").ZustandStoreHook} */
|
|
570
|
+
var useCustomDataStore = create(withImmutableActions(function (set) {
|
|
571
|
+
return {
|
|
572
|
+
customData: {},
|
|
573
|
+
setCustomDataState: set
|
|
574
|
+
};
|
|
575
|
+
}));
|
|
576
|
+
|
|
947
577
|
var transformObjectToDotNotation = function transformObjectToDotNotation(obj) {
|
|
948
578
|
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
949
579
|
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
@@ -1007,37 +637,29 @@ var NeetoRules$2 = function NeetoRules(_ref) {
|
|
|
1007
637
|
_ref$handleCancel = _ref.handleCancel,
|
|
1008
638
|
handleCancel = _ref$handleCancel === void 0 ? noop : _ref$handleCancel;
|
|
1009
639
|
var formRef = useRef(null);
|
|
1010
|
-
var submitForm =
|
|
1011
|
-
var
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
while (1) switch (_context.prev = _context.next) {
|
|
1015
|
-
case 0:
|
|
1016
|
-
payload = buildPayload(data, values);
|
|
1017
|
-
handleSubmit(payload, formikBag);
|
|
1018
|
-
case 2:
|
|
1019
|
-
case "end":
|
|
1020
|
-
return _context.stop();
|
|
1021
|
-
}
|
|
1022
|
-
}, _callee);
|
|
1023
|
-
}));
|
|
1024
|
-
return function submitForm(_x, _x2) {
|
|
1025
|
-
return _ref2.apply(this, arguments);
|
|
1026
|
-
};
|
|
1027
|
-
}();
|
|
640
|
+
var submitForm = function submitForm(values, formikBag) {
|
|
641
|
+
var payload = buildPayload(data, values);
|
|
642
|
+
handleSubmit(payload, formikBag);
|
|
643
|
+
};
|
|
1028
644
|
var initialValues = useMemo(function () {
|
|
1029
645
|
return formatData(data);
|
|
1030
646
|
}, [data]);
|
|
647
|
+
var _useCustomDataStore = useCustomDataStore(function (store) {
|
|
648
|
+
return {
|
|
649
|
+
customData: store["customData"]
|
|
650
|
+
};
|
|
651
|
+
}, shallow),
|
|
652
|
+
customData = _useCustomDataStore.customData;
|
|
1031
653
|
return /*#__PURE__*/React.createElement(Formik, {
|
|
1032
654
|
initialValues: initialValues,
|
|
1033
655
|
enableReinitialize: true,
|
|
1034
|
-
validationSchema: getValidationSchema(data),
|
|
656
|
+
validationSchema: getValidationSchema(data, customData),
|
|
1035
657
|
onSubmit: submitForm
|
|
1036
|
-
}, function (
|
|
1037
|
-
var isSubmitting =
|
|
1038
|
-
dirty =
|
|
1039
|
-
values =
|
|
1040
|
-
fromikBag = _objectWithoutProperties(
|
|
658
|
+
}, function (_ref2) {
|
|
659
|
+
var isSubmitting = _ref2.isSubmitting,
|
|
660
|
+
dirty = _ref2.dirty,
|
|
661
|
+
values = _ref2.values,
|
|
662
|
+
fromikBag = _objectWithoutProperties(_ref2, _excluded$9);
|
|
1041
663
|
return /*#__PURE__*/React.createElement(Form, {
|
|
1042
664
|
className: classNames(["w-full space-y-6 px-24", className]),
|
|
1043
665
|
ref: formRef
|
|
@@ -1078,7 +700,7 @@ var Main = function Main(_ref) {
|
|
|
1078
700
|
|
|
1079
701
|
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}}
|
|
1080
702
|
|
|
1081
|
-
var css = ".neeto-filters-error-boundary{align-items:center;background-color
|
|
703
|
+
var css = ".neeto-filters-error-boundary{align-items:center;background-color:rgb(var(--neeto-ui-gray-100));border-radius:var(--neeto-ui-rounded-sm);display:flex;gap:16px;margin-bottom:12px;padding:8px 20px}.neeto-filters-error-boundary p{color:rgb(var(--neeto-ui-gray-800))}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3NyYy9zdHlsZXNoZWV0cy9jb21wb25lbnRzL19lcnJvci1ib3VuZGFyeS5zY3NzIiwiYXBwL2phdmFzY3JpcHQvc3JjL3N0eWxlc2hlZXRzL21haW4uc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSw4QkFJRSxrQkFBQSxDQUdBLDhDQUFBLENBREEsd0NBQUEsQ0FIQSxZQUFBLENBRUEsUUFBQSxDQUhBLGtCQUFBLENBREEsZ0JDT0YsQ0RDRSxnQ0FDRSxtQ0NDSiIsInNvdXJjZXNDb250ZW50IjpbIi5uZWV0by1maWx0ZXJzLWVycm9yLWJvdW5kYXJ5IHtcbiAgcGFkZGluZzogOHB4IDIwcHg7XG4gIG1hcmdpbi1ib3R0b206IDEycHg7XG4gIGRpc3BsYXk6IGZsZXg7XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIGdhcDogMTZweDtcbiAgYm9yZGVyLXJhZGl1czogdmFyKC0tbmVldG8tdWktcm91bmRlZC1zbSk7XG4gIGJhY2tncm91bmQtY29sb3I6IHJnYih2YXIoLS1uZWV0by11aS1ncmF5LTEwMCkpO1xuXG4gIHAge1xuICAgIGNvbG9yOiByZ2IodmFyKC0tbmVldG8tdWktZ3JheS04MDApKTtcbiAgfVxufVxuIiwiLm5lZXRvLWZpbHRlcnMtZXJyb3ItYm91bmRhcnkge1xuICBwYWRkaW5nOiA4cHggMjBweDtcbiAgbWFyZ2luLWJvdHRvbTogMTJweDtcbiAgZGlzcGxheTogZmxleDtcbiAgYWxpZ24taXRlbXM6IGNlbnRlcjtcbiAgZ2FwOiAxNnB4O1xuICBib3JkZXItcmFkaXVzOiB2YXIoLS1uZWV0by11aS1yb3VuZGVkLXNtKTtcbiAgYmFja2dyb3VuZC1jb2xvcjogcmdiKHZhcigtLW5lZXRvLXVpLWdyYXktMTAwKSk7XG59XG4ubmVldG8tZmlsdGVycy1lcnJvci1ib3VuZGFyeSBwIHtcbiAgY29sb3I6IHJnYih2YXIoLS1uZWV0by11aS1ncmF5LTgwMCkpO1xufSJdfQ== */";
|
|
1082
704
|
n(css,{});
|
|
1083
705
|
|
|
1084
706
|
var NeetoRules$1 = function NeetoRules(_ref) {
|
|
@@ -3121,31 +2743,196 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
3121
2743
|
});
|
|
3122
2744
|
}
|
|
3123
2745
|
};
|
|
3124
|
-
useEffect(function () {
|
|
3125
|
-
findDefaultSelectedOption();
|
|
3126
|
-
}, [options, conditions]);
|
|
2746
|
+
useEffect(function () {
|
|
2747
|
+
findDefaultSelectedOption();
|
|
2748
|
+
}, [options, conditions]);
|
|
2749
|
+
return /*#__PURE__*/React.createElement(Dropdown$1, {
|
|
2750
|
+
buttonStyle: "secondary",
|
|
2751
|
+
className: "neeto-ui-bg-gray-100",
|
|
2752
|
+
customTarget: /*#__PURE__*/React.createElement(Typography, {
|
|
2753
|
+
"data-cy": "condition-value-dropdown-button",
|
|
2754
|
+
style: "h5",
|
|
2755
|
+
weight: "semibold",
|
|
2756
|
+
className: classNames("hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800 mt-1 cursor-pointer underline", {
|
|
2757
|
+
"neeto-ui-text-primary-800": isActive,
|
|
2758
|
+
"neeto-ui-text-error-500": isValueSelected
|
|
2759
|
+
}),
|
|
2760
|
+
onClick: function onClick() {
|
|
2761
|
+
setTouched(assocPath(["conditions", "value", index], true, touched));
|
|
2762
|
+
setIsActive(function (prevState) {
|
|
2763
|
+
return !prevState;
|
|
2764
|
+
});
|
|
2765
|
+
}
|
|
2766
|
+
}, defaultSelectedOption === null || defaultSelectedOption === void 0 || (_defaultSelectedOptio = defaultSelectedOption.label) === null || _defaultSelectedOptio === void 0 ? void 0 : _defaultSelectedOptio.toLowerCase()),
|
|
2767
|
+
onClose: handleClose
|
|
2768
|
+
}, /*#__PURE__*/React.createElement(Menu$5, {
|
|
2769
|
+
className: "max-h-60 max-w-2xl p-3"
|
|
2770
|
+
}, options.length > MAXIMUM_OPTION_LENGTH$2 && /*#__PURE__*/React.createElement(Input$1, {
|
|
2771
|
+
autoFocus: true,
|
|
2772
|
+
className: "mb-1",
|
|
2773
|
+
"data-cy": "search-text-field",
|
|
2774
|
+
placeholder: t$1("neetoRules.common.search"),
|
|
2775
|
+
prefix: /*#__PURE__*/React.createElement(Search, null),
|
|
2776
|
+
value: searchTerm,
|
|
2777
|
+
onChange: function onChange(e) {
|
|
2778
|
+
return setSearchTerm(e.target.value);
|
|
2779
|
+
},
|
|
2780
|
+
onClick: function onClick(e) {
|
|
2781
|
+
return e.stopPropagation();
|
|
2782
|
+
}
|
|
2783
|
+
}), /*#__PURE__*/React.createElement(OptionsWrapper, {
|
|
2784
|
+
hasScroll: options.length > MAXIMUM_OPTION_LENGTH$2
|
|
2785
|
+
}, searchedOptions.map(function (option, idx) {
|
|
2786
|
+
return /*#__PURE__*/React.createElement(MenuItem$5.Button, {
|
|
2787
|
+
"data-cy": "".concat(joinHyphenCase(option.label), "-menu-item"),
|
|
2788
|
+
key: idx,
|
|
2789
|
+
className: classNames({
|
|
2790
|
+
"neeto-ui-bg-gray-100": (defaultSelectedOption === null || defaultSelectedOption === void 0 ? void 0 : defaultSelectedOption.value) === option.value
|
|
2791
|
+
}),
|
|
2792
|
+
suffix: (defaultSelectedOption === null || defaultSelectedOption === void 0 ? void 0 : defaultSelectedOption.value) === option.value && /*#__PURE__*/React.createElement(Check, {
|
|
2793
|
+
className: "neeto-ui-text-primary-800"
|
|
2794
|
+
}),
|
|
2795
|
+
onClick: function onClick() {
|
|
2796
|
+
return handleSelectOption(option);
|
|
2797
|
+
}
|
|
2798
|
+
}, option.label);
|
|
2799
|
+
})), isEmpty(options) && /*#__PURE__*/React.createElement(MenuItem$5.Button, {
|
|
2800
|
+
"data-cy": "no-options-menu-item"
|
|
2801
|
+
}, t$1("neetoRules.common.noOptions"))));
|
|
2802
|
+
};
|
|
2803
|
+
|
|
2804
|
+
var InputField$1 = function InputField(_ref) {
|
|
2805
|
+
var _condition$metadata, _errors$conditions, _touched$conditions;
|
|
2806
|
+
var name = _ref.name,
|
|
2807
|
+
index = _ref.index,
|
|
2808
|
+
placeholder = _ref.placeholder;
|
|
2809
|
+
var _useFormikContext = useFormikContext(),
|
|
2810
|
+
conditions = _useFormikContext.values.conditions,
|
|
2811
|
+
errors = _useFormikContext.errors,
|
|
2812
|
+
touched = _useFormikContext.touched;
|
|
2813
|
+
var _useState = useState(false),
|
|
2814
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
2815
|
+
showInput = _useState2[0],
|
|
2816
|
+
setShowInput = _useState2[1];
|
|
2817
|
+
var inputRef = useRef(null);
|
|
2818
|
+
useCloseInputField(inputRef, showInput, function () {
|
|
2819
|
+
return setShowInput(false);
|
|
2820
|
+
});
|
|
2821
|
+
var condition = conditions.value[index];
|
|
2822
|
+
var valueTerm = (_condition$metadata = condition.metadata) === null || _condition$metadata === void 0 || (_condition$metadata = _condition$metadata.value) === null || _condition$metadata === void 0 ? void 0 : _condition$metadata.toString();
|
|
2823
|
+
var label = valueTerm && valueTerm !== null && valueTerm !== void 0 && valueTerm.trim().length ? valueTerm : t$1("neetoRules.form.addValue");
|
|
2824
|
+
var isValid = errors.conditions && isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0 || (_errors$conditions = _errors$conditions.value) === null || _errors$conditions === void 0 ? void 0 : _errors$conditions[index]) && isNotNil((_touched$conditions = touched.conditions) === null || _touched$conditions === void 0 || (_touched$conditions = _touched$conditions.value) === null || _touched$conditions === void 0 ? void 0 : _touched$conditions[index]);
|
|
2825
|
+
useEffect(function () {
|
|
2826
|
+
setShowInput(false);
|
|
2827
|
+
}, [condition.verb]);
|
|
2828
|
+
return showInput ? /*#__PURE__*/React.createElement(Input$2, {
|
|
2829
|
+
name: name,
|
|
2830
|
+
placeholder: placeholder,
|
|
2831
|
+
ref: inputRef,
|
|
2832
|
+
size: "small",
|
|
2833
|
+
suffix: /*#__PURE__*/React.createElement(Check, {
|
|
2834
|
+
className: "cursor-pointer",
|
|
2835
|
+
onClick: function onClick() {
|
|
2836
|
+
return setShowInput(function (prevState) {
|
|
2837
|
+
return !prevState;
|
|
2838
|
+
});
|
|
2839
|
+
}
|
|
2840
|
+
})
|
|
2841
|
+
}) : /*#__PURE__*/React.createElement(Typography, {
|
|
2842
|
+
style: "h5",
|
|
2843
|
+
weight: "semibold",
|
|
2844
|
+
className: classNames("neeto-ui-text-gray-800 hover:neeto-ui-text-primary-800 mt-1 cursor-pointer underline", {
|
|
2845
|
+
"neeto-ui-text-error-500": isValid
|
|
2846
|
+
}),
|
|
2847
|
+
onClick: function onClick() {
|
|
2848
|
+
return setShowInput(function (prevState) {
|
|
2849
|
+
return !prevState;
|
|
2850
|
+
});
|
|
2851
|
+
}
|
|
2852
|
+
}, label);
|
|
2853
|
+
};
|
|
2854
|
+
|
|
2855
|
+
var Menu$4 = Dropdown$1.Menu,
|
|
2856
|
+
MenuItem$4 = Dropdown$1.MenuItem;
|
|
2857
|
+
var MultiSelect = function MultiSelect(_ref) {
|
|
2858
|
+
var _conditions$value$ind, _errors$conditions, _touched$conditions;
|
|
2859
|
+
var name = _ref.name,
|
|
2860
|
+
dropDownOptions = _ref.dropDownOptions,
|
|
2861
|
+
index = _ref.index;
|
|
2862
|
+
var _useFormikContext = useFormikContext(),
|
|
2863
|
+
conditions = _useFormikContext.values.conditions,
|
|
2864
|
+
setFieldValue = _useFormikContext.setFieldValue,
|
|
2865
|
+
errors = _useFormikContext.errors,
|
|
2866
|
+
touched = _useFormikContext.touched,
|
|
2867
|
+
setTouched = _useFormikContext.setTouched;
|
|
2868
|
+
var _useState = useState(null),
|
|
2869
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
2870
|
+
activeOption = _useState2[0],
|
|
2871
|
+
setActiveOption = _useState2[1];
|
|
2872
|
+
var _useState3 = useState(""),
|
|
2873
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
2874
|
+
searchTerm = _useState4[0],
|
|
2875
|
+
setSearchTerm = _useState4[1];
|
|
2876
|
+
var values = (_conditions$value$ind = conditions.value[index]) === null || _conditions$value$ind === void 0 || (_conditions$value$ind = _conditions$value$ind.metadata) === null || _conditions$value$ind === void 0 ? void 0 : _conditions$value$ind.values;
|
|
2877
|
+
var selectedOptions = values || [];
|
|
2878
|
+
var defaultLabel = t$1("neetoRules.form.selectValues");
|
|
2879
|
+
var options = dropDownOptions === null || dropDownOptions === void 0 ? void 0 : dropDownOptions.filter(function (option) {
|
|
2880
|
+
return selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.includes(option.value);
|
|
2881
|
+
});
|
|
2882
|
+
var searchedOptions = getSearchedOptions$2(dropDownOptions, searchTerm);
|
|
2883
|
+
var isValid = errors.conditions && isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0 || (_errors$conditions = _errors$conditions.value) === null || _errors$conditions === void 0 ? void 0 : _errors$conditions[index]) && isNotNil((_touched$conditions = touched.conditions) === null || _touched$conditions === void 0 || (_touched$conditions = _touched$conditions.value) === null || _touched$conditions === void 0 ? void 0 : _touched$conditions[index]);
|
|
2884
|
+
var handleMultiSelectOption = function handleMultiSelectOption(value) {
|
|
2885
|
+
var options = selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.includes(value) ? without([value], selectedOptions) : append(value, selectedOptions);
|
|
2886
|
+
setFieldValue(name, options);
|
|
2887
|
+
};
|
|
2888
|
+
var handleClose = function handleClose() {
|
|
2889
|
+
setActiveOption(null);
|
|
2890
|
+
setSearchTerm("");
|
|
2891
|
+
};
|
|
3127
2892
|
return /*#__PURE__*/React.createElement(Dropdown$1, {
|
|
3128
2893
|
buttonStyle: "secondary",
|
|
3129
2894
|
className: "neeto-ui-bg-gray-100",
|
|
3130
|
-
|
|
3131
|
-
|
|
2895
|
+
closeOnSelect: false,
|
|
2896
|
+
position: "top-start",
|
|
2897
|
+
customTarget: isNotEmpty(options) ? /*#__PURE__*/React.createElement("span", {
|
|
2898
|
+
className: "flex flex-wrap gap-y-1"
|
|
2899
|
+
}, options.map(function (option, idx) {
|
|
2900
|
+
var _option$label;
|
|
2901
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
2902
|
+
key: idx
|
|
2903
|
+
}, !!idx && /*#__PURE__*/React.createElement(Typography, {
|
|
2904
|
+
className: "neeto-ui-text-gray-700 mr-1 mt-1",
|
|
2905
|
+
style: "h5",
|
|
2906
|
+
weight: "normal"
|
|
2907
|
+
}, t$1("neetoRules.common.or")), /*#__PURE__*/React.createElement(Typography, {
|
|
2908
|
+
"data-cy": "condition-value-multi-select-field",
|
|
2909
|
+
style: "h5",
|
|
2910
|
+
weight: "semibold",
|
|
2911
|
+
className: classNames("hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800 mr-1 mt-1 cursor-pointer underline", {
|
|
2912
|
+
"neeto-ui-text-primary-800": activeOption === option.value
|
|
2913
|
+
}),
|
|
2914
|
+
onClick: function onClick() {
|
|
2915
|
+
setTouched(assocPath(["conditions", "value", index], true, touched));
|
|
2916
|
+
setActiveOption(activeOption ? null : option.value);
|
|
2917
|
+
}
|
|
2918
|
+
}, option === null || option === void 0 || (_option$label = option.label) === null || _option$label === void 0 ? void 0 : _option$label.toLowerCase()));
|
|
2919
|
+
})) : /*#__PURE__*/React.createElement(Typography, {
|
|
2920
|
+
"data-cy": "condition-value-multi-select-field",
|
|
3132
2921
|
style: "h5",
|
|
3133
2922
|
weight: "semibold",
|
|
3134
2923
|
className: classNames("hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800 mt-1 cursor-pointer underline", {
|
|
3135
|
-
"neeto-ui-text-primary-800":
|
|
3136
|
-
"neeto-ui-text-error-500":
|
|
2924
|
+
"neeto-ui-text-primary-800": activeOption === defaultLabel,
|
|
2925
|
+
"neeto-ui-text-error-500": isValid
|
|
3137
2926
|
}),
|
|
3138
2927
|
onClick: function onClick() {
|
|
3139
2928
|
setTouched(assocPath(["conditions", "value", index], true, touched));
|
|
3140
|
-
|
|
3141
|
-
return !prevState;
|
|
3142
|
-
});
|
|
2929
|
+
setActiveOption(activeOption ? null : defaultLabel);
|
|
3143
2930
|
}
|
|
3144
|
-
},
|
|
2931
|
+
}, defaultLabel),
|
|
3145
2932
|
onClose: handleClose
|
|
3146
|
-
}, /*#__PURE__*/React.createElement(Menu$
|
|
2933
|
+
}, /*#__PURE__*/React.createElement(Menu$4, {
|
|
3147
2934
|
className: "max-h-60 max-w-2xl p-3"
|
|
3148
|
-
},
|
|
2935
|
+
}, dropDownOptions.length > MAXIMUM_OPTION_LENGTH$2 && /*#__PURE__*/React.createElement(Input$1, {
|
|
3149
2936
|
autoFocus: true,
|
|
3150
2937
|
className: "mb-1",
|
|
3151
2938
|
"data-cy": "search-text-field",
|
|
@@ -3154,286 +2941,501 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
3154
2941
|
value: searchTerm,
|
|
3155
2942
|
onChange: function onChange(e) {
|
|
3156
2943
|
return setSearchTerm(e.target.value);
|
|
3157
|
-
},
|
|
3158
|
-
onClick: function onClick(e) {
|
|
3159
|
-
return e.stopPropagation();
|
|
3160
2944
|
}
|
|
3161
2945
|
}), /*#__PURE__*/React.createElement(OptionsWrapper, {
|
|
3162
|
-
hasScroll:
|
|
2946
|
+
hasScroll: dropDownOptions.length > MAXIMUM_OPTION_LENGTH$2
|
|
3163
2947
|
}, searchedOptions.map(function (option, idx) {
|
|
3164
|
-
return /*#__PURE__*/React.createElement(MenuItem$
|
|
2948
|
+
return /*#__PURE__*/React.createElement(MenuItem$4.Button, {
|
|
3165
2949
|
"data-cy": "".concat(joinHyphenCase(option.label), "-menu-item"),
|
|
3166
2950
|
key: idx,
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
className: "neeto-ui-text-primary-800"
|
|
2951
|
+
prefix: /*#__PURE__*/React.createElement(Checkbox, {
|
|
2952
|
+
checked: selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.includes(option.value),
|
|
2953
|
+
"data-cy": "check-icon",
|
|
2954
|
+
id: option.value
|
|
3172
2955
|
}),
|
|
3173
2956
|
onClick: function onClick() {
|
|
3174
|
-
return
|
|
2957
|
+
return handleMultiSelectOption(option.value);
|
|
3175
2958
|
}
|
|
3176
2959
|
}, option.label);
|
|
3177
|
-
})), isEmpty(
|
|
2960
|
+
})), isEmpty(dropDownOptions) && /*#__PURE__*/React.createElement(MenuItem$4.Button, {
|
|
3178
2961
|
"data-cy": "no-options-menu-item"
|
|
3179
2962
|
}, t$1("neetoRules.common.noOptions"))));
|
|
3180
2963
|
};
|
|
3181
2964
|
|
|
3182
|
-
var
|
|
3183
|
-
|
|
2965
|
+
var _excluded$6 = ["name", "index"];
|
|
2966
|
+
var MultiSelectCreate = function MultiSelectCreate(_ref) {
|
|
2967
|
+
var _conditions$value$ind, _errors$conditions, _touched$conditions;
|
|
3184
2968
|
var name = _ref.name,
|
|
3185
2969
|
index = _ref.index,
|
|
3186
|
-
|
|
2970
|
+
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
3187
2971
|
var _useFormikContext = useFormikContext(),
|
|
3188
2972
|
conditions = _useFormikContext.values.conditions,
|
|
2973
|
+
setFieldValue = _useFormikContext.setFieldValue,
|
|
3189
2974
|
errors = _useFormikContext.errors,
|
|
3190
|
-
touched = _useFormikContext.touched
|
|
2975
|
+
touched = _useFormikContext.touched,
|
|
2976
|
+
setTouched = _useFormikContext.setTouched;
|
|
3191
2977
|
var _useState = useState(false),
|
|
3192
2978
|
_useState2 = _slicedToArray(_useState, 2),
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
var
|
|
3196
|
-
|
|
3197
|
-
return
|
|
2979
|
+
showPane = _useState2[0],
|
|
2980
|
+
setShowPane = _useState2[1];
|
|
2981
|
+
var initialFocusRef = useRef(null);
|
|
2982
|
+
useOnButtonPressed(initialFocusRef, function () {
|
|
2983
|
+
return setShowPane(false);
|
|
3198
2984
|
});
|
|
3199
|
-
var
|
|
3200
|
-
var
|
|
3201
|
-
var
|
|
2985
|
+
var values = (_conditions$value$ind = conditions.value[index]) === null || _conditions$value$ind === void 0 || (_conditions$value$ind = _conditions$value$ind.metadata) === null || _conditions$value$ind === void 0 ? void 0 : _conditions$value$ind.values;
|
|
2986
|
+
var allOptions = getAllOptions(values);
|
|
2987
|
+
var defaultLabel = t$1("neetoRules.form.selectValues");
|
|
3202
2988
|
var isValid = errors.conditions && isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0 || (_errors$conditions = _errors$conditions.value) === null || _errors$conditions === void 0 ? void 0 : _errors$conditions[index]) && isNotNil((_touched$conditions = touched.conditions) === null || _touched$conditions === void 0 || (_touched$conditions = _touched$conditions.value) === null || _touched$conditions === void 0 ? void 0 : _touched$conditions[index]);
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
}, [condition.verb]);
|
|
3206
|
-
return showInput ? /*#__PURE__*/React.createElement(Input$2, {
|
|
3207
|
-
name: name,
|
|
3208
|
-
placeholder: placeholder,
|
|
3209
|
-
ref: inputRef,
|
|
3210
|
-
size: "small",
|
|
3211
|
-
suffix: /*#__PURE__*/React.createElement(Check, {
|
|
3212
|
-
className: "cursor-pointer",
|
|
3213
|
-
onClick: function onClick() {
|
|
3214
|
-
return setShowInput(function (prevState) {
|
|
3215
|
-
return !prevState;
|
|
3216
|
-
});
|
|
3217
|
-
}
|
|
3218
|
-
})
|
|
3219
|
-
}) : /*#__PURE__*/React.createElement(Typography, {
|
|
2989
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, isEmpty(allOptions) && /*#__PURE__*/React.createElement(Typography, {
|
|
2990
|
+
"data-cy": "condition-value-multi-select-create-button",
|
|
3220
2991
|
style: "h5",
|
|
3221
2992
|
weight: "semibold",
|
|
3222
|
-
className: classNames("neeto-ui-text-
|
|
2993
|
+
className: classNames("hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800 mt-1 cursor-pointer underline", {
|
|
3223
2994
|
"neeto-ui-text-error-500": isValid
|
|
3224
2995
|
}),
|
|
3225
2996
|
onClick: function onClick() {
|
|
3226
|
-
|
|
2997
|
+
setTouched(assocPath(["conditions", "value", index], true, touched));
|
|
2998
|
+
setShowPane(function (prevState) {
|
|
3227
2999
|
return !prevState;
|
|
3228
3000
|
});
|
|
3229
3001
|
}
|
|
3230
|
-
},
|
|
3002
|
+
}, defaultLabel), allOptions.map(function (option, idx) {
|
|
3003
|
+
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
3004
|
+
key: idx
|
|
3005
|
+
}, !!idx && /*#__PURE__*/React.createElement(Typography, {
|
|
3006
|
+
className: "neeto-ui-text-gray-700 mt-1",
|
|
3007
|
+
style: "h5",
|
|
3008
|
+
weight: "normal"
|
|
3009
|
+
}, t$1("neetoRules.common.or")), /*#__PURE__*/React.createElement(Typography, {
|
|
3010
|
+
className: "hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800 mt-1 cursor-pointer underline",
|
|
3011
|
+
"data-cy": "condition-value-multi-select-create-button",
|
|
3012
|
+
style: "h5",
|
|
3013
|
+
weight: "semibold",
|
|
3014
|
+
onClick: function onClick() {
|
|
3015
|
+
return setShowPane(function (prevState) {
|
|
3016
|
+
return !prevState;
|
|
3017
|
+
});
|
|
3018
|
+
}
|
|
3019
|
+
}, option.label));
|
|
3020
|
+
}), /*#__PURE__*/React.createElement(Pane, {
|
|
3021
|
+
initialFocusRef: initialFocusRef,
|
|
3022
|
+
isOpen: showPane,
|
|
3023
|
+
size: "large",
|
|
3024
|
+
onClose: function onClose() {
|
|
3025
|
+
return setShowPane(false);
|
|
3026
|
+
}
|
|
3027
|
+
}, /*#__PURE__*/React.createElement(Pane.Header, null, /*#__PURE__*/React.createElement(Typography, {
|
|
3028
|
+
className: "neeto-ui-text-gray-700",
|
|
3029
|
+
"data-cy": "multi-select-create-pane-header-title",
|
|
3030
|
+
style: "h3"
|
|
3031
|
+
}, t$1("neetoRules.labels.multipleValues"))), /*#__PURE__*/React.createElement(Pane.Body, null, /*#__PURE__*/React.createElement(Select, _extends({
|
|
3032
|
+
isMulti: true,
|
|
3033
|
+
className: "mt-4 w-full",
|
|
3034
|
+
"data-cy": "multi-select-create-container",
|
|
3035
|
+
defaultValue: allOptions,
|
|
3036
|
+
innerRef: initialFocusRef,
|
|
3037
|
+
label: t$1("neetoRules.labels.selectValues"),
|
|
3038
|
+
onChange: function onChange(options) {
|
|
3039
|
+
return setFieldValue(name, options.map(function (option) {
|
|
3040
|
+
return option.value;
|
|
3041
|
+
}));
|
|
3042
|
+
}
|
|
3043
|
+
}, props))), /*#__PURE__*/React.createElement(Pane.Footer, {
|
|
3044
|
+
className: "flex items-center space-x-2"
|
|
3045
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
3046
|
+
"data-cy": "save-changes-button",
|
|
3047
|
+
label: t$1("neetoRules.common.saveChange"),
|
|
3048
|
+
onClick: function onClick() {
|
|
3049
|
+
return setShowPane(false);
|
|
3050
|
+
}
|
|
3051
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
3052
|
+
label: t$1("neetoRules.buttons.cancel"),
|
|
3053
|
+
style: "text",
|
|
3054
|
+
onClick: function onClick() {
|
|
3055
|
+
return setShowPane(false);
|
|
3056
|
+
}
|
|
3057
|
+
}))));
|
|
3231
3058
|
};
|
|
3232
3059
|
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
var
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
}
|
|
3060
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
3061
|
+
try {
|
|
3062
|
+
var info = gen[key](arg);
|
|
3063
|
+
var value = info.value;
|
|
3064
|
+
} catch (error) {
|
|
3065
|
+
reject(error);
|
|
3066
|
+
return;
|
|
3067
|
+
}
|
|
3068
|
+
if (info.done) {
|
|
3069
|
+
resolve(value);
|
|
3070
|
+
} else {
|
|
3071
|
+
Promise.resolve(value).then(_next, _throw);
|
|
3072
|
+
}
|
|
3073
|
+
}
|
|
3074
|
+
function _asyncToGenerator(fn) {
|
|
3075
|
+
return function () {
|
|
3076
|
+
var self = this,
|
|
3077
|
+
args = arguments;
|
|
3078
|
+
return new Promise(function (resolve, reject) {
|
|
3079
|
+
var gen = fn.apply(self, args);
|
|
3080
|
+
function _next(value) {
|
|
3081
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
3082
|
+
}
|
|
3083
|
+
function _throw(err) {
|
|
3084
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
3085
|
+
}
|
|
3086
|
+
_next(undefined);
|
|
3087
|
+
});
|
|
3088
|
+
};
|
|
3089
|
+
}
|
|
3090
|
+
|
|
3091
|
+
var regeneratorRuntime$1 = {exports: {}};
|
|
3092
|
+
|
|
3093
|
+
var _typeof = {exports: {}};
|
|
3094
|
+
|
|
3095
|
+
_typeof.exports;
|
|
3096
|
+
|
|
3097
|
+
(function (module) {
|
|
3098
|
+
function _typeof(obj) {
|
|
3099
|
+
"@babel/helpers - typeof";
|
|
3100
|
+
|
|
3101
|
+
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
3102
|
+
return typeof obj;
|
|
3103
|
+
} : function (obj) {
|
|
3104
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
3105
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
|
|
3106
|
+
}
|
|
3107
|
+
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3108
|
+
} (_typeof));
|
|
3109
|
+
|
|
3110
|
+
var _typeofExports = _typeof.exports;
|
|
3111
|
+
|
|
3112
|
+
regeneratorRuntime$1.exports;
|
|
3113
|
+
|
|
3114
|
+
(function (module) {
|
|
3115
|
+
var _typeof = _typeofExports["default"];
|
|
3116
|
+
function _regeneratorRuntime() {
|
|
3117
|
+
module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
3118
|
+
return exports;
|
|
3119
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3120
|
+
var exports = {},
|
|
3121
|
+
Op = Object.prototype,
|
|
3122
|
+
hasOwn = Op.hasOwnProperty,
|
|
3123
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
3124
|
+
obj[key] = desc.value;
|
|
3125
|
+
},
|
|
3126
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
3127
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
3128
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
3129
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
3130
|
+
function define(obj, key, value) {
|
|
3131
|
+
return Object.defineProperty(obj, key, {
|
|
3132
|
+
value: value,
|
|
3133
|
+
enumerable: !0,
|
|
3134
|
+
configurable: !0,
|
|
3135
|
+
writable: !0
|
|
3136
|
+
}), obj[key];
|
|
3137
|
+
}
|
|
3138
|
+
try {
|
|
3139
|
+
define({}, "");
|
|
3140
|
+
} catch (err) {
|
|
3141
|
+
define = function define(obj, key, value) {
|
|
3142
|
+
return obj[key] = value;
|
|
3143
|
+
};
|
|
3144
|
+
}
|
|
3145
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
3146
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
3147
|
+
generator = Object.create(protoGenerator.prototype),
|
|
3148
|
+
context = new Context(tryLocsList || []);
|
|
3149
|
+
return defineProperty(generator, "_invoke", {
|
|
3150
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
3151
|
+
}), generator;
|
|
3152
|
+
}
|
|
3153
|
+
function tryCatch(fn, obj, arg) {
|
|
3154
|
+
try {
|
|
3155
|
+
return {
|
|
3156
|
+
type: "normal",
|
|
3157
|
+
arg: fn.call(obj, arg)
|
|
3158
|
+
};
|
|
3159
|
+
} catch (err) {
|
|
3160
|
+
return {
|
|
3161
|
+
type: "throw",
|
|
3162
|
+
arg: err
|
|
3163
|
+
};
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
exports.wrap = wrap;
|
|
3167
|
+
var ContinueSentinel = {};
|
|
3168
|
+
function Generator() {}
|
|
3169
|
+
function GeneratorFunction() {}
|
|
3170
|
+
function GeneratorFunctionPrototype() {}
|
|
3171
|
+
var IteratorPrototype = {};
|
|
3172
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
3173
|
+
return this;
|
|
3174
|
+
});
|
|
3175
|
+
var getProto = Object.getPrototypeOf,
|
|
3176
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
3177
|
+
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
3178
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
3179
|
+
function defineIteratorMethods(prototype) {
|
|
3180
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
3181
|
+
define(prototype, method, function (arg) {
|
|
3182
|
+
return this._invoke(method, arg);
|
|
3183
|
+
});
|
|
3184
|
+
});
|
|
3185
|
+
}
|
|
3186
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
3187
|
+
function invoke(method, arg, resolve, reject) {
|
|
3188
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
3189
|
+
if ("throw" !== record.type) {
|
|
3190
|
+
var result = record.arg,
|
|
3191
|
+
value = result.value;
|
|
3192
|
+
return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
3193
|
+
invoke("next", value, resolve, reject);
|
|
3194
|
+
}, function (err) {
|
|
3195
|
+
invoke("throw", err, resolve, reject);
|
|
3196
|
+
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
3197
|
+
result.value = unwrapped, resolve(result);
|
|
3198
|
+
}, function (error) {
|
|
3199
|
+
return invoke("throw", error, resolve, reject);
|
|
3200
|
+
});
|
|
3201
|
+
}
|
|
3202
|
+
reject(record.arg);
|
|
3203
|
+
}
|
|
3204
|
+
var previousPromise;
|
|
3205
|
+
defineProperty(this, "_invoke", {
|
|
3206
|
+
value: function value(method, arg) {
|
|
3207
|
+
function callInvokeWithMethodAndArg() {
|
|
3208
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
3209
|
+
invoke(method, arg, resolve, reject);
|
|
3210
|
+
});
|
|
3211
|
+
}
|
|
3212
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
3213
|
+
}
|
|
3214
|
+
});
|
|
3215
|
+
}
|
|
3216
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
3217
|
+
var state = "suspendedStart";
|
|
3218
|
+
return function (method, arg) {
|
|
3219
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
3220
|
+
if ("completed" === state) {
|
|
3221
|
+
if ("throw" === method) throw arg;
|
|
3222
|
+
return doneResult();
|
|
3223
|
+
}
|
|
3224
|
+
for (context.method = method, context.arg = arg;;) {
|
|
3225
|
+
var delegate = context.delegate;
|
|
3226
|
+
if (delegate) {
|
|
3227
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
3228
|
+
if (delegateResult) {
|
|
3229
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
3230
|
+
return delegateResult;
|
|
3231
|
+
}
|
|
3232
|
+
}
|
|
3233
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
3234
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
3235
|
+
context.dispatchException(context.arg);
|
|
3236
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
3237
|
+
state = "executing";
|
|
3238
|
+
var record = tryCatch(innerFn, self, context);
|
|
3239
|
+
if ("normal" === record.type) {
|
|
3240
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
3241
|
+
return {
|
|
3242
|
+
value: record.arg,
|
|
3243
|
+
done: context.done
|
|
3244
|
+
};
|
|
3245
|
+
}
|
|
3246
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
3247
|
+
}
|
|
3248
|
+
};
|
|
3249
|
+
}
|
|
3250
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
3251
|
+
var methodName = context.method,
|
|
3252
|
+
method = delegate.iterator[methodName];
|
|
3253
|
+
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
|
|
3254
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
3255
|
+
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
3256
|
+
var info = record.arg;
|
|
3257
|
+
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
3258
|
+
}
|
|
3259
|
+
function pushTryEntry(locs) {
|
|
3260
|
+
var entry = {
|
|
3261
|
+
tryLoc: locs[0]
|
|
3262
|
+
};
|
|
3263
|
+
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
3264
|
+
}
|
|
3265
|
+
function resetTryEntry(entry) {
|
|
3266
|
+
var record = entry.completion || {};
|
|
3267
|
+
record.type = "normal", delete record.arg, entry.completion = record;
|
|
3268
|
+
}
|
|
3269
|
+
function Context(tryLocsList) {
|
|
3270
|
+
this.tryEntries = [{
|
|
3271
|
+
tryLoc: "root"
|
|
3272
|
+
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
3273
|
+
}
|
|
3274
|
+
function values(iterable) {
|
|
3275
|
+
if (iterable) {
|
|
3276
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
3277
|
+
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
3278
|
+
if ("function" == typeof iterable.next) return iterable;
|
|
3279
|
+
if (!isNaN(iterable.length)) {
|
|
3280
|
+
var i = -1,
|
|
3281
|
+
next = function next() {
|
|
3282
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
3283
|
+
return next.value = undefined, next.done = !0, next;
|
|
3284
|
+
};
|
|
3285
|
+
return next.next = next;
|
|
3286
|
+
}
|
|
3287
|
+
}
|
|
3288
|
+
return {
|
|
3289
|
+
next: doneResult
|
|
3290
|
+
};
|
|
3291
|
+
}
|
|
3292
|
+
function doneResult() {
|
|
3293
|
+
return {
|
|
3294
|
+
value: undefined,
|
|
3295
|
+
done: !0
|
|
3296
|
+
};
|
|
3297
|
+
}
|
|
3298
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
3299
|
+
value: GeneratorFunctionPrototype,
|
|
3300
|
+
configurable: !0
|
|
3301
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
3302
|
+
value: GeneratorFunction,
|
|
3303
|
+
configurable: !0
|
|
3304
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
3305
|
+
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
3306
|
+
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
3307
|
+
}, exports.mark = function (genFun) {
|
|
3308
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
3309
|
+
}, exports.awrap = function (arg) {
|
|
3310
|
+
return {
|
|
3311
|
+
__await: arg
|
|
3312
|
+
};
|
|
3313
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
3314
|
+
return this;
|
|
3315
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
3316
|
+
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
3317
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
3318
|
+
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
3319
|
+
return result.done ? result.value : iter.next();
|
|
3320
|
+
});
|
|
3321
|
+
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
3322
|
+
return this;
|
|
3323
|
+
}), define(Gp, "toString", function () {
|
|
3324
|
+
return "[object Generator]";
|
|
3325
|
+
}), exports.keys = function (val) {
|
|
3326
|
+
var object = Object(val),
|
|
3327
|
+
keys = [];
|
|
3328
|
+
for (var key in object) keys.push(key);
|
|
3329
|
+
return keys.reverse(), function next() {
|
|
3330
|
+
for (; keys.length;) {
|
|
3331
|
+
var key = keys.pop();
|
|
3332
|
+
if (key in object) return next.value = key, next.done = !1, next;
|
|
3333
|
+
}
|
|
3334
|
+
return next.done = !0, next;
|
|
3335
|
+
};
|
|
3336
|
+
}, exports.values = values, Context.prototype = {
|
|
3337
|
+
constructor: Context,
|
|
3338
|
+
reset: function reset(skipTempReset) {
|
|
3339
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
3340
|
+
},
|
|
3341
|
+
stop: function stop() {
|
|
3342
|
+
this.done = !0;
|
|
3343
|
+
var rootRecord = this.tryEntries[0].completion;
|
|
3344
|
+
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
3345
|
+
return this.rval;
|
|
3346
|
+
},
|
|
3347
|
+
dispatchException: function dispatchException(exception) {
|
|
3348
|
+
if (this.done) throw exception;
|
|
3349
|
+
var context = this;
|
|
3350
|
+
function handle(loc, caught) {
|
|
3351
|
+
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
3352
|
+
}
|
|
3353
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
3354
|
+
var entry = this.tryEntries[i],
|
|
3355
|
+
record = entry.completion;
|
|
3356
|
+
if ("root" === entry.tryLoc) return handle("end");
|
|
3357
|
+
if (entry.tryLoc <= this.prev) {
|
|
3358
|
+
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
3359
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
3360
|
+
if (hasCatch && hasFinally) {
|
|
3361
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
3362
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
3363
|
+
} else if (hasCatch) {
|
|
3364
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
3365
|
+
} else {
|
|
3366
|
+
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
3367
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
3368
|
+
}
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3371
|
+
},
|
|
3372
|
+
abrupt: function abrupt(type, arg) {
|
|
3373
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
3374
|
+
var entry = this.tryEntries[i];
|
|
3375
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
3376
|
+
var finallyEntry = entry;
|
|
3377
|
+
break;
|
|
3378
|
+
}
|
|
3379
|
+
}
|
|
3380
|
+
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
3381
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
3382
|
+
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
3383
|
+
},
|
|
3384
|
+
complete: function complete(record, afterLoc) {
|
|
3385
|
+
if ("throw" === record.type) throw record.arg;
|
|
3386
|
+
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
3387
|
+
},
|
|
3388
|
+
finish: function finish(finallyLoc) {
|
|
3389
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
3390
|
+
var entry = this.tryEntries[i];
|
|
3391
|
+
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
3392
|
+
}
|
|
3393
|
+
},
|
|
3394
|
+
"catch": function _catch(tryLoc) {
|
|
3395
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
3396
|
+
var entry = this.tryEntries[i];
|
|
3397
|
+
if (entry.tryLoc === tryLoc) {
|
|
3398
|
+
var record = entry.completion;
|
|
3399
|
+
if ("throw" === record.type) {
|
|
3400
|
+
var thrown = record.arg;
|
|
3401
|
+
resetTryEntry(entry);
|
|
3402
|
+
}
|
|
3403
|
+
return thrown;
|
|
3404
|
+
}
|
|
3405
|
+
}
|
|
3406
|
+
throw new Error("illegal catch attempt");
|
|
3407
|
+
},
|
|
3408
|
+
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
3409
|
+
return this.delegate = {
|
|
3410
|
+
iterator: values(iterable),
|
|
3411
|
+
resultName: resultName,
|
|
3412
|
+
nextLoc: nextLoc
|
|
3413
|
+
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
3414
|
+
}
|
|
3415
|
+
}, exports;
|
|
3416
|
+
}
|
|
3417
|
+
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
3418
|
+
} (regeneratorRuntime$1));
|
|
3419
|
+
|
|
3420
|
+
var regeneratorRuntimeExports = regeneratorRuntime$1.exports;
|
|
3342
3421
|
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
useOnButtonPressed(initialFocusRef, function () {
|
|
3361
|
-
return setShowPane(false);
|
|
3362
|
-
});
|
|
3363
|
-
var values = (_conditions$value$ind = conditions.value[index]) === null || _conditions$value$ind === void 0 || (_conditions$value$ind = _conditions$value$ind.metadata) === null || _conditions$value$ind === void 0 ? void 0 : _conditions$value$ind.values;
|
|
3364
|
-
var allOptions = getAllOptions(values);
|
|
3365
|
-
var defaultLabel = t$1("neetoRules.form.selectValues");
|
|
3366
|
-
var isValid = errors.conditions && isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0 || (_errors$conditions = _errors$conditions.value) === null || _errors$conditions === void 0 ? void 0 : _errors$conditions[index]) && isNotNil((_touched$conditions = touched.conditions) === null || _touched$conditions === void 0 || (_touched$conditions = _touched$conditions.value) === null || _touched$conditions === void 0 ? void 0 : _touched$conditions[index]);
|
|
3367
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, isEmpty(allOptions) && /*#__PURE__*/React.createElement(Typography, {
|
|
3368
|
-
"data-cy": "condition-value-multi-select-create-button",
|
|
3369
|
-
style: "h5",
|
|
3370
|
-
weight: "semibold",
|
|
3371
|
-
className: classNames("hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800 mt-1 cursor-pointer underline", {
|
|
3372
|
-
"neeto-ui-text-error-500": isValid
|
|
3373
|
-
}),
|
|
3374
|
-
onClick: function onClick() {
|
|
3375
|
-
setTouched(assocPath(["conditions", "value", index], true, touched));
|
|
3376
|
-
setShowPane(function (prevState) {
|
|
3377
|
-
return !prevState;
|
|
3378
|
-
});
|
|
3379
|
-
}
|
|
3380
|
-
}, defaultLabel), allOptions.map(function (option, idx) {
|
|
3381
|
-
return /*#__PURE__*/React.createElement(React.Fragment, {
|
|
3382
|
-
key: idx
|
|
3383
|
-
}, !!idx && /*#__PURE__*/React.createElement(Typography, {
|
|
3384
|
-
className: "neeto-ui-text-gray-700 mt-1",
|
|
3385
|
-
style: "h5",
|
|
3386
|
-
weight: "normal"
|
|
3387
|
-
}, t$1("neetoRules.common.or")), /*#__PURE__*/React.createElement(Typography, {
|
|
3388
|
-
className: "hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800 mt-1 cursor-pointer underline",
|
|
3389
|
-
"data-cy": "condition-value-multi-select-create-button",
|
|
3390
|
-
style: "h5",
|
|
3391
|
-
weight: "semibold",
|
|
3392
|
-
onClick: function onClick() {
|
|
3393
|
-
return setShowPane(function (prevState) {
|
|
3394
|
-
return !prevState;
|
|
3395
|
-
});
|
|
3396
|
-
}
|
|
3397
|
-
}, option.label));
|
|
3398
|
-
}), /*#__PURE__*/React.createElement(Pane, {
|
|
3399
|
-
initialFocusRef: initialFocusRef,
|
|
3400
|
-
isOpen: showPane,
|
|
3401
|
-
size: "large",
|
|
3402
|
-
onClose: function onClose() {
|
|
3403
|
-
return setShowPane(false);
|
|
3404
|
-
}
|
|
3405
|
-
}, /*#__PURE__*/React.createElement(Pane.Header, null, /*#__PURE__*/React.createElement(Typography, {
|
|
3406
|
-
className: "neeto-ui-text-gray-700",
|
|
3407
|
-
"data-cy": "multi-select-create-pane-header-title",
|
|
3408
|
-
style: "h3"
|
|
3409
|
-
}, t$1("neetoRules.labels.multipleValues"))), /*#__PURE__*/React.createElement(Pane.Body, null, /*#__PURE__*/React.createElement(Select, _extends({
|
|
3410
|
-
isMulti: true,
|
|
3411
|
-
className: "mt-4 w-full",
|
|
3412
|
-
"data-cy": "multi-select-create-container",
|
|
3413
|
-
defaultValue: allOptions,
|
|
3414
|
-
innerRef: initialFocusRef,
|
|
3415
|
-
label: t$1("neetoRules.labels.selectValues"),
|
|
3416
|
-
onChange: function onChange(options) {
|
|
3417
|
-
return setFieldValue(name, options.map(function (option) {
|
|
3418
|
-
return option.value;
|
|
3419
|
-
}));
|
|
3420
|
-
}
|
|
3421
|
-
}, props))), /*#__PURE__*/React.createElement(Pane.Footer, {
|
|
3422
|
-
className: "flex items-center space-x-2"
|
|
3423
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
|
3424
|
-
"data-cy": "save-changes-button",
|
|
3425
|
-
label: t$1("neetoRules.common.saveChange"),
|
|
3426
|
-
onClick: function onClick() {
|
|
3427
|
-
return setShowPane(false);
|
|
3428
|
-
}
|
|
3429
|
-
}), /*#__PURE__*/React.createElement(Button, {
|
|
3430
|
-
label: t$1("neetoRules.buttons.cancel"),
|
|
3431
|
-
style: "text",
|
|
3432
|
-
onClick: function onClick() {
|
|
3433
|
-
return setShowPane(false);
|
|
3434
|
-
}
|
|
3435
|
-
}))));
|
|
3436
|
-
};
|
|
3422
|
+
// TODO(Babel 8): Remove this file.
|
|
3423
|
+
|
|
3424
|
+
var runtime = regeneratorRuntimeExports();
|
|
3425
|
+
var regenerator = runtime;
|
|
3426
|
+
|
|
3427
|
+
// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
|
|
3428
|
+
try {
|
|
3429
|
+
regeneratorRuntime = runtime;
|
|
3430
|
+
} catch (accidentalStrictMode) {
|
|
3431
|
+
if (typeof globalThis === "object") {
|
|
3432
|
+
globalThis.regeneratorRuntime = runtime;
|
|
3433
|
+
} else {
|
|
3434
|
+
Function("r", "regeneratorRuntime = r")(runtime);
|
|
3435
|
+
}
|
|
3436
|
+
}
|
|
3437
|
+
|
|
3438
|
+
var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regenerator);
|
|
3437
3439
|
|
|
3438
3440
|
var DateField = function DateField(_ref) {
|
|
3439
3441
|
var _conditions$value$ind, _errors$conditions, _touched$conditions;
|
|
@@ -4679,5 +4681,5 @@ NeetoRules.Card = Card;
|
|
|
4679
4681
|
NeetoRules.MultiSelectField = MultiSelectField;
|
|
4680
4682
|
NeetoRules.EventConditions = EventConditions;
|
|
4681
4683
|
|
|
4682
|
-
export { NeetoRules as NeetoRulesForm, RulePreview, NeetoRules$1 as default };
|
|
4684
|
+
export { NeetoRules as NeetoRulesForm, RulePreview, NeetoRules$1 as default, useCustomDataStore };
|
|
4683
4685
|
//# sourceMappingURL=index.js.map
|