@bigbinary/neeto-form-frontend 3.9.9 → 3.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BuildForm.js +156 -280
- package/dist/BuildForm.js.map +1 -1
- package/dist/ExternalForm.js +8 -8
- package/dist/ExternalForm.js.map +1 -1
- package/dist/NeetoFormProvider.js.map +1 -1
- package/dist/Submission.js +1 -1
- package/dist/Submission.js.map +1 -1
- package/dist/UrlBuilder.js +7 -7
- package/dist/UrlBuilder.js.map +1 -1
- package/dist/{buildForm-CthgTgsm.js → buildForm-12iKiorQ.js} +3 -2
- package/dist/buildForm-12iKiorQ.js.map +1 -0
- package/dist/{buildForm-GdQQ62ve.js → buildForm-Zw1xpuBS.js} +3 -2
- package/dist/buildForm-Zw1xpuBS.js.map +1 -0
- package/dist/cjs/BuildForm.js +166 -290
- package/dist/cjs/BuildForm.js.map +1 -1
- package/dist/cjs/ExternalForm.js +8 -8
- package/dist/cjs/ExternalForm.js.map +1 -1
- package/dist/cjs/NeetoFormProvider.js.map +1 -1
- package/dist/cjs/Submission.js +1 -1
- package/dist/cjs/Submission.js.map +1 -1
- package/dist/cjs/UrlBuilder.js +7 -7
- package/dist/cjs/UrlBuilder.js.map +1 -1
- package/dist/cjs/hooks.js +3 -3
- package/dist/cjs/index.js +7 -7
- package/dist/{constants-C5wOjKeR.js → constants-AohkxnRH.js} +78 -28
- package/dist/constants-AohkxnRH.js.map +1 -0
- package/dist/{constants-BCiFseWW.js → constants-CCpt0hVT.js} +83 -26
- package/dist/constants-CCpt0hVT.js.map +1 -0
- package/dist/constants-D-XSuLo2.js.map +1 -1
- package/dist/constants-DlRX5mcQ.js.map +1 -1
- package/dist/hooks.js +3 -3
- package/dist/index-2caW4Cx0.js.map +1 -1
- package/dist/index-BL5SirYx.js.map +1 -1
- package/dist/index.js +7 -7
- package/dist/{useFormApi-DAiOGCeD.js → useFormApi-CWHgrz3I.js} +6 -6
- package/dist/useFormApi-CWHgrz3I.js.map +1 -0
- package/dist/{useFormApi-BS-TCKwR.js → useFormApi-DtoxIPE7.js} +6 -6
- package/dist/useFormApi-DtoxIPE7.js.map +1 -0
- package/dist/{useFormSubmission-B2aaxL1m.js → useFormSubmission-Bb1kpT-Z.js} +2 -2
- package/dist/{useFormSubmission-B2aaxL1m.js.map → useFormSubmission-Bb1kpT-Z.js.map} +1 -1
- package/dist/{useFormSubmission-DeaBHZs7.js → useFormSubmission-CU-i51el.js} +2 -2
- package/dist/{useFormSubmission-DeaBHZs7.js.map → useFormSubmission-CU-i51el.js.map} +1 -1
- package/dist/{utils-DvTIh9-Y.js → utils-ClGaz0cq.js} +27 -26
- package/dist/utils-ClGaz0cq.js.map +1 -0
- package/dist/{utils-DjiqVQzl.js → utils-DI6tmFqX.js} +27 -26
- package/dist/utils-DI6tmFqX.js.map +1 -0
- package/package.json +60 -57
- package/types.d.ts +1 -1
- package/dist/buildForm-CthgTgsm.js.map +0 -1
- package/dist/buildForm-GdQQ62ve.js.map +0 -1
- package/dist/constants-BCiFseWW.js.map +0 -1
- package/dist/constants-C5wOjKeR.js.map +0 -1
- package/dist/useFormApi-BS-TCKwR.js.map +0 -1
- package/dist/useFormApi-DAiOGCeD.js.map +0 -1
- package/dist/utils-DjiqVQzl.js.map +0 -1
- package/dist/utils-DvTIh9-Y.js.map +0 -1
package/dist/BuildForm.js
CHANGED
|
@@ -2,14 +2,14 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
2
2
|
import { useState, useRef, useEffect, createElement } from 'react';
|
|
3
3
|
import { useQueryClient } from '@tanstack/react-query';
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import { useFormikContext, useField,
|
|
5
|
+
import { useFormikContext, useField, Form as Form$3, Formik } from 'formik';
|
|
6
6
|
import { isPresent, truncate, findBy, isNotPresent, slugify, hyphenate, noop, nullSafe, filterBy, removeBy } from '@bigbinary/neeto-cist';
|
|
7
7
|
import { showThumbsUpToastr, withEventTargetValue, hyphenize } from '@bigbinary/neeto-commons-frontend/utils';
|
|
8
8
|
import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
|
|
9
|
-
import { equals,
|
|
10
|
-
import { h as useDeleteQuestion, i as useFetchQuestions, j as useCreateQuestion, k as useUpdateQuestion, l as useReorderQuestions, Q as QUERY_KEYS } from './useFormApi-
|
|
9
|
+
import { equals, path, when, assoc, includes, isEmpty, reject, keys, pick, omit, evolve, map, modify, without, mergeLeft, isNil, pipe, filter, isNotNil, uniq, join, pluck, test, difference, prop, split, last, __, concat, F } from 'ramda';
|
|
10
|
+
import { h as useDeleteQuestion, i as useFetchQuestions, j as useCreateQuestion, k as useUpdateQuestion, l as useReorderQuestions, Q as QUERY_KEYS } from './useFormApi-DtoxIPE7.js';
|
|
11
11
|
import { Q as QUESTION_KIND } from './constants-DlRX5mcQ.js';
|
|
12
|
-
import { I as INDEPENDENT_LABELS_MAP,
|
|
12
|
+
import { I as INDEPENDENT_LABELS_MAP, i as isRichTextQuestion, h as htmlToPlainText, a as isElementOverflowing, D as Drag, b as QUESTION_TYPES, S as SELECTABLE_KINDS, c as isAutoGeneratedQuestion, N as NON_BASIC_LATIN_CHARACTERS_REGEX, R as RESERVED_FIELD_CODES, d as isDefaultLanguage, e as buildDisabledAddButtonTooltipProps, f as buildAddQuestionButtonProps, v as validateEditorContent, F as FIELD_CODES_REJECT_CHARS_REGEX, j as isImmutableField, Q as QUESTIONS_WITHOUT_FIELD_CODE, k as NON_HIDEABLE_FIELDS, l as RICH_TEXT_QUESTIONS, C as CAPTCHA_TYPES, m as FILE_TYPES_MAP, n as FILE_GROUPS, M as MINIMUM_OPTIONS, o as RATING_OPTIONS, p as STAR_RATING_MIN_VALUE_OPTIONS, q as STAR_RATING_MAX_VALUE_OPTIONS, r as STAR_RATING_ICONS_MAP, s as QUESTION_ACTIONS, t as QUESTION_KINDS, u as getActiveQuestionKindDetails, w as DEFAULT_AVAILABLE_LANGUAGES, x as QUESTIONS_INITIAL_VALUE, y as buildReorderPayload, z as IMMUTABLE_KINDS, A as MANDATORY_KINDS } from './constants-AohkxnRH.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';
|
|
@@ -17,7 +17,7 @@ import { isMetaKeyPressed, withT, useStateWithDependency, useOnClickOutside } fr
|
|
|
17
17
|
import HelpPopover from '@bigbinary/neeto-molecules/HelpPopover';
|
|
18
18
|
import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
|
|
19
19
|
import { useTranslation, Trans } from 'react-i18next';
|
|
20
|
-
import { a as useBuildFormStore } from './buildForm-
|
|
20
|
+
import { a as useBuildFormStore } from './buildForm-Zw1xpuBS.js';
|
|
21
21
|
import { shallow } from 'zustand/shallow';
|
|
22
22
|
import Alert from '@bigbinary/neetoui/Alert';
|
|
23
23
|
import { f as fieldWithFallback, i as isFunction } from './index-BL5SirYx.js';
|
|
@@ -26,9 +26,8 @@ import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
|
|
|
26
26
|
import Typography from '@bigbinary/neetoui/Typography';
|
|
27
27
|
import Dropdown from '@bigbinary/neetoui/Dropdown';
|
|
28
28
|
import Tooltip from '@bigbinary/neetoui/Tooltip';
|
|
29
|
-
import { t } from 'i18next';
|
|
30
|
-
import Plus from '@bigbinary/neeto-icons/Plus';
|
|
31
29
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
30
|
+
import { t } from 'i18next';
|
|
32
31
|
import { v4 } from 'uuid';
|
|
33
32
|
import NoData from '@bigbinary/neetoui/NoData';
|
|
34
33
|
import Pane from '@bigbinary/neetoui/Pane';
|
|
@@ -53,10 +52,11 @@ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
|
53
52
|
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
54
53
|
import Checkbox$1 from '@bigbinary/neetoui/formik/Checkbox';
|
|
55
54
|
import Checkbox from '@bigbinary/neetoui/Checkbox';
|
|
56
|
-
import
|
|
55
|
+
import OptionFields from '@bigbinary/neeto-molecules/OptionFields';
|
|
57
56
|
import '@bigbinary/neeto-commons-frontend/constants';
|
|
58
57
|
import 'axios';
|
|
59
58
|
import 'dompurify';
|
|
59
|
+
import '@bigbinary/neeto-icons/Plus';
|
|
60
60
|
import 'zustand';
|
|
61
61
|
import '@babel/runtime/helpers/typeof';
|
|
62
62
|
|
|
@@ -233,50 +233,8 @@ var Overview = function Overview(_ref) {
|
|
|
233
233
|
});
|
|
234
234
|
};
|
|
235
235
|
|
|
236
|
-
function ownKeys$
|
|
237
|
-
function _objectSpread$
|
|
238
|
-
var validateEditorContent = function validateEditorContent(editorRef) {
|
|
239
|
-
return function () {
|
|
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") : "";
|
|
242
|
-
};
|
|
243
|
-
};
|
|
244
|
-
var buildReorderPayload = function buildReorderPayload(questions) {
|
|
245
|
-
return reduce(function (acc, _ref) {
|
|
246
|
-
var id = _ref.id,
|
|
247
|
-
displayOrder = _ref.displayOrder;
|
|
248
|
-
return assoc(id, displayOrder, acc);
|
|
249
|
-
}, {}, questions);
|
|
250
|
-
};
|
|
251
|
-
var isRichTextQuestion = includes(__, RICH_TEXT_QUESTIONS);
|
|
252
|
-
var isAutoGeneratedQuestion = includes(__, AUTO_GENERATED_KINDS);
|
|
253
|
-
var isImmutableField = function isImmutableField(field) {
|
|
254
|
-
return IMMUTABLE_KINDS.includes(field.kind);
|
|
255
|
-
};
|
|
256
|
-
var buildAddQuestionButtonProps = function buildAddQuestionButtonProps(onAdd, isDisabled, tooltipProps) {
|
|
257
|
-
return _objectSpread$h({
|
|
258
|
-
"data-cy": "neeto-form-engine-add-question-button",
|
|
259
|
-
disabled: isDisabled,
|
|
260
|
-
label: t("neetoForm.questions.common.primaryPanel.addQuestion"),
|
|
261
|
-
icon: Plus,
|
|
262
|
-
iconPosition: "left",
|
|
263
|
-
style: "link",
|
|
264
|
-
onClick: onAdd
|
|
265
|
-
}, isDisabled && {
|
|
266
|
-
tooltipProps: tooltipProps
|
|
267
|
-
});
|
|
268
|
-
};
|
|
269
|
-
var buildDisabledAddButtonTooltipProps = function buildDisabledAddButtonTooltipProps(isDisabled) {
|
|
270
|
-
var disabledAddButtonTooltipProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
271
|
-
return _objectSpread$h({
|
|
272
|
-
disabled: !isDisabled,
|
|
273
|
-
position: "top",
|
|
274
|
-
content: t("neetoForm.questions.common.primaryPanel.noQuestionLeft")
|
|
275
|
-
}, disabledAddButtonTooltipProps);
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
function ownKeys$g(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
279
|
-
function _objectSpread$g(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$g(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$g(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
236
|
+
function ownKeys$f(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
237
|
+
function _objectSpread$f(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$f(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$f(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
280
238
|
var Card = function Card(_ref) {
|
|
281
239
|
var _ref$question = _ref.question,
|
|
282
240
|
question = _ref$question === void 0 ? {} : _ref$question,
|
|
@@ -327,6 +285,7 @@ var Card = function Card(_ref) {
|
|
|
327
285
|
position: "top",
|
|
328
286
|
children: /*#__PURE__*/jsx(Typography, {
|
|
329
287
|
className: "line-clamp-2 min-w-0 flex-grow truncate break-words",
|
|
288
|
+
"data-cy": "".concat(slugify(questionLabel), "-question-card-label"),
|
|
330
289
|
lineHeight: "snug",
|
|
331
290
|
ref: questionLabelRef,
|
|
332
291
|
style: "body2",
|
|
@@ -336,7 +295,7 @@ var Card = function Card(_ref) {
|
|
|
336
295
|
})]
|
|
337
296
|
}), /*#__PURE__*/jsxs("div", {
|
|
338
297
|
className: "flex items-center gap-1",
|
|
339
|
-
children: [isSmsReminderQuestion && /*#__PURE__*/jsx(HelpPopover, _objectSpread$
|
|
298
|
+
children: [isSmsReminderQuestion && /*#__PURE__*/jsx(HelpPopover, _objectSpread$f({
|
|
340
299
|
description: t("neetoForm.smsReminder.popoverDescription"),
|
|
341
300
|
popoverProps: {
|
|
342
301
|
position: "top"
|
|
@@ -375,8 +334,8 @@ var Card = function Card(_ref) {
|
|
|
375
334
|
});
|
|
376
335
|
};
|
|
377
336
|
|
|
378
|
-
function ownKeys$
|
|
379
|
-
function _objectSpread$
|
|
337
|
+
function ownKeys$e(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
338
|
+
function _objectSpread$e(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$e(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$e(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
380
339
|
var Questions = function Questions(_ref) {
|
|
381
340
|
var questions = _ref.questions,
|
|
382
341
|
isDeletable = _ref.isDeletable,
|
|
@@ -393,7 +352,7 @@ var Questions = function Questions(_ref) {
|
|
|
393
352
|
var droppableProps = _ref2.droppableProps,
|
|
394
353
|
placeholder = _ref2.placeholder,
|
|
395
354
|
innerRef = _ref2.innerRef;
|
|
396
|
-
return /*#__PURE__*/jsxs("div", _objectSpread$
|
|
355
|
+
return /*#__PURE__*/jsxs("div", _objectSpread$e(_objectSpread$e({}, droppableProps), {}, {
|
|
397
356
|
className: "space-y-2",
|
|
398
357
|
ref: innerRef,
|
|
399
358
|
children: [questions.map(function (question, index) {
|
|
@@ -406,7 +365,7 @@ var Questions = function Questions(_ref) {
|
|
|
406
365
|
var draggableProps = _ref3.draggableProps,
|
|
407
366
|
dragHandleProps = _ref3.dragHandleProps,
|
|
408
367
|
innerRef = _ref3.innerRef;
|
|
409
|
-
return /*#__PURE__*/jsx("div", _objectSpread$
|
|
368
|
+
return /*#__PURE__*/jsx("div", _objectSpread$e(_objectSpread$e(_objectSpread$e({}, draggableProps), dragHandleProps), {}, {
|
|
410
369
|
ref: innerRef,
|
|
411
370
|
children: /*#__PURE__*/jsx(Card, {
|
|
412
371
|
allQuestionKinds: allQuestionKinds,
|
|
@@ -438,8 +397,8 @@ var arrayHelpers = {
|
|
|
438
397
|
moveItem: moveItem
|
|
439
398
|
};
|
|
440
399
|
|
|
441
|
-
function ownKeys$
|
|
442
|
-
function _objectSpread$
|
|
400
|
+
function ownKeys$d(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
401
|
+
function _objectSpread$d(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$d(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$d(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
443
402
|
var isChoiceQuestion = function isChoiceQuestion(question) {
|
|
444
403
|
return includes(question === null || question === void 0 ? void 0 : question.kind, SELECTABLE_KINDS);
|
|
445
404
|
};
|
|
@@ -466,12 +425,24 @@ var generateFieldCodePrefix = function generateFieldCodePrefix(label, kind) {
|
|
|
466
425
|
}
|
|
467
426
|
return addSuffixForReservedFieldCode(prefix) || "";
|
|
468
427
|
};
|
|
469
|
-
var
|
|
470
|
-
var
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
428
|
+
var modifyDefaultValues = function modifyDefaultValues(_ref) {
|
|
429
|
+
var values = _ref.values,
|
|
430
|
+
kind = _ref.kind,
|
|
431
|
+
selectedLanguage = _ref.selectedLanguage,
|
|
432
|
+
isUsingDefaultQuestionKinds = _ref.isUsingDefaultQuestionKinds;
|
|
433
|
+
if (!includes(kind, SELECTABLE_KINDS) || isDefaultLanguage(selectedLanguage) || !isUsingDefaultQuestionKinds) {
|
|
434
|
+
return values;
|
|
435
|
+
}
|
|
436
|
+
return evolve({
|
|
437
|
+
optionsAttributes: map(assoc("label", ""))
|
|
438
|
+
}, values);
|
|
439
|
+
};
|
|
440
|
+
var generateUniqueFieldCode = function generateUniqueFieldCode(_ref2) {
|
|
441
|
+
var questions = _ref2.questions,
|
|
442
|
+
_ref2$label = _ref2.label,
|
|
443
|
+
label = _ref2$label === void 0 ? "" : _ref2$label,
|
|
444
|
+
_ref2$kind = _ref2.kind,
|
|
445
|
+
kind = _ref2$kind === void 0 ? "" : _ref2$kind;
|
|
475
446
|
var prefix = generateFieldCodePrefix(label, kind);
|
|
476
447
|
var uniqueNumber = Math.max.apply(Math, [0].concat(_toConsumableArray(getUniqueNumbersFromExistingFieldCodes(prefix, questions))));
|
|
477
448
|
var candidateFieldCode = "";
|
|
@@ -487,37 +458,45 @@ var generateUniqueFieldCode = function generateUniqueFieldCode(_ref) {
|
|
|
487
458
|
}
|
|
488
459
|
return candidateFieldCode;
|
|
489
460
|
};
|
|
490
|
-
var isQuestionKindAlreadyActive = function isQuestionKindAlreadyActive(
|
|
491
|
-
var activeQuestions =
|
|
492
|
-
kind =
|
|
461
|
+
var isQuestionKindAlreadyActive = function isQuestionKindAlreadyActive(_ref3) {
|
|
462
|
+
var activeQuestions = _ref3.activeQuestions,
|
|
463
|
+
kind = _ref3.kind;
|
|
493
464
|
return activeQuestions.some(function (activeQuestion) {
|
|
494
465
|
return activeQuestion.kind === kind.type && activeQuestion._destroy !== true;
|
|
495
466
|
});
|
|
496
467
|
};
|
|
497
|
-
var handleFieldDragEnd = function handleFieldDragEnd(
|
|
498
|
-
var items =
|
|
499
|
-
setValue =
|
|
500
|
-
source =
|
|
501
|
-
destination =
|
|
468
|
+
var handleFieldDragEnd = function handleFieldDragEnd(_ref4) {
|
|
469
|
+
var items = _ref4.items,
|
|
470
|
+
setValue = _ref4.setValue,
|
|
471
|
+
source = _ref4.source,
|
|
472
|
+
destination = _ref4.destination;
|
|
502
473
|
if (!(destination && items instanceof Array)) return;
|
|
503
474
|
var nextItems = _toConsumableArray(items);
|
|
504
475
|
arrayHelpers.moveItem(nextItems, source.index, destination.index);
|
|
505
476
|
var orderedItems = nextItems.map(function (item, index) {
|
|
506
|
-
return _objectSpread$
|
|
477
|
+
return _objectSpread$d(_objectSpread$d({}, item), {}, {
|
|
507
478
|
displayOrder: index
|
|
508
479
|
});
|
|
509
480
|
});
|
|
510
481
|
setValue("questions", orderedItems);
|
|
511
482
|
};
|
|
512
|
-
var createFieldData = function createFieldData(
|
|
513
|
-
var
|
|
514
|
-
defaults =
|
|
515
|
-
type =
|
|
516
|
-
metadata =
|
|
517
|
-
|
|
518
|
-
isRequired =
|
|
519
|
-
questions =
|
|
520
|
-
|
|
483
|
+
var createFieldData = function createFieldData(_ref5) {
|
|
484
|
+
var _ref5$kind = _ref5.kind,
|
|
485
|
+
defaults = _ref5$kind.defaults,
|
|
486
|
+
type = _ref5$kind.type,
|
|
487
|
+
metadata = _ref5$kind.metadata,
|
|
488
|
+
_ref5$isRequired = _ref5.isRequired,
|
|
489
|
+
isRequired = _ref5$isRequired === void 0 ? undefined : _ref5$isRequired,
|
|
490
|
+
questions = _ref5.questions,
|
|
491
|
+
selectedLanguage = _ref5.selectedLanguage,
|
|
492
|
+
isUsingDefaultQuestionKinds = _ref5.isUsingDefaultQuestionKinds;
|
|
493
|
+
var modifiedDefaultValues = modifyDefaultValues({
|
|
494
|
+
values: defaults,
|
|
495
|
+
kind: type,
|
|
496
|
+
selectedLanguage: selectedLanguage,
|
|
497
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds
|
|
498
|
+
});
|
|
499
|
+
return _objectSpread$d(_objectSpread$d({}, modifiedDefaultValues), {}, {
|
|
521
500
|
metadata: metadata,
|
|
522
501
|
isRequired: isRequired,
|
|
523
502
|
kind: type,
|
|
@@ -529,10 +508,10 @@ var createFieldData = function createFieldData(_ref4) {
|
|
|
529
508
|
})
|
|
530
509
|
});
|
|
531
510
|
};
|
|
532
|
-
var duplicateFieldData = function duplicateFieldData(
|
|
533
|
-
var item =
|
|
534
|
-
questionKinds =
|
|
535
|
-
questions =
|
|
511
|
+
var duplicateFieldData = function duplicateFieldData(_ref6) {
|
|
512
|
+
var item = _ref6.item,
|
|
513
|
+
questionKinds = _ref6.questionKinds,
|
|
514
|
+
questions = _ref6.questions;
|
|
536
515
|
var isRequired = item.isRequired,
|
|
537
516
|
kind = item.kind,
|
|
538
517
|
optionsAttributes = item.optionsAttributes;
|
|
@@ -545,7 +524,7 @@ var duplicateFieldData = function duplicateFieldData(_ref5) {
|
|
|
545
524
|
var newQuestionLabel = isRichTextQuestion(kind) ? label : t("neetoForm.common.clonedElementLabel", {
|
|
546
525
|
label: label
|
|
547
526
|
});
|
|
548
|
-
return _objectSpread$
|
|
527
|
+
return _objectSpread$d(_objectSpread$d({}, defaultAttributes), {}, {
|
|
549
528
|
isRequired: isRequired,
|
|
550
529
|
kind: kind,
|
|
551
530
|
label: newQuestionLabel,
|
|
@@ -559,11 +538,11 @@ var duplicateFieldData = function duplicateFieldData(_ref5) {
|
|
|
559
538
|
displayOrder: item.displayOrder + 1
|
|
560
539
|
});
|
|
561
540
|
};
|
|
562
|
-
var getAvailableQuestionKinds = function getAvailableQuestionKinds(
|
|
563
|
-
var allQuestionKinds =
|
|
564
|
-
|
|
565
|
-
activeQuestions =
|
|
566
|
-
isKindAlreadyActive =
|
|
541
|
+
var getAvailableQuestionKinds = function getAvailableQuestionKinds(_ref7) {
|
|
542
|
+
var allQuestionKinds = _ref7.allQuestionKinds,
|
|
543
|
+
_ref7$activeQuestions = _ref7.activeQuestions,
|
|
544
|
+
activeQuestions = _ref7$activeQuestions === void 0 ? [] : _ref7$activeQuestions,
|
|
545
|
+
isKindAlreadyActive = _ref7.isKindAlreadyActive;
|
|
567
546
|
if (isEmpty(activeQuestions)) return allQuestionKinds;
|
|
568
547
|
return reject(function (kind) {
|
|
569
548
|
var isSingularKind = kind.isSingular;
|
|
@@ -629,8 +608,8 @@ var INITIAL_VALUES = {
|
|
|
629
608
|
var VALID_FIELD_CODE_REGEX = /^[a-z0-9]+(_[a-z0-9]+)*$/;
|
|
630
609
|
|
|
631
610
|
var _excluded$8 = ["label", "name"];
|
|
632
|
-
function ownKeys$
|
|
633
|
-
function _objectSpread$
|
|
611
|
+
function ownKeys$c(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
612
|
+
function _objectSpread$c(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$c(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$c(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
634
613
|
var FormikAdaptiveInput = function FormikAdaptiveInput(_ref) {
|
|
635
614
|
var label = _ref.label,
|
|
636
615
|
name = _ref.name,
|
|
@@ -649,7 +628,7 @@ var FormikAdaptiveInput = function FormikAdaptiveInput(_ref) {
|
|
|
649
628
|
var end = element.value.length;
|
|
650
629
|
element.setSelectionRange(end, end);
|
|
651
630
|
};
|
|
652
|
-
return /*#__PURE__*/jsx(Textarea, _objectSpread$
|
|
631
|
+
return /*#__PURE__*/jsx(Textarea, _objectSpread$c({
|
|
653
632
|
label: label,
|
|
654
633
|
name: name,
|
|
655
634
|
className: "neeto-form-nano-adaptive-input",
|
|
@@ -715,8 +694,8 @@ var useUpdateEditorContent = function useUpdateEditorContent(_ref) {
|
|
|
715
694
|
return store.formState.richTextFieldsToReset.includes(fieldCode);
|
|
716
695
|
});
|
|
717
696
|
var setEditorContent = function setEditorContent(content) {
|
|
718
|
-
var _editorRef$current$ed
|
|
719
|
-
return (_editorRef$current$ed = editorRef.current.editor) === null || _editorRef$current$ed === void 0
|
|
697
|
+
var _editorRef$current$ed;
|
|
698
|
+
return (_editorRef$current$ed = editorRef.current.editor) === null || _editorRef$current$ed === void 0 || (_editorRef$current$ed = _editorRef$current$ed.commands) === null || _editorRef$current$ed === void 0 ? void 0 : _editorRef$current$ed.setContent(content);
|
|
720
699
|
};
|
|
721
700
|
if (shouldReset) {
|
|
722
701
|
setEditorContent(initialValue);
|
|
@@ -804,8 +783,8 @@ var RequiredSwitch = withT(function (_ref) {
|
|
|
804
783
|
});
|
|
805
784
|
|
|
806
785
|
var _excluded$7 = ["maxLength"];
|
|
807
|
-
function ownKeys$
|
|
808
|
-
function _objectSpread$
|
|
786
|
+
function ownKeys$b(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
787
|
+
function _objectSpread$b(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$b(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$b(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
809
788
|
var InputWithMaxLength = function InputWithMaxLength(_ref) {
|
|
810
789
|
var maxLength = _ref.maxLength,
|
|
811
790
|
props = _objectWithoutProperties(_ref, _excluded$7);
|
|
@@ -819,7 +798,7 @@ var InputWithMaxLength = function InputWithMaxLength(_ref) {
|
|
|
819
798
|
}
|
|
820
799
|
}, [value, maxLength, setValue]);
|
|
821
800
|
var shouldShowMaxLength = value && value.length > maxLength - 10;
|
|
822
|
-
return /*#__PURE__*/jsx(Input, _objectSpread$
|
|
801
|
+
return /*#__PURE__*/jsx(Input, _objectSpread$b(_objectSpread$b({}, props), shouldShowMaxLength && {
|
|
823
802
|
maxLength: maxLength
|
|
824
803
|
}));
|
|
825
804
|
};
|
|
@@ -876,14 +855,18 @@ var Form$1 = function Form(_ref) {
|
|
|
876
855
|
setFieldValue = _useFormikContext.setFieldValue;
|
|
877
856
|
var hideQuestionHelpDoc = useBuildFormStore(path(["formState", "helpDocUrls", "hideQuestion"]));
|
|
878
857
|
var _useBuildFormStore = useBuildFormStore(function (store) {
|
|
879
|
-
var _store$formState, _store$formState2;
|
|
858
|
+
var _store$formState, _store$formState2, _store$formState3, _store$formState4;
|
|
880
859
|
return {
|
|
881
860
|
enableDomainWhitelisting: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["enableDomainWhitelisting"],
|
|
882
|
-
enableDomainBlacklisting: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["enableDomainBlacklisting"]
|
|
861
|
+
enableDomainBlacklisting: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["enableDomainBlacklisting"],
|
|
862
|
+
selectedLanguage: (_store$formState3 = store["formState"]) === null || _store$formState3 === void 0 ? void 0 : _store$formState3["selectedLanguage"],
|
|
863
|
+
isUsingDefaultQuestionKinds: (_store$formState4 = store["formState"]) === null || _store$formState4 === void 0 ? void 0 : _store$formState4["isUsingDefaultQuestionKinds"]
|
|
883
864
|
};
|
|
884
865
|
}, shallow),
|
|
885
866
|
enableDomainWhitelisting = _useBuildFormStore.enableDomainWhitelisting,
|
|
886
|
-
enableDomainBlacklisting = _useBuildFormStore.enableDomainBlacklisting
|
|
867
|
+
enableDomainBlacklisting = _useBuildFormStore.enableDomainBlacklisting,
|
|
868
|
+
selectedLanguage = _useBuildFormStore.selectedLanguage,
|
|
869
|
+
isUsingDefaultQuestionKinds = _useBuildFormStore.isUsingDefaultQuestionKinds;
|
|
887
870
|
var kind = values.kind;
|
|
888
871
|
var questionKinds = isEdit ? allQuestionKinds : availableQuestionKinds;
|
|
889
872
|
var questionKindUniquenessPattern = mergeLeft(isEdit && additionalQuestionKindPattern ? additionalQuestionKindPattern(values) : {}, {
|
|
@@ -924,7 +907,9 @@ var Form$1 = function Form(_ref) {
|
|
|
924
907
|
return createFieldData({
|
|
925
908
|
kind: questionKind,
|
|
926
909
|
isRequired: isRequired,
|
|
927
|
-
questions: questions
|
|
910
|
+
questions: questions,
|
|
911
|
+
selectedLanguage: selectedLanguage,
|
|
912
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds
|
|
928
913
|
});
|
|
929
914
|
};
|
|
930
915
|
var updateFormState = function updateFormState(data) {
|
|
@@ -1024,15 +1009,13 @@ var formValidationSchema = function formValidationSchema() {
|
|
|
1024
1009
|
fieldCode: yup.string().trim().notOneOf(RESERVED_FIELD_CODES, t("neetoForm.error.invalidFieldCode")).when("kind", function (kind, schema) {
|
|
1025
1010
|
return enableFieldCode && !includes(kind, QUESTIONS_WITHOUT_FIELD_CODE) ? fieldCodeValidation(schema, t("neetoForm.questions.common.questionFields.field.fieldCode")) : schema.notRequired();
|
|
1026
1011
|
}),
|
|
1027
|
-
optionsAttributes: yup.array().when("
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
});
|
|
1035
|
-
}
|
|
1012
|
+
optionsAttributes: yup.array().when("kind", function (kind, schema) {
|
|
1013
|
+
return includes(kind, SELECTABLE_KINDS) ? schema.of(yup.object().shape({
|
|
1014
|
+
label: yup.string().when("_destroy", {
|
|
1015
|
+
is: true,
|
|
1016
|
+
otherwise: requiredLabelValidation(yup.string(), t("neetoForm.questions.common.questionFields.field.option"))
|
|
1017
|
+
})
|
|
1018
|
+
})) : schema.notRequired();
|
|
1036
1019
|
}),
|
|
1037
1020
|
highestRatingLabel: yup.string().nullable(),
|
|
1038
1021
|
averageRatingLabel: yup.string().nullable(),
|
|
@@ -1041,8 +1024,8 @@ var formValidationSchema = function formValidationSchema() {
|
|
|
1041
1024
|
};
|
|
1042
1025
|
|
|
1043
1026
|
var _excluded$6 = ["question", "onClose", "questions", "handleSelect", "buildRequestArgs", "isOpen"];
|
|
1044
|
-
function ownKeys$
|
|
1045
|
-
function _objectSpread$
|
|
1027
|
+
function ownKeys$a(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1028
|
+
function _objectSpread$a(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$a(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$a(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1046
1029
|
var Add = function Add(_ref) {
|
|
1047
1030
|
var question = _ref.question,
|
|
1048
1031
|
onClose = _ref.onClose,
|
|
@@ -1073,7 +1056,7 @@ var Add = function Add(_ref) {
|
|
|
1073
1056
|
var handleSubmit = function handleSubmit(values) {
|
|
1074
1057
|
if (isCreating || !isOpen) return;
|
|
1075
1058
|
var displayOrder = question ? question.displayOrder + 1 : questions.length;
|
|
1076
|
-
createQuestion(_objectSpread$
|
|
1059
|
+
createQuestion(_objectSpread$a({
|
|
1077
1060
|
language: language,
|
|
1078
1061
|
neetoFormQuestion: mergeLeft({
|
|
1079
1062
|
displayOrder: displayOrder
|
|
@@ -1102,7 +1085,7 @@ var Add = function Add(_ref) {
|
|
|
1102
1085
|
onSubmit: handleSubmit
|
|
1103
1086
|
},
|
|
1104
1087
|
children: /*#__PURE__*/jsxs(Fragment, {
|
|
1105
|
-
children: [/*#__PURE__*/jsx(Form$1, _objectSpread$
|
|
1088
|
+
children: [/*#__PURE__*/jsx(Form$1, _objectSpread$a({}, _objectSpread$a(_objectSpread$a({}, props), {}, {
|
|
1106
1089
|
question: question,
|
|
1107
1090
|
questions: questions
|
|
1108
1091
|
}))), /*#__PURE__*/jsx(Pane.Footer, {
|
|
@@ -1119,8 +1102,8 @@ var Add = function Add(_ref) {
|
|
|
1119
1102
|
};
|
|
1120
1103
|
|
|
1121
1104
|
var _excluded$5 = ["question", "isOpen", "onClose"];
|
|
1122
|
-
function ownKeys$
|
|
1123
|
-
function _objectSpread$
|
|
1105
|
+
function ownKeys$9(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1106
|
+
function _objectSpread$9(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$9(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$9(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1124
1107
|
var Edit = function Edit(_ref) {
|
|
1125
1108
|
var question = _ref.question,
|
|
1126
1109
|
isOpen = _ref.isOpen,
|
|
@@ -1172,7 +1155,7 @@ var Edit = function Edit(_ref) {
|
|
|
1172
1155
|
onSubmit: handleSubmit
|
|
1173
1156
|
},
|
|
1174
1157
|
children: /*#__PURE__*/jsxs(Fragment, {
|
|
1175
|
-
children: [/*#__PURE__*/jsx(Form$1, _objectSpread$
|
|
1158
|
+
children: [/*#__PURE__*/jsx(Form$1, _objectSpread$9(_objectSpread$9({}, _objectSpread$9({
|
|
1176
1159
|
question: question
|
|
1177
1160
|
}, props)), {}, {
|
|
1178
1161
|
isEdit: true
|
|
@@ -1208,8 +1191,8 @@ var Captcha = withT(function (_ref) {
|
|
|
1208
1191
|
});
|
|
1209
1192
|
|
|
1210
1193
|
var _excluded$4 = ["name", "title", "className"];
|
|
1211
|
-
function ownKeys$
|
|
1212
|
-
function _objectSpread$
|
|
1194
|
+
function ownKeys$8(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1195
|
+
function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$8(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$8(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1213
1196
|
var SwitchBlock = function SwitchBlock(_ref) {
|
|
1214
1197
|
var name = _ref.name,
|
|
1215
1198
|
title = _ref.title,
|
|
@@ -1219,7 +1202,7 @@ var SwitchBlock = function SwitchBlock(_ref) {
|
|
|
1219
1202
|
return /*#__PURE__*/jsxs(Label, {
|
|
1220
1203
|
className: classnames("flex items-center justify-start gap-2 ", className),
|
|
1221
1204
|
"data-cy": "neeto-form-engine-".concat(hyphenate(title && name), "-toggle-label"),
|
|
1222
|
-
children: [/*#__PURE__*/jsx(Switch, _objectSpread$
|
|
1205
|
+
children: [/*#__PURE__*/jsx(Switch, _objectSpread$8(_objectSpread$8({}, _objectSpread$8(_objectSpread$8({}, otherProps), {}, {
|
|
1223
1206
|
name: name
|
|
1224
1207
|
})), {}, {
|
|
1225
1208
|
"data-cy": "neeto-form-engine-".concat(hyphenate(title && name), "-switch")
|
|
@@ -1231,15 +1214,15 @@ var SwitchBlock = function SwitchBlock(_ref) {
|
|
|
1231
1214
|
});
|
|
1232
1215
|
};
|
|
1233
1216
|
|
|
1234
|
-
function ownKeys$
|
|
1235
|
-
function _objectSpread$
|
|
1217
|
+
function ownKeys$7(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1218
|
+
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1236
1219
|
var TitleWithHelpPopover = function TitleWithHelpPopover(_ref) {
|
|
1237
1220
|
var title = _ref.title,
|
|
1238
1221
|
description = _ref.description,
|
|
1239
1222
|
helpLink = _ref.helpLink;
|
|
1240
1223
|
return /*#__PURE__*/jsxs("div", {
|
|
1241
1224
|
className: "flex gap-2",
|
|
1242
|
-
children: [title, /*#__PURE__*/jsx(HelpPopover, _objectSpread$
|
|
1225
|
+
children: [title, /*#__PURE__*/jsx(HelpPopover, _objectSpread$7({
|
|
1243
1226
|
description: description,
|
|
1244
1227
|
popoverProps: {
|
|
1245
1228
|
position: "top"
|
|
@@ -1266,8 +1249,8 @@ var DOMAIN_RESTRICTION_TRANSLATIONS = {
|
|
|
1266
1249
|
};
|
|
1267
1250
|
|
|
1268
1251
|
var _excluded$3 = ["children"];
|
|
1269
|
-
function ownKeys$
|
|
1270
|
-
function _objectSpread$
|
|
1252
|
+
function ownKeys$6(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1253
|
+
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1271
1254
|
var STYLES = {
|
|
1272
1255
|
border: {
|
|
1273
1256
|
"default": "1px solid rgb(var(--neeto-ui-gray-400))",
|
|
@@ -1279,8 +1262,8 @@ var STYLES = {
|
|
|
1279
1262
|
}
|
|
1280
1263
|
};
|
|
1281
1264
|
var MultiValueRemove = function MultiValueRemove(props) {
|
|
1282
|
-
return /*#__PURE__*/jsx(components.MultiValueRemove, _objectSpread$
|
|
1283
|
-
innerProps: _objectSpread$
|
|
1265
|
+
return /*#__PURE__*/jsx(components.MultiValueRemove, _objectSpread$6(_objectSpread$6({}, props), {}, {
|
|
1266
|
+
innerProps: _objectSpread$6(_objectSpread$6({}, props.innerProps), {}, _defineProperty({}, "data-cy", "".concat(hyphenize(props.data.label), "-remove-icon"))),
|
|
1284
1267
|
children: /*#__PURE__*/jsx(Close, {
|
|
1285
1268
|
size: 16
|
|
1286
1269
|
})
|
|
@@ -1300,8 +1283,8 @@ var ValueContainer = function ValueContainer(_ref) {
|
|
|
1300
1283
|
firstChild = _children[0],
|
|
1301
1284
|
rest = _children.slice(1);
|
|
1302
1285
|
var shouldCollapse = !isFocused && value.length > visibleDomainsCount;
|
|
1303
|
-
return /*#__PURE__*/jsxs(components.ValueContainer, _objectSpread$
|
|
1304
|
-
innerProps: _objectSpread$
|
|
1286
|
+
return /*#__PURE__*/jsxs(components.ValueContainer, _objectSpread$6(_objectSpread$6({}, props), {}, {
|
|
1287
|
+
innerProps: _objectSpread$6(_objectSpread$6({}, props.innerProps), {}, _defineProperty({}, "data-cy", "multi-domain-input-container")),
|
|
1305
1288
|
children: [shouldCollapse ? firstChild.slice(0, visibleDomainsCount) : firstChild, shouldCollapse && /*#__PURE__*/jsx(Tag, {
|
|
1306
1289
|
style: "secondary",
|
|
1307
1290
|
label: t("neetoForm.common.remainingItemsCount", {
|
|
@@ -1311,8 +1294,8 @@ var ValueContainer = function ValueContainer(_ref) {
|
|
|
1311
1294
|
}));
|
|
1312
1295
|
};
|
|
1313
1296
|
var ClearIndicator = function ClearIndicator(props) {
|
|
1314
|
-
return /*#__PURE__*/jsx(components.ClearIndicator, _objectSpread$
|
|
1315
|
-
innerProps: _objectSpread$
|
|
1297
|
+
return /*#__PURE__*/jsx(components.ClearIndicator, _objectSpread$6(_objectSpread$6({}, props), {}, {
|
|
1298
|
+
innerProps: _objectSpread$6(_objectSpread$6({}, props.innerProps), {}, _defineProperty({}, "data-cy", "clear-all-button")),
|
|
1316
1299
|
children: /*#__PURE__*/jsx(Close, {
|
|
1317
1300
|
className: "cursor-pointer",
|
|
1318
1301
|
size: 16
|
|
@@ -1333,7 +1316,7 @@ var CUSTOM_STYLES = {
|
|
|
1333
1316
|
input: assoc("overflow", "hidden"),
|
|
1334
1317
|
multiValue: function multiValue(styles, _ref2) {
|
|
1335
1318
|
var valid = _ref2.data.valid;
|
|
1336
|
-
return _objectSpread$
|
|
1319
|
+
return _objectSpread$6(_objectSpread$6({}, styles), {}, {
|
|
1337
1320
|
border: valid ? STYLES.border["default"] : STYLES.border.error,
|
|
1338
1321
|
color: valid ? STYLES.color["default"] : STYLES.color.error
|
|
1339
1322
|
});
|
|
@@ -1376,8 +1359,8 @@ var formatErrorMessage = function formatErrorMessage(error) {
|
|
|
1376
1359
|
};
|
|
1377
1360
|
|
|
1378
1361
|
var _excluded$2 = ["label", "value", "onChange", "error", "onBlur"];
|
|
1379
|
-
function ownKeys$
|
|
1380
|
-
function _objectSpread$
|
|
1362
|
+
function ownKeys$5(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1363
|
+
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1381
1364
|
var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
1382
1365
|
var _ref$label = _ref.label,
|
|
1383
1366
|
label = _ref$label === void 0 ? "" : _ref$label,
|
|
@@ -1436,7 +1419,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1436
1419
|
"data-cy": "".concat(hyphenize(label), "-input-label"),
|
|
1437
1420
|
children: label
|
|
1438
1421
|
})
|
|
1439
|
-
}), /*#__PURE__*/jsx(CreatableSelect, _objectSpread$
|
|
1422
|
+
}), /*#__PURE__*/jsx(CreatableSelect, _objectSpread$5({
|
|
1440
1423
|
isMulti: true,
|
|
1441
1424
|
required: true,
|
|
1442
1425
|
classNamePrefix: "neeto-ui-react-select",
|
|
@@ -1446,7 +1429,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1446
1429
|
className: classnames("neeto-ui-react-select__container neeto-ui-react-select__container--medium neeto-ui-email-input__select", {
|
|
1447
1430
|
"neeto-ui-react-select__container--error": !!error
|
|
1448
1431
|
}),
|
|
1449
|
-
styles: _objectSpread$
|
|
1432
|
+
styles: _objectSpread$5(_objectSpread$5({}, CUSTOM_STYLES), {}, {
|
|
1450
1433
|
control: mergeLeft({
|
|
1451
1434
|
maxHeight: "200px",
|
|
1452
1435
|
overflowY: "auto"
|
|
@@ -1458,7 +1441,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1458
1441
|
},
|
|
1459
1442
|
onInputChange: setInputValue,
|
|
1460
1443
|
onKeyDown: handleKeyDown
|
|
1461
|
-
}, _objectSpread$
|
|
1444
|
+
}, _objectSpread$5({
|
|
1462
1445
|
inputValue: inputValue,
|
|
1463
1446
|
isFocused: isFocused,
|
|
1464
1447
|
onChange: onChange,
|
|
@@ -1685,73 +1668,6 @@ var FileUpload = function FileUpload() {
|
|
|
1685
1668
|
});
|
|
1686
1669
|
};
|
|
1687
1670
|
|
|
1688
|
-
function ownKeys$5(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1689
|
-
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1690
|
-
var defaultConfig = {
|
|
1691
|
-
strict: true,
|
|
1692
|
-
matchKey: "value"
|
|
1693
|
-
};
|
|
1694
|
-
var findOptionByValue = function findOptionByValue(value) {
|
|
1695
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
1696
|
-
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1697
|
-
var configObject = _objectSpread$5(_objectSpread$5({}, defaultConfig), config);
|
|
1698
|
-
var matchKey = configObject.matchKey,
|
|
1699
|
-
strict = configObject.strict;
|
|
1700
|
-
return options.find(function (option) {
|
|
1701
|
-
return (
|
|
1702
|
-
// eslint-disable-next-line eqeqeq
|
|
1703
|
-
strict ? option[matchKey] === value : option[matchKey] == value
|
|
1704
|
-
);
|
|
1705
|
-
});
|
|
1706
|
-
};
|
|
1707
|
-
var filterOptionsByValues = function filterOptionsByValues() {
|
|
1708
|
-
var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1709
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
1710
|
-
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1711
|
-
var configObject = _objectSpread$5(_objectSpread$5({}, defaultConfig), config);
|
|
1712
|
-
var matchKey = configObject.matchKey,
|
|
1713
|
-
strict = configObject.strict;
|
|
1714
|
-
return options.filter(function (option) {
|
|
1715
|
-
return values.some(function (value) {
|
|
1716
|
-
return (
|
|
1717
|
-
// eslint-disable-next-line eqeqeq
|
|
1718
|
-
strict ? option[matchKey] === value : option[matchKey] == value
|
|
1719
|
-
);
|
|
1720
|
-
});
|
|
1721
|
-
});
|
|
1722
|
-
};
|
|
1723
|
-
var destroyFromList = function destroyFromList(items, index) {
|
|
1724
|
-
var itemToRemove = items[index];
|
|
1725
|
-
if (itemToRemove) {
|
|
1726
|
-
var nextItems = _toConsumableArray(items);
|
|
1727
|
-
nextItems.splice(index, 1);
|
|
1728
|
-
if (itemToRemove.id) {
|
|
1729
|
-
nextItems.push(_objectSpread$5(_objectSpread$5({}, itemToRemove), {}, {
|
|
1730
|
-
_destroy: true
|
|
1731
|
-
}));
|
|
1732
|
-
}
|
|
1733
|
-
return nextItems;
|
|
1734
|
-
}
|
|
1735
|
-
return items;
|
|
1736
|
-
};
|
|
1737
|
-
var insertToList = function insertToList(items, item, index) {
|
|
1738
|
-
var nextItems = _toConsumableArray(items !== null && items !== void 0 ? items : []);
|
|
1739
|
-
nextItems.splice(index, 0, item);
|
|
1740
|
-
return nextItems;
|
|
1741
|
-
};
|
|
1742
|
-
var pushToList = function pushToList(items, item) {
|
|
1743
|
-
var nextItems = _toConsumableArray(items !== null && items !== void 0 ? items : []);
|
|
1744
|
-
nextItems.push(item);
|
|
1745
|
-
return nextItems;
|
|
1746
|
-
};
|
|
1747
|
-
var formHelpers = {
|
|
1748
|
-
findOptionByValue: findOptionByValue,
|
|
1749
|
-
filterOptionsByValues: filterOptionsByValues,
|
|
1750
|
-
destroyFromList: destroyFromList,
|
|
1751
|
-
insertToList: insertToList,
|
|
1752
|
-
pushToList: pushToList
|
|
1753
|
-
};
|
|
1754
|
-
|
|
1755
1671
|
function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1756
1672
|
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1757
1673
|
var Options = function Options(_ref) {
|
|
@@ -1765,9 +1681,10 @@ var Options = function Options(_ref) {
|
|
|
1765
1681
|
};
|
|
1766
1682
|
}, shallow),
|
|
1767
1683
|
selectedLanguage = _useBuildFormStore.selectedLanguage;
|
|
1768
|
-
var
|
|
1769
|
-
|
|
1770
|
-
|
|
1684
|
+
var name = "optionsAttributes";
|
|
1685
|
+
var _useField = useField(name),
|
|
1686
|
+
_useField2 = _slicedToArray(_useField, 3);
|
|
1687
|
+
_useField2[0];
|
|
1771
1688
|
_useField2[1];
|
|
1772
1689
|
var setOptionsAttributes = _useField2[2].setValue;
|
|
1773
1690
|
var _ref2 = questionProps || {},
|
|
@@ -1779,73 +1696,28 @@ var Options = function Options(_ref) {
|
|
|
1779
1696
|
disableAddOption = _ref2$disableAddOptio === void 0 ? false : _ref2$disableAddOptio,
|
|
1780
1697
|
_ref2$disableRemoveOp = _ref2.disableRemoveOption,
|
|
1781
1698
|
disableRemoveOption = _ref2$disableRemoveOp === void 0 ? false : _ref2$disableRemoveOp;
|
|
1782
|
-
var handleRemoveOption = function handleRemoveOption(index) {
|
|
1783
|
-
var nextOptions = formHelpers.destroyFromList(optionsAttributes, index);
|
|
1784
|
-
setOptionsAttributes(nextOptions);
|
|
1785
|
-
};
|
|
1786
1699
|
var isManageOptionDisabled = isFunction(freezeOptions) ? freezeOptions(selectedLanguage) : freezeOptions;
|
|
1787
1700
|
var isAddOptionDisabled = disableAddOption || isManageOptionDisabled;
|
|
1788
1701
|
var isRemoveOptionDisabled = disableRemoveOption || isManageOptionDisabled;
|
|
1789
|
-
return /*#__PURE__*/
|
|
1702
|
+
return /*#__PURE__*/jsxs("div", {
|
|
1790
1703
|
className: "w-full",
|
|
1791
|
-
children: /*#__PURE__*/jsx(
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
required: true,
|
|
1809
|
-
disabled: isManageOptionDisabled,
|
|
1810
|
-
name: "optionsAttributes.".concat(index, ".label"),
|
|
1811
|
-
placeholder: t("neetoForm.questions.common.questionFields.field.numberedOption", {
|
|
1812
|
-
number: index + 1
|
|
1813
|
-
})
|
|
1814
|
-
}), !isRemoveOptionDisabled && /*#__PURE__*/jsx(Button, {
|
|
1815
|
-
"data-cy": "neeto-form-engine-delete-option-button",
|
|
1816
|
-
icon: Delete,
|
|
1817
|
-
size: "small",
|
|
1818
|
-
style: "text",
|
|
1819
|
-
className: classnames({
|
|
1820
|
-
invisible: index < MINIMUM_OPTIONS
|
|
1821
|
-
}),
|
|
1822
|
-
tooltipProps: {
|
|
1823
|
-
position: "top",
|
|
1824
|
-
content: t("neetoForm.common.delete")
|
|
1825
|
-
},
|
|
1826
|
-
onClick: function onClick() {
|
|
1827
|
-
return handleRemoveOption(index);
|
|
1828
|
-
}
|
|
1829
|
-
})]
|
|
1830
|
-
}, "question-option-".concat((_option$id = option.id) !== null && _option$id !== void 0 ? _option$id : index));
|
|
1831
|
-
})
|
|
1832
|
-
}), !isAddOptionDisabled && /*#__PURE__*/jsx("div", {
|
|
1833
|
-
className: "mt-3 w-full",
|
|
1834
|
-
children: /*#__PURE__*/jsx(Button, {
|
|
1835
|
-
"data-cy": "neeto-form-engine-add-option-button",
|
|
1836
|
-
icon: Plus,
|
|
1837
|
-
iconPosition: "left",
|
|
1838
|
-
size: "small",
|
|
1839
|
-
style: "text",
|
|
1840
|
-
label: t("neetoForm.questions.common.questionFields.field.addOption"),
|
|
1841
|
-
onClick: handlePush({
|
|
1842
|
-
label: ""
|
|
1843
|
-
})
|
|
1844
|
-
})
|
|
1845
|
-
})]
|
|
1846
|
-
});
|
|
1847
|
-
}
|
|
1848
|
-
})
|
|
1704
|
+
children: [/*#__PURE__*/jsx(Label, _objectSpread$4(_objectSpread$4({
|
|
1705
|
+
className: "mb-2 block"
|
|
1706
|
+
}, optionLabelProps), {}, {
|
|
1707
|
+
children: t("neetoForm.questions.common.questionFields.field.options")
|
|
1708
|
+
})), /*#__PURE__*/jsx(OptionFields, {
|
|
1709
|
+
name: name,
|
|
1710
|
+
shouldDestroy: true,
|
|
1711
|
+
destroyFlagName: "_destroy",
|
|
1712
|
+
disabled: isManageOptionDisabled,
|
|
1713
|
+
draggable: !isManageOptionDisabled,
|
|
1714
|
+
isAddOptionEnabled: !isAddOptionDisabled,
|
|
1715
|
+
isDeleteOptionEnabled: !isRemoveOptionDisabled,
|
|
1716
|
+
isNewItemsPrefilled: isDefaultLanguage(selectedLanguage),
|
|
1717
|
+
minOptions: MINIMUM_OPTIONS,
|
|
1718
|
+
shouldResetEmptyOptionOnBlur: false,
|
|
1719
|
+
onChange: setOptionsAttributes
|
|
1720
|
+
})]
|
|
1849
1721
|
});
|
|
1850
1722
|
};
|
|
1851
1723
|
|
|
@@ -2061,7 +1933,7 @@ var AddQuestion = function AddQuestion(_ref) {
|
|
|
2061
1933
|
}));
|
|
2062
1934
|
};
|
|
2063
1935
|
|
|
2064
|
-
var _excluded = ["questionKinds", "onValueChange", "formId", "isDeletable", "isRequiredField", "submitButtonProps", "cancelButtonProps", "isKindAlreadyActive", "getActiveKindDetails", "isDisabledFieldLabel", "disabledAddButtonTooltipProps", "enableFieldCode", "isFormEnabled", "savedTitle", "formTitle", "formDescription", "selectedLanguage", "availableLanguages", "onLanguageChange", "additionalActionOptions", "isReordering", "additionalQuestionKindPattern", "showActionBlock", "buildRequestArgs", "enableDomainBlacklisting", "enableDomainWhitelisting", "helpDocUrls", "questionsHelpProps"];
|
|
1936
|
+
var _excluded = ["questionKinds", "onValueChange", "formId", "isDeletable", "isRequiredField", "submitButtonProps", "cancelButtonProps", "isKindAlreadyActive", "getActiveKindDetails", "isDisabledFieldLabel", "disabledAddButtonTooltipProps", "enableFieldCode", "isFormEnabled", "savedTitle", "formTitle", "formDescription", "selectedLanguage", "availableLanguages", "onLanguageChange", "additionalActionOptions", "isReordering", "additionalQuestionKindPattern", "showActionBlock", "buildRequestArgs", "enableDomainBlacklisting", "enableDomainWhitelisting", "helpDocUrls", "questionsHelpProps", "isUsingDefaultQuestionKinds"];
|
|
2065
1937
|
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2066
1938
|
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2067
1939
|
var Form = function Form(_ref) {
|
|
@@ -2093,6 +1965,7 @@ var Form = function Form(_ref) {
|
|
|
2093
1965
|
enableDomainWhitelisting = _ref.enableDomainWhitelisting,
|
|
2094
1966
|
helpDocUrls = _ref.helpDocUrls,
|
|
2095
1967
|
questionsHelpProps = _ref.questionsHelpProps,
|
|
1968
|
+
isUsingDefaultQuestionKinds = _ref.isUsingDefaultQuestionKinds,
|
|
2096
1969
|
formDomProps = _objectWithoutProperties(_ref, _excluded);
|
|
2097
1970
|
var containerRef = useRef();
|
|
2098
1971
|
var _useTranslation = useTranslation(),
|
|
@@ -2142,9 +2015,10 @@ var Form = function Form(_ref) {
|
|
|
2142
2015
|
selectedLanguage: selectedLanguage,
|
|
2143
2016
|
helpDocUrls: helpDocUrls,
|
|
2144
2017
|
enableDomainBlacklisting: enableDomainBlacklisting,
|
|
2145
|
-
enableDomainWhitelisting: enableDomainWhitelisting
|
|
2018
|
+
enableDomainWhitelisting: enableDomainWhitelisting,
|
|
2019
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds
|
|
2146
2020
|
});
|
|
2147
|
-
}, [formId, isFormEnabled, savedTitle, setFormData, values, dirty, isSubmitting, isValid, errors, submitForm, resetForm, selectedLanguage, helpDocUrls, enableDomainBlacklisting, enableDomainWhitelisting]);
|
|
2021
|
+
}, [formId, isFormEnabled, savedTitle, setFormData, values, dirty, isSubmitting, isValid, errors, submitForm, resetForm, selectedLanguage, helpDocUrls, enableDomainBlacklisting, enableDomainWhitelisting, isUsingDefaultQuestionKinds]);
|
|
2148
2022
|
var questions = values.questions;
|
|
2149
2023
|
var handleSelect = function handleSelect(question) {
|
|
2150
2024
|
setSelectedQuestion(question);
|
|
@@ -2190,7 +2064,7 @@ var Form = function Form(_ref) {
|
|
|
2190
2064
|
enabled: !(isDeleteAlertOpen || isManageQuestionPaneOpen)
|
|
2191
2065
|
});
|
|
2192
2066
|
useEffect(function () {
|
|
2193
|
-
onValueChange === null || onValueChange === void 0
|
|
2067
|
+
onValueChange === null || onValueChange === void 0 || onValueChange(questions);
|
|
2194
2068
|
}, [questions]);
|
|
2195
2069
|
var availableQuestionKinds = getAvailableQuestionKinds({
|
|
2196
2070
|
allQuestionKinds: questionKinds,
|
|
@@ -2379,7 +2253,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2379
2253
|
isQuestionsLoading = _ref2.isQuestionsLoading;
|
|
2380
2254
|
useEffect(function () {
|
|
2381
2255
|
if (data) {
|
|
2382
|
-
onUpdate === null || onUpdate === void 0
|
|
2256
|
+
onUpdate === null || onUpdate === void 0 || onUpdate(data);
|
|
2383
2257
|
}
|
|
2384
2258
|
}, [data]);
|
|
2385
2259
|
if (isLoading || showLoader && isQuestionsLoading && !isQuestionsPending) {
|
|
@@ -2422,6 +2296,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2422
2296
|
var defaultQuestionKinds = allowAdditionalGuests ? QUESTION_KINDS : removeBy({
|
|
2423
2297
|
type: QUESTION_KIND.ADDITIONAL_GUESTS.value
|
|
2424
2298
|
}, QUESTION_KINDS);
|
|
2299
|
+
var isUsingDefaultQuestionKinds = isNil(questionKinds);
|
|
2425
2300
|
return /*#__PURE__*/jsxs("div", {
|
|
2426
2301
|
className: classnames("neeto-form-nano-form-outer-wrapper relative", className),
|
|
2427
2302
|
children: [/*#__PURE__*/jsx(Formik, {
|
|
@@ -2453,6 +2328,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2453
2328
|
isKindAlreadyActive: isKindAlreadyActive,
|
|
2454
2329
|
isReordering: isReordering,
|
|
2455
2330
|
isRequiredField: isRequiredField,
|
|
2331
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds,
|
|
2456
2332
|
kindUniqueOn: kindUniqueOn,
|
|
2457
2333
|
onLanguageChange: onLanguageChange,
|
|
2458
2334
|
onValueChange: onValueChange,
|
|
@@ -2463,7 +2339,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2463
2339
|
submitButtonProps: submitButtonProps
|
|
2464
2340
|
})), {}, {
|
|
2465
2341
|
formId: id,
|
|
2466
|
-
questionKinds:
|
|
2342
|
+
questionKinds: isUsingDefaultQuestionKinds ? defaultQuestionKinds : questionKinds,
|
|
2467
2343
|
onChange: function onChange(event) {
|
|
2468
2344
|
if (isEmpty(errors)) return;
|
|
2469
2345
|
setFieldError(event.target.name);
|