@bigbinary/neeto-form-frontend 3.9.0 → 3.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/javascript/src/translations/ar.json +3 -1
- package/app/javascript/src/translations/de.json +3 -1
- package/app/javascript/src/translations/es.json +3 -1
- package/app/javascript/src/translations/fr.json +3 -1
- package/app/javascript/src/translations/it.json +201 -0
- package/app/javascript/src/translations/nl.json +3 -1
- package/app/javascript/src/translations/pl.json +3 -1
- package/app/javascript/src/translations/pt.json +3 -1
- package/app/javascript/src/translations/ru.json +202 -0
- package/dist/BuildForm.js +14 -77
- package/dist/BuildForm.js.map +1 -1
- package/dist/ExternalForm.js +12 -12
- package/dist/ExternalForm.js.map +1 -1
- package/dist/Submission.js +1 -1
- package/dist/Submission.js.map +1 -1
- package/dist/UrlBuilder.js +10 -10
- package/dist/UrlBuilder.js.map +1 -1
- package/dist/buildForm-b8eb931e.js.map +1 -1
- package/dist/buildForm-dfd708c6.js.map +1 -1
- package/dist/cjs/BuildForm.js +16 -79
- package/dist/cjs/BuildForm.js.map +1 -1
- package/dist/cjs/ExternalForm.js +12 -12
- package/dist/cjs/ExternalForm.js.map +1 -1
- package/dist/cjs/Submission.js +1 -1
- package/dist/cjs/Submission.js.map +1 -1
- package/dist/cjs/UrlBuilder.js +10 -10
- package/dist/cjs/UrlBuilder.js.map +1 -1
- package/dist/cjs/hooks.js +2 -2
- package/dist/cjs/index.js +5 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/constants-4d9fc943.js.map +1 -1
- package/dist/constants-75b78b3a.js.map +1 -1
- package/dist/{constants-56bf4022.js → constants-771cca31.js} +2 -3
- package/dist/{constants-56bf4022.js.map → constants-771cca31.js.map} +1 -1
- package/dist/{constants-d9148acf.js → constants-9538731d.js} +2 -3
- package/dist/{constants-d9148acf.js.map → constants-9538731d.js.map} +1 -1
- package/dist/hooks.js +2 -2
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/{useFormApi-408d0060.js → useFormApi-24e05ed2.js} +6 -6
- package/dist/{useFormApi-408d0060.js.map → useFormApi-24e05ed2.js.map} +1 -1
- package/dist/{useFormApi-e3476a20.js → useFormApi-dee63a95.js} +6 -6
- package/dist/{useFormApi-e3476a20.js.map → useFormApi-dee63a95.js.map} +1 -1
- package/dist/{useFormSubmission-e2e84587.js → useFormSubmission-8b23d7aa.js} +2 -2
- package/dist/{useFormSubmission-e2e84587.js.map → useFormSubmission-8b23d7aa.js.map} +1 -1
- package/dist/{useFormSubmission-46db678f.js → useFormSubmission-c4e42402.js} +2 -2
- package/dist/{useFormSubmission-46db678f.js.map → useFormSubmission-c4e42402.js.map} +1 -1
- package/dist/{utils-6039d7d2.js → utils-58566755.js} +35 -36
- package/dist/utils-58566755.js.map +1 -0
- package/dist/{utils-3eb74c1b.js → utils-d5895099.js} +35 -36
- package/dist/utils-d5895099.js.map +1 -0
- package/package.json +101 -92
- package/dist/utils-3eb74c1b.js.map +0 -1
- package/dist/utils-6039d7d2.js.map +0 -1
package/dist/BuildForm.js
CHANGED
|
@@ -7,9 +7,9 @@ import { isPresent, truncate, findBy, isNotPresent, slugify, filterBy, hyphenate
|
|
|
7
7
|
import { showThumbsUpToastr, hyphenize } from '@bigbinary/neeto-commons-frontend/utils';
|
|
8
8
|
import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
|
|
9
9
|
import { equals, includes, __, reduce, assoc, path, when, isEmpty, reject, keys, pick, omit, pluck, modify, without, mergeLeft, isNil, pipe, filter, isNotNil, uniq, join, map, test, difference, prop, split, last, concat, F } from 'ramda';
|
|
10
|
-
import { e as useDeleteQuestion, f as useFetchQuestions, g as useCreateQuestion, h as useUpdateQuestion, i as useReorderQuestions, Q as QUERY_KEYS } from './useFormApi-
|
|
10
|
+
import { e as useDeleteQuestion, f as useFetchQuestions, g as useCreateQuestion, h as useUpdateQuestion, i as useReorderQuestions, Q as QUERY_KEYS } from './useFormApi-dee63a95.js';
|
|
11
11
|
import { Q as QUESTION_KIND } from './constants-75b78b3a.js';
|
|
12
|
-
import { I as INDEPENDENT_LABELS_MAP, R as RICH_TEXT_QUESTIONS, A as AUTO_GENERATED_KINDS, a as IMMUTABLE_KINDS, h as htmlToPlainText, i as isElementOverflowing, D as Drag, Q as QUESTION_TYPES, S as SELECTABLE_KINDS, b as RESERVED_FIELD_CODES, c as QUESTIONS_WITHOUT_FIELD_CODE, N as NON_HIDEABLE_FIELDS, C as CAPTCHA_TYPES, F as FILE_TYPES_MAP, d as FILE_GROUPS, M as MINIMUM_OPTIONS, e as RATING_OPTIONS, f as STAR_RATING_MIN_VALUE_OPTIONS, g as STAR_RATING_MAX_VALUE_OPTIONS, j as STAR_RATING_ICONS_MAP, k as QUESTION_ACTIONS, l as QUESTION_KINDS, m as getActiveQuestionKindDetails, n as DEFAULT_AVAILABLE_LANGUAGES, o as QUESTIONS_INITIAL_VALUE, p as MANDATORY_KINDS } from './constants-
|
|
12
|
+
import { I as INDEPENDENT_LABELS_MAP, R as RICH_TEXT_QUESTIONS, A as AUTO_GENERATED_KINDS, a as IMMUTABLE_KINDS, h as htmlToPlainText, i as isElementOverflowing, D as Drag, Q as QUESTION_TYPES, S as SELECTABLE_KINDS, b as RESERVED_FIELD_CODES, c as QUESTIONS_WITHOUT_FIELD_CODE, N as NON_HIDEABLE_FIELDS, C as CAPTCHA_TYPES, F as FILE_TYPES_MAP, d as FILE_GROUPS, M as MINIMUM_OPTIONS, e as RATING_OPTIONS, f as STAR_RATING_MIN_VALUE_OPTIONS, g as STAR_RATING_MAX_VALUE_OPTIONS, j as STAR_RATING_ICONS_MAP, k as QUESTION_ACTIONS, l as QUESTION_KINDS, m as getActiveQuestionKindDetails, n as DEFAULT_AVAILABLE_LANGUAGES, o as QUESTIONS_INITIAL_VALUE, p as MANDATORY_KINDS } from './constants-9538731d.js';
|
|
13
13
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
14
14
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
15
15
|
import { Droppable, Draggable, DragDropContext } from '@hello-pangea/dnd';
|
|
@@ -29,6 +29,7 @@ import HelpPopover from '@bigbinary/neeto-molecules/HelpPopover';
|
|
|
29
29
|
import { t } from 'i18next';
|
|
30
30
|
import Plus from '@bigbinary/neeto-icons/Plus';
|
|
31
31
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
32
|
+
import { v4 } from 'uuid';
|
|
32
33
|
import NoData from '@bigbinary/neetoui/NoData';
|
|
33
34
|
import Pane from '@bigbinary/neetoui/Pane';
|
|
34
35
|
import Form$2 from '@bigbinary/neetoui/formik/Form';
|
|
@@ -236,8 +237,8 @@ function ownKeys$h(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
|
|
|
236
237
|
function _objectSpread$h(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$h(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$h(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
237
238
|
var validateEditorContent = function validateEditorContent(editorRef) {
|
|
238
239
|
return function () {
|
|
239
|
-
var _editorRef$current;
|
|
240
|
-
return (_editorRef$current = editorRef.current) !== null && _editorRef$current !== void 0 && (_editorRef$current = _editorRef$current.editor) !== null && _editorRef$current !== void 0 && _editorRef$current.isEmpty ? t("neetoForm.common.thisFieldIsRequired") : "";
|
|
240
|
+
var _editorRef$current, _editorRef$current$ed;
|
|
241
|
+
return (_editorRef$current = editorRef.current) !== null && _editorRef$current !== void 0 && (_editorRef$current$ed = _editorRef$current.editor) !== null && _editorRef$current$ed !== void 0 && _editorRef$current$ed.isEmpty ? t("neetoForm.common.thisFieldIsRequired") : "";
|
|
241
242
|
};
|
|
242
243
|
};
|
|
243
244
|
var buildReorderPayload = function buildReorderPayload(questions) {
|
|
@@ -425,71 +426,6 @@ var Questions = function Questions(_ref) {
|
|
|
425
426
|
});
|
|
426
427
|
};
|
|
427
428
|
|
|
428
|
-
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
429
|
-
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
430
|
-
// generators (like Math.random()).
|
|
431
|
-
let getRandomValues;
|
|
432
|
-
const rnds8 = new Uint8Array(16);
|
|
433
|
-
function rng() {
|
|
434
|
-
// lazy load so that environments that need to polyfill have a chance to do so
|
|
435
|
-
if (!getRandomValues) {
|
|
436
|
-
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
437
|
-
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
438
|
-
|
|
439
|
-
if (!getRandomValues) {
|
|
440
|
-
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
return getRandomValues(rnds8);
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
/**
|
|
448
|
-
* Convert array of 16 byte values to UUID string format of the form:
|
|
449
|
-
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
450
|
-
*/
|
|
451
|
-
|
|
452
|
-
const byteToHex = [];
|
|
453
|
-
|
|
454
|
-
for (let i = 0; i < 256; ++i) {
|
|
455
|
-
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
function unsafeStringify(arr, offset = 0) {
|
|
459
|
-
// Note: Be careful editing this code! It's been tuned for performance
|
|
460
|
-
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
461
|
-
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
465
|
-
var native = {
|
|
466
|
-
randomUUID
|
|
467
|
-
};
|
|
468
|
-
|
|
469
|
-
function v4(options, buf, offset) {
|
|
470
|
-
if (native.randomUUID && !buf && !options) {
|
|
471
|
-
return native.randomUUID();
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
options = options || {};
|
|
475
|
-
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
476
|
-
|
|
477
|
-
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
478
|
-
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
479
|
-
|
|
480
|
-
if (buf) {
|
|
481
|
-
offset = offset || 0;
|
|
482
|
-
|
|
483
|
-
for (let i = 0; i < 16; ++i) {
|
|
484
|
-
buf[offset + i] = rnds[i];
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
return buf;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
return unsafeStringify(rnds);
|
|
491
|
-
}
|
|
492
|
-
|
|
493
429
|
var moveItem = function moveItem(arr, sourceIndex, destinationIndex) {
|
|
494
430
|
if (sourceIndex === destinationIndex) return arr;
|
|
495
431
|
if (arr instanceof Array && arr[sourceIndex] !== undefined) {
|
|
@@ -745,8 +681,8 @@ var useUpdateEditorContent = function useUpdateEditorContent(_ref) {
|
|
|
745
681
|
return store.formState.richTextFieldsToReset.includes(fieldCode);
|
|
746
682
|
});
|
|
747
683
|
var setEditorContent = function setEditorContent(content) {
|
|
748
|
-
var _editorRef$current$ed;
|
|
749
|
-
return (_editorRef$current$ed = editorRef.current.editor) === null || _editorRef$current$ed === void 0
|
|
684
|
+
var _editorRef$current$ed, _editorRef$current$ed2;
|
|
685
|
+
return (_editorRef$current$ed = editorRef.current.editor) === null || _editorRef$current$ed === void 0 ? void 0 : (_editorRef$current$ed2 = _editorRef$current$ed.commands) === null || _editorRef$current$ed2 === void 0 ? void 0 : _editorRef$current$ed2.setContent(content);
|
|
750
686
|
};
|
|
751
687
|
if (shouldReset) {
|
|
752
688
|
setEditorContent(initialValue);
|
|
@@ -1225,11 +1161,11 @@ var SwitchBlock = function SwitchBlock(_ref) {
|
|
|
1225
1161
|
otherProps = _objectWithoutProperties(_ref, _excluded$4);
|
|
1226
1162
|
return /*#__PURE__*/jsxs(Label, {
|
|
1227
1163
|
className: classnames("flex items-center justify-start gap-2 ", className),
|
|
1228
|
-
"data-cy": "neeto-form-engine-".concat(hyphenate(title), "-toggle-label"),
|
|
1164
|
+
"data-cy": "neeto-form-engine-".concat(hyphenate(title && name), "-toggle-label"),
|
|
1229
1165
|
children: [/*#__PURE__*/jsx(Switch, _objectSpread$9(_objectSpread$9({}, _objectSpread$9(_objectSpread$9({}, otherProps), {}, {
|
|
1230
1166
|
name: name
|
|
1231
1167
|
})), {}, {
|
|
1232
|
-
"data-cy": "neeto-form-engine-".concat(hyphenate(title), "-switch")
|
|
1168
|
+
"data-cy": "neeto-form-engine-".concat(hyphenate(title && name), "-switch")
|
|
1233
1169
|
})), /*#__PURE__*/jsx(Typography, {
|
|
1234
1170
|
component: "span",
|
|
1235
1171
|
style: "body1",
|
|
@@ -1495,8 +1431,8 @@ var validateDomains = function validateDomains(value) {
|
|
|
1495
1431
|
}));
|
|
1496
1432
|
|
|
1497
1433
|
// eslint-disable-next-line no-async-promise-executor
|
|
1498
|
-
return new Promise(
|
|
1499
|
-
var _ref = _asyncToGenerator(
|
|
1434
|
+
return new Promise(/*#__PURE__*/function () {
|
|
1435
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(resolve) {
|
|
1500
1436
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
1501
1437
|
while (1) switch (_context.prev = _context.next) {
|
|
1502
1438
|
case 0:
|
|
@@ -1569,6 +1505,7 @@ var RestrictDomainsBlock = function RestrictDomainsBlock(_ref) {
|
|
|
1569
1505
|
var helpLink = useBuildFormStore(path(["formState", "helpDocUrls", domainName]));
|
|
1570
1506
|
return /*#__PURE__*/jsxs("div", {
|
|
1571
1507
|
className: "flex flex-col space-y-4",
|
|
1508
|
+
"data-cy": "".concat(hyphenate(switchName), "-container"),
|
|
1572
1509
|
children: [/*#__PURE__*/jsx(SwitchBlock, {
|
|
1573
1510
|
className: "mt-4",
|
|
1574
1511
|
name: switchName,
|
|
@@ -2195,7 +2132,7 @@ var Form = function Form(_ref) {
|
|
|
2195
2132
|
enabled: !(isDeleteAlertOpen || isManageQuestionPaneOpen)
|
|
2196
2133
|
});
|
|
2197
2134
|
useEffect(function () {
|
|
2198
|
-
onValueChange === null || onValueChange === void 0
|
|
2135
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(questions);
|
|
2199
2136
|
}, [questions]);
|
|
2200
2137
|
var availableQuestionKinds = getAvailableQuestionKinds({
|
|
2201
2138
|
allQuestionKinds: questionKinds,
|
|
@@ -2380,7 +2317,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2380
2317
|
isQuestionsLoading = _ref2.isQuestionsLoading;
|
|
2381
2318
|
useEffect(function () {
|
|
2382
2319
|
if (data) {
|
|
2383
|
-
onUpdate === null || onUpdate === void 0
|
|
2320
|
+
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(data);
|
|
2384
2321
|
}
|
|
2385
2322
|
}, [data]);
|
|
2386
2323
|
if (isLoading || showLoader && isQuestionsLoading && !isQuestionsPending) {
|