@bigbinary/neeto-rules-frontend 0.3.4 → 0.3.6
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 +12 -458
- package/dist/index.cjs.js +706 -2817
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +686 -2796
- package/dist/index.js.map +1 -1
- package/package.json +140 -113
- package/types.d.ts +3 -0
- package/dist/main.css +0 -2
- package/dist/main.css.map +0 -1
- /package/{src → app/javascript/src}/translations/en.json +0 -0
- /package/{src → app/javascript/src}/translations/fr.json +0 -0
- /package/{src → app/javascript/src}/translations/index.js +0 -0
package/dist/index.cjs.js
CHANGED
|
@@ -1,2303 +1,62 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6
|
-
|
|
7
|
-
var React = require('react');
|
|
8
|
-
var classNames = require('classnames');
|
|
9
|
-
var formik = require('formik');
|
|
10
|
-
var neetoCist = require('@bigbinary/neeto-cist');
|
|
11
|
-
var formik$1 = require('@bigbinary/neetoui/formik');
|
|
12
|
-
var i18next = require('i18next');
|
|
13
|
-
var neetoEditor = require('@bigbinary/neeto-editor');
|
|
14
|
-
var yup = require('yup');
|
|
15
|
-
var PageLoader = require('@bigbinary/neeto-molecules/PageLoader');
|
|
16
|
-
var neetoui = require('@bigbinary/neetoui');
|
|
17
|
-
var reactI18next = require('react-i18next');
|
|
18
|
-
var neetoIcons = require('@bigbinary/neeto-icons');
|
|
19
|
-
var ramda = require('ramda');
|
|
20
|
-
var utils = require('@bigbinary/neeto-commons-frontend/utils');
|
|
21
|
-
var dayjs = require('dayjs');
|
|
22
|
-
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
23
|
-
|
|
24
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
25
|
-
|
|
26
|
-
function _interopNamespace(e) {
|
|
27
|
-
if (e && e.__esModule) return e;
|
|
28
|
-
var n = Object.create(null);
|
|
29
|
-
if (e) {
|
|
30
|
-
Object.keys(e).forEach(function (k) {
|
|
31
|
-
if (k !== 'default') {
|
|
32
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
33
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
get: function () { return e[k]; }
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
n["default"] = e;
|
|
41
|
-
return Object.freeze(n);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
45
|
-
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
46
|
-
var yup__namespace = /*#__PURE__*/_interopNamespace(yup);
|
|
47
|
-
var PageLoader__default = /*#__PURE__*/_interopDefaultLegacy(PageLoader);
|
|
48
|
-
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
|
|
49
|
-
|
|
50
|
-
function _objectDestructuringEmpty(obj) {
|
|
51
|
-
if (obj == null) throw new TypeError("Cannot destructure " + obj);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function _setPrototypeOf$1(o, p) {
|
|
55
|
-
_setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
56
|
-
o.__proto__ = p;
|
|
57
|
-
return o;
|
|
58
|
-
};
|
|
59
|
-
return _setPrototypeOf$1(o, p);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function _inheritsLoose$1(subClass, superClass) {
|
|
63
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
64
|
-
subClass.prototype.constructor = subClass;
|
|
65
|
-
_setPrototypeOf$1(subClass, superClass);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
var propTypes = {exports: {}};
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
72
|
-
*
|
|
73
|
-
* This source code is licensed under the MIT license found in the
|
|
74
|
-
* LICENSE file in the root directory of this source tree.
|
|
75
|
-
*/
|
|
76
|
-
var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
77
|
-
var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
81
|
-
*
|
|
82
|
-
* This source code is licensed under the MIT license found in the
|
|
83
|
-
* LICENSE file in the root directory of this source tree.
|
|
84
|
-
*/
|
|
85
|
-
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
86
|
-
function emptyFunction() {}
|
|
87
|
-
function emptyFunctionWithReset() {}
|
|
88
|
-
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
89
|
-
var factoryWithThrowingShims = function factoryWithThrowingShims() {
|
|
90
|
-
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
91
|
-
if (secret === ReactPropTypesSecret) {
|
|
92
|
-
// It is still safe when called from React.
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
var err = new Error('Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
|
|
96
|
-
err.name = 'Invariant Violation';
|
|
97
|
-
throw err;
|
|
98
|
-
}
|
|
99
|
-
shim.isRequired = shim;
|
|
100
|
-
function getShim() {
|
|
101
|
-
return shim;
|
|
102
|
-
}
|
|
103
|
-
// Important!
|
|
104
|
-
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
105
|
-
var ReactPropTypes = {
|
|
106
|
-
array: shim,
|
|
107
|
-
bigint: shim,
|
|
108
|
-
bool: shim,
|
|
109
|
-
func: shim,
|
|
110
|
-
number: shim,
|
|
111
|
-
object: shim,
|
|
112
|
-
string: shim,
|
|
113
|
-
symbol: shim,
|
|
114
|
-
any: shim,
|
|
115
|
-
arrayOf: getShim,
|
|
116
|
-
element: shim,
|
|
117
|
-
elementType: shim,
|
|
118
|
-
instanceOf: getShim,
|
|
119
|
-
node: shim,
|
|
120
|
-
objectOf: getShim,
|
|
121
|
-
oneOf: getShim,
|
|
122
|
-
oneOfType: getShim,
|
|
123
|
-
shape: getShim,
|
|
124
|
-
exact: getShim,
|
|
125
|
-
checkPropTypes: emptyFunctionWithReset,
|
|
126
|
-
resetWarningCache: emptyFunction
|
|
127
|
-
};
|
|
128
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
129
|
-
return ReactPropTypes;
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
134
|
-
*
|
|
135
|
-
* This source code is licensed under the MIT license found in the
|
|
136
|
-
* LICENSE file in the root directory of this source tree.
|
|
137
|
-
*/
|
|
138
|
-
{
|
|
139
|
-
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
140
|
-
// http://fb.me/prop-types-in-prod
|
|
141
|
-
propTypes.exports = factoryWithThrowingShims();
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function _extends$1() {
|
|
145
|
-
_extends$1 = Object.assign || function (target) {
|
|
146
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
147
|
-
var source = arguments[i];
|
|
148
|
-
for (var key in source) {
|
|
149
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
150
|
-
target[key] = source[key];
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
return target;
|
|
155
|
-
};
|
|
156
|
-
return _extends$1.apply(this, arguments);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function isAbsolute(pathname) {
|
|
160
|
-
return pathname.charAt(0) === '/';
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// About 1.5x faster than the two-arg version of Array#splice()
|
|
164
|
-
function spliceOne(list, index) {
|
|
165
|
-
for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {
|
|
166
|
-
list[i] = list[k];
|
|
167
|
-
}
|
|
168
|
-
list.pop();
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// This implementation is based heavily on node's url.parse
|
|
172
|
-
function resolvePathname(to, from) {
|
|
173
|
-
if (from === undefined) from = '';
|
|
174
|
-
var toParts = to && to.split('/') || [];
|
|
175
|
-
var fromParts = from && from.split('/') || [];
|
|
176
|
-
var isToAbs = to && isAbsolute(to);
|
|
177
|
-
var isFromAbs = from && isAbsolute(from);
|
|
178
|
-
var mustEndAbs = isToAbs || isFromAbs;
|
|
179
|
-
if (to && isAbsolute(to)) {
|
|
180
|
-
// to is absolute
|
|
181
|
-
fromParts = toParts;
|
|
182
|
-
} else if (toParts.length) {
|
|
183
|
-
// to is relative, drop the filename
|
|
184
|
-
fromParts.pop();
|
|
185
|
-
fromParts = fromParts.concat(toParts);
|
|
186
|
-
}
|
|
187
|
-
if (!fromParts.length) return '/';
|
|
188
|
-
var hasTrailingSlash;
|
|
189
|
-
if (fromParts.length) {
|
|
190
|
-
var last = fromParts[fromParts.length - 1];
|
|
191
|
-
hasTrailingSlash = last === '.' || last === '..' || last === '';
|
|
192
|
-
} else {
|
|
193
|
-
hasTrailingSlash = false;
|
|
194
|
-
}
|
|
195
|
-
var up = 0;
|
|
196
|
-
for (var i = fromParts.length; i >= 0; i--) {
|
|
197
|
-
var part = fromParts[i];
|
|
198
|
-
if (part === '.') {
|
|
199
|
-
spliceOne(fromParts, i);
|
|
200
|
-
} else if (part === '..') {
|
|
201
|
-
spliceOne(fromParts, i);
|
|
202
|
-
up++;
|
|
203
|
-
} else if (up) {
|
|
204
|
-
spliceOne(fromParts, i);
|
|
205
|
-
up--;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
if (!mustEndAbs) for (; up--; up) {
|
|
209
|
-
fromParts.unshift('..');
|
|
210
|
-
}
|
|
211
|
-
if (mustEndAbs && fromParts[0] !== '' && (!fromParts[0] || !isAbsolute(fromParts[0]))) fromParts.unshift('');
|
|
212
|
-
var result = fromParts.join('/');
|
|
213
|
-
if (hasTrailingSlash && result.substr(-1) !== '/') result += '/';
|
|
214
|
-
return result;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
function _typeof$1(obj) {
|
|
218
|
-
"@babel/helpers - typeof";
|
|
219
|
-
|
|
220
|
-
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
221
|
-
return typeof obj;
|
|
222
|
-
} : function (obj) {
|
|
223
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
224
|
-
}, _typeof$1(obj);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
var prefix = 'Invariant failed';
|
|
228
|
-
function invariant(condition, message) {
|
|
229
|
-
if (condition) {
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
{
|
|
233
|
-
throw new Error(prefix);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
function addLeadingSlash$1(path) {
|
|
238
|
-
return path.charAt(0) === '/' ? path : '/' + path;
|
|
239
|
-
}
|
|
240
|
-
function stripLeadingSlash(path) {
|
|
241
|
-
return path.charAt(0) === '/' ? path.substr(1) : path;
|
|
242
|
-
}
|
|
243
|
-
function hasBasename(path, prefix) {
|
|
244
|
-
return path.toLowerCase().indexOf(prefix.toLowerCase()) === 0 && '/?#'.indexOf(path.charAt(prefix.length)) !== -1;
|
|
245
|
-
}
|
|
246
|
-
function stripBasename$1(path, prefix) {
|
|
247
|
-
return hasBasename(path, prefix) ? path.substr(prefix.length) : path;
|
|
248
|
-
}
|
|
249
|
-
function stripTrailingSlash(path) {
|
|
250
|
-
return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path;
|
|
251
|
-
}
|
|
252
|
-
function parsePath(path) {
|
|
253
|
-
var pathname = path || '/';
|
|
254
|
-
var search = '';
|
|
255
|
-
var hash = '';
|
|
256
|
-
var hashIndex = pathname.indexOf('#');
|
|
257
|
-
if (hashIndex !== -1) {
|
|
258
|
-
hash = pathname.substr(hashIndex);
|
|
259
|
-
pathname = pathname.substr(0, hashIndex);
|
|
260
|
-
}
|
|
261
|
-
var searchIndex = pathname.indexOf('?');
|
|
262
|
-
if (searchIndex !== -1) {
|
|
263
|
-
search = pathname.substr(searchIndex);
|
|
264
|
-
pathname = pathname.substr(0, searchIndex);
|
|
265
|
-
}
|
|
266
|
-
return {
|
|
267
|
-
pathname: pathname,
|
|
268
|
-
search: search === '?' ? '' : search,
|
|
269
|
-
hash: hash === '#' ? '' : hash
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
function createPath(location) {
|
|
273
|
-
var pathname = location.pathname,
|
|
274
|
-
search = location.search,
|
|
275
|
-
hash = location.hash;
|
|
276
|
-
var path = pathname || '/';
|
|
277
|
-
if (search && search !== '?') path += search.charAt(0) === '?' ? search : "?" + search;
|
|
278
|
-
if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : "#" + hash;
|
|
279
|
-
return path;
|
|
280
|
-
}
|
|
281
|
-
function createLocation(path, state, key, currentLocation) {
|
|
282
|
-
var location;
|
|
283
|
-
if (typeof path === 'string') {
|
|
284
|
-
// Two-arg form: push(path, state)
|
|
285
|
-
location = parsePath(path);
|
|
286
|
-
location.state = state;
|
|
287
|
-
} else {
|
|
288
|
-
// One-arg form: push(location)
|
|
289
|
-
location = _extends$1({}, path);
|
|
290
|
-
if (location.pathname === undefined) location.pathname = '';
|
|
291
|
-
if (location.search) {
|
|
292
|
-
if (location.search.charAt(0) !== '?') location.search = '?' + location.search;
|
|
293
|
-
} else {
|
|
294
|
-
location.search = '';
|
|
295
|
-
}
|
|
296
|
-
if (location.hash) {
|
|
297
|
-
if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash;
|
|
298
|
-
} else {
|
|
299
|
-
location.hash = '';
|
|
300
|
-
}
|
|
301
|
-
if (state !== undefined && location.state === undefined) location.state = state;
|
|
302
|
-
}
|
|
303
|
-
try {
|
|
304
|
-
location.pathname = decodeURI(location.pathname);
|
|
305
|
-
} catch (e) {
|
|
306
|
-
if (e instanceof URIError) {
|
|
307
|
-
throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.');
|
|
308
|
-
} else {
|
|
309
|
-
throw e;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
if (key) location.key = key;
|
|
313
|
-
if (currentLocation) {
|
|
314
|
-
// Resolve incomplete/relative pathname relative to current location.
|
|
315
|
-
if (!location.pathname) {
|
|
316
|
-
location.pathname = currentLocation.pathname;
|
|
317
|
-
} else if (location.pathname.charAt(0) !== '/') {
|
|
318
|
-
location.pathname = resolvePathname(location.pathname, currentLocation.pathname);
|
|
319
|
-
}
|
|
320
|
-
} else {
|
|
321
|
-
// When there is no prior location and pathname is empty, set it to /
|
|
322
|
-
if (!location.pathname) {
|
|
323
|
-
location.pathname = '/';
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
return location;
|
|
327
|
-
}
|
|
328
|
-
function createTransitionManager() {
|
|
329
|
-
var prompt = null;
|
|
330
|
-
function setPrompt(nextPrompt) {
|
|
331
|
-
prompt = nextPrompt;
|
|
332
|
-
return function () {
|
|
333
|
-
if (prompt === nextPrompt) prompt = null;
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
function confirmTransitionTo(location, action, getUserConfirmation, callback) {
|
|
337
|
-
// TODO: If another transition starts while we're still confirming
|
|
338
|
-
// the previous one, we may end up in a weird state. Figure out the
|
|
339
|
-
// best way to handle this.
|
|
340
|
-
if (prompt != null) {
|
|
341
|
-
var result = typeof prompt === 'function' ? prompt(location, action) : prompt;
|
|
342
|
-
if (typeof result === 'string') {
|
|
343
|
-
if (typeof getUserConfirmation === 'function') {
|
|
344
|
-
getUserConfirmation(result, callback);
|
|
345
|
-
} else {
|
|
346
|
-
callback(true);
|
|
347
|
-
}
|
|
348
|
-
} else {
|
|
349
|
-
// Return false from a transition hook to cancel the transition.
|
|
350
|
-
callback(result !== false);
|
|
351
|
-
}
|
|
352
|
-
} else {
|
|
353
|
-
callback(true);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
var listeners = [];
|
|
357
|
-
function appendListener(fn) {
|
|
358
|
-
var isActive = true;
|
|
359
|
-
function listener() {
|
|
360
|
-
if (isActive) fn.apply(void 0, arguments);
|
|
361
|
-
}
|
|
362
|
-
listeners.push(listener);
|
|
363
|
-
return function () {
|
|
364
|
-
isActive = false;
|
|
365
|
-
listeners = listeners.filter(function (item) {
|
|
366
|
-
return item !== listener;
|
|
367
|
-
});
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
function notifyListeners() {
|
|
371
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
372
|
-
args[_key] = arguments[_key];
|
|
373
|
-
}
|
|
374
|
-
listeners.forEach(function (listener) {
|
|
375
|
-
return listener.apply(void 0, args);
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
return {
|
|
379
|
-
setPrompt: setPrompt,
|
|
380
|
-
confirmTransitionTo: confirmTransitionTo,
|
|
381
|
-
appendListener: appendListener,
|
|
382
|
-
notifyListeners: notifyListeners
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
386
|
-
function getConfirmation(message, callback) {
|
|
387
|
-
callback(window.confirm(message)); // eslint-disable-line no-alert
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* Returns true if the HTML5 history API is supported. Taken from Modernizr.
|
|
391
|
-
*
|
|
392
|
-
* https://github.com/Modernizr/Modernizr/blob/master/LICENSE
|
|
393
|
-
* https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
|
|
394
|
-
* changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586
|
|
395
|
-
*/
|
|
396
|
-
|
|
397
|
-
function supportsHistory() {
|
|
398
|
-
var ua = window.navigator.userAgent;
|
|
399
|
-
if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false;
|
|
400
|
-
return window.history && 'pushState' in window.history;
|
|
401
|
-
}
|
|
402
|
-
/**
|
|
403
|
-
* Returns true if browser fires popstate on hash change.
|
|
404
|
-
* IE10 and IE11 do not.
|
|
405
|
-
*/
|
|
406
|
-
|
|
407
|
-
function supportsPopStateOnHashChange() {
|
|
408
|
-
return window.navigator.userAgent.indexOf('Trident') === -1;
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* Returns false if using go(n) with hash history causes a full page reload.
|
|
412
|
-
*/
|
|
413
|
-
|
|
414
|
-
function supportsGoWithoutReloadUsingHash() {
|
|
415
|
-
return window.navigator.userAgent.indexOf('Firefox') === -1;
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* Returns true if a given popstate event is an extraneous WebKit event.
|
|
419
|
-
* Accounts for the fact that Chrome on iOS fires real popstate events
|
|
420
|
-
* containing undefined state when pressing the back button.
|
|
421
|
-
*/
|
|
422
|
-
|
|
423
|
-
function isExtraneousPopstateEvent(event) {
|
|
424
|
-
return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1;
|
|
425
|
-
}
|
|
426
|
-
var PopStateEvent = 'popstate';
|
|
427
|
-
var HashChangeEvent = 'hashchange';
|
|
428
|
-
function getHistoryState() {
|
|
429
|
-
try {
|
|
430
|
-
return window.history.state || {};
|
|
431
|
-
} catch (e) {
|
|
432
|
-
// IE 11 sometimes throws when accessing window.history.state
|
|
433
|
-
// See https://github.com/ReactTraining/history/pull/289
|
|
434
|
-
return {};
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
/**
|
|
438
|
-
* Creates a history object that uses the HTML5 history API including
|
|
439
|
-
* pushState, replaceState, and the popstate event.
|
|
440
|
-
*/
|
|
441
|
-
|
|
442
|
-
function createBrowserHistory(props) {
|
|
443
|
-
if (props === void 0) {
|
|
444
|
-
props = {};
|
|
445
|
-
}
|
|
446
|
-
!canUseDOM ? invariant(false) : void 0;
|
|
447
|
-
var globalHistory = window.history;
|
|
448
|
-
var canUseHistory = supportsHistory();
|
|
449
|
-
var needsHashChangeListener = !supportsPopStateOnHashChange();
|
|
450
|
-
var _props = props,
|
|
451
|
-
_props$forceRefresh = _props.forceRefresh,
|
|
452
|
-
forceRefresh = _props$forceRefresh === void 0 ? false : _props$forceRefresh,
|
|
453
|
-
_props$getUserConfirm = _props.getUserConfirmation,
|
|
454
|
-
getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,
|
|
455
|
-
_props$keyLength = _props.keyLength,
|
|
456
|
-
keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;
|
|
457
|
-
var basename = props.basename ? stripTrailingSlash(addLeadingSlash$1(props.basename)) : '';
|
|
458
|
-
function getDOMLocation(historyState) {
|
|
459
|
-
var _ref = historyState || {},
|
|
460
|
-
key = _ref.key,
|
|
461
|
-
state = _ref.state;
|
|
462
|
-
var _window$location = window.location,
|
|
463
|
-
pathname = _window$location.pathname,
|
|
464
|
-
search = _window$location.search,
|
|
465
|
-
hash = _window$location.hash;
|
|
466
|
-
var path = pathname + search + hash;
|
|
467
|
-
if (basename) path = stripBasename$1(path, basename);
|
|
468
|
-
return createLocation(path, state, key);
|
|
469
|
-
}
|
|
470
|
-
function createKey() {
|
|
471
|
-
return Math.random().toString(36).substr(2, keyLength);
|
|
472
|
-
}
|
|
473
|
-
var transitionManager = createTransitionManager();
|
|
474
|
-
function setState(nextState) {
|
|
475
|
-
_extends$1(history, nextState);
|
|
476
|
-
history.length = globalHistory.length;
|
|
477
|
-
transitionManager.notifyListeners(history.location, history.action);
|
|
478
|
-
}
|
|
479
|
-
function handlePopState(event) {
|
|
480
|
-
// Ignore extraneous popstate events in WebKit.
|
|
481
|
-
if (isExtraneousPopstateEvent(event)) return;
|
|
482
|
-
handlePop(getDOMLocation(event.state));
|
|
483
|
-
}
|
|
484
|
-
function handleHashChange() {
|
|
485
|
-
handlePop(getDOMLocation(getHistoryState()));
|
|
486
|
-
}
|
|
487
|
-
var forceNextPop = false;
|
|
488
|
-
function handlePop(location) {
|
|
489
|
-
if (forceNextPop) {
|
|
490
|
-
forceNextPop = false;
|
|
491
|
-
setState();
|
|
492
|
-
} else {
|
|
493
|
-
var action = 'POP';
|
|
494
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
495
|
-
if (ok) {
|
|
496
|
-
setState({
|
|
497
|
-
action: action,
|
|
498
|
-
location: location
|
|
499
|
-
});
|
|
500
|
-
} else {
|
|
501
|
-
revertPop(location);
|
|
502
|
-
}
|
|
503
|
-
});
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
function revertPop(fromLocation) {
|
|
507
|
-
var toLocation = history.location; // TODO: We could probably make this more reliable by
|
|
508
|
-
// keeping a list of keys we've seen in sessionStorage.
|
|
509
|
-
// Instead, we just default to 0 for keys we don't know.
|
|
510
|
-
|
|
511
|
-
var toIndex = allKeys.indexOf(toLocation.key);
|
|
512
|
-
if (toIndex === -1) toIndex = 0;
|
|
513
|
-
var fromIndex = allKeys.indexOf(fromLocation.key);
|
|
514
|
-
if (fromIndex === -1) fromIndex = 0;
|
|
515
|
-
var delta = toIndex - fromIndex;
|
|
516
|
-
if (delta) {
|
|
517
|
-
forceNextPop = true;
|
|
518
|
-
go(delta);
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
var initialLocation = getDOMLocation(getHistoryState());
|
|
522
|
-
var allKeys = [initialLocation.key]; // Public interface
|
|
523
|
-
|
|
524
|
-
function createHref(location) {
|
|
525
|
-
return basename + createPath(location);
|
|
526
|
-
}
|
|
527
|
-
function push(path, state) {
|
|
528
|
-
var action = 'PUSH';
|
|
529
|
-
var location = createLocation(path, state, createKey(), history.location);
|
|
530
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
531
|
-
if (!ok) return;
|
|
532
|
-
var href = createHref(location);
|
|
533
|
-
var key = location.key,
|
|
534
|
-
state = location.state;
|
|
535
|
-
if (canUseHistory) {
|
|
536
|
-
globalHistory.pushState({
|
|
537
|
-
key: key,
|
|
538
|
-
state: state
|
|
539
|
-
}, null, href);
|
|
540
|
-
if (forceRefresh) {
|
|
541
|
-
window.location.href = href;
|
|
542
|
-
} else {
|
|
543
|
-
var prevIndex = allKeys.indexOf(history.location.key);
|
|
544
|
-
var nextKeys = allKeys.slice(0, prevIndex + 1);
|
|
545
|
-
nextKeys.push(location.key);
|
|
546
|
-
allKeys = nextKeys;
|
|
547
|
-
setState({
|
|
548
|
-
action: action,
|
|
549
|
-
location: location
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
|
-
} else {
|
|
553
|
-
window.location.href = href;
|
|
554
|
-
}
|
|
555
|
-
});
|
|
556
|
-
}
|
|
557
|
-
function replace(path, state) {
|
|
558
|
-
var action = 'REPLACE';
|
|
559
|
-
var location = createLocation(path, state, createKey(), history.location);
|
|
560
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
561
|
-
if (!ok) return;
|
|
562
|
-
var href = createHref(location);
|
|
563
|
-
var key = location.key,
|
|
564
|
-
state = location.state;
|
|
565
|
-
if (canUseHistory) {
|
|
566
|
-
globalHistory.replaceState({
|
|
567
|
-
key: key,
|
|
568
|
-
state: state
|
|
569
|
-
}, null, href);
|
|
570
|
-
if (forceRefresh) {
|
|
571
|
-
window.location.replace(href);
|
|
572
|
-
} else {
|
|
573
|
-
var prevIndex = allKeys.indexOf(history.location.key);
|
|
574
|
-
if (prevIndex !== -1) allKeys[prevIndex] = location.key;
|
|
575
|
-
setState({
|
|
576
|
-
action: action,
|
|
577
|
-
location: location
|
|
578
|
-
});
|
|
579
|
-
}
|
|
580
|
-
} else {
|
|
581
|
-
window.location.replace(href);
|
|
582
|
-
}
|
|
583
|
-
});
|
|
584
|
-
}
|
|
585
|
-
function go(n) {
|
|
586
|
-
globalHistory.go(n);
|
|
587
|
-
}
|
|
588
|
-
function goBack() {
|
|
589
|
-
go(-1);
|
|
590
|
-
}
|
|
591
|
-
function goForward() {
|
|
592
|
-
go(1);
|
|
593
|
-
}
|
|
594
|
-
var listenerCount = 0;
|
|
595
|
-
function checkDOMListeners(delta) {
|
|
596
|
-
listenerCount += delta;
|
|
597
|
-
if (listenerCount === 1 && delta === 1) {
|
|
598
|
-
window.addEventListener(PopStateEvent, handlePopState);
|
|
599
|
-
if (needsHashChangeListener) window.addEventListener(HashChangeEvent, handleHashChange);
|
|
600
|
-
} else if (listenerCount === 0) {
|
|
601
|
-
window.removeEventListener(PopStateEvent, handlePopState);
|
|
602
|
-
if (needsHashChangeListener) window.removeEventListener(HashChangeEvent, handleHashChange);
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
var isBlocked = false;
|
|
606
|
-
function block(prompt) {
|
|
607
|
-
if (prompt === void 0) {
|
|
608
|
-
prompt = false;
|
|
609
|
-
}
|
|
610
|
-
var unblock = transitionManager.setPrompt(prompt);
|
|
611
|
-
if (!isBlocked) {
|
|
612
|
-
checkDOMListeners(1);
|
|
613
|
-
isBlocked = true;
|
|
614
|
-
}
|
|
615
|
-
return function () {
|
|
616
|
-
if (isBlocked) {
|
|
617
|
-
isBlocked = false;
|
|
618
|
-
checkDOMListeners(-1);
|
|
619
|
-
}
|
|
620
|
-
return unblock();
|
|
621
|
-
};
|
|
622
|
-
}
|
|
623
|
-
function listen(listener) {
|
|
624
|
-
var unlisten = transitionManager.appendListener(listener);
|
|
625
|
-
checkDOMListeners(1);
|
|
626
|
-
return function () {
|
|
627
|
-
checkDOMListeners(-1);
|
|
628
|
-
unlisten();
|
|
629
|
-
};
|
|
630
|
-
}
|
|
631
|
-
var history = {
|
|
632
|
-
length: globalHistory.length,
|
|
633
|
-
action: 'POP',
|
|
634
|
-
location: initialLocation,
|
|
635
|
-
createHref: createHref,
|
|
636
|
-
push: push,
|
|
637
|
-
replace: replace,
|
|
638
|
-
go: go,
|
|
639
|
-
goBack: goBack,
|
|
640
|
-
goForward: goForward,
|
|
641
|
-
block: block,
|
|
642
|
-
listen: listen
|
|
643
|
-
};
|
|
644
|
-
return history;
|
|
645
|
-
}
|
|
646
|
-
var HashChangeEvent$1 = 'hashchange';
|
|
647
|
-
var HashPathCoders = {
|
|
648
|
-
hashbang: {
|
|
649
|
-
encodePath: function encodePath(path) {
|
|
650
|
-
return path.charAt(0) === '!' ? path : '!/' + stripLeadingSlash(path);
|
|
651
|
-
},
|
|
652
|
-
decodePath: function decodePath(path) {
|
|
653
|
-
return path.charAt(0) === '!' ? path.substr(1) : path;
|
|
654
|
-
}
|
|
655
|
-
},
|
|
656
|
-
noslash: {
|
|
657
|
-
encodePath: stripLeadingSlash,
|
|
658
|
-
decodePath: addLeadingSlash$1
|
|
659
|
-
},
|
|
660
|
-
slash: {
|
|
661
|
-
encodePath: addLeadingSlash$1,
|
|
662
|
-
decodePath: addLeadingSlash$1
|
|
663
|
-
}
|
|
664
|
-
};
|
|
665
|
-
function stripHash(url) {
|
|
666
|
-
var hashIndex = url.indexOf('#');
|
|
667
|
-
return hashIndex === -1 ? url : url.slice(0, hashIndex);
|
|
668
|
-
}
|
|
669
|
-
function getHashPath() {
|
|
670
|
-
// We can't use window.location.hash here because it's not
|
|
671
|
-
// consistent across browsers - Firefox will pre-decode it!
|
|
672
|
-
var href = window.location.href;
|
|
673
|
-
var hashIndex = href.indexOf('#');
|
|
674
|
-
return hashIndex === -1 ? '' : href.substring(hashIndex + 1);
|
|
675
|
-
}
|
|
676
|
-
function pushHashPath(path) {
|
|
677
|
-
window.location.hash = path;
|
|
678
|
-
}
|
|
679
|
-
function replaceHashPath(path) {
|
|
680
|
-
window.location.replace(stripHash(window.location.href) + '#' + path);
|
|
681
|
-
}
|
|
682
|
-
function createHashHistory(props) {
|
|
683
|
-
if (props === void 0) {
|
|
684
|
-
props = {};
|
|
685
|
-
}
|
|
686
|
-
!canUseDOM ? invariant(false) : void 0;
|
|
687
|
-
var globalHistory = window.history;
|
|
688
|
-
supportsGoWithoutReloadUsingHash();
|
|
689
|
-
var _props = props,
|
|
690
|
-
_props$getUserConfirm = _props.getUserConfirmation,
|
|
691
|
-
getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,
|
|
692
|
-
_props$hashType = _props.hashType,
|
|
693
|
-
hashType = _props$hashType === void 0 ? 'slash' : _props$hashType;
|
|
694
|
-
var basename = props.basename ? stripTrailingSlash(addLeadingSlash$1(props.basename)) : '';
|
|
695
|
-
var _HashPathCoders$hashT = HashPathCoders[hashType],
|
|
696
|
-
encodePath = _HashPathCoders$hashT.encodePath,
|
|
697
|
-
decodePath = _HashPathCoders$hashT.decodePath;
|
|
698
|
-
function getDOMLocation() {
|
|
699
|
-
var path = decodePath(getHashPath());
|
|
700
|
-
if (basename) path = stripBasename$1(path, basename);
|
|
701
|
-
return createLocation(path);
|
|
702
|
-
}
|
|
703
|
-
var transitionManager = createTransitionManager();
|
|
704
|
-
function setState(nextState) {
|
|
705
|
-
_extends$1(history, nextState);
|
|
706
|
-
history.length = globalHistory.length;
|
|
707
|
-
transitionManager.notifyListeners(history.location, history.action);
|
|
708
|
-
}
|
|
709
|
-
var forceNextPop = false;
|
|
710
|
-
var ignorePath = null;
|
|
711
|
-
function locationsAreEqual$$1(a, b) {
|
|
712
|
-
return a.pathname === b.pathname && a.search === b.search && a.hash === b.hash;
|
|
713
|
-
}
|
|
714
|
-
function handleHashChange() {
|
|
715
|
-
var path = getHashPath();
|
|
716
|
-
var encodedPath = encodePath(path);
|
|
717
|
-
if (path !== encodedPath) {
|
|
718
|
-
// Ensure we always have a properly-encoded hash.
|
|
719
|
-
replaceHashPath(encodedPath);
|
|
720
|
-
} else {
|
|
721
|
-
var location = getDOMLocation();
|
|
722
|
-
var prevLocation = history.location;
|
|
723
|
-
if (!forceNextPop && locationsAreEqual$$1(prevLocation, location)) return; // A hashchange doesn't always == location change.
|
|
724
|
-
|
|
725
|
-
if (ignorePath === createPath(location)) return; // Ignore this change; we already setState in push/replace.
|
|
726
|
-
|
|
727
|
-
ignorePath = null;
|
|
728
|
-
handlePop(location);
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
function handlePop(location) {
|
|
732
|
-
if (forceNextPop) {
|
|
733
|
-
forceNextPop = false;
|
|
734
|
-
setState();
|
|
735
|
-
} else {
|
|
736
|
-
var action = 'POP';
|
|
737
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
738
|
-
if (ok) {
|
|
739
|
-
setState({
|
|
740
|
-
action: action,
|
|
741
|
-
location: location
|
|
742
|
-
});
|
|
743
|
-
} else {
|
|
744
|
-
revertPop(location);
|
|
745
|
-
}
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
function revertPop(fromLocation) {
|
|
750
|
-
var toLocation = history.location; // TODO: We could probably make this more reliable by
|
|
751
|
-
// keeping a list of paths we've seen in sessionStorage.
|
|
752
|
-
// Instead, we just default to 0 for paths we don't know.
|
|
753
|
-
|
|
754
|
-
var toIndex = allPaths.lastIndexOf(createPath(toLocation));
|
|
755
|
-
if (toIndex === -1) toIndex = 0;
|
|
756
|
-
var fromIndex = allPaths.lastIndexOf(createPath(fromLocation));
|
|
757
|
-
if (fromIndex === -1) fromIndex = 0;
|
|
758
|
-
var delta = toIndex - fromIndex;
|
|
759
|
-
if (delta) {
|
|
760
|
-
forceNextPop = true;
|
|
761
|
-
go(delta);
|
|
762
|
-
}
|
|
763
|
-
} // Ensure the hash is encoded properly before doing anything else.
|
|
764
|
-
|
|
765
|
-
var path = getHashPath();
|
|
766
|
-
var encodedPath = encodePath(path);
|
|
767
|
-
if (path !== encodedPath) replaceHashPath(encodedPath);
|
|
768
|
-
var initialLocation = getDOMLocation();
|
|
769
|
-
var allPaths = [createPath(initialLocation)]; // Public interface
|
|
770
|
-
|
|
771
|
-
function createHref(location) {
|
|
772
|
-
var baseTag = document.querySelector('base');
|
|
773
|
-
var href = '';
|
|
774
|
-
if (baseTag && baseTag.getAttribute('href')) {
|
|
775
|
-
href = stripHash(window.location.href);
|
|
776
|
-
}
|
|
777
|
-
return href + '#' + encodePath(basename + createPath(location));
|
|
778
|
-
}
|
|
779
|
-
function push(path, state) {
|
|
780
|
-
var action = 'PUSH';
|
|
781
|
-
var location = createLocation(path, undefined, undefined, history.location);
|
|
782
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
783
|
-
if (!ok) return;
|
|
784
|
-
var path = createPath(location);
|
|
785
|
-
var encodedPath = encodePath(basename + path);
|
|
786
|
-
var hashChanged = getHashPath() !== encodedPath;
|
|
787
|
-
if (hashChanged) {
|
|
788
|
-
// We cannot tell if a hashchange was caused by a PUSH, so we'd
|
|
789
|
-
// rather setState here and ignore the hashchange. The caveat here
|
|
790
|
-
// is that other hash histories in the page will consider it a POP.
|
|
791
|
-
ignorePath = path;
|
|
792
|
-
pushHashPath(encodedPath);
|
|
793
|
-
var prevIndex = allPaths.lastIndexOf(createPath(history.location));
|
|
794
|
-
var nextPaths = allPaths.slice(0, prevIndex + 1);
|
|
795
|
-
nextPaths.push(path);
|
|
796
|
-
allPaths = nextPaths;
|
|
797
|
-
setState({
|
|
798
|
-
action: action,
|
|
799
|
-
location: location
|
|
800
|
-
});
|
|
801
|
-
} else {
|
|
802
|
-
setState();
|
|
803
|
-
}
|
|
804
|
-
});
|
|
805
|
-
}
|
|
806
|
-
function replace(path, state) {
|
|
807
|
-
var action = 'REPLACE';
|
|
808
|
-
var location = createLocation(path, undefined, undefined, history.location);
|
|
809
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
810
|
-
if (!ok) return;
|
|
811
|
-
var path = createPath(location);
|
|
812
|
-
var encodedPath = encodePath(basename + path);
|
|
813
|
-
var hashChanged = getHashPath() !== encodedPath;
|
|
814
|
-
if (hashChanged) {
|
|
815
|
-
// We cannot tell if a hashchange was caused by a REPLACE, so we'd
|
|
816
|
-
// rather setState here and ignore the hashchange. The caveat here
|
|
817
|
-
// is that other hash histories in the page will consider it a POP.
|
|
818
|
-
ignorePath = path;
|
|
819
|
-
replaceHashPath(encodedPath);
|
|
820
|
-
}
|
|
821
|
-
var prevIndex = allPaths.indexOf(createPath(history.location));
|
|
822
|
-
if (prevIndex !== -1) allPaths[prevIndex] = path;
|
|
823
|
-
setState({
|
|
824
|
-
action: action,
|
|
825
|
-
location: location
|
|
826
|
-
});
|
|
827
|
-
});
|
|
828
|
-
}
|
|
829
|
-
function go(n) {
|
|
830
|
-
globalHistory.go(n);
|
|
831
|
-
}
|
|
832
|
-
function goBack() {
|
|
833
|
-
go(-1);
|
|
834
|
-
}
|
|
835
|
-
function goForward() {
|
|
836
|
-
go(1);
|
|
837
|
-
}
|
|
838
|
-
var listenerCount = 0;
|
|
839
|
-
function checkDOMListeners(delta) {
|
|
840
|
-
listenerCount += delta;
|
|
841
|
-
if (listenerCount === 1 && delta === 1) {
|
|
842
|
-
window.addEventListener(HashChangeEvent$1, handleHashChange);
|
|
843
|
-
} else if (listenerCount === 0) {
|
|
844
|
-
window.removeEventListener(HashChangeEvent$1, handleHashChange);
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
var isBlocked = false;
|
|
848
|
-
function block(prompt) {
|
|
849
|
-
if (prompt === void 0) {
|
|
850
|
-
prompt = false;
|
|
851
|
-
}
|
|
852
|
-
var unblock = transitionManager.setPrompt(prompt);
|
|
853
|
-
if (!isBlocked) {
|
|
854
|
-
checkDOMListeners(1);
|
|
855
|
-
isBlocked = true;
|
|
856
|
-
}
|
|
857
|
-
return function () {
|
|
858
|
-
if (isBlocked) {
|
|
859
|
-
isBlocked = false;
|
|
860
|
-
checkDOMListeners(-1);
|
|
861
|
-
}
|
|
862
|
-
return unblock();
|
|
863
|
-
};
|
|
864
|
-
}
|
|
865
|
-
function listen(listener) {
|
|
866
|
-
var unlisten = transitionManager.appendListener(listener);
|
|
867
|
-
checkDOMListeners(1);
|
|
868
|
-
return function () {
|
|
869
|
-
checkDOMListeners(-1);
|
|
870
|
-
unlisten();
|
|
871
|
-
};
|
|
872
|
-
}
|
|
873
|
-
var history = {
|
|
874
|
-
length: globalHistory.length,
|
|
875
|
-
action: 'POP',
|
|
876
|
-
location: initialLocation,
|
|
877
|
-
createHref: createHref,
|
|
878
|
-
push: push,
|
|
879
|
-
replace: replace,
|
|
880
|
-
go: go,
|
|
881
|
-
goBack: goBack,
|
|
882
|
-
goForward: goForward,
|
|
883
|
-
block: block,
|
|
884
|
-
listen: listen
|
|
885
|
-
};
|
|
886
|
-
return history;
|
|
887
|
-
}
|
|
888
|
-
function clamp(n, lowerBound, upperBound) {
|
|
889
|
-
return Math.min(Math.max(n, lowerBound), upperBound);
|
|
890
|
-
}
|
|
891
|
-
/**
|
|
892
|
-
* Creates a history object that stores locations in memory.
|
|
893
|
-
*/
|
|
894
|
-
|
|
895
|
-
function createMemoryHistory(props) {
|
|
896
|
-
if (props === void 0) {
|
|
897
|
-
props = {};
|
|
898
|
-
}
|
|
899
|
-
var _props = props,
|
|
900
|
-
getUserConfirmation = _props.getUserConfirmation,
|
|
901
|
-
_props$initialEntries = _props.initialEntries,
|
|
902
|
-
initialEntries = _props$initialEntries === void 0 ? ['/'] : _props$initialEntries,
|
|
903
|
-
_props$initialIndex = _props.initialIndex,
|
|
904
|
-
initialIndex = _props$initialIndex === void 0 ? 0 : _props$initialIndex,
|
|
905
|
-
_props$keyLength = _props.keyLength,
|
|
906
|
-
keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;
|
|
907
|
-
var transitionManager = createTransitionManager();
|
|
908
|
-
function setState(nextState) {
|
|
909
|
-
_extends$1(history, nextState);
|
|
910
|
-
history.length = history.entries.length;
|
|
911
|
-
transitionManager.notifyListeners(history.location, history.action);
|
|
912
|
-
}
|
|
913
|
-
function createKey() {
|
|
914
|
-
return Math.random().toString(36).substr(2, keyLength);
|
|
915
|
-
}
|
|
916
|
-
var index = clamp(initialIndex, 0, initialEntries.length - 1);
|
|
917
|
-
var entries = initialEntries.map(function (entry) {
|
|
918
|
-
return typeof entry === 'string' ? createLocation(entry, undefined, createKey()) : createLocation(entry, undefined, entry.key || createKey());
|
|
919
|
-
}); // Public interface
|
|
920
|
-
|
|
921
|
-
var createHref = createPath;
|
|
922
|
-
function push(path, state) {
|
|
923
|
-
var action = 'PUSH';
|
|
924
|
-
var location = createLocation(path, state, createKey(), history.location);
|
|
925
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
926
|
-
if (!ok) return;
|
|
927
|
-
var prevIndex = history.index;
|
|
928
|
-
var nextIndex = prevIndex + 1;
|
|
929
|
-
var nextEntries = history.entries.slice(0);
|
|
930
|
-
if (nextEntries.length > nextIndex) {
|
|
931
|
-
nextEntries.splice(nextIndex, nextEntries.length - nextIndex, location);
|
|
932
|
-
} else {
|
|
933
|
-
nextEntries.push(location);
|
|
934
|
-
}
|
|
935
|
-
setState({
|
|
936
|
-
action: action,
|
|
937
|
-
location: location,
|
|
938
|
-
index: nextIndex,
|
|
939
|
-
entries: nextEntries
|
|
940
|
-
});
|
|
941
|
-
});
|
|
942
|
-
}
|
|
943
|
-
function replace(path, state) {
|
|
944
|
-
var action = 'REPLACE';
|
|
945
|
-
var location = createLocation(path, state, createKey(), history.location);
|
|
946
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
947
|
-
if (!ok) return;
|
|
948
|
-
history.entries[history.index] = location;
|
|
949
|
-
setState({
|
|
950
|
-
action: action,
|
|
951
|
-
location: location
|
|
952
|
-
});
|
|
953
|
-
});
|
|
954
|
-
}
|
|
955
|
-
function go(n) {
|
|
956
|
-
var nextIndex = clamp(history.index + n, 0, history.entries.length - 1);
|
|
957
|
-
var action = 'POP';
|
|
958
|
-
var location = history.entries[nextIndex];
|
|
959
|
-
transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
|
|
960
|
-
if (ok) {
|
|
961
|
-
setState({
|
|
962
|
-
action: action,
|
|
963
|
-
location: location,
|
|
964
|
-
index: nextIndex
|
|
965
|
-
});
|
|
966
|
-
} else {
|
|
967
|
-
// Mimic the behavior of DOM histories by
|
|
968
|
-
// causing a render after a cancelled POP.
|
|
969
|
-
setState();
|
|
970
|
-
}
|
|
971
|
-
});
|
|
972
|
-
}
|
|
973
|
-
function goBack() {
|
|
974
|
-
go(-1);
|
|
975
|
-
}
|
|
976
|
-
function goForward() {
|
|
977
|
-
go(1);
|
|
978
|
-
}
|
|
979
|
-
function canGo(n) {
|
|
980
|
-
var nextIndex = history.index + n;
|
|
981
|
-
return nextIndex >= 0 && nextIndex < history.entries.length;
|
|
982
|
-
}
|
|
983
|
-
function block(prompt) {
|
|
984
|
-
if (prompt === void 0) {
|
|
985
|
-
prompt = false;
|
|
986
|
-
}
|
|
987
|
-
return transitionManager.setPrompt(prompt);
|
|
988
|
-
}
|
|
989
|
-
function listen(listener) {
|
|
990
|
-
return transitionManager.appendListener(listener);
|
|
991
|
-
}
|
|
992
|
-
var history = {
|
|
993
|
-
length: entries.length,
|
|
994
|
-
action: 'POP',
|
|
995
|
-
location: entries[index],
|
|
996
|
-
index: index,
|
|
997
|
-
entries: entries,
|
|
998
|
-
createHref: createHref,
|
|
999
|
-
push: push,
|
|
1000
|
-
replace: replace,
|
|
1001
|
-
go: go,
|
|
1002
|
-
goBack: goBack,
|
|
1003
|
-
goForward: goForward,
|
|
1004
|
-
canGo: canGo,
|
|
1005
|
-
block: block,
|
|
1006
|
-
listen: listen
|
|
1007
|
-
};
|
|
1008
|
-
return history;
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
function _setPrototypeOf(o, p) {
|
|
1012
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
1013
|
-
o.__proto__ = p;
|
|
1014
|
-
return o;
|
|
1015
|
-
};
|
|
1016
|
-
return _setPrototypeOf(o, p);
|
|
1017
|
-
}
|
|
1018
|
-
|
|
1019
|
-
function _inheritsLoose(subClass, superClass) {
|
|
1020
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
1021
|
-
subClass.prototype.constructor = subClass;
|
|
1022
|
-
_setPrototypeOf(subClass, superClass);
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
var MAX_SIGNED_31_BIT_INT = 1073741823;
|
|
1026
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {};
|
|
1027
|
-
function getUniqueId() {
|
|
1028
|
-
var key = '__global_unique_id__';
|
|
1029
|
-
return commonjsGlobal[key] = (commonjsGlobal[key] || 0) + 1;
|
|
1030
|
-
}
|
|
1031
|
-
function objectIs(x, y) {
|
|
1032
|
-
if (x === y) {
|
|
1033
|
-
return x !== 0 || 1 / x === 1 / y;
|
|
1034
|
-
} else {
|
|
1035
|
-
return x !== x && y !== y;
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
function createEventEmitter(value) {
|
|
1039
|
-
var handlers = [];
|
|
1040
|
-
return {
|
|
1041
|
-
on: function on(handler) {
|
|
1042
|
-
handlers.push(handler);
|
|
1043
|
-
},
|
|
1044
|
-
off: function off(handler) {
|
|
1045
|
-
handlers = handlers.filter(function (h) {
|
|
1046
|
-
return h !== handler;
|
|
1047
|
-
});
|
|
1048
|
-
},
|
|
1049
|
-
get: function get() {
|
|
1050
|
-
return value;
|
|
1051
|
-
},
|
|
1052
|
-
set: function set(newValue, changedBits) {
|
|
1053
|
-
value = newValue;
|
|
1054
|
-
handlers.forEach(function (handler) {
|
|
1055
|
-
return handler(value, changedBits);
|
|
1056
|
-
});
|
|
1057
|
-
}
|
|
1058
|
-
};
|
|
1059
|
-
}
|
|
1060
|
-
function onlyChild(children) {
|
|
1061
|
-
return Array.isArray(children) ? children[0] : children;
|
|
1062
|
-
}
|
|
1063
|
-
function createReactContext(defaultValue, calculateChangedBits) {
|
|
1064
|
-
var _Provider$childContex, _Consumer$contextType;
|
|
1065
|
-
var contextProp = '__create-react-context-' + getUniqueId() + '__';
|
|
1066
|
-
var Provider = /*#__PURE__*/function (_Component) {
|
|
1067
|
-
_inheritsLoose(Provider, _Component);
|
|
1068
|
-
function Provider() {
|
|
1069
|
-
var _this;
|
|
1070
|
-
_this = _Component.apply(this, arguments) || this;
|
|
1071
|
-
_this.emitter = createEventEmitter(_this.props.value);
|
|
1072
|
-
return _this;
|
|
1073
|
-
}
|
|
1074
|
-
var _proto = Provider.prototype;
|
|
1075
|
-
_proto.getChildContext = function getChildContext() {
|
|
1076
|
-
var _ref;
|
|
1077
|
-
return _ref = {}, _ref[contextProp] = this.emitter, _ref;
|
|
1078
|
-
};
|
|
1079
|
-
_proto.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
1080
|
-
if (this.props.value !== nextProps.value) {
|
|
1081
|
-
var oldValue = this.props.value;
|
|
1082
|
-
var newValue = nextProps.value;
|
|
1083
|
-
var changedBits;
|
|
1084
|
-
if (objectIs(oldValue, newValue)) {
|
|
1085
|
-
changedBits = 0;
|
|
1086
|
-
} else {
|
|
1087
|
-
changedBits = typeof calculateChangedBits === 'function' ? calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;
|
|
1088
|
-
changedBits |= 0;
|
|
1089
|
-
if (changedBits !== 0) {
|
|
1090
|
-
this.emitter.set(nextProps.value, changedBits);
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
};
|
|
1095
|
-
_proto.render = function render() {
|
|
1096
|
-
return this.props.children;
|
|
1097
|
-
};
|
|
1098
|
-
return Provider;
|
|
1099
|
-
}(React.Component);
|
|
1100
|
-
Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[contextProp] = propTypes.exports.object.isRequired, _Provider$childContex);
|
|
1101
|
-
var Consumer = /*#__PURE__*/function (_Component2) {
|
|
1102
|
-
_inheritsLoose(Consumer, _Component2);
|
|
1103
|
-
function Consumer() {
|
|
1104
|
-
var _this2;
|
|
1105
|
-
_this2 = _Component2.apply(this, arguments) || this;
|
|
1106
|
-
_this2.state = {
|
|
1107
|
-
value: _this2.getValue()
|
|
1108
|
-
};
|
|
1109
|
-
_this2.onUpdate = function (newValue, changedBits) {
|
|
1110
|
-
var observedBits = _this2.observedBits | 0;
|
|
1111
|
-
if ((observedBits & changedBits) !== 0) {
|
|
1112
|
-
_this2.setState({
|
|
1113
|
-
value: _this2.getValue()
|
|
1114
|
-
});
|
|
1115
|
-
}
|
|
1116
|
-
};
|
|
1117
|
-
return _this2;
|
|
1118
|
-
}
|
|
1119
|
-
var _proto2 = Consumer.prototype;
|
|
1120
|
-
_proto2.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
1121
|
-
var observedBits = nextProps.observedBits;
|
|
1122
|
-
this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits;
|
|
1123
|
-
};
|
|
1124
|
-
_proto2.componentDidMount = function componentDidMount() {
|
|
1125
|
-
if (this.context[contextProp]) {
|
|
1126
|
-
this.context[contextProp].on(this.onUpdate);
|
|
1127
|
-
}
|
|
1128
|
-
var observedBits = this.props.observedBits;
|
|
1129
|
-
this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT : observedBits;
|
|
1130
|
-
};
|
|
1131
|
-
_proto2.componentWillUnmount = function componentWillUnmount() {
|
|
1132
|
-
if (this.context[contextProp]) {
|
|
1133
|
-
this.context[contextProp].off(this.onUpdate);
|
|
1134
|
-
}
|
|
1135
|
-
};
|
|
1136
|
-
_proto2.getValue = function getValue() {
|
|
1137
|
-
if (this.context[contextProp]) {
|
|
1138
|
-
return this.context[contextProp].get();
|
|
1139
|
-
} else {
|
|
1140
|
-
return defaultValue;
|
|
1141
|
-
}
|
|
1142
|
-
};
|
|
1143
|
-
_proto2.render = function render() {
|
|
1144
|
-
return onlyChild(this.props.children)(this.state.value);
|
|
1145
|
-
};
|
|
1146
|
-
return Consumer;
|
|
1147
|
-
}(React.Component);
|
|
1148
|
-
Consumer.contextTypes = (_Consumer$contextType = {}, _Consumer$contextType[contextProp] = propTypes.exports.object, _Consumer$contextType);
|
|
1149
|
-
return {
|
|
1150
|
-
Provider: Provider,
|
|
1151
|
-
Consumer: Consumer
|
|
1152
|
-
};
|
|
1153
|
-
}
|
|
1154
|
-
var index = React__default["default"].createContext || createReactContext;
|
|
1155
|
-
|
|
1156
|
-
function _extends() {
|
|
1157
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
1158
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
1159
|
-
var source = arguments[i];
|
|
1160
|
-
for (var key in source) {
|
|
1161
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1162
|
-
target[key] = source[key];
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
return target;
|
|
1167
|
-
};
|
|
1168
|
-
return _extends.apply(this, arguments);
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
var pathToRegexp$1 = {exports: {}};
|
|
1172
|
-
|
|
1173
|
-
var isarray$1 = Array.isArray || function (arr) {
|
|
1174
|
-
return Object.prototype.toString.call(arr) == '[object Array]';
|
|
1175
|
-
};
|
|
1176
|
-
|
|
1177
|
-
var isarray = isarray$1;
|
|
1178
|
-
|
|
1179
|
-
/**
|
|
1180
|
-
* Expose `pathToRegexp`.
|
|
1181
|
-
*/
|
|
1182
|
-
pathToRegexp$1.exports = pathToRegexp;
|
|
1183
|
-
pathToRegexp$1.exports.parse = parse;
|
|
1184
|
-
pathToRegexp$1.exports.compile = compile;
|
|
1185
|
-
pathToRegexp$1.exports.tokensToFunction = tokensToFunction;
|
|
1186
|
-
pathToRegexp$1.exports.tokensToRegExp = tokensToRegExp;
|
|
1187
|
-
|
|
1188
|
-
/**
|
|
1189
|
-
* The main path matching regexp utility.
|
|
1190
|
-
*
|
|
1191
|
-
* @type {RegExp}
|
|
1192
|
-
*/
|
|
1193
|
-
var PATH_REGEXP = new RegExp([
|
|
1194
|
-
// Match escaped characters that would otherwise appear in future matches.
|
|
1195
|
-
// This allows the user to escape special characters that won't transform.
|
|
1196
|
-
'(\\\\.)',
|
|
1197
|
-
// Match Express-style parameters and un-named parameters with a prefix
|
|
1198
|
-
// and optional suffixes. Matches appear as:
|
|
1199
|
-
//
|
|
1200
|
-
// "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
|
|
1201
|
-
// "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
|
|
1202
|
-
// "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
|
|
1203
|
-
'([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'].join('|'), 'g');
|
|
1204
|
-
|
|
1205
|
-
/**
|
|
1206
|
-
* Parse a string for the raw tokens.
|
|
1207
|
-
*
|
|
1208
|
-
* @param {string} str
|
|
1209
|
-
* @param {Object=} options
|
|
1210
|
-
* @return {!Array}
|
|
1211
|
-
*/
|
|
1212
|
-
function parse(str, options) {
|
|
1213
|
-
var tokens = [];
|
|
1214
|
-
var key = 0;
|
|
1215
|
-
var index = 0;
|
|
1216
|
-
var path = '';
|
|
1217
|
-
var defaultDelimiter = options && options.delimiter || '/';
|
|
1218
|
-
var res;
|
|
1219
|
-
while ((res = PATH_REGEXP.exec(str)) != null) {
|
|
1220
|
-
var m = res[0];
|
|
1221
|
-
var escaped = res[1];
|
|
1222
|
-
var offset = res.index;
|
|
1223
|
-
path += str.slice(index, offset);
|
|
1224
|
-
index = offset + m.length;
|
|
1225
|
-
|
|
1226
|
-
// Ignore already escaped sequences.
|
|
1227
|
-
if (escaped) {
|
|
1228
|
-
path += escaped[1];
|
|
1229
|
-
continue;
|
|
1230
|
-
}
|
|
1231
|
-
var next = str[index];
|
|
1232
|
-
var prefix = res[2];
|
|
1233
|
-
var name = res[3];
|
|
1234
|
-
var capture = res[4];
|
|
1235
|
-
var group = res[5];
|
|
1236
|
-
var modifier = res[6];
|
|
1237
|
-
var asterisk = res[7];
|
|
1238
|
-
|
|
1239
|
-
// Push the current path onto the tokens.
|
|
1240
|
-
if (path) {
|
|
1241
|
-
tokens.push(path);
|
|
1242
|
-
path = '';
|
|
1243
|
-
}
|
|
1244
|
-
var partial = prefix != null && next != null && next !== prefix;
|
|
1245
|
-
var repeat = modifier === '+' || modifier === '*';
|
|
1246
|
-
var optional = modifier === '?' || modifier === '*';
|
|
1247
|
-
var delimiter = res[2] || defaultDelimiter;
|
|
1248
|
-
var pattern = capture || group;
|
|
1249
|
-
tokens.push({
|
|
1250
|
-
name: name || key++,
|
|
1251
|
-
prefix: prefix || '',
|
|
1252
|
-
delimiter: delimiter,
|
|
1253
|
-
optional: optional,
|
|
1254
|
-
repeat: repeat,
|
|
1255
|
-
partial: partial,
|
|
1256
|
-
asterisk: !!asterisk,
|
|
1257
|
-
pattern: pattern ? escapeGroup(pattern) : asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?'
|
|
1258
|
-
});
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
// Match any characters still remaining.
|
|
1262
|
-
if (index < str.length) {
|
|
1263
|
-
path += str.substr(index);
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
// If the path exists, push it onto the end.
|
|
1267
|
-
if (path) {
|
|
1268
|
-
tokens.push(path);
|
|
1269
|
-
}
|
|
1270
|
-
return tokens;
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
/**
|
|
1274
|
-
* Compile a string to a template function for the path.
|
|
1275
|
-
*
|
|
1276
|
-
* @param {string} str
|
|
1277
|
-
* @param {Object=} options
|
|
1278
|
-
* @return {!function(Object=, Object=)}
|
|
1279
|
-
*/
|
|
1280
|
-
function compile(str, options) {
|
|
1281
|
-
return tokensToFunction(parse(str, options), options);
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
/**
|
|
1285
|
-
* Prettier encoding of URI path segments.
|
|
1286
|
-
*
|
|
1287
|
-
* @param {string}
|
|
1288
|
-
* @return {string}
|
|
1289
|
-
*/
|
|
1290
|
-
function encodeURIComponentPretty(str) {
|
|
1291
|
-
return encodeURI(str).replace(/[\/?#]/g, function (c) {
|
|
1292
|
-
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
|
|
1293
|
-
});
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1296
|
-
/**
|
|
1297
|
-
* Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
|
|
1298
|
-
*
|
|
1299
|
-
* @param {string}
|
|
1300
|
-
* @return {string}
|
|
1301
|
-
*/
|
|
1302
|
-
function encodeAsterisk(str) {
|
|
1303
|
-
return encodeURI(str).replace(/[?#]/g, function (c) {
|
|
1304
|
-
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
|
|
1305
|
-
});
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
|
-
/**
|
|
1309
|
-
* Expose a method for transforming tokens into the path function.
|
|
1310
|
-
*/
|
|
1311
|
-
function tokensToFunction(tokens, options) {
|
|
1312
|
-
// Compile all the tokens into regexps.
|
|
1313
|
-
var matches = new Array(tokens.length);
|
|
1314
|
-
|
|
1315
|
-
// Compile all the patterns before compilation.
|
|
1316
|
-
for (var i = 0; i < tokens.length; i++) {
|
|
1317
|
-
if (_typeof$1(tokens[i]) === 'object') {
|
|
1318
|
-
matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$', flags(options));
|
|
1319
|
-
}
|
|
1320
|
-
}
|
|
1321
|
-
return function (obj, opts) {
|
|
1322
|
-
var path = '';
|
|
1323
|
-
var data = obj || {};
|
|
1324
|
-
var options = opts || {};
|
|
1325
|
-
var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
|
|
1326
|
-
for (var i = 0; i < tokens.length; i++) {
|
|
1327
|
-
var token = tokens[i];
|
|
1328
|
-
if (typeof token === 'string') {
|
|
1329
|
-
path += token;
|
|
1330
|
-
continue;
|
|
1331
|
-
}
|
|
1332
|
-
var value = data[token.name];
|
|
1333
|
-
var segment;
|
|
1334
|
-
if (value == null) {
|
|
1335
|
-
if (token.optional) {
|
|
1336
|
-
// Prepend partial segment prefixes.
|
|
1337
|
-
if (token.partial) {
|
|
1338
|
-
path += token.prefix;
|
|
1339
|
-
}
|
|
1340
|
-
continue;
|
|
1341
|
-
} else {
|
|
1342
|
-
throw new TypeError('Expected "' + token.name + '" to be defined');
|
|
1343
|
-
}
|
|
1344
|
-
}
|
|
1345
|
-
if (isarray(value)) {
|
|
1346
|
-
if (!token.repeat) {
|
|
1347
|
-
throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`');
|
|
1348
|
-
}
|
|
1349
|
-
if (value.length === 0) {
|
|
1350
|
-
if (token.optional) {
|
|
1351
|
-
continue;
|
|
1352
|
-
} else {
|
|
1353
|
-
throw new TypeError('Expected "' + token.name + '" to not be empty');
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
for (var j = 0; j < value.length; j++) {
|
|
1357
|
-
segment = encode(value[j]);
|
|
1358
|
-
if (!matches[i].test(segment)) {
|
|
1359
|
-
throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`');
|
|
1360
|
-
}
|
|
1361
|
-
path += (j === 0 ? token.prefix : token.delimiter) + segment;
|
|
1362
|
-
}
|
|
1363
|
-
continue;
|
|
1364
|
-
}
|
|
1365
|
-
segment = token.asterisk ? encodeAsterisk(value) : encode(value);
|
|
1366
|
-
if (!matches[i].test(segment)) {
|
|
1367
|
-
throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"');
|
|
1368
|
-
}
|
|
1369
|
-
path += token.prefix + segment;
|
|
1370
|
-
}
|
|
1371
|
-
return path;
|
|
1372
|
-
};
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
|
-
/**
|
|
1376
|
-
* Escape a regular expression string.
|
|
1377
|
-
*
|
|
1378
|
-
* @param {string} str
|
|
1379
|
-
* @return {string}
|
|
1380
|
-
*/
|
|
1381
|
-
function escapeString(str) {
|
|
1382
|
-
return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1');
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
|
-
/**
|
|
1386
|
-
* Escape the capturing group by escaping special characters and meaning.
|
|
1387
|
-
*
|
|
1388
|
-
* @param {string} group
|
|
1389
|
-
* @return {string}
|
|
1390
|
-
*/
|
|
1391
|
-
function escapeGroup(group) {
|
|
1392
|
-
return group.replace(/([=!:$\/()])/g, '\\$1');
|
|
1393
|
-
}
|
|
1394
|
-
|
|
1395
|
-
/**
|
|
1396
|
-
* Attach the keys as a property of the regexp.
|
|
1397
|
-
*
|
|
1398
|
-
* @param {!RegExp} re
|
|
1399
|
-
* @param {Array} keys
|
|
1400
|
-
* @return {!RegExp}
|
|
1401
|
-
*/
|
|
1402
|
-
function attachKeys(re, keys) {
|
|
1403
|
-
re.keys = keys;
|
|
1404
|
-
return re;
|
|
1405
|
-
}
|
|
1406
|
-
|
|
1407
|
-
/**
|
|
1408
|
-
* Get the flags for a regexp from the options.
|
|
1409
|
-
*
|
|
1410
|
-
* @param {Object} options
|
|
1411
|
-
* @return {string}
|
|
1412
|
-
*/
|
|
1413
|
-
function flags(options) {
|
|
1414
|
-
return options && options.sensitive ? '' : 'i';
|
|
1415
|
-
}
|
|
1416
|
-
|
|
1417
|
-
/**
|
|
1418
|
-
* Pull out keys from a regexp.
|
|
1419
|
-
*
|
|
1420
|
-
* @param {!RegExp} path
|
|
1421
|
-
* @param {!Array} keys
|
|
1422
|
-
* @return {!RegExp}
|
|
1423
|
-
*/
|
|
1424
|
-
function regexpToRegexp(path, keys) {
|
|
1425
|
-
// Use a negative lookahead to match only capturing groups.
|
|
1426
|
-
var groups = path.source.match(/\((?!\?)/g);
|
|
1427
|
-
if (groups) {
|
|
1428
|
-
for (var i = 0; i < groups.length; i++) {
|
|
1429
|
-
keys.push({
|
|
1430
|
-
name: i,
|
|
1431
|
-
prefix: null,
|
|
1432
|
-
delimiter: null,
|
|
1433
|
-
optional: false,
|
|
1434
|
-
repeat: false,
|
|
1435
|
-
partial: false,
|
|
1436
|
-
asterisk: false,
|
|
1437
|
-
pattern: null
|
|
1438
|
-
});
|
|
1439
|
-
}
|
|
1440
|
-
}
|
|
1441
|
-
return attachKeys(path, keys);
|
|
1442
|
-
}
|
|
1443
|
-
|
|
1444
|
-
/**
|
|
1445
|
-
* Transform an array into a regexp.
|
|
1446
|
-
*
|
|
1447
|
-
* @param {!Array} path
|
|
1448
|
-
* @param {Array} keys
|
|
1449
|
-
* @param {!Object} options
|
|
1450
|
-
* @return {!RegExp}
|
|
1451
|
-
*/
|
|
1452
|
-
function arrayToRegexp(path, keys, options) {
|
|
1453
|
-
var parts = [];
|
|
1454
|
-
for (var i = 0; i < path.length; i++) {
|
|
1455
|
-
parts.push(pathToRegexp(path[i], keys, options).source);
|
|
1456
|
-
}
|
|
1457
|
-
var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
|
|
1458
|
-
return attachKeys(regexp, keys);
|
|
1459
|
-
}
|
|
1460
|
-
|
|
1461
|
-
/**
|
|
1462
|
-
* Create a path regexp from string input.
|
|
1463
|
-
*
|
|
1464
|
-
* @param {string} path
|
|
1465
|
-
* @param {!Array} keys
|
|
1466
|
-
* @param {!Object} options
|
|
1467
|
-
* @return {!RegExp}
|
|
1468
|
-
*/
|
|
1469
|
-
function stringToRegexp(path, keys, options) {
|
|
1470
|
-
return tokensToRegExp(parse(path, options), keys, options);
|
|
1471
|
-
}
|
|
1472
|
-
|
|
1473
|
-
/**
|
|
1474
|
-
* Expose a function for taking tokens and returning a RegExp.
|
|
1475
|
-
*
|
|
1476
|
-
* @param {!Array} tokens
|
|
1477
|
-
* @param {(Array|Object)=} keys
|
|
1478
|
-
* @param {Object=} options
|
|
1479
|
-
* @return {!RegExp}
|
|
1480
|
-
*/
|
|
1481
|
-
function tokensToRegExp(tokens, keys, options) {
|
|
1482
|
-
if (!isarray(keys)) {
|
|
1483
|
-
options = /** @type {!Object} */keys || options;
|
|
1484
|
-
keys = [];
|
|
1485
|
-
}
|
|
1486
|
-
options = options || {};
|
|
1487
|
-
var strict = options.strict;
|
|
1488
|
-
var end = options.end !== false;
|
|
1489
|
-
var route = '';
|
|
1490
|
-
|
|
1491
|
-
// Iterate over the tokens and create our regexp string.
|
|
1492
|
-
for (var i = 0; i < tokens.length; i++) {
|
|
1493
|
-
var token = tokens[i];
|
|
1494
|
-
if (typeof token === 'string') {
|
|
1495
|
-
route += escapeString(token);
|
|
1496
|
-
} else {
|
|
1497
|
-
var prefix = escapeString(token.prefix);
|
|
1498
|
-
var capture = '(?:' + token.pattern + ')';
|
|
1499
|
-
keys.push(token);
|
|
1500
|
-
if (token.repeat) {
|
|
1501
|
-
capture += '(?:' + prefix + capture + ')*';
|
|
1502
|
-
}
|
|
1503
|
-
if (token.optional) {
|
|
1504
|
-
if (!token.partial) {
|
|
1505
|
-
capture = '(?:' + prefix + '(' + capture + '))?';
|
|
1506
|
-
} else {
|
|
1507
|
-
capture = prefix + '(' + capture + ')?';
|
|
1508
|
-
}
|
|
1509
|
-
} else {
|
|
1510
|
-
capture = prefix + '(' + capture + ')';
|
|
1511
|
-
}
|
|
1512
|
-
route += capture;
|
|
1513
|
-
}
|
|
1514
|
-
}
|
|
1515
|
-
var delimiter = escapeString(options.delimiter || '/');
|
|
1516
|
-
var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
|
|
1517
|
-
|
|
1518
|
-
// In non-strict mode we allow a slash at the end of match. If the path to
|
|
1519
|
-
// match already ends with a slash, we remove it for consistency. The slash
|
|
1520
|
-
// is valid at the end of a path match, not in the middle. This is important
|
|
1521
|
-
// in non-ending mode, where "/test/" shouldn't match "/test//route".
|
|
1522
|
-
if (!strict) {
|
|
1523
|
-
route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
|
|
1524
|
-
}
|
|
1525
|
-
if (end) {
|
|
1526
|
-
route += '$';
|
|
1527
|
-
} else {
|
|
1528
|
-
// In non-ending mode, we need the capturing groups to match as much as
|
|
1529
|
-
// possible by using a positive lookahead to the end or next path segment.
|
|
1530
|
-
route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
|
|
1531
|
-
}
|
|
1532
|
-
return attachKeys(new RegExp('^' + route, flags(options)), keys);
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
|
-
/**
|
|
1536
|
-
* Normalize the given path string, returning a regular expression.
|
|
1537
|
-
*
|
|
1538
|
-
* An empty array can be passed in for the keys, which will hold the
|
|
1539
|
-
* placeholder key descriptions. For example, using `/user/:id`, `keys` will
|
|
1540
|
-
* contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
|
|
1541
|
-
*
|
|
1542
|
-
* @param {(string|RegExp|Array)} path
|
|
1543
|
-
* @param {(Array|Object)=} keys
|
|
1544
|
-
* @param {Object=} options
|
|
1545
|
-
* @return {!RegExp}
|
|
1546
|
-
*/
|
|
1547
|
-
function pathToRegexp(path, keys, options) {
|
|
1548
|
-
if (!isarray(keys)) {
|
|
1549
|
-
options = /** @type {!Object} */keys || options;
|
|
1550
|
-
keys = [];
|
|
1551
|
-
}
|
|
1552
|
-
options = options || {};
|
|
1553
|
-
if (path instanceof RegExp) {
|
|
1554
|
-
return regexpToRegexp(path, /** @type {!Array} */keys);
|
|
1555
|
-
}
|
|
1556
|
-
if (isarray(path)) {
|
|
1557
|
-
return arrayToRegexp( /** @type {!Array} */path, /** @type {!Array} */keys, options);
|
|
1558
|
-
}
|
|
1559
|
-
return stringToRegexp( /** @type {string} */path, /** @type {!Array} */keys, options);
|
|
1560
|
-
}
|
|
1561
|
-
|
|
1562
|
-
var reactIs$1 = {exports: {}};
|
|
1563
|
-
|
|
1564
|
-
var reactIs_production_min = {};
|
|
1565
|
-
|
|
1566
|
-
var b = "function" === typeof Symbol && Symbol["for"],
|
|
1567
|
-
c = b ? Symbol["for"]("react.element") : 60103,
|
|
1568
|
-
d = b ? Symbol["for"]("react.portal") : 60106,
|
|
1569
|
-
e = b ? Symbol["for"]("react.fragment") : 60107,
|
|
1570
|
-
f = b ? Symbol["for"]("react.strict_mode") : 60108,
|
|
1571
|
-
g = b ? Symbol["for"]("react.profiler") : 60114,
|
|
1572
|
-
h = b ? Symbol["for"]("react.provider") : 60109,
|
|
1573
|
-
k = b ? Symbol["for"]("react.context") : 60110,
|
|
1574
|
-
l = b ? Symbol["for"]("react.async_mode") : 60111,
|
|
1575
|
-
m = b ? Symbol["for"]("react.concurrent_mode") : 60111,
|
|
1576
|
-
n = b ? Symbol["for"]("react.forward_ref") : 60112,
|
|
1577
|
-
p = b ? Symbol["for"]("react.suspense") : 60113,
|
|
1578
|
-
q = b ? Symbol["for"]("react.suspense_list") : 60120,
|
|
1579
|
-
r = b ? Symbol["for"]("react.memo") : 60115,
|
|
1580
|
-
t = b ? Symbol["for"]("react.lazy") : 60116,
|
|
1581
|
-
v = b ? Symbol["for"]("react.block") : 60121,
|
|
1582
|
-
w = b ? Symbol["for"]("react.fundamental") : 60117,
|
|
1583
|
-
x = b ? Symbol["for"]("react.responder") : 60118,
|
|
1584
|
-
y = b ? Symbol["for"]("react.scope") : 60119;
|
|
1585
|
-
function z(a) {
|
|
1586
|
-
if ("object" === _typeof$1(a) && null !== a) {
|
|
1587
|
-
var u = a.$$typeof;
|
|
1588
|
-
switch (u) {
|
|
1589
|
-
case c:
|
|
1590
|
-
switch (a = a.type, a) {
|
|
1591
|
-
case l:
|
|
1592
|
-
case m:
|
|
1593
|
-
case e:
|
|
1594
|
-
case g:
|
|
1595
|
-
case f:
|
|
1596
|
-
case p:
|
|
1597
|
-
return a;
|
|
1598
|
-
default:
|
|
1599
|
-
switch (a = a && a.$$typeof, a) {
|
|
1600
|
-
case k:
|
|
1601
|
-
case n:
|
|
1602
|
-
case t:
|
|
1603
|
-
case r:
|
|
1604
|
-
case h:
|
|
1605
|
-
return a;
|
|
1606
|
-
default:
|
|
1607
|
-
return u;
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
case d:
|
|
1611
|
-
return u;
|
|
1612
|
-
}
|
|
1613
|
-
}
|
|
1614
|
-
}
|
|
1615
|
-
function A(a) {
|
|
1616
|
-
return z(a) === m;
|
|
1617
|
-
}
|
|
1618
|
-
reactIs_production_min.AsyncMode = l;
|
|
1619
|
-
reactIs_production_min.ConcurrentMode = m;
|
|
1620
|
-
reactIs_production_min.ContextConsumer = k;
|
|
1621
|
-
reactIs_production_min.ContextProvider = h;
|
|
1622
|
-
reactIs_production_min.Element = c;
|
|
1623
|
-
reactIs_production_min.ForwardRef = n;
|
|
1624
|
-
reactIs_production_min.Fragment = e;
|
|
1625
|
-
reactIs_production_min.Lazy = t;
|
|
1626
|
-
reactIs_production_min.Memo = r;
|
|
1627
|
-
reactIs_production_min.Portal = d;
|
|
1628
|
-
reactIs_production_min.Profiler = g;
|
|
1629
|
-
reactIs_production_min.StrictMode = f;
|
|
1630
|
-
reactIs_production_min.Suspense = p;
|
|
1631
|
-
reactIs_production_min.isAsyncMode = function (a) {
|
|
1632
|
-
return A(a) || z(a) === l;
|
|
1633
|
-
};
|
|
1634
|
-
reactIs_production_min.isConcurrentMode = A;
|
|
1635
|
-
reactIs_production_min.isContextConsumer = function (a) {
|
|
1636
|
-
return z(a) === k;
|
|
1637
|
-
};
|
|
1638
|
-
reactIs_production_min.isContextProvider = function (a) {
|
|
1639
|
-
return z(a) === h;
|
|
1640
|
-
};
|
|
1641
|
-
reactIs_production_min.isElement = function (a) {
|
|
1642
|
-
return "object" === _typeof$1(a) && null !== a && a.$$typeof === c;
|
|
1643
|
-
};
|
|
1644
|
-
reactIs_production_min.isForwardRef = function (a) {
|
|
1645
|
-
return z(a) === n;
|
|
1646
|
-
};
|
|
1647
|
-
reactIs_production_min.isFragment = function (a) {
|
|
1648
|
-
return z(a) === e;
|
|
1649
|
-
};
|
|
1650
|
-
reactIs_production_min.isLazy = function (a) {
|
|
1651
|
-
return z(a) === t;
|
|
1652
|
-
};
|
|
1653
|
-
reactIs_production_min.isMemo = function (a) {
|
|
1654
|
-
return z(a) === r;
|
|
1655
|
-
};
|
|
1656
|
-
reactIs_production_min.isPortal = function (a) {
|
|
1657
|
-
return z(a) === d;
|
|
1658
|
-
};
|
|
1659
|
-
reactIs_production_min.isProfiler = function (a) {
|
|
1660
|
-
return z(a) === g;
|
|
1661
|
-
};
|
|
1662
|
-
reactIs_production_min.isStrictMode = function (a) {
|
|
1663
|
-
return z(a) === f;
|
|
1664
|
-
};
|
|
1665
|
-
reactIs_production_min.isSuspense = function (a) {
|
|
1666
|
-
return z(a) === p;
|
|
1667
|
-
};
|
|
1668
|
-
reactIs_production_min.isValidElementType = function (a) {
|
|
1669
|
-
return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || a === q || "object" === _typeof$1(a) && null !== a && (a.$$typeof === t || a.$$typeof === r || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n || a.$$typeof === w || a.$$typeof === x || a.$$typeof === y || a.$$typeof === v);
|
|
1670
|
-
};
|
|
1671
|
-
reactIs_production_min.typeOf = z;
|
|
1672
|
-
|
|
1673
|
-
(function (module) {
|
|
1674
|
-
|
|
1675
|
-
{
|
|
1676
|
-
module.exports = reactIs_production_min;
|
|
1677
|
-
}
|
|
1678
|
-
})(reactIs$1);
|
|
1679
|
-
|
|
1680
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
1681
|
-
if (source == null) return {};
|
|
1682
|
-
var target = {};
|
|
1683
|
-
var sourceKeys = Object.keys(source);
|
|
1684
|
-
var key, i;
|
|
1685
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
1686
|
-
key = sourceKeys[i];
|
|
1687
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
1688
|
-
target[key] = source[key];
|
|
1689
|
-
}
|
|
1690
|
-
return target;
|
|
1691
|
-
}
|
|
1692
|
-
|
|
1693
|
-
var reactIs = reactIs$1.exports;
|
|
1694
|
-
var FORWARD_REF_STATICS = {
|
|
1695
|
-
'$$typeof': true,
|
|
1696
|
-
render: true,
|
|
1697
|
-
defaultProps: true,
|
|
1698
|
-
displayName: true,
|
|
1699
|
-
propTypes: true
|
|
1700
|
-
};
|
|
1701
|
-
var MEMO_STATICS = {
|
|
1702
|
-
'$$typeof': true,
|
|
1703
|
-
compare: true,
|
|
1704
|
-
defaultProps: true,
|
|
1705
|
-
displayName: true,
|
|
1706
|
-
propTypes: true,
|
|
1707
|
-
type: true
|
|
1708
|
-
};
|
|
1709
|
-
var TYPE_STATICS = {};
|
|
1710
|
-
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
|
|
1711
|
-
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
|
|
1712
|
-
|
|
1713
|
-
// TODO: Replace with React.createContext once we can assume React 16+
|
|
1714
|
-
|
|
1715
|
-
var createNamedContext = function createNamedContext(name) {
|
|
1716
|
-
var context = index();
|
|
1717
|
-
context.displayName = name;
|
|
1718
|
-
return context;
|
|
1719
|
-
};
|
|
1720
|
-
var historyContext = /*#__PURE__*/createNamedContext("Router-History");
|
|
1721
|
-
var context = /*#__PURE__*/createNamedContext("Router");
|
|
1722
|
-
|
|
1723
|
-
/**
|
|
1724
|
-
* The public API for putting history on context.
|
|
1725
|
-
*/
|
|
1726
|
-
|
|
1727
|
-
var Router = /*#__PURE__*/function (_React$Component) {
|
|
1728
|
-
_inheritsLoose$1(Router, _React$Component);
|
|
1729
|
-
Router.computeRootMatch = function computeRootMatch(pathname) {
|
|
1730
|
-
return {
|
|
1731
|
-
path: "/",
|
|
1732
|
-
url: "/",
|
|
1733
|
-
params: {},
|
|
1734
|
-
isExact: pathname === "/"
|
|
1735
|
-
};
|
|
1736
|
-
};
|
|
1737
|
-
function Router(props) {
|
|
1738
|
-
var _this;
|
|
1739
|
-
_this = _React$Component.call(this, props) || this;
|
|
1740
|
-
_this.state = {
|
|
1741
|
-
location: props.history.location
|
|
1742
|
-
}; // This is a bit of a hack. We have to start listening for location
|
|
1743
|
-
// changes here in the constructor in case there are any <Redirect>s
|
|
1744
|
-
// on the initial render. If there are, they will replace/push when
|
|
1745
|
-
// they mount and since cDM fires in children before parents, we may
|
|
1746
|
-
// get a new location before the <Router> is mounted.
|
|
1747
|
-
|
|
1748
|
-
_this._isMounted = false;
|
|
1749
|
-
_this._pendingLocation = null;
|
|
1750
|
-
if (!props.staticContext) {
|
|
1751
|
-
_this.unlisten = props.history.listen(function (location) {
|
|
1752
|
-
_this._pendingLocation = location;
|
|
1753
|
-
});
|
|
1754
|
-
}
|
|
1755
|
-
return _this;
|
|
1756
|
-
}
|
|
1757
|
-
var _proto = Router.prototype;
|
|
1758
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
1759
|
-
var _this2 = this;
|
|
1760
|
-
this._isMounted = true;
|
|
1761
|
-
if (this.unlisten) {
|
|
1762
|
-
// Any pre-mount location changes have been captured at
|
|
1763
|
-
// this point, so unregister the listener.
|
|
1764
|
-
this.unlisten();
|
|
1765
|
-
}
|
|
1766
|
-
if (!this.props.staticContext) {
|
|
1767
|
-
this.unlisten = this.props.history.listen(function (location) {
|
|
1768
|
-
if (_this2._isMounted) {
|
|
1769
|
-
_this2.setState({
|
|
1770
|
-
location: location
|
|
1771
|
-
});
|
|
1772
|
-
}
|
|
1773
|
-
});
|
|
1774
|
-
}
|
|
1775
|
-
if (this._pendingLocation) {
|
|
1776
|
-
this.setState({
|
|
1777
|
-
location: this._pendingLocation
|
|
1778
|
-
});
|
|
1779
|
-
}
|
|
1780
|
-
};
|
|
1781
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
1782
|
-
if (this.unlisten) {
|
|
1783
|
-
this.unlisten();
|
|
1784
|
-
this._isMounted = false;
|
|
1785
|
-
this._pendingLocation = null;
|
|
1786
|
-
}
|
|
1787
|
-
};
|
|
1788
|
-
_proto.render = function render() {
|
|
1789
|
-
return /*#__PURE__*/React__default["default"].createElement(context.Provider, {
|
|
1790
|
-
value: {
|
|
1791
|
-
history: this.props.history,
|
|
1792
|
-
location: this.state.location,
|
|
1793
|
-
match: Router.computeRootMatch(this.state.location.pathname),
|
|
1794
|
-
staticContext: this.props.staticContext
|
|
1795
|
-
}
|
|
1796
|
-
}, /*#__PURE__*/React__default["default"].createElement(historyContext.Provider, {
|
|
1797
|
-
children: this.props.children || null,
|
|
1798
|
-
value: this.props.history
|
|
1799
|
-
}));
|
|
1800
|
-
};
|
|
1801
|
-
return Router;
|
|
1802
|
-
}(React__default["default"].Component);
|
|
1803
|
-
|
|
1804
|
-
/**
|
|
1805
|
-
* The public API for a <Router> that stores location in memory.
|
|
1806
|
-
*/
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1807
4
|
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
});
|
|
1825
|
-
};
|
|
1826
|
-
return MemoryRouter;
|
|
1827
|
-
})(React__default["default"].Component);
|
|
1828
|
-
/*#__PURE__*/(function (_React$Component) {
|
|
1829
|
-
_inheritsLoose$1(Lifecycle, _React$Component);
|
|
1830
|
-
function Lifecycle() {
|
|
1831
|
-
return _React$Component.apply(this, arguments) || this;
|
|
1832
|
-
}
|
|
1833
|
-
var _proto = Lifecycle.prototype;
|
|
1834
|
-
_proto.componentDidMount = function componentDidMount() {
|
|
1835
|
-
if (this.props.onMount) this.props.onMount.call(this, this);
|
|
1836
|
-
};
|
|
1837
|
-
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
1838
|
-
if (this.props.onUpdate) this.props.onUpdate.call(this, this, prevProps);
|
|
1839
|
-
};
|
|
1840
|
-
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
1841
|
-
if (this.props.onUnmount) this.props.onUnmount.call(this, this);
|
|
1842
|
-
};
|
|
1843
|
-
_proto.render = function render() {
|
|
1844
|
-
return null;
|
|
1845
|
-
};
|
|
1846
|
-
return Lifecycle;
|
|
1847
|
-
})(React__default["default"].Component);
|
|
1848
|
-
var cache$1 = {};
|
|
1849
|
-
var cacheLimit$1 = 10000;
|
|
1850
|
-
var cacheCount$1 = 0;
|
|
1851
|
-
function compilePath$1(path, options) {
|
|
1852
|
-
var cacheKey = "" + options.end + options.strict + options.sensitive;
|
|
1853
|
-
var pathCache = cache$1[cacheKey] || (cache$1[cacheKey] = {});
|
|
1854
|
-
if (pathCache[path]) return pathCache[path];
|
|
1855
|
-
var keys = [];
|
|
1856
|
-
var regexp = pathToRegexp$1.exports(path, keys, options);
|
|
1857
|
-
var result = {
|
|
1858
|
-
regexp: regexp,
|
|
1859
|
-
keys: keys
|
|
1860
|
-
};
|
|
1861
|
-
if (cacheCount$1 < cacheLimit$1) {
|
|
1862
|
-
pathCache[path] = result;
|
|
1863
|
-
cacheCount$1++;
|
|
1864
|
-
}
|
|
1865
|
-
return result;
|
|
1866
|
-
}
|
|
1867
|
-
/**
|
|
1868
|
-
* Public API for matching a URL pathname to a path.
|
|
1869
|
-
*/
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var reactRouterDom = require('react-router-dom');
|
|
7
|
+
var classNames = require('classnames');
|
|
8
|
+
var formik = require('formik');
|
|
9
|
+
var neetoCist = require('@bigbinary/neeto-cist');
|
|
10
|
+
var formik$1 = require('@bigbinary/neetoui/formik');
|
|
11
|
+
var i18next = require('i18next');
|
|
12
|
+
var yup = require('yup');
|
|
13
|
+
var neetoEditor = require('@bigbinary/neeto-editor');
|
|
14
|
+
var PageLoader = require('@bigbinary/neeto-molecules/PageLoader');
|
|
15
|
+
var neetoui = require('@bigbinary/neetoui');
|
|
16
|
+
var reactI18next = require('react-i18next');
|
|
17
|
+
var neetoIcons = require('@bigbinary/neeto-icons');
|
|
18
|
+
var ramda = require('ramda');
|
|
19
|
+
var utils = require('@bigbinary/neeto-commons-frontend/utils');
|
|
20
|
+
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
1870
21
|
|
|
1871
|
-
function
|
|
1872
|
-
if (options === void 0) {
|
|
1873
|
-
options = {};
|
|
1874
|
-
}
|
|
1875
|
-
if (typeof options === "string" || Array.isArray(options)) {
|
|
1876
|
-
options = {
|
|
1877
|
-
path: options
|
|
1878
|
-
};
|
|
1879
|
-
}
|
|
1880
|
-
var _options = options,
|
|
1881
|
-
path = _options.path,
|
|
1882
|
-
_options$exact = _options.exact,
|
|
1883
|
-
exact = _options$exact === void 0 ? false : _options$exact,
|
|
1884
|
-
_options$strict = _options.strict,
|
|
1885
|
-
strict = _options$strict === void 0 ? false : _options$strict,
|
|
1886
|
-
_options$sensitive = _options.sensitive,
|
|
1887
|
-
sensitive = _options$sensitive === void 0 ? false : _options$sensitive;
|
|
1888
|
-
var paths = [].concat(path);
|
|
1889
|
-
return paths.reduce(function (matched, path) {
|
|
1890
|
-
if (!path && path !== "") return null;
|
|
1891
|
-
if (matched) return matched;
|
|
1892
|
-
var _compilePath = compilePath$1(path, {
|
|
1893
|
-
end: exact,
|
|
1894
|
-
strict: strict,
|
|
1895
|
-
sensitive: sensitive
|
|
1896
|
-
}),
|
|
1897
|
-
regexp = _compilePath.regexp,
|
|
1898
|
-
keys = _compilePath.keys;
|
|
1899
|
-
var match = regexp.exec(pathname);
|
|
1900
|
-
if (!match) return null;
|
|
1901
|
-
var url = match[0],
|
|
1902
|
-
values = match.slice(1);
|
|
1903
|
-
var isExact = pathname === url;
|
|
1904
|
-
if (exact && !isExact) return null;
|
|
1905
|
-
return {
|
|
1906
|
-
path: path,
|
|
1907
|
-
// the path used to match
|
|
1908
|
-
url: path === "/" && url === "" ? "/" : url,
|
|
1909
|
-
// the matched portion of the URL
|
|
1910
|
-
isExact: isExact,
|
|
1911
|
-
// whether or not we matched exactly
|
|
1912
|
-
params: keys.reduce(function (memo, key, index) {
|
|
1913
|
-
memo[key.name] = values[index];
|
|
1914
|
-
return memo;
|
|
1915
|
-
}, {})
|
|
1916
|
-
};
|
|
1917
|
-
}, null);
|
|
1918
|
-
}
|
|
1919
|
-
function isEmptyChildren(children) {
|
|
1920
|
-
return React__default["default"].Children.count(children) === 0;
|
|
1921
|
-
}
|
|
1922
|
-
/**
|
|
1923
|
-
* The public API for matching a single path and rendering.
|
|
1924
|
-
*/
|
|
22
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
1925
23
|
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
var match = _this.props.computedMatch ? _this.props.computedMatch // <Switch> already computed the match for us
|
|
1938
|
-
: _this.props.path ? matchPath(location.pathname, _this.props) : context$1.match;
|
|
1939
|
-
var props = _extends({}, context$1, {
|
|
1940
|
-
location: location,
|
|
1941
|
-
match: match
|
|
1942
|
-
});
|
|
1943
|
-
var _this$props = _this.props,
|
|
1944
|
-
children = _this$props.children,
|
|
1945
|
-
component = _this$props.component,
|
|
1946
|
-
render = _this$props.render; // Preact uses an empty array as children by
|
|
1947
|
-
// default, so use null if that's the case.
|
|
1948
|
-
|
|
1949
|
-
if (Array.isArray(children) && isEmptyChildren(children)) {
|
|
1950
|
-
children = null;
|
|
24
|
+
function _interopNamespace(e) {
|
|
25
|
+
if (e && e.__esModule) return e;
|
|
26
|
+
var n = Object.create(null);
|
|
27
|
+
if (e) {
|
|
28
|
+
Object.keys(e).forEach(function (k) {
|
|
29
|
+
if (k !== 'default') {
|
|
30
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
31
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () { return e[k]; }
|
|
34
|
+
});
|
|
1951
35
|
}
|
|
1952
|
-
return /*#__PURE__*/React__default["default"].createElement(context.Provider, {
|
|
1953
|
-
value: props
|
|
1954
|
-
}, props.match ? children ? typeof children === "function" ? children(props) : children : component ? /*#__PURE__*/React__default["default"].createElement(component, props) : render ? render(props) : null : typeof children === "function" ? children(props) : null);
|
|
1955
|
-
});
|
|
1956
|
-
};
|
|
1957
|
-
return Route;
|
|
1958
|
-
})(React__default["default"].Component);
|
|
1959
|
-
function addLeadingSlash(path) {
|
|
1960
|
-
return path.charAt(0) === "/" ? path : "/" + path;
|
|
1961
|
-
}
|
|
1962
|
-
function addBasename(basename, location) {
|
|
1963
|
-
if (!basename) return location;
|
|
1964
|
-
return _extends({}, location, {
|
|
1965
|
-
pathname: addLeadingSlash(basename) + location.pathname
|
|
1966
|
-
});
|
|
1967
|
-
}
|
|
1968
|
-
function stripBasename(basename, location) {
|
|
1969
|
-
if (!basename) return location;
|
|
1970
|
-
var base = addLeadingSlash(basename);
|
|
1971
|
-
if (location.pathname.indexOf(base) !== 0) return location;
|
|
1972
|
-
return _extends({}, location, {
|
|
1973
|
-
pathname: location.pathname.substr(base.length)
|
|
1974
|
-
});
|
|
1975
|
-
}
|
|
1976
|
-
function createURL(location) {
|
|
1977
|
-
return typeof location === "string" ? location : createPath(location);
|
|
1978
|
-
}
|
|
1979
|
-
function staticHandler(methodName) {
|
|
1980
|
-
return function () {
|
|
1981
|
-
invariant(false);
|
|
1982
|
-
};
|
|
1983
|
-
}
|
|
1984
|
-
function noop() {}
|
|
1985
|
-
/**
|
|
1986
|
-
* The public top-level API for a "static" <Router>, so-called because it
|
|
1987
|
-
* can't actually change the current location. Instead, it just records
|
|
1988
|
-
* location changes in a context object. Useful mainly in testing and
|
|
1989
|
-
* server-rendering scenarios.
|
|
1990
|
-
*/
|
|
1991
|
-
|
|
1992
|
-
/*#__PURE__*/(function (_React$Component) {
|
|
1993
|
-
_inheritsLoose$1(StaticRouter, _React$Component);
|
|
1994
|
-
function StaticRouter() {
|
|
1995
|
-
var _this;
|
|
1996
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1997
|
-
args[_key] = arguments[_key];
|
|
1998
|
-
}
|
|
1999
|
-
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
2000
|
-
_this.handlePush = function (location) {
|
|
2001
|
-
return _this.navigateTo(location, "PUSH");
|
|
2002
|
-
};
|
|
2003
|
-
_this.handleReplace = function (location) {
|
|
2004
|
-
return _this.navigateTo(location, "REPLACE");
|
|
2005
|
-
};
|
|
2006
|
-
_this.handleListen = function () {
|
|
2007
|
-
return noop;
|
|
2008
|
-
};
|
|
2009
|
-
_this.handleBlock = function () {
|
|
2010
|
-
return noop;
|
|
2011
|
-
};
|
|
2012
|
-
return _this;
|
|
2013
|
-
}
|
|
2014
|
-
var _proto = StaticRouter.prototype;
|
|
2015
|
-
_proto.navigateTo = function navigateTo(location, action) {
|
|
2016
|
-
var _this$props = this.props,
|
|
2017
|
-
_this$props$basename = _this$props.basename,
|
|
2018
|
-
basename = _this$props$basename === void 0 ? "" : _this$props$basename,
|
|
2019
|
-
_this$props$context = _this$props.context,
|
|
2020
|
-
context = _this$props$context === void 0 ? {} : _this$props$context;
|
|
2021
|
-
context.action = action;
|
|
2022
|
-
context.location = addBasename(basename, createLocation(location));
|
|
2023
|
-
context.url = createURL(context.location);
|
|
2024
|
-
};
|
|
2025
|
-
_proto.render = function render() {
|
|
2026
|
-
var _this$props2 = this.props,
|
|
2027
|
-
_this$props2$basename = _this$props2.basename,
|
|
2028
|
-
basename = _this$props2$basename === void 0 ? "" : _this$props2$basename,
|
|
2029
|
-
_this$props2$context = _this$props2.context,
|
|
2030
|
-
context = _this$props2$context === void 0 ? {} : _this$props2$context,
|
|
2031
|
-
_this$props2$location = _this$props2.location,
|
|
2032
|
-
location = _this$props2$location === void 0 ? "/" : _this$props2$location,
|
|
2033
|
-
rest = _objectWithoutPropertiesLoose(_this$props2, ["basename", "context", "location"]);
|
|
2034
|
-
var history = {
|
|
2035
|
-
createHref: function createHref(path) {
|
|
2036
|
-
return addLeadingSlash(basename + createURL(path));
|
|
2037
|
-
},
|
|
2038
|
-
action: "POP",
|
|
2039
|
-
location: stripBasename(basename, createLocation(location)),
|
|
2040
|
-
push: this.handlePush,
|
|
2041
|
-
replace: this.handleReplace,
|
|
2042
|
-
go: staticHandler(),
|
|
2043
|
-
goBack: staticHandler(),
|
|
2044
|
-
goForward: staticHandler(),
|
|
2045
|
-
listen: this.handleListen,
|
|
2046
|
-
block: this.handleBlock
|
|
2047
|
-
};
|
|
2048
|
-
return /*#__PURE__*/React__default["default"].createElement(Router, _extends({}, rest, {
|
|
2049
|
-
history: history,
|
|
2050
|
-
staticContext: context
|
|
2051
|
-
}));
|
|
2052
|
-
};
|
|
2053
|
-
return StaticRouter;
|
|
2054
|
-
})(React__default["default"].Component);
|
|
2055
|
-
|
|
2056
|
-
/**
|
|
2057
|
-
* The public API for rendering the first <Route> that matches.
|
|
2058
|
-
*/
|
|
2059
|
-
|
|
2060
|
-
/*#__PURE__*/(function (_React$Component) {
|
|
2061
|
-
_inheritsLoose$1(Switch, _React$Component);
|
|
2062
|
-
function Switch() {
|
|
2063
|
-
return _React$Component.apply(this, arguments) || this;
|
|
2064
|
-
}
|
|
2065
|
-
var _proto = Switch.prototype;
|
|
2066
|
-
_proto.render = function render() {
|
|
2067
|
-
var _this = this;
|
|
2068
|
-
return /*#__PURE__*/React__default["default"].createElement(context.Consumer, null, function (context) {
|
|
2069
|
-
!context ? invariant(false) : void 0;
|
|
2070
|
-
var location = _this.props.location || context.location;
|
|
2071
|
-
var element, match; // We use React.Children.forEach instead of React.Children.toArray().find()
|
|
2072
|
-
// here because toArray adds keys to all child elements and we do not want
|
|
2073
|
-
// to trigger an unmount/remount for two <Route>s that render the same
|
|
2074
|
-
// component at different URLs.
|
|
2075
|
-
|
|
2076
|
-
React__default["default"].Children.forEach(_this.props.children, function (child) {
|
|
2077
|
-
if (match == null && /*#__PURE__*/React__default["default"].isValidElement(child)) {
|
|
2078
|
-
element = child;
|
|
2079
|
-
var path = child.props.path || child.props.from;
|
|
2080
|
-
match = path ? matchPath(location.pathname, _extends({}, child.props, {
|
|
2081
|
-
path: path
|
|
2082
|
-
})) : context.match;
|
|
2083
|
-
}
|
|
2084
|
-
});
|
|
2085
|
-
return match ? /*#__PURE__*/React__default["default"].cloneElement(element, {
|
|
2086
|
-
location: location,
|
|
2087
|
-
computedMatch: match
|
|
2088
|
-
}) : null;
|
|
2089
|
-
});
|
|
2090
|
-
};
|
|
2091
|
-
return Switch;
|
|
2092
|
-
})(React__default["default"].Component);
|
|
2093
|
-
React__default["default"].useContext;
|
|
2094
|
-
|
|
2095
|
-
/**
|
|
2096
|
-
* The public API for a <Router> that uses HTML5 history.
|
|
2097
|
-
*/
|
|
2098
|
-
|
|
2099
|
-
var BrowserRouter = /*#__PURE__*/function (_React$Component) {
|
|
2100
|
-
_inheritsLoose$1(BrowserRouter, _React$Component);
|
|
2101
|
-
function BrowserRouter() {
|
|
2102
|
-
var _this;
|
|
2103
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2104
|
-
args[_key] = arguments[_key];
|
|
2105
|
-
}
|
|
2106
|
-
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
2107
|
-
_this.history = createBrowserHistory(_this.props);
|
|
2108
|
-
return _this;
|
|
2109
|
-
}
|
|
2110
|
-
var _proto = BrowserRouter.prototype;
|
|
2111
|
-
_proto.render = function render() {
|
|
2112
|
-
return /*#__PURE__*/React__default["default"].createElement(Router, {
|
|
2113
|
-
history: this.history,
|
|
2114
|
-
children: this.props.children
|
|
2115
36
|
});
|
|
2116
|
-
};
|
|
2117
|
-
return BrowserRouter;
|
|
2118
|
-
}(React__default["default"].Component);
|
|
2119
|
-
|
|
2120
|
-
/**
|
|
2121
|
-
* The public API for a <Router> that uses window.location.hash.
|
|
2122
|
-
*/
|
|
2123
|
-
|
|
2124
|
-
/*#__PURE__*/(function (_React$Component) {
|
|
2125
|
-
_inheritsLoose$1(HashRouter, _React$Component);
|
|
2126
|
-
function HashRouter() {
|
|
2127
|
-
var _this;
|
|
2128
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2129
|
-
args[_key] = arguments[_key];
|
|
2130
|
-
}
|
|
2131
|
-
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
2132
|
-
_this.history = createHashHistory(_this.props);
|
|
2133
|
-
return _this;
|
|
2134
37
|
}
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
return /*#__PURE__*/React__default["default"].createElement(Router, {
|
|
2138
|
-
history: this.history,
|
|
2139
|
-
children: this.props.children
|
|
2140
|
-
});
|
|
2141
|
-
};
|
|
2142
|
-
return HashRouter;
|
|
2143
|
-
})(React__default["default"].Component);
|
|
2144
|
-
var resolveToLocation = function resolveToLocation(to, currentLocation) {
|
|
2145
|
-
return typeof to === "function" ? to(currentLocation) : to;
|
|
2146
|
-
};
|
|
2147
|
-
var normalizeToLocation = function normalizeToLocation(to, currentLocation) {
|
|
2148
|
-
return typeof to === "string" ? createLocation(to, null, null, currentLocation) : to;
|
|
2149
|
-
};
|
|
2150
|
-
var forwardRefShim = function forwardRefShim(C) {
|
|
2151
|
-
return C;
|
|
2152
|
-
};
|
|
2153
|
-
var forwardRef = React__default["default"].forwardRef;
|
|
2154
|
-
if (typeof forwardRef === "undefined") {
|
|
2155
|
-
forwardRef = forwardRefShim;
|
|
2156
|
-
}
|
|
2157
|
-
function isModifiedEvent(event) {
|
|
2158
|
-
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
|
38
|
+
n["default"] = e;
|
|
39
|
+
return Object.freeze(n);
|
|
2159
40
|
}
|
|
2160
|
-
var LinkAnchor = forwardRef(function (_ref, forwardedRef) {
|
|
2161
|
-
var innerRef = _ref.innerRef,
|
|
2162
|
-
navigate = _ref.navigate,
|
|
2163
|
-
_onClick = _ref.onClick,
|
|
2164
|
-
rest = _objectWithoutPropertiesLoose(_ref, ["innerRef", "navigate", "onClick"]);
|
|
2165
|
-
var target = rest.target;
|
|
2166
|
-
var props = _extends({}, rest, {
|
|
2167
|
-
onClick: function onClick(event) {
|
|
2168
|
-
try {
|
|
2169
|
-
if (_onClick) _onClick(event);
|
|
2170
|
-
} catch (ex) {
|
|
2171
|
-
event.preventDefault();
|
|
2172
|
-
throw ex;
|
|
2173
|
-
}
|
|
2174
|
-
if (!event.defaultPrevented &&
|
|
2175
|
-
// onClick prevented default
|
|
2176
|
-
event.button === 0 && (
|
|
2177
|
-
// ignore everything but left clicks
|
|
2178
|
-
!target || target === "_self") &&
|
|
2179
|
-
// let browser handle "target=_blank" etc.
|
|
2180
|
-
!isModifiedEvent(event) // ignore clicks with modifier keys
|
|
2181
|
-
) {
|
|
2182
|
-
event.preventDefault();
|
|
2183
|
-
navigate();
|
|
2184
|
-
}
|
|
2185
|
-
}
|
|
2186
|
-
}); // React 15 compat
|
|
2187
41
|
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
}
|
|
2193
|
-
/* eslint-disable-next-line jsx-a11y/anchor-has-content */
|
|
42
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
43
|
+
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
44
|
+
var yup__namespace = /*#__PURE__*/_interopNamespace(yup);
|
|
45
|
+
var PageLoader__default = /*#__PURE__*/_interopDefaultLegacy(PageLoader);
|
|
2194
46
|
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
* The public API for rendering a history-aware <a>.
|
|
2199
|
-
*/
|
|
47
|
+
function _objectDestructuringEmpty(obj) {
|
|
48
|
+
if (obj == null) throw new TypeError("Cannot destructure " + obj);
|
|
49
|
+
}
|
|
2200
50
|
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
component = _ref2$component === void 0 ? LinkAnchor : _ref2$component,
|
|
2204
|
-
replace = _ref2.replace,
|
|
2205
|
-
to = _ref2.to,
|
|
2206
|
-
innerRef = _ref2.innerRef,
|
|
2207
|
-
rest = _objectWithoutPropertiesLoose(_ref2, ["component", "replace", "to", "innerRef"]);
|
|
2208
|
-
return /*#__PURE__*/React__default["default"].createElement(context.Consumer, null, function (context) {
|
|
2209
|
-
!context ? invariant(false) : void 0;
|
|
2210
|
-
var history = context.history;
|
|
2211
|
-
var location = normalizeToLocation(resolveToLocation(to, context.location), context.location);
|
|
2212
|
-
var href = location ? history.createHref(location) : "";
|
|
2213
|
-
var props = _extends({}, rest, {
|
|
2214
|
-
href: href,
|
|
2215
|
-
navigate: function navigate() {
|
|
2216
|
-
var location = resolveToLocation(to, context.location);
|
|
2217
|
-
var isDuplicateNavigation = createPath(context.location) === createPath(normalizeToLocation(location));
|
|
2218
|
-
var method = replace || isDuplicateNavigation ? history.replace : history.push;
|
|
2219
|
-
method(location);
|
|
2220
|
-
}
|
|
2221
|
-
}); // React 15 compat
|
|
51
|
+
function _typeof$1(obj) {
|
|
52
|
+
"@babel/helpers - typeof";
|
|
2222
53
|
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
return /*#__PURE__*/React__default["default"].createElement(component, props);
|
|
2229
|
-
});
|
|
2230
|
-
});
|
|
2231
|
-
var forwardRefShim$1 = function forwardRefShim(C) {
|
|
2232
|
-
return C;
|
|
2233
|
-
};
|
|
2234
|
-
var forwardRef$1 = React__default["default"].forwardRef;
|
|
2235
|
-
if (typeof forwardRef$1 === "undefined") {
|
|
2236
|
-
forwardRef$1 = forwardRefShim$1;
|
|
2237
|
-
}
|
|
2238
|
-
function joinClassnames() {
|
|
2239
|
-
for (var _len = arguments.length, classnames = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2240
|
-
classnames[_key] = arguments[_key];
|
|
2241
|
-
}
|
|
2242
|
-
return classnames.filter(function (i) {
|
|
2243
|
-
return i;
|
|
2244
|
-
}).join(" ");
|
|
54
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
55
|
+
return typeof obj;
|
|
56
|
+
} : function (obj) {
|
|
57
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
58
|
+
}, _typeof$1(obj);
|
|
2245
59
|
}
|
|
2246
|
-
/**
|
|
2247
|
-
* A <Link> wrapper that knows if it's "active" or not.
|
|
2248
|
-
*/
|
|
2249
|
-
|
|
2250
|
-
forwardRef$1(function (_ref, forwardedRef) {
|
|
2251
|
-
var _ref$ariaCurrent = _ref["aria-current"],
|
|
2252
|
-
ariaCurrent = _ref$ariaCurrent === void 0 ? "page" : _ref$ariaCurrent,
|
|
2253
|
-
_ref$activeClassName = _ref.activeClassName,
|
|
2254
|
-
activeClassName = _ref$activeClassName === void 0 ? "active" : _ref$activeClassName,
|
|
2255
|
-
activeStyle = _ref.activeStyle,
|
|
2256
|
-
classNameProp = _ref.className,
|
|
2257
|
-
exact = _ref.exact,
|
|
2258
|
-
isActiveProp = _ref.isActive,
|
|
2259
|
-
locationProp = _ref.location,
|
|
2260
|
-
sensitive = _ref.sensitive,
|
|
2261
|
-
strict = _ref.strict,
|
|
2262
|
-
styleProp = _ref.style,
|
|
2263
|
-
to = _ref.to,
|
|
2264
|
-
innerRef = _ref.innerRef,
|
|
2265
|
-
rest = _objectWithoutPropertiesLoose(_ref, ["aria-current", "activeClassName", "activeStyle", "className", "exact", "isActive", "location", "sensitive", "strict", "style", "to", "innerRef"]);
|
|
2266
|
-
return /*#__PURE__*/React__default["default"].createElement(context.Consumer, null, function (context) {
|
|
2267
|
-
!context ? invariant(false) : void 0;
|
|
2268
|
-
var currentLocation = locationProp || context.location;
|
|
2269
|
-
var toLocation = normalizeToLocation(resolveToLocation(to, currentLocation), currentLocation);
|
|
2270
|
-
var path = toLocation.pathname; // Regex taken from: https://github.com/pillarjs/path-to-regexp/blob/master/index.js#L202
|
|
2271
|
-
|
|
2272
|
-
var escapedPath = path && path.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
|
|
2273
|
-
var match = escapedPath ? matchPath(currentLocation.pathname, {
|
|
2274
|
-
path: escapedPath,
|
|
2275
|
-
exact: exact,
|
|
2276
|
-
sensitive: sensitive,
|
|
2277
|
-
strict: strict
|
|
2278
|
-
}) : null;
|
|
2279
|
-
var isActive = !!(isActiveProp ? isActiveProp(match, currentLocation) : match);
|
|
2280
|
-
var className = typeof classNameProp === "function" ? classNameProp(isActive) : classNameProp;
|
|
2281
|
-
var style = typeof styleProp === "function" ? styleProp(isActive) : styleProp;
|
|
2282
|
-
if (isActive) {
|
|
2283
|
-
className = joinClassnames(className, activeClassName);
|
|
2284
|
-
style = _extends({}, style, activeStyle);
|
|
2285
|
-
}
|
|
2286
|
-
var props = _extends({
|
|
2287
|
-
"aria-current": isActive && ariaCurrent || null,
|
|
2288
|
-
className: className,
|
|
2289
|
-
style: style,
|
|
2290
|
-
to: toLocation
|
|
2291
|
-
}, rest); // React 15 compat
|
|
2292
|
-
|
|
2293
|
-
if (forwardRefShim$1 !== forwardRef$1) {
|
|
2294
|
-
props.ref = forwardedRef || innerRef;
|
|
2295
|
-
} else {
|
|
2296
|
-
props.innerRef = innerRef;
|
|
2297
|
-
}
|
|
2298
|
-
return /*#__PURE__*/React__default["default"].createElement(Link, props);
|
|
2299
|
-
});
|
|
2300
|
-
});
|
|
2301
60
|
|
|
2302
61
|
function _toPrimitive(input, hint) {
|
|
2303
62
|
if (_typeof$1(input) !== "object" || input === null) return input;
|
|
@@ -2330,6 +89,19 @@ function _defineProperty(obj, key, value) {
|
|
|
2330
89
|
return obj;
|
|
2331
90
|
}
|
|
2332
91
|
|
|
92
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
93
|
+
if (source == null) return {};
|
|
94
|
+
var target = {};
|
|
95
|
+
var sourceKeys = Object.keys(source);
|
|
96
|
+
var key, i;
|
|
97
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
98
|
+
key = sourceKeys[i];
|
|
99
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
100
|
+
target[key] = source[key];
|
|
101
|
+
}
|
|
102
|
+
return target;
|
|
103
|
+
}
|
|
104
|
+
|
|
2333
105
|
function _objectWithoutProperties(source, excluded) {
|
|
2334
106
|
if (source == null) return {};
|
|
2335
107
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
@@ -2359,376 +131,473 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
2359
131
|
} else {
|
|
2360
132
|
Promise.resolve(value).then(_next, _throw);
|
|
2361
133
|
}
|
|
2362
|
-
}
|
|
2363
|
-
function _asyncToGenerator(fn) {
|
|
2364
|
-
return function () {
|
|
2365
|
-
var self = this,
|
|
2366
|
-
args = arguments;
|
|
2367
|
-
return new Promise(function (resolve, reject) {
|
|
2368
|
-
var gen = fn.apply(self, args);
|
|
2369
|
-
function _next(value) {
|
|
2370
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
2371
|
-
}
|
|
2372
|
-
function _throw(err) {
|
|
2373
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
2374
|
-
}
|
|
2375
|
-
_next(undefined);
|
|
2376
|
-
});
|
|
2377
|
-
};
|
|
2378
|
-
}
|
|
2379
|
-
|
|
2380
|
-
var regeneratorRuntime$1 = {exports: {}};
|
|
2381
|
-
|
|
2382
|
-
var _typeof = {exports: {}};
|
|
2383
|
-
|
|
2384
|
-
(function (module) {
|
|
2385
|
-
function _typeof(obj) {
|
|
2386
|
-
"@babel/helpers - typeof";
|
|
2387
|
-
|
|
2388
|
-
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
2389
|
-
return typeof obj;
|
|
2390
|
-
} : function (obj) {
|
|
2391
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
2392
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
|
|
2393
|
-
}
|
|
2394
|
-
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
2395
|
-
})(_typeof);
|
|
2396
|
-
|
|
2397
|
-
(function (module) {
|
|
2398
|
-
var _typeof$1 = _typeof.exports["default"];
|
|
2399
|
-
function _regeneratorRuntime() {
|
|
2400
|
-
|
|
2401
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
2402
|
-
module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
2403
|
-
return exports;
|
|
2404
|
-
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
2405
|
-
var exports = {},
|
|
2406
|
-
Op = Object.prototype,
|
|
2407
|
-
hasOwn = Op.hasOwnProperty,
|
|
2408
|
-
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
2409
|
-
obj[key] = desc.value;
|
|
2410
|
-
},
|
|
2411
|
-
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
2412
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
2413
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
2414
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
2415
|
-
function define(obj, key, value) {
|
|
2416
|
-
return Object.defineProperty(obj, key, {
|
|
2417
|
-
value: value,
|
|
2418
|
-
enumerable: !0,
|
|
2419
|
-
configurable: !0,
|
|
2420
|
-
writable: !0
|
|
2421
|
-
}), obj[key];
|
|
2422
|
-
}
|
|
2423
|
-
try {
|
|
2424
|
-
define({}, "");
|
|
2425
|
-
} catch (err) {
|
|
2426
|
-
define = function define(obj, key, value) {
|
|
2427
|
-
return obj[key] = value;
|
|
2428
|
-
};
|
|
2429
|
-
}
|
|
2430
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
2431
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
2432
|
-
generator = Object.create(protoGenerator.prototype),
|
|
2433
|
-
context = new Context(tryLocsList || []);
|
|
2434
|
-
return defineProperty(generator, "_invoke", {
|
|
2435
|
-
value: makeInvokeMethod(innerFn, self, context)
|
|
2436
|
-
}), generator;
|
|
2437
|
-
}
|
|
2438
|
-
function tryCatch(fn, obj, arg) {
|
|
2439
|
-
try {
|
|
2440
|
-
return {
|
|
2441
|
-
type: "normal",
|
|
2442
|
-
arg: fn.call(obj, arg)
|
|
2443
|
-
};
|
|
2444
|
-
} catch (err) {
|
|
2445
|
-
return {
|
|
2446
|
-
type: "throw",
|
|
2447
|
-
arg: err
|
|
2448
|
-
};
|
|
2449
|
-
}
|
|
2450
|
-
}
|
|
2451
|
-
exports.wrap = wrap;
|
|
2452
|
-
var ContinueSentinel = {};
|
|
2453
|
-
function Generator() {}
|
|
2454
|
-
function GeneratorFunction() {}
|
|
2455
|
-
function GeneratorFunctionPrototype() {}
|
|
2456
|
-
var IteratorPrototype = {};
|
|
2457
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
2458
|
-
return this;
|
|
2459
|
-
});
|
|
2460
|
-
var getProto = Object.getPrototypeOf,
|
|
2461
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
2462
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
2463
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
2464
|
-
function defineIteratorMethods(prototype) {
|
|
2465
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
2466
|
-
define(prototype, method, function (arg) {
|
|
2467
|
-
return this._invoke(method, arg);
|
|
2468
|
-
});
|
|
2469
|
-
});
|
|
2470
|
-
}
|
|
2471
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
2472
|
-
function invoke(method, arg, resolve, reject) {
|
|
2473
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
2474
|
-
if ("throw" !== record.type) {
|
|
2475
|
-
var result = record.arg,
|
|
2476
|
-
value = result.value;
|
|
2477
|
-
return value && "object" == _typeof$1(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
2478
|
-
invoke("next", value, resolve, reject);
|
|
2479
|
-
}, function (err) {
|
|
2480
|
-
invoke("throw", err, resolve, reject);
|
|
2481
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
2482
|
-
result.value = unwrapped, resolve(result);
|
|
2483
|
-
}, function (error) {
|
|
2484
|
-
return invoke("throw", error, resolve, reject);
|
|
2485
|
-
});
|
|
2486
|
-
}
|
|
2487
|
-
reject(record.arg);
|
|
2488
|
-
}
|
|
2489
|
-
var previousPromise;
|
|
2490
|
-
defineProperty(this, "_invoke", {
|
|
2491
|
-
value: function value(method, arg) {
|
|
2492
|
-
function callInvokeWithMethodAndArg() {
|
|
2493
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
2494
|
-
invoke(method, arg, resolve, reject);
|
|
2495
|
-
});
|
|
2496
|
-
}
|
|
2497
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
2498
|
-
}
|
|
2499
|
-
});
|
|
2500
|
-
}
|
|
2501
|
-
function makeInvokeMethod(innerFn, self, context) {
|
|
2502
|
-
var state = "suspendedStart";
|
|
2503
|
-
return function (method, arg) {
|
|
2504
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
2505
|
-
if ("completed" === state) {
|
|
2506
|
-
if ("throw" === method) throw arg;
|
|
2507
|
-
return doneResult();
|
|
2508
|
-
}
|
|
2509
|
-
for (context.method = method, context.arg = arg;;) {
|
|
2510
|
-
var delegate = context.delegate;
|
|
2511
|
-
if (delegate) {
|
|
2512
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
2513
|
-
if (delegateResult) {
|
|
2514
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
2515
|
-
return delegateResult;
|
|
2516
|
-
}
|
|
2517
|
-
}
|
|
2518
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
2519
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
2520
|
-
context.dispatchException(context.arg);
|
|
2521
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
2522
|
-
state = "executing";
|
|
2523
|
-
var record = tryCatch(innerFn, self, context);
|
|
2524
|
-
if ("normal" === record.type) {
|
|
2525
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
2526
|
-
return {
|
|
2527
|
-
value: record.arg,
|
|
2528
|
-
done: context.done
|
|
2529
|
-
};
|
|
2530
|
-
}
|
|
2531
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
2532
|
-
}
|
|
2533
|
-
};
|
|
2534
|
-
}
|
|
2535
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
2536
|
-
var methodName = context.method,
|
|
2537
|
-
method = delegate.iterator[methodName];
|
|
2538
|
-
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;
|
|
2539
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
2540
|
-
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
2541
|
-
var info = record.arg;
|
|
2542
|
-
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);
|
|
2543
|
-
}
|
|
2544
|
-
function pushTryEntry(locs) {
|
|
2545
|
-
var entry = {
|
|
2546
|
-
tryLoc: locs[0]
|
|
2547
|
-
};
|
|
2548
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
2549
|
-
}
|
|
2550
|
-
function resetTryEntry(entry) {
|
|
2551
|
-
var record = entry.completion || {};
|
|
2552
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
2553
|
-
}
|
|
2554
|
-
function Context(tryLocsList) {
|
|
2555
|
-
this.tryEntries = [{
|
|
2556
|
-
tryLoc: "root"
|
|
2557
|
-
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
2558
|
-
}
|
|
2559
|
-
function values(iterable) {
|
|
2560
|
-
if (iterable) {
|
|
2561
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
2562
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
2563
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
2564
|
-
if (!isNaN(iterable.length)) {
|
|
2565
|
-
var i = -1,
|
|
2566
|
-
next = function next() {
|
|
2567
|
-
for (; ++i < iterable.length;) {
|
|
2568
|
-
if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
2569
|
-
}
|
|
2570
|
-
return next.value = undefined, next.done = !0, next;
|
|
2571
|
-
};
|
|
2572
|
-
return next.next = next;
|
|
2573
|
-
}
|
|
2574
|
-
}
|
|
2575
|
-
return {
|
|
2576
|
-
next: doneResult
|
|
2577
|
-
};
|
|
2578
|
-
}
|
|
2579
|
-
function doneResult() {
|
|
2580
|
-
return {
|
|
2581
|
-
value: undefined,
|
|
2582
|
-
done: !0
|
|
2583
|
-
};
|
|
2584
|
-
}
|
|
2585
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
2586
|
-
value: GeneratorFunctionPrototype,
|
|
2587
|
-
configurable: !0
|
|
2588
|
-
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
2589
|
-
value: GeneratorFunction,
|
|
2590
|
-
configurable: !0
|
|
2591
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
2592
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
2593
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
2594
|
-
}, exports.mark = function (genFun) {
|
|
2595
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
2596
|
-
}, exports.awrap = function (arg) {
|
|
2597
|
-
return {
|
|
2598
|
-
__await: arg
|
|
2599
|
-
};
|
|
2600
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
2601
|
-
return this;
|
|
2602
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
2603
|
-
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
2604
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
2605
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
2606
|
-
return result.done ? result.value : iter.next();
|
|
2607
|
-
});
|
|
2608
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
2609
|
-
return this;
|
|
2610
|
-
}), define(Gp, "toString", function () {
|
|
2611
|
-
return "[object Generator]";
|
|
2612
|
-
}), exports.keys = function (val) {
|
|
2613
|
-
var object = Object(val),
|
|
2614
|
-
keys = [];
|
|
2615
|
-
for (var key in object) {
|
|
2616
|
-
keys.push(key);
|
|
134
|
+
}
|
|
135
|
+
function _asyncToGenerator(fn) {
|
|
136
|
+
return function () {
|
|
137
|
+
var self = this,
|
|
138
|
+
args = arguments;
|
|
139
|
+
return new Promise(function (resolve, reject) {
|
|
140
|
+
var gen = fn.apply(self, args);
|
|
141
|
+
function _next(value) {
|
|
142
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
2617
143
|
}
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
var key = keys.pop();
|
|
2621
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
2622
|
-
}
|
|
2623
|
-
return next.done = !0, next;
|
|
2624
|
-
};
|
|
2625
|
-
}, exports.values = values, Context.prototype = {
|
|
2626
|
-
constructor: Context,
|
|
2627
|
-
reset: function reset(skipTempReset) {
|
|
2628
|
-
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) {
|
|
2629
|
-
"t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
2630
|
-
}
|
|
2631
|
-
},
|
|
2632
|
-
stop: function stop() {
|
|
2633
|
-
this.done = !0;
|
|
2634
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
2635
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
2636
|
-
return this.rval;
|
|
2637
|
-
},
|
|
2638
|
-
dispatchException: function dispatchException(exception) {
|
|
2639
|
-
if (this.done) throw exception;
|
|
2640
|
-
var context = this;
|
|
2641
|
-
function handle(loc, caught) {
|
|
2642
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
2643
|
-
}
|
|
2644
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2645
|
-
var entry = this.tryEntries[i],
|
|
2646
|
-
record = entry.completion;
|
|
2647
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
2648
|
-
if (entry.tryLoc <= this.prev) {
|
|
2649
|
-
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
2650
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
2651
|
-
if (hasCatch && hasFinally) {
|
|
2652
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
2653
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
2654
|
-
} else if (hasCatch) {
|
|
2655
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
2656
|
-
} else {
|
|
2657
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
2658
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
2659
|
-
}
|
|
2660
|
-
}
|
|
2661
|
-
}
|
|
2662
|
-
},
|
|
2663
|
-
abrupt: function abrupt(type, arg) {
|
|
2664
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2665
|
-
var entry = this.tryEntries[i];
|
|
2666
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
2667
|
-
var finallyEntry = entry;
|
|
2668
|
-
break;
|
|
2669
|
-
}
|
|
2670
|
-
}
|
|
2671
|
-
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
2672
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
2673
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
2674
|
-
},
|
|
2675
|
-
complete: function complete(record, afterLoc) {
|
|
2676
|
-
if ("throw" === record.type) throw record.arg;
|
|
2677
|
-
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;
|
|
2678
|
-
},
|
|
2679
|
-
finish: function finish(finallyLoc) {
|
|
2680
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2681
|
-
var entry = this.tryEntries[i];
|
|
2682
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
2683
|
-
}
|
|
2684
|
-
},
|
|
2685
|
-
"catch": function _catch(tryLoc) {
|
|
2686
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
2687
|
-
var entry = this.tryEntries[i];
|
|
2688
|
-
if (entry.tryLoc === tryLoc) {
|
|
2689
|
-
var record = entry.completion;
|
|
2690
|
-
if ("throw" === record.type) {
|
|
2691
|
-
var thrown = record.arg;
|
|
2692
|
-
resetTryEntry(entry);
|
|
2693
|
-
}
|
|
2694
|
-
return thrown;
|
|
2695
|
-
}
|
|
2696
|
-
}
|
|
2697
|
-
throw new Error("illegal catch attempt");
|
|
2698
|
-
},
|
|
2699
|
-
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
2700
|
-
return this.delegate = {
|
|
2701
|
-
iterator: values(iterable),
|
|
2702
|
-
resultName: resultName,
|
|
2703
|
-
nextLoc: nextLoc
|
|
2704
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
144
|
+
function _throw(err) {
|
|
145
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
2705
146
|
}
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
}
|
|
147
|
+
_next(undefined);
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
153
|
+
|
|
154
|
+
function getDefaultExportFromCjs (x) {
|
|
155
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
var regeneratorRuntime$1 = {exports: {}};
|
|
159
|
+
|
|
160
|
+
var _typeof = {exports: {}};
|
|
161
|
+
|
|
162
|
+
_typeof.exports;
|
|
163
|
+
|
|
164
|
+
(function (module) {
|
|
165
|
+
function _typeof(obj) {
|
|
166
|
+
"@babel/helpers - typeof";
|
|
167
|
+
|
|
168
|
+
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
169
|
+
return typeof obj;
|
|
170
|
+
} : function (obj) {
|
|
171
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
172
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
|
|
173
|
+
}
|
|
174
|
+
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
175
|
+
} (_typeof));
|
|
176
|
+
|
|
177
|
+
var _typeofExports = _typeof.exports;
|
|
178
|
+
|
|
179
|
+
regeneratorRuntime$1.exports;
|
|
180
|
+
|
|
181
|
+
(function (module) {
|
|
182
|
+
var _typeof = _typeofExports["default"];
|
|
183
|
+
function _regeneratorRuntime() {
|
|
184
|
+
module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
|
|
185
|
+
return exports;
|
|
186
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
187
|
+
var exports = {},
|
|
188
|
+
Op = Object.prototype,
|
|
189
|
+
hasOwn = Op.hasOwnProperty,
|
|
190
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
191
|
+
obj[key] = desc.value;
|
|
192
|
+
},
|
|
193
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
194
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
195
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
196
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
197
|
+
function define(obj, key, value) {
|
|
198
|
+
return Object.defineProperty(obj, key, {
|
|
199
|
+
value: value,
|
|
200
|
+
enumerable: !0,
|
|
201
|
+
configurable: !0,
|
|
202
|
+
writable: !0
|
|
203
|
+
}), obj[key];
|
|
204
|
+
}
|
|
205
|
+
try {
|
|
206
|
+
define({}, "");
|
|
207
|
+
} catch (err) {
|
|
208
|
+
define = function define(obj, key, value) {
|
|
209
|
+
return obj[key] = value;
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
213
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
214
|
+
generator = Object.create(protoGenerator.prototype),
|
|
215
|
+
context = new Context(tryLocsList || []);
|
|
216
|
+
return defineProperty(generator, "_invoke", {
|
|
217
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
218
|
+
}), generator;
|
|
219
|
+
}
|
|
220
|
+
function tryCatch(fn, obj, arg) {
|
|
221
|
+
try {
|
|
222
|
+
return {
|
|
223
|
+
type: "normal",
|
|
224
|
+
arg: fn.call(obj, arg)
|
|
225
|
+
};
|
|
226
|
+
} catch (err) {
|
|
227
|
+
return {
|
|
228
|
+
type: "throw",
|
|
229
|
+
arg: err
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
exports.wrap = wrap;
|
|
234
|
+
var ContinueSentinel = {};
|
|
235
|
+
function Generator() {}
|
|
236
|
+
function GeneratorFunction() {}
|
|
237
|
+
function GeneratorFunctionPrototype() {}
|
|
238
|
+
var IteratorPrototype = {};
|
|
239
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
240
|
+
return this;
|
|
241
|
+
});
|
|
242
|
+
var getProto = Object.getPrototypeOf,
|
|
243
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
244
|
+
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
245
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
246
|
+
function defineIteratorMethods(prototype) {
|
|
247
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
248
|
+
define(prototype, method, function (arg) {
|
|
249
|
+
return this._invoke(method, arg);
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
254
|
+
function invoke(method, arg, resolve, reject) {
|
|
255
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
256
|
+
if ("throw" !== record.type) {
|
|
257
|
+
var result = record.arg,
|
|
258
|
+
value = result.value;
|
|
259
|
+
return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
260
|
+
invoke("next", value, resolve, reject);
|
|
261
|
+
}, function (err) {
|
|
262
|
+
invoke("throw", err, resolve, reject);
|
|
263
|
+
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
264
|
+
result.value = unwrapped, resolve(result);
|
|
265
|
+
}, function (error) {
|
|
266
|
+
return invoke("throw", error, resolve, reject);
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
reject(record.arg);
|
|
270
|
+
}
|
|
271
|
+
var previousPromise;
|
|
272
|
+
defineProperty(this, "_invoke", {
|
|
273
|
+
value: function value(method, arg) {
|
|
274
|
+
function callInvokeWithMethodAndArg() {
|
|
275
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
276
|
+
invoke(method, arg, resolve, reject);
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
284
|
+
var state = "suspendedStart";
|
|
285
|
+
return function (method, arg) {
|
|
286
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
287
|
+
if ("completed" === state) {
|
|
288
|
+
if ("throw" === method) throw arg;
|
|
289
|
+
return doneResult();
|
|
290
|
+
}
|
|
291
|
+
for (context.method = method, context.arg = arg;;) {
|
|
292
|
+
var delegate = context.delegate;
|
|
293
|
+
if (delegate) {
|
|
294
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
295
|
+
if (delegateResult) {
|
|
296
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
297
|
+
return delegateResult;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
301
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
302
|
+
context.dispatchException(context.arg);
|
|
303
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
304
|
+
state = "executing";
|
|
305
|
+
var record = tryCatch(innerFn, self, context);
|
|
306
|
+
if ("normal" === record.type) {
|
|
307
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
308
|
+
return {
|
|
309
|
+
value: record.arg,
|
|
310
|
+
done: context.done
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
318
|
+
var methodName = context.method,
|
|
319
|
+
method = delegate.iterator[methodName];
|
|
320
|
+
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;
|
|
321
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
322
|
+
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
323
|
+
var info = record.arg;
|
|
324
|
+
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);
|
|
325
|
+
}
|
|
326
|
+
function pushTryEntry(locs) {
|
|
327
|
+
var entry = {
|
|
328
|
+
tryLoc: locs[0]
|
|
329
|
+
};
|
|
330
|
+
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
331
|
+
}
|
|
332
|
+
function resetTryEntry(entry) {
|
|
333
|
+
var record = entry.completion || {};
|
|
334
|
+
record.type = "normal", delete record.arg, entry.completion = record;
|
|
335
|
+
}
|
|
336
|
+
function Context(tryLocsList) {
|
|
337
|
+
this.tryEntries = [{
|
|
338
|
+
tryLoc: "root"
|
|
339
|
+
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
340
|
+
}
|
|
341
|
+
function values(iterable) {
|
|
342
|
+
if (iterable) {
|
|
343
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
344
|
+
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
345
|
+
if ("function" == typeof iterable.next) return iterable;
|
|
346
|
+
if (!isNaN(iterable.length)) {
|
|
347
|
+
var i = -1,
|
|
348
|
+
next = function next() {
|
|
349
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
350
|
+
return next.value = undefined, next.done = !0, next;
|
|
351
|
+
};
|
|
352
|
+
return next.next = next;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return {
|
|
356
|
+
next: doneResult
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
function doneResult() {
|
|
360
|
+
return {
|
|
361
|
+
value: undefined,
|
|
362
|
+
done: !0
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
366
|
+
value: GeneratorFunctionPrototype,
|
|
367
|
+
configurable: !0
|
|
368
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
369
|
+
value: GeneratorFunction,
|
|
370
|
+
configurable: !0
|
|
371
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
372
|
+
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
373
|
+
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
374
|
+
}, exports.mark = function (genFun) {
|
|
375
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
376
|
+
}, exports.awrap = function (arg) {
|
|
377
|
+
return {
|
|
378
|
+
__await: arg
|
|
379
|
+
};
|
|
380
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
381
|
+
return this;
|
|
382
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
383
|
+
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
384
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
385
|
+
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
386
|
+
return result.done ? result.value : iter.next();
|
|
387
|
+
});
|
|
388
|
+
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
389
|
+
return this;
|
|
390
|
+
}), define(Gp, "toString", function () {
|
|
391
|
+
return "[object Generator]";
|
|
392
|
+
}), exports.keys = function (val) {
|
|
393
|
+
var object = Object(val),
|
|
394
|
+
keys = [];
|
|
395
|
+
for (var key in object) keys.push(key);
|
|
396
|
+
return keys.reverse(), function next() {
|
|
397
|
+
for (; keys.length;) {
|
|
398
|
+
var key = keys.pop();
|
|
399
|
+
if (key in object) return next.value = key, next.done = !1, next;
|
|
400
|
+
}
|
|
401
|
+
return next.done = !0, next;
|
|
402
|
+
};
|
|
403
|
+
}, exports.values = values, Context.prototype = {
|
|
404
|
+
constructor: Context,
|
|
405
|
+
reset: function reset(skipTempReset) {
|
|
406
|
+
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);
|
|
407
|
+
},
|
|
408
|
+
stop: function stop() {
|
|
409
|
+
this.done = !0;
|
|
410
|
+
var rootRecord = this.tryEntries[0].completion;
|
|
411
|
+
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
412
|
+
return this.rval;
|
|
413
|
+
},
|
|
414
|
+
dispatchException: function dispatchException(exception) {
|
|
415
|
+
if (this.done) throw exception;
|
|
416
|
+
var context = this;
|
|
417
|
+
function handle(loc, caught) {
|
|
418
|
+
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
419
|
+
}
|
|
420
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
421
|
+
var entry = this.tryEntries[i],
|
|
422
|
+
record = entry.completion;
|
|
423
|
+
if ("root" === entry.tryLoc) return handle("end");
|
|
424
|
+
if (entry.tryLoc <= this.prev) {
|
|
425
|
+
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
426
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
427
|
+
if (hasCatch && hasFinally) {
|
|
428
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
429
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
430
|
+
} else if (hasCatch) {
|
|
431
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
432
|
+
} else {
|
|
433
|
+
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
434
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
abrupt: function abrupt(type, arg) {
|
|
440
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
441
|
+
var entry = this.tryEntries[i];
|
|
442
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
443
|
+
var finallyEntry = entry;
|
|
444
|
+
break;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
448
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
449
|
+
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
450
|
+
},
|
|
451
|
+
complete: function complete(record, afterLoc) {
|
|
452
|
+
if ("throw" === record.type) throw record.arg;
|
|
453
|
+
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;
|
|
454
|
+
},
|
|
455
|
+
finish: function finish(finallyLoc) {
|
|
456
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
457
|
+
var entry = this.tryEntries[i];
|
|
458
|
+
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
"catch": function _catch(tryLoc) {
|
|
462
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
463
|
+
var entry = this.tryEntries[i];
|
|
464
|
+
if (entry.tryLoc === tryLoc) {
|
|
465
|
+
var record = entry.completion;
|
|
466
|
+
if ("throw" === record.type) {
|
|
467
|
+
var thrown = record.arg;
|
|
468
|
+
resetTryEntry(entry);
|
|
469
|
+
}
|
|
470
|
+
return thrown;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
throw new Error("illegal catch attempt");
|
|
474
|
+
},
|
|
475
|
+
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
476
|
+
return this.delegate = {
|
|
477
|
+
iterator: values(iterable),
|
|
478
|
+
resultName: resultName,
|
|
479
|
+
nextLoc: nextLoc
|
|
480
|
+
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
481
|
+
}
|
|
482
|
+
}, exports;
|
|
483
|
+
}
|
|
484
|
+
module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
485
|
+
} (regeneratorRuntime$1));
|
|
486
|
+
|
|
487
|
+
var regeneratorRuntimeExports = regeneratorRuntime$1.exports;
|
|
2710
488
|
|
|
2711
489
|
// TODO(Babel 8): Remove this file.
|
|
2712
490
|
|
|
2713
|
-
var runtime =
|
|
491
|
+
var runtime = regeneratorRuntimeExports();
|
|
2714
492
|
var regenerator = runtime;
|
|
2715
493
|
|
|
2716
494
|
// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
|
|
2717
495
|
try {
|
|
2718
496
|
regeneratorRuntime = runtime;
|
|
2719
497
|
} catch (accidentalStrictMode) {
|
|
2720
|
-
if (
|
|
498
|
+
if (typeof globalThis === "object") {
|
|
2721
499
|
globalThis.regeneratorRuntime = runtime;
|
|
2722
500
|
} else {
|
|
2723
501
|
Function("r", "regeneratorRuntime = r")(runtime);
|
|
2724
502
|
}
|
|
2725
503
|
}
|
|
2726
504
|
|
|
505
|
+
var _regeneratorRuntime = /*@__PURE__*/getDefaultExportFromCjs(regenerator);
|
|
506
|
+
|
|
507
|
+
var propTypes = {exports: {}};
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
511
|
+
*
|
|
512
|
+
* This source code is licensed under the MIT license found in the
|
|
513
|
+
* LICENSE file in the root directory of this source tree.
|
|
514
|
+
*/
|
|
515
|
+
|
|
516
|
+
var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
517
|
+
|
|
518
|
+
var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
522
|
+
*
|
|
523
|
+
* This source code is licensed under the MIT license found in the
|
|
524
|
+
* LICENSE file in the root directory of this source tree.
|
|
525
|
+
*/
|
|
526
|
+
|
|
527
|
+
var ReactPropTypesSecret = ReactPropTypesSecret_1;
|
|
528
|
+
|
|
529
|
+
function emptyFunction() {}
|
|
530
|
+
function emptyFunctionWithReset() {}
|
|
531
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
532
|
+
|
|
533
|
+
var factoryWithThrowingShims = function() {
|
|
534
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
535
|
+
if (secret === ReactPropTypesSecret) {
|
|
536
|
+
// It is still safe when called from React.
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
var err = new Error(
|
|
540
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
541
|
+
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
542
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
543
|
+
);
|
|
544
|
+
err.name = 'Invariant Violation';
|
|
545
|
+
throw err;
|
|
546
|
+
} shim.isRequired = shim;
|
|
547
|
+
function getShim() {
|
|
548
|
+
return shim;
|
|
549
|
+
} // Important!
|
|
550
|
+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
551
|
+
var ReactPropTypes = {
|
|
552
|
+
array: shim,
|
|
553
|
+
bigint: shim,
|
|
554
|
+
bool: shim,
|
|
555
|
+
func: shim,
|
|
556
|
+
number: shim,
|
|
557
|
+
object: shim,
|
|
558
|
+
string: shim,
|
|
559
|
+
symbol: shim,
|
|
560
|
+
|
|
561
|
+
any: shim,
|
|
562
|
+
arrayOf: getShim,
|
|
563
|
+
element: shim,
|
|
564
|
+
elementType: shim,
|
|
565
|
+
instanceOf: getShim,
|
|
566
|
+
node: shim,
|
|
567
|
+
objectOf: getShim,
|
|
568
|
+
oneOf: getShim,
|
|
569
|
+
oneOfType: getShim,
|
|
570
|
+
shape: getShim,
|
|
571
|
+
exact: getShim,
|
|
572
|
+
|
|
573
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
574
|
+
resetWarningCache: emptyFunction
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
578
|
+
|
|
579
|
+
return ReactPropTypes;
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
584
|
+
*
|
|
585
|
+
* This source code is licensed under the MIT license found in the
|
|
586
|
+
* LICENSE file in the root directory of this source tree.
|
|
587
|
+
*/
|
|
588
|
+
|
|
589
|
+
{
|
|
590
|
+
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
591
|
+
// http://fb.me/prop-types-in-prod
|
|
592
|
+
propTypes.exports = factoryWithThrowingShims();
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
var propTypesExports = propTypes.exports;
|
|
596
|
+
var PropTypes = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);
|
|
597
|
+
|
|
2727
598
|
function _arrayLikeToArray(arr, len) {
|
|
2728
599
|
if (len == null || len > arr.length) len = arr.length;
|
|
2729
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
2730
|
-
arr2[i] = arr[i];
|
|
2731
|
-
}
|
|
600
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
2732
601
|
return arr2;
|
|
2733
602
|
}
|
|
2734
603
|
|
|
@@ -3071,7 +940,7 @@ var POSITIVE_NUMBER_REGEX = /^[0-9]+$/;
|
|
|
3071
940
|
function ownKeys$5(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; }
|
|
3072
941
|
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$5(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3073
942
|
var buildPayload = function buildPayload(data, values) {
|
|
3074
|
-
|
|
943
|
+
return Object.keys(data).reduce(function (acc, key) {
|
|
3075
944
|
var fieldValue = values[key].value;
|
|
3076
945
|
if (Array.isArray(fieldValue)) {
|
|
3077
946
|
var _values$key;
|
|
@@ -3088,7 +957,6 @@ var buildPayload = function buildPayload(data, values) {
|
|
|
3088
957
|
}
|
|
3089
958
|
return _objectSpread$5(_objectSpread$5({}, acc), {}, _defineProperty({}, key, fieldValue));
|
|
3090
959
|
}, {});
|
|
3091
|
-
return payload;
|
|
3092
960
|
};
|
|
3093
961
|
var formatData = function formatData(data) {
|
|
3094
962
|
return Object.keys(data).reduce(function (acc, key) {
|
|
@@ -3169,18 +1037,16 @@ var NeetoRules$2 = function NeetoRules(_ref) {
|
|
|
3169
1037
|
handleCancel = _ref$handleCancel === void 0 ? neetoCist.noop : _ref$handleCancel;
|
|
3170
1038
|
var formRef = React.useRef(null);
|
|
3171
1039
|
var submitForm = /*#__PURE__*/function () {
|
|
3172
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/
|
|
1040
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values, formikBag) {
|
|
3173
1041
|
var payload;
|
|
3174
|
-
return
|
|
3175
|
-
while (1) {
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
return _context.stop();
|
|
3183
|
-
}
|
|
1042
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
1043
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1044
|
+
case 0:
|
|
1045
|
+
payload = buildPayload(data, values);
|
|
1046
|
+
handleSubmit(payload, formikBag);
|
|
1047
|
+
case 2:
|
|
1048
|
+
case "end":
|
|
1049
|
+
return _context.stop();
|
|
3184
1050
|
}
|
|
3185
1051
|
}, _callee);
|
|
3186
1052
|
}));
|
|
@@ -3192,8 +1058,8 @@ var NeetoRules$2 = function NeetoRules(_ref) {
|
|
|
3192
1058
|
return formatData(data);
|
|
3193
1059
|
}, [data]);
|
|
3194
1060
|
return /*#__PURE__*/React__default["default"].createElement(formik.Formik, {
|
|
3195
|
-
enableReinitialize: true,
|
|
3196
1061
|
initialValues: initialValues,
|
|
1062
|
+
enableReinitialize: true,
|
|
3197
1063
|
validationSchema: getValidationSchema(data),
|
|
3198
1064
|
onSubmit: submitForm
|
|
3199
1065
|
}, function (_ref3) {
|
|
@@ -3229,9 +1095,9 @@ var NeetoRules$2 = function NeetoRules(_ref) {
|
|
|
3229
1095
|
});
|
|
3230
1096
|
};
|
|
3231
1097
|
NeetoRules$2.prototype = {
|
|
3232
|
-
data:
|
|
3233
|
-
handleSubmit:
|
|
3234
|
-
className:
|
|
1098
|
+
data: PropTypes.object,
|
|
1099
|
+
handleSubmit: PropTypes.func,
|
|
1100
|
+
className: PropTypes.string
|
|
3235
1101
|
};
|
|
3236
1102
|
|
|
3237
1103
|
var Main = function Main(_ref) {
|
|
@@ -3239,9 +1105,14 @@ var Main = function Main(_ref) {
|
|
|
3239
1105
|
return /*#__PURE__*/React__default["default"].createElement(NeetoRules$2, rest);
|
|
3240
1106
|
};
|
|
3241
1107
|
|
|
1108
|
+
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}}
|
|
1109
|
+
|
|
1110
|
+
var css = ".neeto-filters-error-boundary{align-items:center;background-color:#f8f9f9;border-radius:2px;display:flex;gap:16px;margin-bottom:12px;padding:8px 20px}.neeto-filters-error-boundary p{color:#2f3941}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3NyYy9zdHlsZXNoZWV0cy9jb21wb25lbnRzL19lcnJvci1ib3VuZGFyeS5zY3NzIiwiYXBwL2phdmFzY3JpcHQvc3JjL3N0eWxlc2hlZXRzL2Fic3RyYWN0cy9fbmVldG8tdWktdmFyaWFibGVzLnNjc3MiLCJhcHAvamF2YXNjcmlwdC9zcmMvc3R5bGVzaGVldHMvbWFpbi5zY3NzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDhCQUlFLGtCQUFBLENBR0Esd0JDS2tCLENETmxCLGlCQ2VvQixDRGxCcEIsWUFBQSxDQUVBLFFBQUEsQ0FIQSxrQkFBQSxDQURBLGdCRU9GLENGQ0UsZ0NBQ0UsYUVDSiIsInNvdXJjZXNDb250ZW50IjpbIi5uZWV0by1maWx0ZXJzLWVycm9yLWJvdW5kYXJ5IHtcbiAgcGFkZGluZzogOHB4IDIwcHg7XG4gIG1hcmdpbi1ib3R0b206IDEycHg7XG4gIGRpc3BsYXk6IGZsZXg7XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIGdhcDogMTZweDtcbiAgYm9yZGVyLXJhZGl1czogJG5lZXRvLXVpLXJvdW5kZWQtc207XG4gIGJhY2tncm91bmQtY29sb3I6ICRuZWV0by11aS1ncmF5LTEwMDtcblxuICBwIHtcbiAgICBjb2xvcjogJG5lZXRvLXVpLWdyYXktODAwO1xuICB9XG59XG4iLCIvLyBDb2xvciBwZWxldHRlXG5cbi8vIHByaW1hcnlcbiRuZWV0by11aS13aGl0ZTogI2ZmZmZmZjtcbi8vIGdyYXlzXG4kbmVldG8tdWktZ3JheS04MDA6ICMyZjM5NDE7XG4kbmVldG8tdWktZ3JheS03MDA6ICM0OTU0NWM7XG4kbmVldG8tdWktZ3JheS02MDA6ICM2ODczN2Q7XG4kbmVldG8tdWktZ3JheS01MDA6ICM4NzkyOWQ7XG4kbmVldG8tdWktZ3JheS00MDA6ICNjMmM4Y2M7XG4kbmVldG8tdWktZ3JheS0zMDA6ICNkOGRjZGU7XG4kbmVldG8tdWktZ3JheS0yMDA6ICNlOWViZWQ7XG4kbmVldG8tdWktZ3JheS0xMDA6ICNmOGY5Zjk7XG4vLyBwYXN0ZWxzXG4kbmVldG8tdWktcGFzdGVsLWJsdWU6ICNlYWYzZmM7XG5cbi8vIEZvbnQgd2VpZ2h0c1xuJG5lZXRvLXVpLWZvbnQtc2VtaWJvbGQ6IDYwMDtcbiRuZWV0by11aS1mb250LW5vcm1hbDogNDAwO1xuXG4vLyBCb3JkZXIgUmFkaXVzXG4kbmVldG8tdWktcm91bmRlZC1zbTogMnB4O1xuXG4vLyBCb3ggU2hhZG93c1xuJG5lZXRvLXVpLXNoYWRvdy1zOiAwcHggM3B4IDEycHggLTFweCByZ2JhKDI4LCA1MiwgODQsIDAuMTIpLFxuICAwcHggMnB4IDRweCAtMXB4IHJnYmEoMjgsIDU1LCA5MCwgMC4wOCk7XG5cbi8vIFRyYW5zaXRpb25cbiRuZWV0by11aS10cmFuc2l0aW9uOiBhbGwgMC4zcyBlYXNlLWluLW91dDtcbiIsIi5uZWV0by1maWx0ZXJzLWVycm9yLWJvdW5kYXJ5IHtcbiAgcGFkZGluZzogOHB4IDIwcHg7XG4gIG1hcmdpbi1ib3R0b206IDEycHg7XG4gIGRpc3BsYXk6IGZsZXg7XG4gIGFsaWduLWl0ZW1zOiBjZW50ZXI7XG4gIGdhcDogMTZweDtcbiAgYm9yZGVyLXJhZGl1czogMnB4O1xuICBiYWNrZ3JvdW5kLWNvbG9yOiAjZjhmOWY5O1xufVxuLm5lZXRvLWZpbHRlcnMtZXJyb3ItYm91bmRhcnkgcCB7XG4gIGNvbG9yOiAjMmYzOTQxO1xufSJdfQ== */";
|
|
1111
|
+
n(css,{});
|
|
1112
|
+
|
|
3242
1113
|
var NeetoRules$1 = function NeetoRules(_ref) {
|
|
3243
1114
|
var rest = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
3244
|
-
return /*#__PURE__*/React__default["default"].createElement(BrowserRouter, null, /*#__PURE__*/React__default["default"].createElement(Main, rest));
|
|
1115
|
+
return /*#__PURE__*/React__default["default"].createElement(reactRouterDom.BrowserRouter, null, /*#__PURE__*/React__default["default"].createElement(Main, rest));
|
|
3245
1116
|
};
|
|
3246
1117
|
|
|
3247
1118
|
function _arrayWithHoles(arr) {
|
|
@@ -3262,9 +1133,7 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
3262
1133
|
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
3263
1134
|
if (Object(_i) !== _i) return;
|
|
3264
1135
|
_n = !1;
|
|
3265
|
-
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0)
|
|
3266
|
-
;
|
|
3267
|
-
}
|
|
1136
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
3268
1137
|
} catch (err) {
|
|
3269
1138
|
_d = !0, _e = err;
|
|
3270
1139
|
} finally {
|
|
@@ -3317,10 +1186,10 @@ var MultiSelectValues = function MultiSelectValues(_ref) {
|
|
|
3317
1186
|
};
|
|
3318
1187
|
|
|
3319
1188
|
var getEntityDisplayValue = function getEntityDisplayValue(entitiy, entitiyOption) {
|
|
3320
|
-
var _findBy
|
|
1189
|
+
var _findBy;
|
|
3321
1190
|
return (_findBy = neetoCist.findBy({
|
|
3322
1191
|
value: entitiy.metadata.value
|
|
3323
|
-
}, entitiyOption.dropdownOptions)) === null || _findBy === void 0
|
|
1192
|
+
}, entitiyOption.dropdownOptions)) === null || _findBy === void 0 || (_findBy = _findBy.label) === null || _findBy === void 0 ? void 0 : _findBy.toLowerCase();
|
|
3324
1193
|
};
|
|
3325
1194
|
|
|
3326
1195
|
var ActionsDetail = function ActionsDetail(_ref) {
|
|
@@ -3352,10 +1221,10 @@ var ActionsDetail = function ActionsDetail(_ref) {
|
|
|
3352
1221
|
return action.metadata.value.includes(value);
|
|
3353
1222
|
}));
|
|
3354
1223
|
return /*#__PURE__*/React__default["default"].createElement(MultiSelectValues, {
|
|
1224
|
+
values: values,
|
|
3355
1225
|
separator: t("neetoRules.common.and", {
|
|
3356
1226
|
what: ""
|
|
3357
|
-
})
|
|
3358
|
-
values: values
|
|
1227
|
+
})
|
|
3359
1228
|
});
|
|
3360
1229
|
}
|
|
3361
1230
|
return null;
|
|
@@ -3386,9 +1255,9 @@ var ActionsDetail = function ActionsDetail(_ref) {
|
|
|
3386
1255
|
className: "mt-3 w-full"
|
|
3387
1256
|
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
3388
1257
|
icon: !viewMore ? neetoIcons.Down : neetoIcons.Up,
|
|
3389
|
-
label: !viewMore ? t("neetoRules.common.viewMore") : t("neetoRules.common.viewLess"),
|
|
3390
1258
|
size: "small",
|
|
3391
1259
|
style: "link",
|
|
1260
|
+
label: !viewMore ? t("neetoRules.common.viewMore") : t("neetoRules.common.viewLess"),
|
|
3392
1261
|
onClick: function onClick() {
|
|
3393
1262
|
return setViewMore(function (prevState) {
|
|
3394
1263
|
return !prevState;
|
|
@@ -3419,8 +1288,8 @@ var ConditionsDetail = function ConditionsDetail(_ref) {
|
|
|
3419
1288
|
return condition.metadata.values.includes(value);
|
|
3420
1289
|
}));
|
|
3421
1290
|
return /*#__PURE__*/React__default["default"].createElement(MultiSelectValues, {
|
|
3422
|
-
|
|
3423
|
-
|
|
1291
|
+
values: values,
|
|
1292
|
+
separator: i18next.t("neetoRules.common.or")
|
|
3424
1293
|
});
|
|
3425
1294
|
}
|
|
3426
1295
|
if (conditionOption.type === "dropdown") {
|
|
@@ -3520,7 +1389,7 @@ var EventsDetail = function EventsDetail(_ref) {
|
|
|
3520
1389
|
className: "neeto-ui-text-gray-800",
|
|
3521
1390
|
style: "h5",
|
|
3522
1391
|
weight: "semibold"
|
|
3523
|
-
}, currentPerformer === null || currentPerformer === void 0
|
|
1392
|
+
}, currentPerformer === null || currentPerformer === void 0 || (_currentPerformer$lab = currentPerformer.label) === null || _currentPerformer$lab === void 0 ? void 0 : _currentPerformer$lab.toLowerCase())), /*#__PURE__*/React__default["default"].createElement(ConditionsDetail, {
|
|
3524
1393
|
conditionOptions: conditions.conditionOptions,
|
|
3525
1394
|
conditionVerbs: conditions.verbs,
|
|
3526
1395
|
conditions: allConditions
|
|
@@ -3528,9 +1397,9 @@ var EventsDetail = function EventsDetail(_ref) {
|
|
|
3528
1397
|
className: "mt-3 w-full"
|
|
3529
1398
|
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
3530
1399
|
icon: !viewMore ? neetoIcons.Down : neetoIcons.Up,
|
|
3531
|
-
label: !viewMore ? i18next.t("neetoRules.common.viewMore") : i18next.t("neetoRules.common.viewLess"),
|
|
3532
1400
|
size: "small",
|
|
3533
1401
|
style: "link",
|
|
1402
|
+
label: !viewMore ? i18next.t("neetoRules.common.viewMore") : i18next.t("neetoRules.common.viewLess"),
|
|
3534
1403
|
onClick: function onClick() {
|
|
3535
1404
|
return setViewMore(function (prevState) {
|
|
3536
1405
|
return !prevState;
|
|
@@ -3628,7 +1497,7 @@ var useOnButtonPressed = function useOnButtonPressed(ref, handler) {
|
|
|
3628
1497
|
var DEFAULT_LONG_TEXT_ROWS = 8;
|
|
3629
1498
|
|
|
3630
1499
|
var LongTextField = function LongTextField(_ref) {
|
|
3631
|
-
var _errors$actions,
|
|
1500
|
+
var _errors$actions, _touched$actions, _selectedField$separa;
|
|
3632
1501
|
var name = _ref.name,
|
|
3633
1502
|
_ref$value = _ref.value,
|
|
3634
1503
|
value = _ref$value === void 0 ? "" : _ref$value,
|
|
@@ -3650,8 +1519,8 @@ var LongTextField = function LongTextField(_ref) {
|
|
|
3650
1519
|
useOnButtonPressed(initialFocusRef, function () {
|
|
3651
1520
|
return setShowPane(false);
|
|
3652
1521
|
});
|
|
3653
|
-
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
3654
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
1522
|
+
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
1523
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || defaultSeparator;
|
|
3655
1524
|
var label = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.placeholder) || defaultLabel;
|
|
3656
1525
|
var rows = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.rows) || DEFAULT_LONG_TEXT_ROWS;
|
|
3657
1526
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, separator && /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
@@ -3685,11 +1554,11 @@ var LongTextField = function LongTextField(_ref) {
|
|
|
3685
1554
|
style: "h3",
|
|
3686
1555
|
weight: "semibold"
|
|
3687
1556
|
}, label)), /*#__PURE__*/React__default["default"].createElement(neetoui.Pane.Body, null, /*#__PURE__*/React__default["default"].createElement(formik$1.Textarea, {
|
|
3688
|
-
required: true,
|
|
3689
|
-
className: "w-full",
|
|
3690
1557
|
name: name,
|
|
3691
1558
|
rows: rows,
|
|
3692
|
-
value: value
|
|
1559
|
+
value: value,
|
|
1560
|
+
required: true,
|
|
1561
|
+
className: "w-full"
|
|
3693
1562
|
})), /*#__PURE__*/React__default["default"].createElement(neetoui.Pane.Footer, {
|
|
3694
1563
|
className: "flex items-center space-x-2"
|
|
3695
1564
|
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
@@ -3708,7 +1577,7 @@ var LongTextField = function LongTextField(_ref) {
|
|
|
3708
1577
|
};
|
|
3709
1578
|
|
|
3710
1579
|
var CustomAction = function CustomAction(_ref) {
|
|
3711
|
-
var _errors$actions,
|
|
1580
|
+
var _errors$actions, _touched$actions, _selectedField$separa;
|
|
3712
1581
|
var ActionComponent = _ref.ActionComponent,
|
|
3713
1582
|
name = _ref.name,
|
|
3714
1583
|
action = _ref.action,
|
|
@@ -3725,8 +1594,8 @@ var CustomAction = function CustomAction(_ref) {
|
|
|
3725
1594
|
useOnButtonPressed(initialFocusRef, function () {
|
|
3726
1595
|
return setShowPane(false);
|
|
3727
1596
|
});
|
|
3728
|
-
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
3729
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
1597
|
+
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
1598
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || i18next.t("neetoRules.common.as");
|
|
3730
1599
|
var defaultLabel = selectedField === null || selectedField === void 0 ? void 0 : selectedField.placeholder;
|
|
3731
1600
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
3732
1601
|
className: "neeto-ui-text-gray-700 mt-1",
|
|
@@ -3775,8 +1644,19 @@ var CustomAction = function CustomAction(_ref) {
|
|
|
3775
1644
|
}))));
|
|
3776
1645
|
};
|
|
3777
1646
|
|
|
1647
|
+
var dayjs_min = {exports: {}};
|
|
1648
|
+
|
|
1649
|
+
dayjs_min.exports;
|
|
1650
|
+
|
|
1651
|
+
(function (module, exports) {
|
|
1652
|
+
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p=function(t){return t instanceof b},S=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new b(n)},O=v;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var b=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,f=O.p(t),l=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=O.p(f),y=function(t){var e=w(l);return O.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return O.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return O.s(e.$y,4,"0");case"M":return a+1;case"MM":return O.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return O.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return O.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return O.s(u,2,"0");case"s":return String(e.$s);case"ss":return O.s(e.$s,2,"0");case"SSS":return O.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=O.p(d),m=w(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return O.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:O.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),_=b.prototype;return w.prototype=_,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){_[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,b,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=D[g],w.Ls=D,w.p={},w}));
|
|
1653
|
+
} (dayjs_min, dayjs_min.exports));
|
|
1654
|
+
|
|
1655
|
+
var dayjs_minExports = dayjs_min.exports;
|
|
1656
|
+
var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
|
|
1657
|
+
|
|
3778
1658
|
var DateField$1 = function DateField(_ref) {
|
|
3779
|
-
var _actions$value$index$, _selectedField$separa, _errors$actions,
|
|
1659
|
+
var _actions$value$index$, _selectedField$separa, _errors$actions, _touched$actions;
|
|
3780
1660
|
var name = _ref.name,
|
|
3781
1661
|
index = _ref.index,
|
|
3782
1662
|
selectedField = _ref.selectedField;
|
|
@@ -3792,8 +1672,8 @@ var DateField$1 = function DateField(_ref) {
|
|
|
3792
1672
|
setShowInput = _useState2[1];
|
|
3793
1673
|
var valueTerm = (_actions$value$index$ = actions.value[index].metadata) === null || _actions$value$index$ === void 0 ? void 0 : _actions$value$index$.value;
|
|
3794
1674
|
var label = valueTerm || i18next.t("neetoRules.form.selectDate").toLowerCase();
|
|
3795
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
3796
|
-
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
1675
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || i18next.t("neetoRules.common.to");
|
|
1676
|
+
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
3797
1677
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, !selectedField.hideSeparator && /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
3798
1678
|
className: "neeto-ui-text-gray-700 mt-1",
|
|
3799
1679
|
"data-cy": "action-dropdown-seperator-text",
|
|
@@ -3805,7 +1685,7 @@ var DateField$1 = function DateField(_ref) {
|
|
|
3805
1685
|
name: "".concat(name, ".value"),
|
|
3806
1686
|
type: "date",
|
|
3807
1687
|
onChange: function onChange(date) {
|
|
3808
|
-
return setFieldValue("".concat(name, ".value"), date ?
|
|
1688
|
+
return setFieldValue("".concat(name, ".value"), date ? dayjs(date).format("YYYY-MM-DD") : "");
|
|
3809
1689
|
}
|
|
3810
1690
|
}), /*#__PURE__*/React__default["default"].createElement(neetoIcons.Check, {
|
|
3811
1691
|
className: "cursor-pointer",
|
|
@@ -3846,14 +1726,13 @@ var getActionOptions = function getActionOptions(currentAction, selectedActions)
|
|
|
3846
1726
|
};
|
|
3847
1727
|
var buildEmailValues = function buildEmailValues(emails) {
|
|
3848
1728
|
var emailRegex = EMAIL_REGEX;
|
|
3849
|
-
|
|
1729
|
+
return emails.map(function (email) {
|
|
3850
1730
|
return typeof email === "string" ? {
|
|
3851
1731
|
label: email,
|
|
3852
1732
|
value: email,
|
|
3853
1733
|
valid: emailRegex.test(email)
|
|
3854
1734
|
} : email;
|
|
3855
1735
|
});
|
|
3856
|
-
return formattedEmails;
|
|
3857
1736
|
};
|
|
3858
1737
|
var getDetailsByValue = function getDetailsByValue(value, options) {
|
|
3859
1738
|
return options.find(function (option) {
|
|
@@ -3883,7 +1762,7 @@ var getSlackChannelErrors = function getSlackChannelErrors(slackChannels, action
|
|
|
3883
1762
|
if (action !== null && action !== void 0 && (_action$metadata = action.metadata) !== null && _action$metadata !== void 0 && _action$metadata.value) {
|
|
3884
1763
|
var selectedOption = opts.find(function (op) {
|
|
3885
1764
|
var _action$metadata2;
|
|
3886
|
-
return (op === null || op === void 0 ? void 0 : op.value) === (action === null || action === void 0
|
|
1765
|
+
return (op === null || op === void 0 ? void 0 : op.value) === (action === null || action === void 0 || (_action$metadata2 = action.metadata) === null || _action$metadata2 === void 0 ? void 0 : _action$metadata2.value);
|
|
3887
1766
|
});
|
|
3888
1767
|
if (!selectedOption) {
|
|
3889
1768
|
return {
|
|
@@ -3900,7 +1779,7 @@ var getSlackChannelErrors = function getSlackChannelErrors(slackChannels, action
|
|
|
3900
1779
|
var Menu$9 = neetoui.Dropdown.Menu,
|
|
3901
1780
|
MenuItem$9 = neetoui.Dropdown.MenuItem;
|
|
3902
1781
|
var DropdownField$1 = function DropdownField(_ref) {
|
|
3903
|
-
var _actions$value$index$,
|
|
1782
|
+
var _actions$value$index$, _actions$value$index, _errors$actions, _touched$actions, _selectedField$separa, _defaultSelectedOptio;
|
|
3904
1783
|
var dropdownOptions = _ref.dropdownOptions,
|
|
3905
1784
|
name = _ref.name,
|
|
3906
1785
|
index = _ref.index,
|
|
@@ -3926,10 +1805,10 @@ var DropdownField$1 = function DropdownField(_ref) {
|
|
|
3926
1805
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
3927
1806
|
searchTerm = _useState6[0],
|
|
3928
1807
|
setSearchTerm = _useState6[1];
|
|
3929
|
-
var defaultValue = (_actions$value$index$ = actions.value[index].metadata) === null || _actions$value$index$ === void 0 ? void 0 : _actions$value$index$.value;
|
|
1808
|
+
var defaultValue = ((_actions$value$index$ = actions.value[index].metadata) === null || _actions$value$index$ === void 0 ? void 0 : _actions$value$index$.value) || ((_actions$value$index = actions.value[index]) === null || _actions$value$index === void 0 ? void 0 : _actions$value$index.value);
|
|
3930
1809
|
var searchedOptions = getSearchedOptions$3(dropdownOptions, searchTerm);
|
|
3931
|
-
var isValueSelected = defaultSelectedOption.label === defaultLabel && errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
3932
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
1810
|
+
var isValueSelected = defaultSelectedOption.label === defaultLabel && errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
1811
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || i18next.t("neetoRules.common.to");
|
|
3933
1812
|
var handleClose = function handleClose() {
|
|
3934
1813
|
setIsActive(false);
|
|
3935
1814
|
setSearchTerm("");
|
|
@@ -3982,7 +1861,7 @@ var DropdownField$1 = function DropdownField(_ref) {
|
|
|
3982
1861
|
return !prevState;
|
|
3983
1862
|
});
|
|
3984
1863
|
}
|
|
3985
|
-
}, defaultSelectedOption === null || defaultSelectedOption === void 0
|
|
1864
|
+
}, defaultSelectedOption === null || defaultSelectedOption === void 0 || (_defaultSelectedOptio = defaultSelectedOption.label) === null || _defaultSelectedOptio === void 0 ? void 0 : _defaultSelectedOptio.toLowerCase()),
|
|
3986
1865
|
onClose: handleClose
|
|
3987
1866
|
}, /*#__PURE__*/React__default["default"].createElement(Menu$9, {
|
|
3988
1867
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -4038,14 +1917,14 @@ var EditorAction = function EditorAction(_ref) {
|
|
|
4038
1917
|
setFieldValue(name, editorData);
|
|
4039
1918
|
}, [debouncedValue]);
|
|
4040
1919
|
return /*#__PURE__*/React__default["default"].createElement(neetoEditor.FormikEditor, {
|
|
1920
|
+
label: label,
|
|
1921
|
+
name: name,
|
|
1922
|
+
variables: variables,
|
|
4041
1923
|
autoFocus: true,
|
|
4042
1924
|
hideSlashCommands: true,
|
|
4043
1925
|
addons: EDITOR_ADDONS,
|
|
4044
1926
|
className: "w-full",
|
|
4045
1927
|
"data-cy": "neeto-editor",
|
|
4046
|
-
label: label,
|
|
4047
|
-
name: name,
|
|
4048
|
-
variables: variables,
|
|
4049
1928
|
onChange: function onChange(value) {
|
|
4050
1929
|
return setEditorData(value);
|
|
4051
1930
|
}
|
|
@@ -4063,8 +1942,8 @@ var EmailIdFields = function EmailIdFields(_ref) {
|
|
|
4063
1942
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
4064
1943
|
className: "mb-4"
|
|
4065
1944
|
}, /*#__PURE__*/React__default["default"].createElement(formik$1.MultiEmailInput, {
|
|
4066
|
-
label: i18next.t("neetoRules.common.emailIds"),
|
|
4067
1945
|
name: name,
|
|
1946
|
+
label: i18next.t("neetoRules.common.emailIds"),
|
|
4068
1947
|
placeholder: i18next.t("neetoRules.placeholders.emailField"),
|
|
4069
1948
|
ref: initialFocusRef,
|
|
4070
1949
|
value: formattedEmails,
|
|
@@ -4077,6 +1956,21 @@ var EmailIdFields = function EmailIdFields(_ref) {
|
|
|
4077
1956
|
}));
|
|
4078
1957
|
};
|
|
4079
1958
|
|
|
1959
|
+
function _extends() {
|
|
1960
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
1961
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1962
|
+
var source = arguments[i];
|
|
1963
|
+
for (var key in source) {
|
|
1964
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1965
|
+
target[key] = source[key];
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
return target;
|
|
1970
|
+
};
|
|
1971
|
+
return _extends.apply(this, arguments);
|
|
1972
|
+
}
|
|
1973
|
+
|
|
4080
1974
|
var useDebouncedUpdate = function useDebouncedUpdate(value, setValue) {
|
|
4081
1975
|
var duration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 200;
|
|
4082
1976
|
var _useState = React.useState(value),
|
|
@@ -4119,7 +2013,7 @@ var InputField$2 = function InputField(_ref) {
|
|
|
4119
2013
|
};
|
|
4120
2014
|
|
|
4121
2015
|
var EmailFields = function EmailFields(_ref) {
|
|
4122
|
-
var _errors$actions,
|
|
2016
|
+
var _errors$actions, _touched$actions, _selectedField$separa, _action$metadata;
|
|
4123
2017
|
var _ref$isEmailIdField = _ref.isEmailIdField,
|
|
4124
2018
|
isEmailIdField = _ref$isEmailIdField === void 0 ? false : _ref$isEmailIdField,
|
|
4125
2019
|
name = _ref.name,
|
|
@@ -4139,8 +2033,8 @@ var EmailFields = function EmailFields(_ref) {
|
|
|
4139
2033
|
useOnButtonPressed(initialFocusRef, function () {
|
|
4140
2034
|
return setShowPane(false);
|
|
4141
2035
|
});
|
|
4142
|
-
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
4143
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
2036
|
+
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
2037
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || i18next.t("neetoRules.common.as");
|
|
4144
2038
|
var defaultLabel = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.emailPlaceholder) || i18next.t("neetoRules.common.email");
|
|
4145
2039
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
4146
2040
|
className: "neeto-ui-text-gray-700 mt-1",
|
|
@@ -4222,15 +2116,14 @@ var useCloseInputField = function useCloseInputField(ref, showInput, handler) {
|
|
|
4222
2116
|
};
|
|
4223
2117
|
};
|
|
4224
2118
|
React.useEffect(function () {
|
|
4225
|
-
if (showInput)
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
}
|
|
2119
|
+
if (!showInput) return;
|
|
2120
|
+
ref.current.focus();
|
|
2121
|
+
buttonPressed();
|
|
4229
2122
|
}, [showInput]);
|
|
4230
2123
|
};
|
|
4231
2124
|
|
|
4232
2125
|
var Input = function Input(_ref) {
|
|
4233
|
-
var _action$metadata, _selectedField$separa, _errors$actions,
|
|
2126
|
+
var _action$metadata, _selectedField$separa, _errors$actions, _touched$actions;
|
|
4234
2127
|
var name = _ref.name,
|
|
4235
2128
|
index = _ref.index,
|
|
4236
2129
|
selectedField = _ref.selectedField;
|
|
@@ -4249,8 +2142,8 @@ var Input = function Input(_ref) {
|
|
|
4249
2142
|
var action = actions.value[index];
|
|
4250
2143
|
var valueTerm = (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.value;
|
|
4251
2144
|
var label = valueTerm && neetoCist.isNotEmpty(valueTerm === null || valueTerm === void 0 ? void 0 : valueTerm.trim()) ? valueTerm : i18next.t("neetoRules.form.addValue");
|
|
4252
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
4253
|
-
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
2145
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || i18next.t("neetoRules.common.to");
|
|
2146
|
+
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
4254
2147
|
React.useEffect(function () {
|
|
4255
2148
|
setShowInput(false);
|
|
4256
2149
|
}, [action.name]);
|
|
@@ -4374,9 +2267,9 @@ var InlineInput = /*#__PURE__*/React__default["default"].forwardRef(function (pr
|
|
|
4374
2267
|
tooltipProps: LIST_FIELD_TOOLTIP_PROPS.save,
|
|
4375
2268
|
onClick: onSubmit
|
|
4376
2269
|
}), /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
2270
|
+
ref: ref,
|
|
4377
2271
|
"data-cy": "inline-input-cancel-button",
|
|
4378
2272
|
icon: neetoIcons.Close,
|
|
4379
|
-
ref: ref,
|
|
4380
2273
|
style: "text",
|
|
4381
2274
|
tooltipProps: LIST_FIELD_TOOLTIP_PROPS.cancel,
|
|
4382
2275
|
onClick: handleCancel
|
|
@@ -4386,7 +2279,7 @@ var InlineInput = /*#__PURE__*/React__default["default"].forwardRef(function (pr
|
|
|
4386
2279
|
InlineInput.displayName = "InlineInput";
|
|
4387
2280
|
|
|
4388
2281
|
var ListField = function ListField(_ref) {
|
|
4389
|
-
var _errors$actions,
|
|
2282
|
+
var _errors$actions, _touched$actions, _selectedField$separa;
|
|
4390
2283
|
var name = _ref.name,
|
|
4391
2284
|
_ref$values = _ref.values,
|
|
4392
2285
|
values = _ref$values === void 0 ? [] : _ref$values,
|
|
@@ -4407,8 +2300,8 @@ var ListField = function ListField(_ref) {
|
|
|
4407
2300
|
useOnButtonPressed(initialFocusRef, function () {
|
|
4408
2301
|
return setShowPane(false);
|
|
4409
2302
|
});
|
|
4410
|
-
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
4411
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
2303
|
+
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
2304
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || i18next.t("neetoRules.common.to");
|
|
4412
2305
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
4413
2306
|
className: "neeto-ui-text-gray-700 mt-1",
|
|
4414
2307
|
"data-cy": "list-action-separator-text",
|
|
@@ -4446,7 +2339,7 @@ var ListField = function ListField(_ref) {
|
|
|
4446
2339
|
}, function (arrayHelper) {
|
|
4447
2340
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, values.map(function (item, index) {
|
|
4448
2341
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
4449
|
-
className: "flex flex-wrap justify-between border border-dashed
|
|
2342
|
+
className: "neeto-ui-bg-white flex flex-wrap justify-between border border-dashed px-2 py-1",
|
|
4450
2343
|
key: "".concat(item, ".").concat(index)
|
|
4451
2344
|
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
4452
2345
|
className: "w-4/5 overflow-x-auto",
|
|
@@ -4463,8 +2356,8 @@ var ListField = function ListField(_ref) {
|
|
|
4463
2356
|
}
|
|
4464
2357
|
}));
|
|
4465
2358
|
}), /*#__PURE__*/React__default["default"].createElement(formik.ErrorMessage, {
|
|
4466
|
-
|
|
4467
|
-
|
|
2359
|
+
name: name,
|
|
2360
|
+
className: "w-full"
|
|
4468
2361
|
}, function (message) {
|
|
4469
2362
|
return /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
4470
2363
|
className: "neeto-ui-text-error-500 neeto-ui-text-gray-700 mt-1",
|
|
@@ -4509,7 +2402,7 @@ var ListField = function ListField(_ref) {
|
|
|
4509
2402
|
var Menu$8 = neetoui.Dropdown.Menu,
|
|
4510
2403
|
MenuItem$8 = neetoui.Dropdown.MenuItem;
|
|
4511
2404
|
var MultiSelect$1 = function MultiSelect(_ref) {
|
|
4512
|
-
var _selectedField$placeh, _selectedField$separa, _errors$actions,
|
|
2405
|
+
var _selectedField$placeh, _selectedField$separa, _errors$actions, _touched$actions;
|
|
4513
2406
|
var _ref$values = _ref.values,
|
|
4514
2407
|
values = _ref$values === void 0 ? [] : _ref$values,
|
|
4515
2408
|
_ref$dropDownOptions = _ref.dropDownOptions,
|
|
@@ -4536,10 +2429,10 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
4536
2429
|
});
|
|
4537
2430
|
}, [values, dropDownOptions]);
|
|
4538
2431
|
var selectedOptions = getSelectedOptions(allOptions);
|
|
4539
|
-
var defaultLabel = (selectedField === null || selectedField === void 0
|
|
2432
|
+
var defaultLabel = (selectedField === null || selectedField === void 0 || (_selectedField$placeh = selectedField.placeholder) === null || _selectedField$placeh === void 0 ? void 0 : _selectedField$placeh.toLowerCase()) || i18next.t("neetoRules.form.selectValues").toLowerCase();
|
|
4540
2433
|
var searchedOptions = getSearchedOptions$3(dropDownOptions, searchTerm);
|
|
4541
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
4542
|
-
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
2434
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || i18next.t("neetoRules.common.to");
|
|
2435
|
+
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
4543
2436
|
var handleSelectOption = function handleSelectOption(option) {
|
|
4544
2437
|
var options = values.includes(option.value) ? ramda.without([option.value], values) : ramda.append(option.value, values);
|
|
4545
2438
|
setFieldValue(name, options);
|
|
@@ -4565,7 +2458,7 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
4565
2458
|
className: "flex flex-wrap",
|
|
4566
2459
|
key: idx
|
|
4567
2460
|
}, !!idx && /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
4568
|
-
className: "neeto-ui-text-gray-700
|
|
2461
|
+
className: "neeto-ui-text-gray-700 mr-1 mt-1",
|
|
4569
2462
|
style: "h5",
|
|
4570
2463
|
weight: "normal",
|
|
4571
2464
|
onClick: function onClick(e) {
|
|
@@ -4577,7 +2470,7 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
4577
2470
|
"data-cy": "multi-select-action-button",
|
|
4578
2471
|
style: "h5",
|
|
4579
2472
|
weight: "semibold",
|
|
4580
|
-
className: classNames__default["default"]("hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800
|
|
2473
|
+
className: classNames__default["default"]("hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800 mr-1 mt-1 cursor-pointer underline", {
|
|
4581
2474
|
"neeto-ui-text-primary-800": activeOption === (option === null || option === void 0 ? void 0 : option.value)
|
|
4582
2475
|
}),
|
|
4583
2476
|
onClick: function onClick() {
|
|
@@ -4631,7 +2524,7 @@ var MultiSelect$1 = function MultiSelect(_ref) {
|
|
|
4631
2524
|
};
|
|
4632
2525
|
|
|
4633
2526
|
var NoteField = function NoteField(_ref) {
|
|
4634
|
-
var _errors$actions,
|
|
2527
|
+
var _errors$actions, _touched$actions, _selectedField$separa;
|
|
4635
2528
|
var name = _ref.name,
|
|
4636
2529
|
_ref$value = _ref.value,
|
|
4637
2530
|
value = _ref$value === void 0 ? "" : _ref$value,
|
|
@@ -4648,8 +2541,8 @@ var NoteField = function NoteField(_ref) {
|
|
|
4648
2541
|
useOnButtonPressed(initialFocusRef, function () {
|
|
4649
2542
|
return setShowPane(false);
|
|
4650
2543
|
});
|
|
4651
|
-
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
4652
|
-
var separator = (selectedField === null || selectedField === void 0
|
|
2544
|
+
var isValid = errors.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
2545
|
+
var separator = (selectedField === null || selectedField === void 0 || (_selectedField$separa = selectedField.separator) === null || _selectedField$separa === void 0 ? void 0 : _selectedField$separa.toLowerCase()) || i18next.t("neetoRules.common.as");
|
|
4653
2546
|
var variables = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.variables) || [];
|
|
4654
2547
|
var defaultLabel = (selectedField === null || selectedField === void 0 ? void 0 : selectedField.placeholder) || i18next.t("neetoRules.form.note");
|
|
4655
2548
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
@@ -4714,55 +2607,55 @@ var ActionSubItems = function ActionSubItems(_ref) {
|
|
|
4714
2607
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.emailToIds) {
|
|
4715
2608
|
var _action$metadata;
|
|
4716
2609
|
return /*#__PURE__*/React__default["default"].createElement(EmailFields, {
|
|
4717
|
-
isEmailIdField: true,
|
|
4718
2610
|
action: action,
|
|
4719
|
-
emails: (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.emails,
|
|
4720
2611
|
index: index,
|
|
4721
|
-
key: name,
|
|
4722
2612
|
name: name,
|
|
4723
|
-
selectedField: selectedField
|
|
2613
|
+
selectedField: selectedField,
|
|
2614
|
+
isEmailIdField: true,
|
|
2615
|
+
emails: (_action$metadata = action.metadata) === null || _action$metadata === void 0 ? void 0 : _action$metadata.emails,
|
|
2616
|
+
key: name
|
|
4724
2617
|
});
|
|
4725
2618
|
}
|
|
4726
2619
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.email) {
|
|
4727
2620
|
return /*#__PURE__*/React__default["default"].createElement(EmailFields, {
|
|
4728
2621
|
action: action,
|
|
4729
2622
|
index: index,
|
|
4730
|
-
key: name,
|
|
4731
2623
|
name: name,
|
|
4732
|
-
selectedField: selectedField
|
|
2624
|
+
selectedField: selectedField,
|
|
2625
|
+
key: name
|
|
4733
2626
|
});
|
|
4734
2627
|
}
|
|
4735
2628
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.emailTo) {
|
|
4736
2629
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(DropdownField$1, {
|
|
4737
|
-
dropdownOptions: options,
|
|
4738
2630
|
index: index,
|
|
2631
|
+
selectedField: selectedField,
|
|
2632
|
+
dropdownOptions: options,
|
|
4739
2633
|
key: "".concat(name, ".value"),
|
|
4740
|
-
name: "".concat(name, ".value")
|
|
4741
|
-
selectedField: selectedField
|
|
2634
|
+
name: "".concat(name, ".value")
|
|
4742
2635
|
}), /*#__PURE__*/React__default["default"].createElement(EmailFields, {
|
|
4743
2636
|
action: action,
|
|
4744
2637
|
index: index,
|
|
4745
|
-
key: name,
|
|
4746
2638
|
name: name,
|
|
4747
|
-
selectedField: selectedField
|
|
2639
|
+
selectedField: selectedField,
|
|
2640
|
+
key: name
|
|
4748
2641
|
}));
|
|
4749
2642
|
}
|
|
4750
2643
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.dropdown) {
|
|
4751
2644
|
return /*#__PURE__*/React__default["default"].createElement(DropdownField$1, {
|
|
4752
|
-
dropdownOptions: options,
|
|
4753
2645
|
index: index,
|
|
2646
|
+
selectedField: selectedField,
|
|
2647
|
+
dropdownOptions: options,
|
|
4754
2648
|
key: name,
|
|
4755
|
-
name: "".concat(name, ".value")
|
|
4756
|
-
selectedField: selectedField
|
|
2649
|
+
name: "".concat(name, ".value")
|
|
4757
2650
|
});
|
|
4758
2651
|
}
|
|
4759
2652
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.note) {
|
|
4760
2653
|
var _action$metadata2;
|
|
4761
2654
|
return /*#__PURE__*/React__default["default"].createElement(NoteField, {
|
|
4762
2655
|
index: index,
|
|
2656
|
+
selectedField: selectedField,
|
|
4763
2657
|
key: name,
|
|
4764
2658
|
name: "".concat(name, ".value"),
|
|
4765
|
-
selectedField: selectedField,
|
|
4766
2659
|
value: (_action$metadata2 = action.metadata) === null || _action$metadata2 === void 0 ? void 0 : _action$metadata2.value
|
|
4767
2660
|
});
|
|
4768
2661
|
}
|
|
@@ -4770,20 +2663,20 @@ var ActionSubItems = function ActionSubItems(_ref) {
|
|
|
4770
2663
|
var _action$metadata3;
|
|
4771
2664
|
return /*#__PURE__*/React__default["default"].createElement(ListField, {
|
|
4772
2665
|
index: index,
|
|
2666
|
+
selectedField: selectedField,
|
|
4773
2667
|
key: name,
|
|
4774
2668
|
name: "".concat(name, ".value"),
|
|
4775
|
-
selectedField: selectedField,
|
|
4776
2669
|
values: (_action$metadata3 = action.metadata) === null || _action$metadata3 === void 0 ? void 0 : _action$metadata3.value
|
|
4777
2670
|
});
|
|
4778
2671
|
}
|
|
4779
2672
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.multiSelect) {
|
|
4780
2673
|
var _action$metadata4;
|
|
4781
2674
|
return /*#__PURE__*/React__default["default"].createElement(MultiSelect$1, {
|
|
4782
|
-
dropDownOptions: options,
|
|
4783
2675
|
index: index,
|
|
2676
|
+
selectedField: selectedField,
|
|
2677
|
+
dropDownOptions: options,
|
|
4784
2678
|
key: name,
|
|
4785
2679
|
name: "".concat(name, ".value"),
|
|
4786
|
-
selectedField: selectedField,
|
|
4787
2680
|
values: (_action$metadata4 = action.metadata) === null || _action$metadata4 === void 0 ? void 0 : _action$metadata4.value
|
|
4788
2681
|
});
|
|
4789
2682
|
}
|
|
@@ -4804,12 +2697,12 @@ var ActionSubItems = function ActionSubItems(_ref) {
|
|
|
4804
2697
|
if ((selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.longText || (selectedField === null || selectedField === void 0 ? void 0 : selectedField.type) === ACTION_TYPES.textarea) {
|
|
4805
2698
|
var _action$metadata5;
|
|
4806
2699
|
return /*#__PURE__*/React__default["default"].createElement(LongTextField, {
|
|
2700
|
+
index: index,
|
|
2701
|
+
selectedField: selectedField,
|
|
4807
2702
|
defaultLabel: t("neetoRules.labels.body"),
|
|
4808
2703
|
defaultSeparator: t("neetoRules.common.as"),
|
|
4809
|
-
index: index,
|
|
4810
2704
|
key: name,
|
|
4811
2705
|
name: "".concat(name, ".value"),
|
|
4812
|
-
selectedField: selectedField,
|
|
4813
2706
|
value: (_action$metadata5 = action.metadata) === null || _action$metadata5 === void 0 ? void 0 : _action$metadata5.value
|
|
4814
2707
|
});
|
|
4815
2708
|
}
|
|
@@ -4830,7 +2723,7 @@ var ActionSubItem = /*#__PURE__*/React.memo(ActionSubItems);
|
|
|
4830
2723
|
var Menu$7 = neetoui.Dropdown.Menu,
|
|
4831
2724
|
MenuItem$7 = neetoui.Dropdown.MenuItem;
|
|
4832
2725
|
var ActionItem = function ActionItem(_ref) {
|
|
4833
|
-
var _errors$actions,
|
|
2726
|
+
var _errors$actions, _touched$actions, _selectedOption$label;
|
|
4834
2727
|
var name = _ref.name,
|
|
4835
2728
|
action = _ref.action,
|
|
4836
2729
|
index = _ref.index,
|
|
@@ -4869,7 +2762,7 @@ var ActionItem = function ActionItem(_ref) {
|
|
|
4869
2762
|
return getFieldDetails$1(action.name, actionOptions);
|
|
4870
2763
|
}, [action, actionOptions]);
|
|
4871
2764
|
var searchedOptions = getSearchedOptions$3(actionOptions, searchTerm);
|
|
4872
|
-
var isActionSelected = (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) === i18next.t("neetoRules.form.doThis") && errors.actions && touched.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0
|
|
2765
|
+
var isActionSelected = (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) === i18next.t("neetoRules.form.doThis") && errors.actions && touched.actions && ramda.isNotNil((_errors$actions = errors.actions) === null || _errors$actions === void 0 || (_errors$actions = _errors$actions.value) === null || _errors$actions === void 0 ? void 0 : _errors$actions[index]) && ramda.isNotNil((_touched$actions = touched.actions) === null || _touched$actions === void 0 || (_touched$actions = _touched$actions.value) === null || _touched$actions === void 0 ? void 0 : _touched$actions[index]);
|
|
4873
2766
|
var handleSelectOption = function handleSelectOption(option) {
|
|
4874
2767
|
setFieldValue("".concat(name, ".name"), option.value);
|
|
4875
2768
|
setFieldValue("".concat(name, ".metadata"), {});
|
|
@@ -4929,7 +2822,7 @@ var ActionItem = function ActionItem(_ref) {
|
|
|
4929
2822
|
return !prevState;
|
|
4930
2823
|
});
|
|
4931
2824
|
}
|
|
4932
|
-
}, selectedOption === null || selectedOption === void 0
|
|
2825
|
+
}, selectedOption === null || selectedOption === void 0 || (_selectedOption$label = selectedOption.label) === null || _selectedOption$label === void 0 ? void 0 : _selectedOption$label.toLowerCase()),
|
|
4933
2826
|
onClose: handleClose
|
|
4934
2827
|
}, /*#__PURE__*/React__default["default"].createElement(Menu$7, {
|
|
4935
2828
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -4964,9 +2857,9 @@ var ActionItem = function ActionItem(_ref) {
|
|
|
4964
2857
|
}, i18next.t("neetoRules.common.noOptions")))), /*#__PURE__*/React__default["default"].createElement(ActionSubItem, {
|
|
4965
2858
|
action: action,
|
|
4966
2859
|
index: index,
|
|
2860
|
+
selectedField: selectedField,
|
|
4967
2861
|
name: "".concat(name, ".metadata"),
|
|
4968
|
-
options: getSelectedFieldOptions()
|
|
4969
|
-
selectedField: selectedField
|
|
2862
|
+
options: getSelectedFieldOptions()
|
|
4970
2863
|
}));
|
|
4971
2864
|
};
|
|
4972
2865
|
var ActionItem$1 = /*#__PURE__*/React.memo(ActionItem);
|
|
@@ -5027,10 +2920,10 @@ var Actions = function Actions(_ref) {
|
|
|
5027
2920
|
action: action,
|
|
5028
2921
|
elementProps: elementProps,
|
|
5029
2922
|
index: index,
|
|
5030
|
-
|
|
5031
|
-
parentName: name,
|
|
2923
|
+
onSelectAction: onSelectAction,
|
|
5032
2924
|
selectedActionOptions: selectedActionOptions,
|
|
5033
|
-
|
|
2925
|
+
name: "".concat(name, ".value.").concat(index),
|
|
2926
|
+
parentName: name
|
|
5034
2927
|
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5035
2928
|
className: "-mx-1 flex flex-wrap"
|
|
5036
2929
|
}, handleSlackChannelRefresh && action.name === "message_to_slack" && /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
@@ -5096,13 +2989,12 @@ var getSearchedOptions$2 = function getSearchedOptions(dropDownOptions, searchTe
|
|
|
5096
2989
|
});
|
|
5097
2990
|
};
|
|
5098
2991
|
var getAllOptions = function getAllOptions(options) {
|
|
5099
|
-
|
|
2992
|
+
return Array.isArray(options) ? options.map(function (option) {
|
|
5100
2993
|
return {
|
|
5101
2994
|
label: option,
|
|
5102
2995
|
value: option
|
|
5103
2996
|
};
|
|
5104
2997
|
}) : [];
|
|
5105
|
-
return allOptions;
|
|
5106
2998
|
};
|
|
5107
2999
|
|
|
5108
3000
|
var Menu$6 = neetoui.Dropdown.Menu,
|
|
@@ -5161,7 +3053,7 @@ var DropdownField = function DropdownField(_ref) {
|
|
|
5161
3053
|
return !prevState;
|
|
5162
3054
|
});
|
|
5163
3055
|
}
|
|
5164
|
-
}, selectedOption === null || selectedOption === void 0
|
|
3056
|
+
}, selectedOption === null || selectedOption === void 0 || (_selectedOption$label = selectedOption.label) === null || _selectedOption$label === void 0 ? void 0 : _selectedOption$label.toLowerCase()),
|
|
5165
3057
|
onClose: handleClose
|
|
5166
3058
|
}, /*#__PURE__*/React__default["default"].createElement(Menu$6, {
|
|
5167
3059
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -5204,7 +3096,7 @@ var DropdownField = function DropdownField(_ref) {
|
|
|
5204
3096
|
var Menu$5 = neetoui.Dropdown.Menu,
|
|
5205
3097
|
MenuItem$5 = neetoui.Dropdown.MenuItem;
|
|
5206
3098
|
var Dropdown = function Dropdown(_ref) {
|
|
5207
|
-
var _conditions$value$ind, _errors$conditions,
|
|
3099
|
+
var _conditions$value$ind, _errors$conditions, _touched$conditions, _defaultSelectedOptio;
|
|
5208
3100
|
var name = _ref.name,
|
|
5209
3101
|
options = _ref.options,
|
|
5210
3102
|
index = _ref.index;
|
|
@@ -5231,7 +3123,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
5231
3123
|
setSearchTerm = _useState6[1];
|
|
5232
3124
|
var defaultValue = (_conditions$value$ind = conditions.value[index].metadata) === null || _conditions$value$ind === void 0 ? void 0 : _conditions$value$ind.value;
|
|
5233
3125
|
var searchedOptions = getSearchedOptions$2(options, searchTerm);
|
|
5234
|
-
var isValueSelected = (defaultSelectedOption === null || defaultSelectedOption === void 0 ? void 0 : defaultSelectedOption.label) === defaultLabel && errors.conditions && ramda.isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0
|
|
3126
|
+
var isValueSelected = (defaultSelectedOption === null || defaultSelectedOption === void 0 ? void 0 : defaultSelectedOption.label) === defaultLabel && errors.conditions && ramda.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]) && ramda.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]);
|
|
5235
3127
|
var handleClose = function handleClose() {
|
|
5236
3128
|
setIsActive(false);
|
|
5237
3129
|
setSearchTerm("");
|
|
@@ -5278,7 +3170,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
5278
3170
|
return !prevState;
|
|
5279
3171
|
});
|
|
5280
3172
|
}
|
|
5281
|
-
}, defaultSelectedOption === null || defaultSelectedOption === void 0
|
|
3173
|
+
}, defaultSelectedOption === null || defaultSelectedOption === void 0 || (_defaultSelectedOptio = defaultSelectedOption.label) === null || _defaultSelectedOptio === void 0 ? void 0 : _defaultSelectedOptio.toLowerCase()),
|
|
5282
3174
|
onClose: handleClose
|
|
5283
3175
|
}, /*#__PURE__*/React__default["default"].createElement(Menu$5, {
|
|
5284
3176
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -5317,7 +3209,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
5317
3209
|
};
|
|
5318
3210
|
|
|
5319
3211
|
var InputField$1 = function InputField(_ref) {
|
|
5320
|
-
var _condition$metadata,
|
|
3212
|
+
var _condition$metadata, _errors$conditions, _touched$conditions;
|
|
5321
3213
|
var name = _ref.name,
|
|
5322
3214
|
index = _ref.index,
|
|
5323
3215
|
placeholder = _ref.placeholder;
|
|
@@ -5334,9 +3226,9 @@ var InputField$1 = function InputField(_ref) {
|
|
|
5334
3226
|
return setShowInput(false);
|
|
5335
3227
|
});
|
|
5336
3228
|
var condition = conditions.value[index];
|
|
5337
|
-
var valueTerm = (_condition$metadata = condition.metadata) === null || _condition$metadata === void 0
|
|
3229
|
+
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();
|
|
5338
3230
|
var label = valueTerm && valueTerm !== null && valueTerm !== void 0 && valueTerm.trim().length ? valueTerm : i18next.t("neetoRules.form.addValue");
|
|
5339
|
-
var isValid = errors.conditions && ramda.isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0
|
|
3231
|
+
var isValid = errors.conditions && ramda.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]) && ramda.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]);
|
|
5340
3232
|
React.useEffect(function () {
|
|
5341
3233
|
setShowInput(false);
|
|
5342
3234
|
}, [condition.verb]);
|
|
@@ -5370,7 +3262,7 @@ var InputField$1 = function InputField(_ref) {
|
|
|
5370
3262
|
var Menu$4 = neetoui.Dropdown.Menu,
|
|
5371
3263
|
MenuItem$4 = neetoui.Dropdown.MenuItem;
|
|
5372
3264
|
var MultiSelect = function MultiSelect(_ref) {
|
|
5373
|
-
var _conditions$value$ind,
|
|
3265
|
+
var _conditions$value$ind, _errors$conditions, _touched$conditions;
|
|
5374
3266
|
var name = _ref.name,
|
|
5375
3267
|
dropDownOptions = _ref.dropDownOptions,
|
|
5376
3268
|
index = _ref.index;
|
|
@@ -5388,14 +3280,14 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
5388
3280
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
5389
3281
|
searchTerm = _useState4[0],
|
|
5390
3282
|
setSearchTerm = _useState4[1];
|
|
5391
|
-
var values = (_conditions$value$ind = conditions.value[index]) === null || _conditions$value$ind === void 0
|
|
3283
|
+
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;
|
|
5392
3284
|
var selectedOptions = values || [];
|
|
5393
3285
|
var defaultLabel = i18next.t("neetoRules.form.selectValues");
|
|
5394
3286
|
var options = dropDownOptions === null || dropDownOptions === void 0 ? void 0 : dropDownOptions.filter(function (option) {
|
|
5395
3287
|
return selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.includes(option.value);
|
|
5396
3288
|
});
|
|
5397
3289
|
var searchedOptions = getSearchedOptions$2(dropDownOptions, searchTerm);
|
|
5398
|
-
var isValid = errors.conditions && ramda.isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0
|
|
3290
|
+
var isValid = errors.conditions && ramda.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]) && ramda.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]);
|
|
5399
3291
|
var handleMultiSelectOption = function handleMultiSelectOption(value) {
|
|
5400
3292
|
var options = selectedOptions !== null && selectedOptions !== void 0 && selectedOptions.includes(value) ? ramda.without([value], selectedOptions) : ramda.append(value, selectedOptions);
|
|
5401
3293
|
setFieldValue(name, options);
|
|
@@ -5416,21 +3308,21 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
5416
3308
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, {
|
|
5417
3309
|
key: idx
|
|
5418
3310
|
}, !!idx && /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
5419
|
-
className: "neeto-ui-text-gray-700
|
|
3311
|
+
className: "neeto-ui-text-gray-700 mr-1 mt-1",
|
|
5420
3312
|
style: "h5",
|
|
5421
3313
|
weight: "normal"
|
|
5422
3314
|
}, i18next.t("neetoRules.common.or")), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
5423
3315
|
"data-cy": "condition-value-multi-select-field",
|
|
5424
3316
|
style: "h5",
|
|
5425
3317
|
weight: "semibold",
|
|
5426
|
-
className: classNames__default["default"]("hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800
|
|
3318
|
+
className: classNames__default["default"]("hover:neeto-ui-text-primary-800 neeto-ui-text-gray-800 mr-1 mt-1 cursor-pointer underline", {
|
|
5427
3319
|
"neeto-ui-text-primary-800": activeOption === option.value
|
|
5428
3320
|
}),
|
|
5429
3321
|
onClick: function onClick() {
|
|
5430
3322
|
setTouched(ramda.assocPath(["conditions", "value", index], true, touched));
|
|
5431
3323
|
setActiveOption(activeOption ? null : option.value);
|
|
5432
3324
|
}
|
|
5433
|
-
}, option === null || option === void 0
|
|
3325
|
+
}, option === null || option === void 0 || (_option$label = option.label) === null || _option$label === void 0 ? void 0 : _option$label.toLowerCase()));
|
|
5434
3326
|
})) : /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
5435
3327
|
"data-cy": "condition-value-multi-select-field",
|
|
5436
3328
|
style: "h5",
|
|
@@ -5479,7 +3371,7 @@ var MultiSelect = function MultiSelect(_ref) {
|
|
|
5479
3371
|
|
|
5480
3372
|
var _excluded$6 = ["name", "index"];
|
|
5481
3373
|
var MultiSelectCreate = function MultiSelectCreate(_ref) {
|
|
5482
|
-
var _conditions$value$ind,
|
|
3374
|
+
var _conditions$value$ind, _errors$conditions, _touched$conditions;
|
|
5483
3375
|
var name = _ref.name,
|
|
5484
3376
|
index = _ref.index,
|
|
5485
3377
|
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
@@ -5497,10 +3389,10 @@ var MultiSelectCreate = function MultiSelectCreate(_ref) {
|
|
|
5497
3389
|
useOnButtonPressed(initialFocusRef, function () {
|
|
5498
3390
|
return setShowPane(false);
|
|
5499
3391
|
});
|
|
5500
|
-
var values = (_conditions$value$ind = conditions.value[index]) === null || _conditions$value$ind === void 0
|
|
3392
|
+
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;
|
|
5501
3393
|
var allOptions = getAllOptions(values);
|
|
5502
3394
|
var defaultLabel = i18next.t("neetoRules.form.selectValues");
|
|
5503
|
-
var isValid = errors.conditions && ramda.isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0
|
|
3395
|
+
var isValid = errors.conditions && ramda.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]) && ramda.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]);
|
|
5504
3396
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, ramda.isEmpty(allOptions) && /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
5505
3397
|
"data-cy": "condition-value-multi-select-create-button",
|
|
5506
3398
|
style: "h5",
|
|
@@ -5573,7 +3465,7 @@ var MultiSelectCreate = function MultiSelectCreate(_ref) {
|
|
|
5573
3465
|
};
|
|
5574
3466
|
|
|
5575
3467
|
var DateField = function DateField(_ref) {
|
|
5576
|
-
var _conditions$value$ind, _errors$conditions,
|
|
3468
|
+
var _conditions$value$ind, _errors$conditions, _touched$conditions;
|
|
5577
3469
|
var name = _ref.name,
|
|
5578
3470
|
index = _ref.index,
|
|
5579
3471
|
conditionName = _ref.conditionName;
|
|
@@ -5590,30 +3482,28 @@ var DateField = function DateField(_ref) {
|
|
|
5590
3482
|
setShowInput = _useState2[1];
|
|
5591
3483
|
var valueTerm = (_conditions$value$ind = conditions.value[index].metadata) === null || _conditions$value$ind === void 0 ? void 0 : _conditions$value$ind.value;
|
|
5592
3484
|
var label = valueTerm || i18next.t("neetoRules.form.selectDate").toLowerCase();
|
|
5593
|
-
var isValid = errors.conditions && ramda.isNotNil((_errors$conditions = errors.conditions) === null || _errors$conditions === void 0
|
|
3485
|
+
var isValid = errors.conditions && ramda.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]) && ramda.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]);
|
|
5594
3486
|
var handleValidate = /*#__PURE__*/function () {
|
|
5595
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/
|
|
5596
|
-
return
|
|
5597
|
-
while (1) {
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
if (ramda.isEmpty(errors)) {
|
|
5602
|
-
_context.next = 4;
|
|
5603
|
-
break;
|
|
5604
|
-
}
|
|
3487
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
3488
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
3489
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3490
|
+
case 0:
|
|
3491
|
+
_context.prev = 0;
|
|
3492
|
+
if (ramda.isEmpty(errors)) {
|
|
5605
3493
|
_context.next = 4;
|
|
5606
|
-
return validateField(conditionName);
|
|
5607
|
-
case 4:
|
|
5608
|
-
_context.next = 8;
|
|
5609
3494
|
break;
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
3495
|
+
}
|
|
3496
|
+
_context.next = 4;
|
|
3497
|
+
return validateField(conditionName);
|
|
3498
|
+
case 4:
|
|
3499
|
+
_context.next = 8;
|
|
3500
|
+
break;
|
|
3501
|
+
case 6:
|
|
3502
|
+
_context.prev = 6;
|
|
3503
|
+
_context.t0 = _context["catch"](0);
|
|
3504
|
+
case 8:
|
|
3505
|
+
case "end":
|
|
3506
|
+
return _context.stop();
|
|
5617
3507
|
}
|
|
5618
3508
|
}, _callee, null, [[0, 6]]);
|
|
5619
3509
|
}));
|
|
@@ -5622,7 +3512,7 @@ var DateField = function DateField(_ref) {
|
|
|
5622
3512
|
};
|
|
5623
3513
|
}();
|
|
5624
3514
|
var handleOnChange = function handleOnChange(date) {
|
|
5625
|
-
setFieldValue("".concat(name, ".value"), date ?
|
|
3515
|
+
setFieldValue("".concat(name, ".value"), date ? dayjs(date).format("YYYY-MM-DD") : "");
|
|
5626
3516
|
handleValidate();
|
|
5627
3517
|
};
|
|
5628
3518
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, showInput ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(neetoui.DatePicker, {
|
|
@@ -5675,8 +3565,8 @@ var ValueField = function ValueField(_ref) {
|
|
|
5675
3565
|
if (INPUT_FIELD_TYPES.includes(fieldType)) {
|
|
5676
3566
|
return /*#__PURE__*/React__default["default"].createElement(InputField$1, {
|
|
5677
3567
|
conditionName: conditionName,
|
|
5678
|
-
"data-cy": "condition-value-".concat(fieldType, "-field"),
|
|
5679
3568
|
index: index,
|
|
3569
|
+
"data-cy": "condition-value-".concat(fieldType, "-field"),
|
|
5680
3570
|
name: "".concat(name, ".value"),
|
|
5681
3571
|
placeholder: t("neetoRules.common.value")
|
|
5682
3572
|
});
|
|
@@ -5684,8 +3574,8 @@ var ValueField = function ValueField(_ref) {
|
|
|
5684
3574
|
if (fieldType === CONDITION_VALUE_TYPES.textarea) {
|
|
5685
3575
|
var _condition$metadata;
|
|
5686
3576
|
return /*#__PURE__*/React__default["default"].createElement(LongTextField, {
|
|
5687
|
-
defaultLabel: t("neetoRules.labels.text"),
|
|
5688
3577
|
index: index,
|
|
3578
|
+
defaultLabel: t("neetoRules.labels.text"),
|
|
5689
3579
|
name: "".concat(name, ".value"),
|
|
5690
3580
|
value: (_condition$metadata = condition.metadata) === null || _condition$metadata === void 0 ? void 0 : _condition$metadata.value
|
|
5691
3581
|
});
|
|
@@ -5693,23 +3583,23 @@ var ValueField = function ValueField(_ref) {
|
|
|
5693
3583
|
if (fieldType === CONDITION_VALUE_TYPES.dropdown) {
|
|
5694
3584
|
return /*#__PURE__*/React__default["default"].createElement(Dropdown, {
|
|
5695
3585
|
index: index,
|
|
5696
|
-
|
|
5697
|
-
|
|
3586
|
+
options: options,
|
|
3587
|
+
name: "".concat(name, ".value")
|
|
5698
3588
|
});
|
|
5699
3589
|
}
|
|
5700
3590
|
if (fieldType === CONDITION_VALUE_TYPES.multiSelect) {
|
|
5701
3591
|
return /*#__PURE__*/React__default["default"].createElement(MultiSelect, {
|
|
5702
|
-
dropDownOptions: options,
|
|
5703
3592
|
index: index,
|
|
3593
|
+
dropDownOptions: options,
|
|
5704
3594
|
name: "".concat(name, ".values")
|
|
5705
3595
|
});
|
|
5706
3596
|
}
|
|
5707
3597
|
if (fieldType === CONDITION_VALUE_TYPES.multiSelectCreate) {
|
|
5708
3598
|
return /*#__PURE__*/React__default["default"].createElement(MultiSelectCreate, {
|
|
5709
|
-
isCreateable: true,
|
|
5710
3599
|
index: index,
|
|
5711
|
-
name: "".concat(name, ".values"),
|
|
5712
3600
|
options: options,
|
|
3601
|
+
isCreateable: true,
|
|
3602
|
+
name: "".concat(name, ".values"),
|
|
5713
3603
|
placeholder: t("neetoRules.placeholders.multiSelect")
|
|
5714
3604
|
});
|
|
5715
3605
|
}
|
|
@@ -5774,22 +3664,22 @@ var ConditionItem = function ConditionItem(_ref) {
|
|
|
5774
3664
|
style: "h5",
|
|
5775
3665
|
weight: "normal"
|
|
5776
3666
|
}, defaultLabel), /*#__PURE__*/React__default["default"].createElement(DropdownField, {
|
|
3667
|
+
index: index,
|
|
5777
3668
|
fieldType: "field",
|
|
5778
3669
|
handleSelect: handleFieldChange,
|
|
5779
|
-
index: index,
|
|
5780
3670
|
options: conditionOptions,
|
|
5781
3671
|
placeholder: t("neetoRules.form.selectField")
|
|
5782
3672
|
}), /*#__PURE__*/React__default["default"].createElement(DropdownField, {
|
|
3673
|
+
index: index,
|
|
5783
3674
|
fieldType: "verb",
|
|
5784
3675
|
handleSelect: handleVerbChange,
|
|
5785
|
-
index: index,
|
|
5786
3676
|
options: verbOptions,
|
|
5787
3677
|
placeholder: t("neetoRules.form.selectVerb")
|
|
5788
3678
|
}), /*#__PURE__*/React__default["default"].createElement(ValueField, {
|
|
5789
3679
|
condition: condition,
|
|
3680
|
+
index: index,
|
|
5790
3681
|
conditionName: name,
|
|
5791
3682
|
field: selectedField,
|
|
5792
|
-
index: index,
|
|
5793
3683
|
name: "".concat(name, ".metadata"),
|
|
5794
3684
|
options: getSelectedFieldOptions()
|
|
5795
3685
|
}));
|
|
@@ -5835,7 +3725,7 @@ var Conditions = function Conditions(_ref) {
|
|
|
5835
3725
|
var _elementProps$conditi;
|
|
5836
3726
|
arrayHelpers.push({
|
|
5837
3727
|
field: elementProps === null || elementProps === void 0 ? void 0 : elementProps.conditionOptions[0].value,
|
|
5838
|
-
verb: elementProps === null || elementProps === void 0
|
|
3728
|
+
verb: elementProps === null || elementProps === void 0 || (_elementProps$conditi = elementProps.conditionOptions[0]) === null || _elementProps$conditi === void 0 ? void 0 : _elementProps$conditi.allowMatching[0],
|
|
5839
3729
|
joinType: logicOperation,
|
|
5840
3730
|
metadata: {}
|
|
5841
3731
|
});
|
|
@@ -5876,10 +3766,10 @@ var Conditions = function Conditions(_ref) {
|
|
|
5876
3766
|
elementProps: elementProps,
|
|
5877
3767
|
index: index,
|
|
5878
3768
|
isWithEvents: isWithEvents,
|
|
5879
|
-
|
|
5880
|
-
name: "".concat(name, ".value.").concat(index),
|
|
3769
|
+
onSelectCondition: onSelectCondition,
|
|
5881
3770
|
selectedConditionOptions: selectedConditionOptions,
|
|
5882
|
-
|
|
3771
|
+
key: index,
|
|
3772
|
+
name: "".concat(name, ".value.").concat(index)
|
|
5883
3773
|
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5884
3774
|
className: "flex"
|
|
5885
3775
|
}, index === conditions.length - 1 && /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
@@ -6038,7 +3928,7 @@ var Performer$1 = function Performer(_ref) {
|
|
|
6038
3928
|
return !prevState;
|
|
6039
3929
|
});
|
|
6040
3930
|
}
|
|
6041
|
-
}, selectedOption === null || selectedOption === void 0
|
|
3931
|
+
}, selectedOption === null || selectedOption === void 0 || (_selectedOption$label = selectedOption.label) === null || _selectedOption$label === void 0 ? void 0 : _selectedOption$label.toLowerCase()),
|
|
6042
3932
|
onClose: handleClose
|
|
6043
3933
|
}, /*#__PURE__*/React__default["default"].createElement(Menu$3, {
|
|
6044
3934
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -6202,7 +4092,7 @@ var Events$1 = function Events(_ref) {
|
|
|
6202
4092
|
onClick: function onClick() {
|
|
6203
4093
|
return setActiveOption(activeOption ? null : event.value);
|
|
6204
4094
|
}
|
|
6205
|
-
}, event === null || event === void 0
|
|
4095
|
+
}, event === null || event === void 0 || (_event$label = event.label) === null || _event$label === void 0 ? void 0 : _event$label.toLowerCase()));
|
|
6206
4096
|
})) : /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
6207
4097
|
"data-cy": "condition-value-multi-select-field",
|
|
6208
4098
|
style: "h5",
|
|
@@ -6272,7 +4162,7 @@ var EventConditions = function EventConditions(_ref) {
|
|
|
6272
4162
|
var _conditionProps$condi;
|
|
6273
4163
|
setFieldValue("".concat(conditionsName, ".value"), [{
|
|
6274
4164
|
field: conditionProps === null || conditionProps === void 0 ? void 0 : conditionProps.conditionOptions[0].value,
|
|
6275
|
-
verb: conditionProps === null || conditionProps === void 0
|
|
4165
|
+
verb: conditionProps === null || conditionProps === void 0 || (_conditionProps$condi = conditionProps.conditionOptions[0]) === null || _conditionProps$condi === void 0 ? void 0 : _conditionProps$condi.allowMatching[0],
|
|
6276
4166
|
joinType: OPERATORS.or,
|
|
6277
4167
|
metadata: {}
|
|
6278
4168
|
}]);
|
|
@@ -6288,8 +4178,8 @@ var EventConditions = function EventConditions(_ref) {
|
|
|
6288
4178
|
}, /*#__PURE__*/React__default["default"].createElement(Events$1, {
|
|
6289
4179
|
data: data,
|
|
6290
4180
|
name: name,
|
|
6291
|
-
|
|
6292
|
-
|
|
4181
|
+
onSelectEvent: onSelectEvent,
|
|
4182
|
+
performerName: performerName
|
|
6293
4183
|
})), showAddButton && /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
6294
4184
|
"data-cy": "add-condition-button",
|
|
6295
4185
|
"data-test-id": "automation-rules-add-events-button",
|
|
@@ -6304,8 +4194,8 @@ var EventConditions = function EventConditions(_ref) {
|
|
|
6304
4194
|
})), !showAddButton && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6305
4195
|
className: "mt-3"
|
|
6306
4196
|
}, /*#__PURE__*/React__default["default"].createElement(Conditions, _extends({
|
|
6307
|
-
isWithEvents: true,
|
|
6308
4197
|
data: data,
|
|
4198
|
+
isWithEvents: true,
|
|
6309
4199
|
name: conditionsName
|
|
6310
4200
|
}, config)))));
|
|
6311
4201
|
};
|
|
@@ -6508,7 +4398,7 @@ var Performer = function Performer(_ref) {
|
|
|
6508
4398
|
return !prevState;
|
|
6509
4399
|
});
|
|
6510
4400
|
}
|
|
6511
|
-
}, selectedOption === null || selectedOption === void 0
|
|
4401
|
+
}, selectedOption === null || selectedOption === void 0 || (_selectedOption$label = selectedOption.label) === null || _selectedOption$label === void 0 ? void 0 : _selectedOption$label.toLowerCase()),
|
|
6512
4402
|
onClose: handleClose
|
|
6513
4403
|
}, /*#__PURE__*/React__default["default"].createElement(Menu, {
|
|
6514
4404
|
className: "max-h-60 max-w-2xl p-3"
|
|
@@ -6569,10 +4459,9 @@ var Events = function Events(_ref) {
|
|
|
6569
4459
|
arrayHelpers.remove(index);
|
|
6570
4460
|
};
|
|
6571
4461
|
var popEvent = function popEvent(arrayHelpers) {
|
|
6572
|
-
if (neetoCist.isNotEmpty(arrayHelpers) && neetoCist.isNotEmpty(events))
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
}
|
|
4462
|
+
if (!(neetoCist.isNotEmpty(arrayHelpers) && neetoCist.isNotEmpty(events))) return;
|
|
4463
|
+
var eventIdx = events.length - 1;
|
|
4464
|
+
_removeEvent(eventIdx, events[eventIdx], arrayHelpers);
|
|
6576
4465
|
};
|
|
6577
4466
|
var handleAddEvent = function handleAddEvent(arrayHelpers) {
|
|
6578
4467
|
return arrayHelpers.push({
|
|
@@ -6613,7 +4502,7 @@ var Events = function Events(_ref) {
|
|
|
6613
4502
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6614
4503
|
className: "flex justify-between"
|
|
6615
4504
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6616
|
-
className: classNames__default["default"]("flex flex-wrap gap-
|
|
4505
|
+
className: classNames__default["default"]("flex flex-wrap gap-x-2 gap-y-2", {
|
|
6617
4506
|
"max-w-2xl": showAddButton
|
|
6618
4507
|
})
|
|
6619
4508
|
}, showMessage && /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
@@ -6636,12 +4525,12 @@ var Events = function Events(_ref) {
|
|
|
6636
4525
|
}, i18next.t("neetoRules.common.or")), /*#__PURE__*/React__default["default"].createElement(EventItem, {
|
|
6637
4526
|
elementProps: elementProps,
|
|
6638
4527
|
event: event,
|
|
4528
|
+
onSelectEvent: onSelectEvent,
|
|
6639
4529
|
name: "".concat(name, ".value.").concat(index, ".name"),
|
|
6640
4530
|
parentName: name,
|
|
6641
4531
|
removeEvent: function removeEvent() {
|
|
6642
4532
|
return _removeEvent(index, event, arrayHelpers);
|
|
6643
|
-
}
|
|
6644
|
-
onSelectEvent: onSelectEvent
|
|
4533
|
+
}
|
|
6645
4534
|
}));
|
|
6646
4535
|
}), !showMessage && /*#__PURE__*/React__default["default"].createElement(Performer, {
|
|
6647
4536
|
data: data,
|
|
@@ -6746,9 +4635,9 @@ var RadioField = function RadioField(_ref) {
|
|
|
6746
4635
|
var label = _ref2.label,
|
|
6747
4636
|
value = _ref2.value;
|
|
6748
4637
|
return /*#__PURE__*/React__default["default"].createElement(formik$1.Radio.Item, {
|
|
6749
|
-
key: index,
|
|
6750
4638
|
label: label,
|
|
6751
|
-
value: value
|
|
4639
|
+
value: value,
|
|
4640
|
+
key: index
|
|
6752
4641
|
});
|
|
6753
4642
|
})));
|
|
6754
4643
|
};
|