@bigbinary/neeto-form-frontend 3.12.7 → 3.13.0
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/en.json +0 -5
- package/app/javascript/src/translations/it.json +0 -5
- package/app/javascript/src/translations/ru.json +0 -5
- package/dist/BuildForm.js +345 -468
- package/dist/BuildForm.js.map +1 -1
- package/dist/ExternalForm.js +11 -15
- package/dist/ExternalForm.js.map +1 -1
- package/dist/UrlBuilder.js +2 -2
- package/dist/{buildForm-nI7TrULn.js → buildForm-DQ2wgwuW.js} +5 -14
- package/dist/buildForm-DQ2wgwuW.js.map +1 -0
- package/dist/{buildForm-CkodU5Ns.js → buildForm-miMj_S28.js} +5 -14
- package/dist/buildForm-miMj_S28.js.map +1 -0
- package/dist/cjs/BuildForm.js +342 -465
- package/dist/cjs/BuildForm.js.map +1 -1
- package/dist/cjs/ExternalForm.js +10 -14
- package/dist/cjs/ExternalForm.js.map +1 -1
- package/dist/cjs/UrlBuilder.js +2 -2
- package/dist/cjs/hooks.js +1 -1
- package/dist/cjs/index.js +10 -10
- package/dist/{constants-B33YjyaT.js → constants-Bx5mJ_UK.js} +19 -5
- package/dist/constants-Bx5mJ_UK.js.map +1 -0
- package/dist/{constants-DyjXQHMR.js → constants-T3w90EO4.js} +18 -5
- package/dist/constants-T3w90EO4.js.map +1 -0
- package/dist/hooks.js +1 -1
- package/dist/index.js +10 -10
- package/dist/{utils-O5jbq3ZQ.js → utils-CtH5-JaK.js} +2 -2
- package/dist/{utils-O5jbq3ZQ.js.map → utils-CtH5-JaK.js.map} +1 -1
- package/dist/{utils-vq3PBRhD.js → utils-Dgp-XRJx.js} +2 -2
- package/dist/{utils-vq3PBRhD.js.map → utils-Dgp-XRJx.js.map} +1 -1
- package/package.json +10 -10
- package/types.d.ts +12 -18
- package/dist/buildForm-CkodU5Ns.js.map +0 -1
- package/dist/buildForm-nI7TrULn.js.map +0 -1
- package/dist/constants-B33YjyaT.js.map +0 -1
- package/dist/constants-DyjXQHMR.js.map +0 -1
package/dist/cjs/BuildForm.js
CHANGED
|
@@ -1,39 +1,38 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
|
-
var React = require('react');
|
|
5
3
|
var reactQuery = require('@tanstack/react-query');
|
|
6
4
|
var classnames = require('classnames');
|
|
7
|
-
var formik = require('formik');
|
|
8
5
|
var neetoCist = require('@bigbinary/neeto-cist');
|
|
9
|
-
var utils = require('@bigbinary/neeto-commons-frontend/utils');
|
|
10
6
|
var PageLoader = require('@bigbinary/neeto-molecules/PageLoader');
|
|
11
7
|
var ramda = require('ramda');
|
|
12
8
|
var constants = require('../constants-Dq9-rvtB.js');
|
|
13
|
-
var constants$1 = require('../constants-
|
|
9
|
+
var constants$1 = require('../constants-Bx5mJ_UK.js');
|
|
14
10
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
15
|
-
var
|
|
11
|
+
var React = require('react');
|
|
16
12
|
var dnd = require('@hello-pangea/dnd');
|
|
17
13
|
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var reactI18next = require('react-i18next');
|
|
21
|
-
var buildForm = require('../buildForm-CkodU5Ns.js');
|
|
14
|
+
var utils = require('@bigbinary/neeto-commons-frontend/utils');
|
|
15
|
+
var buildForm = require('../buildForm-miMj_S28.js');
|
|
22
16
|
var shallow = require('zustand/shallow');
|
|
23
17
|
var Alert = require('@bigbinary/neetoui/Alert');
|
|
18
|
+
var reactI18next = require('react-i18next');
|
|
24
19
|
var jsxRuntime = require('react/jsx-runtime');
|
|
25
20
|
var Typography = require('@bigbinary/neetoui/Typography');
|
|
26
21
|
var Modal = require('@bigbinary/neetoui/Modal');
|
|
27
22
|
var MoreDropdown = require('@bigbinary/neeto-molecules/MoreDropdown');
|
|
28
23
|
var Dropdown = require('@bigbinary/neetoui/Dropdown');
|
|
29
24
|
var Tooltip = require('@bigbinary/neetoui/Tooltip');
|
|
25
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
30
26
|
var index = require('../index-CAtNQTCZ.js');
|
|
31
27
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
32
28
|
var i18next = require('i18next');
|
|
33
29
|
var uuid = require('uuid');
|
|
34
30
|
var NoData = require('@bigbinary/neetoui/NoData');
|
|
31
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
35
32
|
var Pane = require('@bigbinary/neetoui/Pane');
|
|
33
|
+
var ActionBlock = require('@bigbinary/neetoui/formik/ActionBlock');
|
|
36
34
|
var Form$2 = require('@bigbinary/neetoui/formik/Form');
|
|
35
|
+
var formik = require('formik');
|
|
37
36
|
var Accordion = require('@bigbinary/neetoui/Accordion');
|
|
38
37
|
var Select = require('@bigbinary/neetoui/formik/Select');
|
|
39
38
|
var Switch = require('@bigbinary/neetoui/formik/Switch');
|
|
@@ -45,6 +44,7 @@ var utils$1 = require('@bigbinary/neeto-editor/utils');
|
|
|
45
44
|
var yup = require('yup');
|
|
46
45
|
var Radio = require('@bigbinary/neetoui/formik/Radio');
|
|
47
46
|
var Label = require('@bigbinary/neetoui/Label');
|
|
47
|
+
var HelpPopover = require('@bigbinary/neeto-molecules/HelpPopover');
|
|
48
48
|
var CreatableSelect = require('react-select/creatable');
|
|
49
49
|
var _toArray = require('@babel/runtime/helpers/toArray');
|
|
50
50
|
var Close = require('@bigbinary/neeto-icons/Close');
|
|
@@ -90,12 +90,14 @@ var DeleteAlert = function DeleteAlert(_ref) {
|
|
|
90
90
|
var _useTranslation = reactI18next.useTranslation(),
|
|
91
91
|
t = _useTranslation.t;
|
|
92
92
|
var _useBuildFormStore = buildForm.useBuildFormStore(function (store) {
|
|
93
|
-
var _store$formState;
|
|
93
|
+
var _store$formState, _store$formState2;
|
|
94
94
|
return {
|
|
95
|
-
selectedLanguage: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["selectedLanguage"]
|
|
95
|
+
selectedLanguage: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["selectedLanguage"],
|
|
96
|
+
onMutateSuccess: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["onMutateSuccess"]
|
|
96
97
|
};
|
|
97
98
|
}, shallow.shallow),
|
|
98
|
-
selectedLanguage = _useBuildFormStore.selectedLanguage
|
|
99
|
+
selectedLanguage = _useBuildFormStore.selectedLanguage,
|
|
100
|
+
onMutateSuccess = _useBuildFormStore.onMutateSuccess;
|
|
99
101
|
var renderQuestionLabel = function renderQuestionLabel() {
|
|
100
102
|
var questionKind = selectedQuestion.kind;
|
|
101
103
|
var independentLabel = constants$1.INDEPENDENT_LABELS_MAP[questionKind];
|
|
@@ -106,6 +108,10 @@ var DeleteAlert = function DeleteAlert(_ref) {
|
|
|
106
108
|
var _useDeleteQuestion = constants.useDeleteQuestion(selectedQuestion === null || selectedQuestion === void 0 ? void 0 : selectedQuestion.formId, selectedLanguage, {
|
|
107
109
|
onSuccess: function onSuccess() {
|
|
108
110
|
utils.showThumbsUpToastr();
|
|
111
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
112
|
+
args[_key] = arguments[_key];
|
|
113
|
+
}
|
|
114
|
+
onMutateSuccess === null || onMutateSuccess === void 0 || onMutateSuccess.apply(void 0, [constants$1.QUESTION_ACTIONS.DELETE].concat(args));
|
|
109
115
|
onClose();
|
|
110
116
|
}
|
|
111
117
|
}),
|
|
@@ -172,67 +178,45 @@ var DeleteSmsReminderModal = function DeleteSmsReminderModal(_ref) {
|
|
|
172
178
|
|
|
173
179
|
var ChangeLanguageDropdown = function ChangeLanguageDropdown(_ref) {
|
|
174
180
|
var _findBy;
|
|
175
|
-
var
|
|
176
|
-
languages = _ref.languages,
|
|
177
|
-
onChange = _ref.onChange;
|
|
178
|
-
var _useState = React.useState(false),
|
|
179
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
180
|
-
isUnsavedChangesAlertOpen = _useState2[0],
|
|
181
|
-
setIsUnsavedChangesAlertOpen = _useState2[1];
|
|
182
|
-
var _useState3 = React.useState(currentLanguage),
|
|
183
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
184
|
-
selectedLanguage = _useState4[0],
|
|
185
|
-
setSelectedLanguage = _useState4[1];
|
|
181
|
+
var availableLanguages = _ref.availableLanguages;
|
|
186
182
|
var _useTranslation = reactI18next.useTranslation(),
|
|
187
183
|
t = _useTranslation.t;
|
|
188
|
-
var
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
184
|
+
var _useBuildFormStore = buildForm.useBuildFormStore(function (store) {
|
|
185
|
+
var _store$formState, _store$formState2, _store$formState3;
|
|
186
|
+
return {
|
|
187
|
+
selectedLanguage: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["selectedLanguage"],
|
|
188
|
+
onLanguageChange: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["onLanguageChange"],
|
|
189
|
+
isReorderingQuestions: (_store$formState3 = store["formState"]) === null || _store$formState3 === void 0 ? void 0 : _store$formState3["isReorderingQuestions"]
|
|
190
|
+
};
|
|
191
|
+
}, shallow.shallow),
|
|
192
|
+
selectedLanguage = _useBuildFormStore.selectedLanguage,
|
|
193
|
+
onLanguageChange = _useBuildFormStore.onLanguageChange,
|
|
194
|
+
isReorderingQuestions = _useBuildFormStore.isReorderingQuestions;
|
|
198
195
|
var selectedLanguageName = (_findBy = neetoCist.findBy({
|
|
199
|
-
code:
|
|
200
|
-
},
|
|
201
|
-
return /*#__PURE__*/jsxRuntime.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
})
|
|
196
|
+
code: selectedLanguage
|
|
197
|
+
}, availableLanguages)) === null || _findBy === void 0 ? void 0 : _findBy.name;
|
|
198
|
+
return /*#__PURE__*/jsxRuntime.jsx(Tooltip, {
|
|
199
|
+
content: t("neetoForm.questions.changeLanguage"),
|
|
200
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
201
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Dropdown, {
|
|
202
|
+
buttonStyle: "secondary",
|
|
203
|
+
disabled: isReorderingQuestions,
|
|
204
|
+
label: selectedLanguageName,
|
|
205
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Dropdown.Menu, {
|
|
206
|
+
children: availableLanguages.map(function (_ref2) {
|
|
207
|
+
var code = _ref2.code,
|
|
208
|
+
name = _ref2.name;
|
|
209
|
+
return /*#__PURE__*/jsxRuntime.jsx(Dropdown.MenuItem.Button, {
|
|
210
|
+
isActive: selectedLanguage === code,
|
|
211
|
+
onClick: function onClick() {
|
|
212
|
+
return onLanguageChange(code);
|
|
213
|
+
},
|
|
214
|
+
children: name
|
|
215
|
+
}, code);
|
|
220
216
|
})
|
|
221
217
|
})
|
|
222
218
|
})
|
|
223
|
-
})
|
|
224
|
-
isOpen: isUnsavedChangesAlertOpen,
|
|
225
|
-
message: t("neetoForm.questions.unsavedChangesAlert.message"),
|
|
226
|
-
submitButtonLabel: t("neetoForm.questions.unsavedChangesAlert.discard"),
|
|
227
|
-
title: t("neetoForm.questions.unsavedChangesAlert.title"),
|
|
228
|
-
onClose: function onClose() {
|
|
229
|
-
return setIsUnsavedChangesAlertOpen(false);
|
|
230
|
-
},
|
|
231
|
-
onSubmit: function onSubmit() {
|
|
232
|
-
onChange(selectedLanguage);
|
|
233
|
-
setIsUnsavedChangesAlertOpen(false);
|
|
234
|
-
}
|
|
235
|
-
})]
|
|
219
|
+
})
|
|
236
220
|
});
|
|
237
221
|
};
|
|
238
222
|
|
|
@@ -240,8 +224,6 @@ var Overview = function Overview(_ref) {
|
|
|
240
224
|
var title = _ref.title,
|
|
241
225
|
description = _ref.description,
|
|
242
226
|
availableLanguages = _ref.availableLanguages,
|
|
243
|
-
selectedLanguage = _ref.selectedLanguage,
|
|
244
|
-
onLanguageChange = _ref.onLanguageChange,
|
|
245
227
|
additionalActionOptions = _ref.additionalActionOptions;
|
|
246
228
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
247
229
|
className: "neeto-form-nano-form-wrapper__overview mb-4 w-full flex-shrink-0 space-y-4 pt-6",
|
|
@@ -256,9 +238,7 @@ var Overview = function Overview(_ref) {
|
|
|
256
238
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
257
239
|
className: "flex flex-shrink-0 items-center justify-between space-x-1",
|
|
258
240
|
children: [availableLanguages.length > 1 && /*#__PURE__*/jsxRuntime.jsx(ChangeLanguageDropdown, {
|
|
259
|
-
|
|
260
|
-
languages: availableLanguages,
|
|
261
|
-
onChange: onLanguageChange
|
|
241
|
+
availableLanguages: availableLanguages
|
|
262
242
|
}), neetoCist.isPresent(additionalActionOptions) && /*#__PURE__*/jsxRuntime.jsx(MoreDropdown, {
|
|
263
243
|
dropdownButtonProps: {
|
|
264
244
|
isRounded: true,
|
|
@@ -364,8 +344,8 @@ var Card = function Card(_ref) {
|
|
|
364
344
|
});
|
|
365
345
|
};
|
|
366
346
|
|
|
367
|
-
function ownKeys$
|
|
368
|
-
function _objectSpread$
|
|
347
|
+
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; }
|
|
348
|
+
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; }
|
|
369
349
|
var Questions = function Questions(_ref) {
|
|
370
350
|
var questions = _ref.questions,
|
|
371
351
|
isDeletable = _ref.isDeletable,
|
|
@@ -382,7 +362,7 @@ var Questions = function Questions(_ref) {
|
|
|
382
362
|
var droppableProps = _ref2.droppableProps,
|
|
383
363
|
placeholder = _ref2.placeholder,
|
|
384
364
|
innerRef = _ref2.innerRef;
|
|
385
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread$
|
|
365
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread$e(_objectSpread$e({}, droppableProps), {}, {
|
|
386
366
|
className: "space-y-2",
|
|
387
367
|
ref: innerRef,
|
|
388
368
|
children: [questions.map(function (question, index) {
|
|
@@ -395,7 +375,7 @@ var Questions = function Questions(_ref) {
|
|
|
395
375
|
var draggableProps = _ref3.draggableProps,
|
|
396
376
|
dragHandleProps = _ref3.dragHandleProps,
|
|
397
377
|
innerRef = _ref3.innerRef;
|
|
398
|
-
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread$
|
|
378
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread$e(_objectSpread$e(_objectSpread$e({}, draggableProps), dragHandleProps), {}, {
|
|
399
379
|
ref: innerRef,
|
|
400
380
|
children: /*#__PURE__*/jsxRuntime.jsx(Card, {
|
|
401
381
|
allQuestionKinds: allQuestionKinds,
|
|
@@ -427,8 +407,8 @@ var arrayHelpers = {
|
|
|
427
407
|
moveItem: moveItem
|
|
428
408
|
};
|
|
429
409
|
|
|
430
|
-
function ownKeys$
|
|
431
|
-
function _objectSpread$
|
|
410
|
+
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; }
|
|
411
|
+
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; }
|
|
432
412
|
var isChoiceQuestion = function isChoiceQuestion(question) {
|
|
433
413
|
return ramda.includes(question === null || question === void 0 ? void 0 : question.kind, constants$1.SELECTABLE_KINDS);
|
|
434
414
|
};
|
|
@@ -484,7 +464,7 @@ var generateUniqueFieldCode = function generateUniqueFieldCode(_ref2) {
|
|
|
484
464
|
var candidateFieldCode = "";
|
|
485
465
|
|
|
486
466
|
//We need to continue this while loop until we can generate a unique fieldCode
|
|
487
|
-
|
|
467
|
+
|
|
488
468
|
while (true) {
|
|
489
469
|
candidateFieldCode = "".concat(prefix).concat(uniqueNumber === 0 ? "" : uniqueNumber);
|
|
490
470
|
if (!neetoCist.findBy({
|
|
@@ -497,9 +477,9 @@ var generateUniqueFieldCode = function generateUniqueFieldCode(_ref2) {
|
|
|
497
477
|
var isQuestionKindAlreadyActive = function isQuestionKindAlreadyActive(_ref3) {
|
|
498
478
|
var activeQuestions = _ref3.activeQuestions,
|
|
499
479
|
kind = _ref3.kind;
|
|
500
|
-
return
|
|
501
|
-
|
|
502
|
-
});
|
|
480
|
+
return neetoCist.existsBy({
|
|
481
|
+
kind: kind.type
|
|
482
|
+
}, activeQuestions);
|
|
503
483
|
};
|
|
504
484
|
var handleFieldDragEnd = function handleFieldDragEnd(_ref4) {
|
|
505
485
|
var items = _ref4.items,
|
|
@@ -510,11 +490,11 @@ var handleFieldDragEnd = function handleFieldDragEnd(_ref4) {
|
|
|
510
490
|
var nextItems = _toConsumableArray(items);
|
|
511
491
|
arrayHelpers.moveItem(nextItems, source.index, destination.index);
|
|
512
492
|
var orderedItems = nextItems.map(function (item, index) {
|
|
513
|
-
return _objectSpread$
|
|
493
|
+
return _objectSpread$d(_objectSpread$d({}, item), {}, {
|
|
514
494
|
displayOrder: index
|
|
515
495
|
});
|
|
516
496
|
});
|
|
517
|
-
setValue(
|
|
497
|
+
setValue(orderedItems);
|
|
518
498
|
};
|
|
519
499
|
var createFieldData = function createFieldData(_ref5) {
|
|
520
500
|
var _ref5$kind = _ref5.kind,
|
|
@@ -532,7 +512,7 @@ var createFieldData = function createFieldData(_ref5) {
|
|
|
532
512
|
selectedLanguage: selectedLanguage,
|
|
533
513
|
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds
|
|
534
514
|
});
|
|
535
|
-
return _objectSpread$
|
|
515
|
+
return _objectSpread$d(_objectSpread$d({}, modifiedDefaultValues), {}, {
|
|
536
516
|
metadata: metadata,
|
|
537
517
|
isRequired: isRequired,
|
|
538
518
|
kind: type,
|
|
@@ -560,7 +540,7 @@ var duplicateFieldData = function duplicateFieldData(_ref6) {
|
|
|
560
540
|
var newQuestionLabel = constants$1.isRichTextQuestion(kind) ? label : i18next.t("neetoForm.common.clonedElementLabel", {
|
|
561
541
|
label: label
|
|
562
542
|
});
|
|
563
|
-
return _objectSpread$
|
|
543
|
+
return _objectSpread$d(_objectSpread$d({}, defaultAttributes), {}, {
|
|
564
544
|
isRequired: isRequired,
|
|
565
545
|
kind: kind,
|
|
566
546
|
label: newQuestionLabel,
|
|
@@ -644,13 +624,17 @@ var INITIAL_VALUES = {
|
|
|
644
624
|
};
|
|
645
625
|
var VALID_FIELD_CODE_REGEX = /^[a-z0-9]+(_[a-z0-9]+)*$/;
|
|
646
626
|
|
|
647
|
-
var
|
|
648
|
-
|
|
649
|
-
|
|
627
|
+
var useHelpDoc = function useHelpDoc(key) {
|
|
628
|
+
return buildForm.useBuildFormStore(ramda.path(["formState", "helpDocUrls", key]));
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
var _excluded$7 = ["label", "name"];
|
|
632
|
+
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; }
|
|
633
|
+
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; }
|
|
650
634
|
var FormikAdaptiveInput = function FormikAdaptiveInput(_ref) {
|
|
651
635
|
var label = _ref.label,
|
|
652
636
|
name = _ref.name,
|
|
653
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$
|
|
637
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$7);
|
|
654
638
|
var _useFormikContext = formik.useFormikContext(),
|
|
655
639
|
dirty = _useFormikContext.dirty,
|
|
656
640
|
isValid = _useFormikContext.isValid,
|
|
@@ -665,7 +649,7 @@ var FormikAdaptiveInput = function FormikAdaptiveInput(_ref) {
|
|
|
665
649
|
var end = element.value.length;
|
|
666
650
|
element.setSelectionRange(end, end);
|
|
667
651
|
};
|
|
668
|
-
return /*#__PURE__*/jsxRuntime.jsx(Textarea, _objectSpread$
|
|
652
|
+
return /*#__PURE__*/jsxRuntime.jsx(Textarea, _objectSpread$c({
|
|
669
653
|
label: label,
|
|
670
654
|
name: name,
|
|
671
655
|
className: "neeto-form-nano-adaptive-input",
|
|
@@ -679,8 +663,8 @@ var FormikAdaptiveInput = function FormikAdaptiveInput(_ref) {
|
|
|
679
663
|
}, otherProps));
|
|
680
664
|
};
|
|
681
665
|
|
|
682
|
-
function ownKeys$
|
|
683
|
-
function _objectSpread$
|
|
666
|
+
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; }
|
|
667
|
+
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; }
|
|
684
668
|
var LabelWithPlaceholder = function LabelWithPlaceholder(_ref) {
|
|
685
669
|
var kind = _ref.kind,
|
|
686
670
|
isLabelDisabled = _ref.isLabelDisabled,
|
|
@@ -694,14 +678,14 @@ var LabelWithPlaceholder = function LabelWithPlaceholder(_ref) {
|
|
|
694
678
|
var shouldShowPlaceholder = ramda.includes(kind, QUESTIONS_WITH_PLACEHOLDERS);
|
|
695
679
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
696
680
|
className: "space-y-4",
|
|
697
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(FormikAdaptiveInput, _objectSpread$
|
|
681
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(FormikAdaptiveInput, _objectSpread$b({
|
|
698
682
|
required: true,
|
|
699
683
|
disabled: isLabelDisabled,
|
|
700
684
|
label: t("neetoForm.questions.common.questionFields.field.question"),
|
|
701
685
|
name: "label",
|
|
702
686
|
placeholder: DEFAULT_PLACEHOLDERS[kind],
|
|
703
687
|
onChange: utils.withEventTargetValue(handleLabelChange)
|
|
704
|
-
}, labelProps)), shouldShowPlaceholder && /*#__PURE__*/jsxRuntime.jsx(FormikAdaptiveInput, _objectSpread$
|
|
688
|
+
}, labelProps)), shouldShowPlaceholder && /*#__PURE__*/jsxRuntime.jsx(FormikAdaptiveInput, _objectSpread$b({
|
|
705
689
|
className: "neeto-form-nano-placeholder-input neeto-form-nano-placeholder-input-".concat(kind),
|
|
706
690
|
name: "placeholder",
|
|
707
691
|
label: t("neetoForm.questions.common.questionFields.field.placeholder")
|
|
@@ -709,8 +693,8 @@ var LabelWithPlaceholder = function LabelWithPlaceholder(_ref) {
|
|
|
709
693
|
});
|
|
710
694
|
};
|
|
711
695
|
|
|
712
|
-
function ownKeys$
|
|
713
|
-
function _objectSpread$
|
|
696
|
+
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; }
|
|
697
|
+
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; }
|
|
714
698
|
var Name = function Name(_ref) {
|
|
715
699
|
var isLabelDisabled = _ref.isLabelDisabled,
|
|
716
700
|
_handleLabelChange = _ref.handleLabelChange;
|
|
@@ -730,7 +714,7 @@ var Name = function Name(_ref) {
|
|
|
730
714
|
label: t("neetoForm.common.splitAsFirstAndLastNames"),
|
|
731
715
|
name: "isSplitMode"
|
|
732
716
|
}), isSplitMode && !usesCustomSubmissionComponent ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
733
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(LabelWithPlaceholder, _objectSpread$
|
|
717
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(LabelWithPlaceholder, _objectSpread$a(_objectSpread$a({}, commonProps), {}, {
|
|
734
718
|
handleLabelChange: function handleLabelChange(value) {
|
|
735
719
|
return _handleLabelChange(value, constants$1.LABEL_FIELDS.FIRST_NAME);
|
|
736
720
|
},
|
|
@@ -742,7 +726,7 @@ var Name = function Name(_ref) {
|
|
|
742
726
|
label: t("neetoForm.questions.common.questionFields.field.firstNamePlaceholder"),
|
|
743
727
|
name: "firstNamePlaceholder"
|
|
744
728
|
}
|
|
745
|
-
})), /*#__PURE__*/jsxRuntime.jsx(LabelWithPlaceholder, _objectSpread$
|
|
729
|
+
})), /*#__PURE__*/jsxRuntime.jsx(LabelWithPlaceholder, _objectSpread$a(_objectSpread$a({}, commonProps), {}, {
|
|
746
730
|
handleLabelChange: function handleLabelChange(value) {
|
|
747
731
|
return _handleLabelChange(value, constants$1.LABEL_FIELDS.LAST_NAME);
|
|
748
732
|
},
|
|
@@ -755,7 +739,7 @@ var Name = function Name(_ref) {
|
|
|
755
739
|
name: "lastNamePlaceholder"
|
|
756
740
|
}
|
|
757
741
|
}))]
|
|
758
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(LabelWithPlaceholder, _objectSpread$
|
|
742
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(LabelWithPlaceholder, _objectSpread$a(_objectSpread$a({}, commonProps), {}, {
|
|
759
743
|
labelProps: {
|
|
760
744
|
name: constants$1.LABEL_FIELDS.FULL_NAME
|
|
761
745
|
},
|
|
@@ -775,14 +759,12 @@ var Properties = function Properties(_ref) {
|
|
|
775
759
|
handleLabelChange = _ref.handleLabelChange,
|
|
776
760
|
questionProps = _ref.questionProps;
|
|
777
761
|
var _useBuildFormStore = buildForm.useBuildFormStore(function (store) {
|
|
778
|
-
var _store$formState
|
|
762
|
+
var _store$formState;
|
|
779
763
|
return {
|
|
780
|
-
|
|
781
|
-
enableDomainBlacklisting: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["enableDomainBlacklisting"]
|
|
764
|
+
usesCustomSubmissionComponent: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["usesCustomSubmissionComponent"]
|
|
782
765
|
};
|
|
783
766
|
}, shallow.shallow),
|
|
784
|
-
|
|
785
|
-
enableDomainBlacklisting = _useBuildFormStore.enableDomainBlacklisting;
|
|
767
|
+
usesCustomSubmissionComponent = _useBuildFormStore.usesCustomSubmissionComponent;
|
|
786
768
|
var hasAdditionalData = ramda.includes(kind, QUESTIONS_WITH_ADDITIONAL_DATA);
|
|
787
769
|
if (index.isNameQuestion(kind)) {
|
|
788
770
|
return /*#__PURE__*/jsxRuntime.jsx(Name, {
|
|
@@ -799,8 +781,7 @@ var Properties = function Properties(_ref) {
|
|
|
799
781
|
}), hasAdditionalData && renderAdditionalData({
|
|
800
782
|
kind: kind,
|
|
801
783
|
questionProps: questionProps,
|
|
802
|
-
|
|
803
|
-
enableDomainBlacklisting: enableDomainBlacklisting
|
|
784
|
+
usesCustomSubmissionComponent: usesCustomSubmissionComponent
|
|
804
785
|
})]
|
|
805
786
|
});
|
|
806
787
|
};
|
|
@@ -831,39 +812,24 @@ var Block = function Block(_ref) {
|
|
|
831
812
|
var useUpdateEditorContent = function useUpdateEditorContent(_ref) {
|
|
832
813
|
var editorRef = _ref.editorRef,
|
|
833
814
|
fieldName = _ref.fieldName,
|
|
834
|
-
value = _ref.value
|
|
835
|
-
initialValue = _ref.initialValue,
|
|
836
|
-
fieldCode = _ref.fieldCode;
|
|
815
|
+
value = _ref.value;
|
|
837
816
|
var initialStateRef = React.useRef({
|
|
838
817
|
language: "",
|
|
839
818
|
value: null
|
|
840
819
|
});
|
|
841
820
|
var _useBuildFormStore = buildForm.useBuildFormStore(function (store) {
|
|
842
|
-
return {
|
|
843
|
-
setFormData: store["setFormData"]
|
|
844
|
-
};
|
|
845
|
-
}, shallow.shallow),
|
|
846
|
-
setFormData = _useBuildFormStore.setFormData;
|
|
847
|
-
var _useBuildFormStore2 = buildForm.useBuildFormStore(function (store) {
|
|
848
821
|
var _store$formState, _store$formState2;
|
|
849
822
|
return {
|
|
850
823
|
formId: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["formId"],
|
|
851
824
|
selectedLanguage: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["selectedLanguage"]
|
|
852
825
|
};
|
|
853
826
|
}, shallow.shallow),
|
|
854
|
-
formId =
|
|
855
|
-
language =
|
|
856
|
-
var shouldReset = buildForm.useBuildFormStore(function (store) {
|
|
857
|
-
return store.formState.richTextFieldsToReset.includes(fieldCode);
|
|
858
|
-
});
|
|
827
|
+
formId = _useBuildFormStore.formId,
|
|
828
|
+
language = _useBuildFormStore.selectedLanguage;
|
|
859
829
|
var setEditorContent = function setEditorContent(content) {
|
|
860
830
|
var _editorRef$current$ed;
|
|
861
831
|
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);
|
|
862
832
|
};
|
|
863
|
-
if (shouldReset) {
|
|
864
|
-
setEditorContent(initialValue);
|
|
865
|
-
setFormData(ramda.modify("richTextFieldsToReset", ramda.without([fieldCode])));
|
|
866
|
-
}
|
|
867
833
|
var _useForm = constants.useForm({
|
|
868
834
|
formId: formId,
|
|
869
835
|
language: language
|
|
@@ -894,8 +860,6 @@ var Editor = function Editor() {
|
|
|
894
860
|
var editorRef = React.useRef({
|
|
895
861
|
editor: {}
|
|
896
862
|
});
|
|
897
|
-
var _useFormikContext = formik.useFormikContext(),
|
|
898
|
-
fieldCode = _useFormikContext.values.fieldCode;
|
|
899
863
|
var fieldName = "label";
|
|
900
864
|
var _useField = formik.useField({
|
|
901
865
|
name: fieldName,
|
|
@@ -906,16 +870,13 @@ var Editor = function Editor() {
|
|
|
906
870
|
_useField2$ = _useField2[1],
|
|
907
871
|
touched = _useField2$.touched,
|
|
908
872
|
error = _useField2$.error,
|
|
909
|
-
initialValue = _useField2$.initialValue,
|
|
910
873
|
_useField2$2 = _useField2[2],
|
|
911
874
|
setTouched = _useField2$2.setTouched,
|
|
912
875
|
setValue = _useField2$2.setValue;
|
|
913
876
|
useUpdateEditorContent({
|
|
914
877
|
editorRef: editorRef,
|
|
915
878
|
fieldName: fieldName,
|
|
916
|
-
value: value
|
|
917
|
-
initialValue: initialValue,
|
|
918
|
-
fieldCode: fieldCode
|
|
879
|
+
value: value
|
|
919
880
|
});
|
|
920
881
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
921
882
|
className: "w-full cursor-auto",
|
|
@@ -945,12 +906,12 @@ var RequiredSwitch = reactUtils.withT(function (_ref) {
|
|
|
945
906
|
});
|
|
946
907
|
});
|
|
947
908
|
|
|
948
|
-
var _excluded$
|
|
949
|
-
function ownKeys$
|
|
950
|
-
function _objectSpread$
|
|
909
|
+
var _excluded$6 = ["maxLength"];
|
|
910
|
+
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; }
|
|
911
|
+
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; }
|
|
951
912
|
var InputWithMaxLength = function InputWithMaxLength(_ref) {
|
|
952
913
|
var maxLength = _ref.maxLength,
|
|
953
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
914
|
+
props = _objectWithoutProperties(_ref, _excluded$6);
|
|
954
915
|
var _useField = formik.useField(props),
|
|
955
916
|
_useField2 = _slicedToArray(_useField, 3),
|
|
956
917
|
value = _useField2[0].value,
|
|
@@ -961,13 +922,13 @@ var InputWithMaxLength = function InputWithMaxLength(_ref) {
|
|
|
961
922
|
}
|
|
962
923
|
}, [value, maxLength, setValue]);
|
|
963
924
|
var shouldShowMaxLength = value && value.length > maxLength - 10;
|
|
964
|
-
return /*#__PURE__*/jsxRuntime.jsx(Input, _objectSpread$
|
|
925
|
+
return /*#__PURE__*/jsxRuntime.jsx(Input, _objectSpread$9(_objectSpread$9({}, props), shouldShowMaxLength && {
|
|
965
926
|
maxLength: maxLength
|
|
966
927
|
}));
|
|
967
928
|
};
|
|
968
929
|
|
|
969
930
|
var FieldCode = function FieldCode() {
|
|
970
|
-
var helpDocUrl =
|
|
931
|
+
var helpDocUrl = useHelpDoc("fieldCode");
|
|
971
932
|
var _useTranslation = reactI18next.useTranslation(),
|
|
972
933
|
t = _useTranslation.t;
|
|
973
934
|
return /*#__PURE__*/jsxRuntime.jsx(InputWithMaxLength, {
|
|
@@ -994,11 +955,10 @@ var Form$1 = function Form(_ref) {
|
|
|
994
955
|
initialFocusRef = _ref.initialFocusRef,
|
|
995
956
|
isRequiredField = _ref.isRequiredField,
|
|
996
957
|
isDisabledFieldLabel = _ref.isDisabledFieldLabel,
|
|
997
|
-
enableFieldCode = _ref.enableFieldCode,
|
|
998
958
|
allQuestionKinds = _ref.allQuestionKinds,
|
|
999
959
|
availableQuestionKinds = _ref.availableQuestionKinds,
|
|
1000
960
|
getActiveKindDetails = _ref.getActiveKindDetails,
|
|
1001
|
-
|
|
961
|
+
kindUniqueOn = _ref.kindUniqueOn,
|
|
1002
962
|
_ref$isEdit = _ref.isEdit,
|
|
1003
963
|
isEdit = _ref$isEdit === void 0 ? false : _ref$isEdit;
|
|
1004
964
|
var _useState = React.useState(false),
|
|
@@ -1015,25 +975,28 @@ var Form$1 = function Form(_ref) {
|
|
|
1015
975
|
setFieldValue = _useFormikContext.setFieldValue,
|
|
1016
976
|
errors = _useFormikContext.errors,
|
|
1017
977
|
submitCount = _useFormikContext.submitCount;
|
|
1018
|
-
var
|
|
1019
|
-
var
|
|
1020
|
-
var
|
|
978
|
+
var hideQuestionHelpDocUrl = useHelpDoc("hideQuestion");
|
|
979
|
+
var readOnlyHelpDocUrl = useHelpDoc("readOnly");
|
|
980
|
+
var responseVisibleOnlyToHostHelpDocUrl = useHelpDoc("responseVisibleOnlyToHost");
|
|
1021
981
|
var _useBuildFormStore = buildForm.useBuildFormStore(function (store) {
|
|
1022
982
|
var _store$formState, _store$formState2, _store$formState3, _store$formState4;
|
|
1023
983
|
return {
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
984
|
+
advancedFeatures: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["advancedFeatures"],
|
|
985
|
+
selectedLanguage: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["selectedLanguage"],
|
|
986
|
+
isUsingDefaultQuestionKinds: (_store$formState3 = store["formState"]) === null || _store$formState3 === void 0 ? void 0 : _store$formState3["isUsingDefaultQuestionKinds"],
|
|
987
|
+
usesCustomSubmissionComponent: (_store$formState4 = store["formState"]) === null || _store$formState4 === void 0 ? void 0 : _store$formState4["usesCustomSubmissionComponent"]
|
|
1028
988
|
};
|
|
1029
989
|
}, shallow.shallow),
|
|
1030
|
-
|
|
1031
|
-
showResponseVisibleOnlyToHostSwitch = _useBuildFormStore.showResponseVisibleOnlyToHostSwitch,
|
|
990
|
+
advancedFeatures = _useBuildFormStore.advancedFeatures,
|
|
1032
991
|
selectedLanguage = _useBuildFormStore.selectedLanguage,
|
|
1033
|
-
isUsingDefaultQuestionKinds = _useBuildFormStore.isUsingDefaultQuestionKinds
|
|
992
|
+
isUsingDefaultQuestionKinds = _useBuildFormStore.isUsingDefaultQuestionKinds,
|
|
993
|
+
usesCustomSubmissionComponent = _useBuildFormStore.usesCustomSubmissionComponent;
|
|
994
|
+
var isFieldCodeEnabled = advancedFeatures.fieldCode,
|
|
995
|
+
markResponsesAsReadOnly = advancedFeatures.markResponsesAsReadOnly,
|
|
996
|
+
restrictResponseVisibilityToHost = advancedFeatures.restrictResponseVisibilityToHost;
|
|
1034
997
|
var kind = values.kind;
|
|
1035
998
|
var questionKinds = isEdit ? allQuestionKinds : availableQuestionKinds;
|
|
1036
|
-
var questionKindUniquenessPattern = ramda.mergeLeft(isEdit &&
|
|
999
|
+
var questionKindUniquenessPattern = ramda.mergeLeft(isEdit && kindUniqueOn ? kindUniqueOn(values) : {}, {
|
|
1037
1000
|
type: kind
|
|
1038
1001
|
});
|
|
1039
1002
|
var _useStateWithDependen = reactUtils.useStateWithDependency(getQuestionKind(questionKinds, questionKindUniquenessPattern), [kind]),
|
|
@@ -1053,10 +1016,10 @@ var Form$1 = function Form(_ref) {
|
|
|
1053
1016
|
var isRequired = questionKind && isRequiredField(questionKind);
|
|
1054
1017
|
var isLabelDisabled = questionKind && isDisabledFieldLabel(questionKind);
|
|
1055
1018
|
var isImmutable = questionKind && constants$1.isImmutableField(questionKind);
|
|
1056
|
-
var shouldShowFieldCode =
|
|
1057
|
-
var shouldShowHideSwitch = !ramda.includes(kind, constants$1.NON_HIDEABLE_FIELDS);
|
|
1058
|
-
var
|
|
1059
|
-
var
|
|
1019
|
+
var shouldShowFieldCode = isFieldCodeEnabled && !ramda.includes(kind, constants$1.QUESTIONS_WITHOUT_FIELD_CODE);
|
|
1020
|
+
var shouldShowHideSwitch = isFieldCodeEnabled && !usesCustomSubmissionComponent && !ramda.includes(kind, constants$1.NON_HIDEABLE_FIELDS);
|
|
1021
|
+
var canRestrictResponseVisibilityToHost = restrictResponseVisibilityToHost && !ramda.includes(kind, constants$1.NON_HIDEABLE_FIELDS);
|
|
1022
|
+
var canMarkResponsesAsReadOnly = markResponsesAsReadOnly && !ramda.includes(kind, constants$1.NON_READ_ONLY_FIELDS);
|
|
1060
1023
|
var isSettingsBlockVisible = !isRequired && (!isImmutable || shouldShowHideSwitch);
|
|
1061
1024
|
var handleKindChange = function handleKindChange(option) {
|
|
1062
1025
|
var data = buildQuestionData(option);
|
|
@@ -1124,26 +1087,26 @@ var Form$1 = function Form(_ref) {
|
|
|
1124
1087
|
title: t("neetoForm.common.settings"),
|
|
1125
1088
|
children: [!isImmutable && /*#__PURE__*/jsxRuntime.jsx(RequiredSwitch, {}), shouldShowHideSwitch && /*#__PURE__*/jsxRuntime.jsx(Switch, {
|
|
1126
1089
|
label: t("neetoForm.common.hideQuestion"),
|
|
1127
|
-
labelProps: hideSwitchLabelProps(
|
|
1090
|
+
labelProps: hideSwitchLabelProps(hideQuestionHelpDocUrl),
|
|
1128
1091
|
name: "isHidden"
|
|
1129
|
-
}),
|
|
1092
|
+
}), canRestrictResponseVisibilityToHost && /*#__PURE__*/jsxRuntime.jsx(Switch, {
|
|
1130
1093
|
label: t("neetoForm.common.responseVisibleOnlyToHost"),
|
|
1131
1094
|
name: "isResponseVisibleOnlyToHost",
|
|
1132
|
-
labelProps: responseVisibleOnlyToHostSwitchLabelProps(
|
|
1095
|
+
labelProps: responseVisibleOnlyToHostSwitchLabelProps(responseVisibleOnlyToHostHelpDocUrl)
|
|
1133
1096
|
})]
|
|
1134
|
-
}), (shouldShowFieldCode ||
|
|
1135
|
-
defaultActiveKey: isFieldCodeInvalid ? 0 : null // This is to open the accordion when field code is invalid
|
|
1136
|
-
,
|
|
1097
|
+
}), (shouldShowFieldCode || canMarkResponsesAsReadOnly) && /*#__PURE__*/jsxRuntime.jsx(Accordion, {
|
|
1137
1098
|
className: "neeto-form-nano-advanced-properties-accordion",
|
|
1138
1099
|
"data-cy": "advanced-properties-card",
|
|
1100
|
+
defaultActiveKey: isFieldCodeInvalid ? 0 : null // This is to open the accordion when field code is invalid
|
|
1101
|
+
,
|
|
1139
1102
|
children: /*#__PURE__*/jsxRuntime.jsx(Accordion.Item, {
|
|
1140
1103
|
title: t("neetoForm.common.advancedProperties"),
|
|
1141
1104
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1142
1105
|
className: "flex flex-col space-y-4",
|
|
1143
|
-
children: [shouldShowFieldCode && /*#__PURE__*/jsxRuntime.jsx(FieldCode, {}),
|
|
1106
|
+
children: [shouldShowFieldCode && /*#__PURE__*/jsxRuntime.jsx(FieldCode, {}), canMarkResponsesAsReadOnly && /*#__PURE__*/jsxRuntime.jsx(Switch, {
|
|
1144
1107
|
label: t("neetoForm.common.readOnly"),
|
|
1145
|
-
|
|
1146
|
-
|
|
1108
|
+
name: "isReadOnly",
|
|
1109
|
+
labelProps: readOnlySwitchLabelProps(readOnlyHelpDocUrl)
|
|
1147
1110
|
})]
|
|
1148
1111
|
})
|
|
1149
1112
|
})
|
|
@@ -1187,7 +1150,7 @@ var buildNameLabelValidationSchema = function buildNameLabelValidationSchema(que
|
|
|
1187
1150
|
};
|
|
1188
1151
|
var stringSchema = yup__namespace.string();
|
|
1189
1152
|
var formValidationSchema = function formValidationSchema(question) {
|
|
1190
|
-
var
|
|
1153
|
+
var isFieldCodeEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1191
1154
|
return yup__namespace.object().shape({
|
|
1192
1155
|
kind: yup__namespace.string().trim().required(i18next.t("neetoForm.common.fieldReq", {
|
|
1193
1156
|
field: i18next.t("neetoForm.questions.common.questionFields.field.questionType")
|
|
@@ -1197,7 +1160,7 @@ var formValidationSchema = function formValidationSchema(question) {
|
|
|
1197
1160
|
firstNameLabel: buildNameLabelValidationSchema(question, stringSchema),
|
|
1198
1161
|
lastNameLabel: buildNameLabelValidationSchema(question, stringSchema),
|
|
1199
1162
|
fieldCode: yup__namespace.string().trim().notOneOf(constants$1.RESERVED_FIELD_CODES, i18next.t("neetoForm.error.invalidFieldCode")).when("kind", function (kind, schema) {
|
|
1200
|
-
return
|
|
1163
|
+
return isFieldCodeEnabled && !ramda.includes(kind, constants$1.QUESTIONS_WITHOUT_FIELD_CODE) ? fieldCodeValidation(schema, i18next.t("neetoForm.questions.common.questionFields.field.fieldCode")) : schema.notRequired();
|
|
1201
1164
|
}),
|
|
1202
1165
|
optionsAttributes: yup__namespace.array().when("kind", function (kind, schema) {
|
|
1203
1166
|
return ramda.includes(kind, constants$1.SELECTABLE_KINDS) ? schema.of(yup__namespace.object().shape({
|
|
@@ -1213,30 +1176,36 @@ var formValidationSchema = function formValidationSchema(question) {
|
|
|
1213
1176
|
});
|
|
1214
1177
|
};
|
|
1215
1178
|
|
|
1216
|
-
var _excluded$
|
|
1217
|
-
function ownKeys$
|
|
1218
|
-
function _objectSpread$
|
|
1179
|
+
var _excluded$5 = ["question", "onClose", "questions", "handleSelect", "isOpen"];
|
|
1180
|
+
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; }
|
|
1181
|
+
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; }
|
|
1219
1182
|
var Add = function Add(_ref) {
|
|
1220
1183
|
var question = _ref.question,
|
|
1221
1184
|
onClose = _ref.onClose,
|
|
1222
1185
|
questions = _ref.questions,
|
|
1223
1186
|
handleSelect = _ref.handleSelect,
|
|
1224
|
-
buildRequestArgs = _ref.buildRequestArgs,
|
|
1225
1187
|
isOpen = _ref.isOpen,
|
|
1226
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1188
|
+
props = _objectWithoutProperties(_ref, _excluded$5);
|
|
1227
1189
|
var _useBuildFormStore = buildForm.useBuildFormStore(function (store) {
|
|
1228
|
-
var _store$formState, _store$formState2;
|
|
1190
|
+
var _store$formState, _store$formState2, _store$formState3;
|
|
1229
1191
|
return {
|
|
1230
1192
|
formId: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["formId"],
|
|
1231
|
-
selectedLanguage: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["selectedLanguage"]
|
|
1193
|
+
selectedLanguage: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["selectedLanguage"],
|
|
1194
|
+
onMutateSuccess: (_store$formState3 = store["formState"]) === null || _store$formState3 === void 0 ? void 0 : _store$formState3["onMutateSuccess"]
|
|
1232
1195
|
};
|
|
1233
1196
|
}, shallow.shallow),
|
|
1234
1197
|
formId = _useBuildFormStore.formId,
|
|
1235
|
-
language = _useBuildFormStore.selectedLanguage
|
|
1198
|
+
language = _useBuildFormStore.selectedLanguage,
|
|
1199
|
+
onMutateSuccess = _useBuildFormStore.onMutateSuccess;
|
|
1200
|
+
var isFieldCodeEnabled = buildForm.useBuildFormStore(ramda.path(["advancedFeatures", "fieldCode"]));
|
|
1236
1201
|
var _useTranslation = reactI18next.useTranslation(),
|
|
1237
1202
|
t = _useTranslation.t;
|
|
1238
1203
|
var _useCreateQuestion = constants.useCreateQuestion(formId, language, {
|
|
1239
1204
|
onSuccess: function onSuccess() {
|
|
1205
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1206
|
+
args[_key] = arguments[_key];
|
|
1207
|
+
}
|
|
1208
|
+
onMutateSuccess === null || onMutateSuccess === void 0 || onMutateSuccess.apply(void 0, [constants$1.QUESTION_ACTIONS.ADD].concat(args));
|
|
1240
1209
|
utils.showThumbsUpToastr();
|
|
1241
1210
|
onClose();
|
|
1242
1211
|
}
|
|
@@ -1246,12 +1215,12 @@ var Add = function Add(_ref) {
|
|
|
1246
1215
|
var handleSubmit = function handleSubmit(values) {
|
|
1247
1216
|
if (isCreating || !isOpen) return;
|
|
1248
1217
|
var displayOrder = question ? question.displayOrder + 1 : questions.length;
|
|
1249
|
-
createQuestion(
|
|
1218
|
+
createQuestion({
|
|
1250
1219
|
language: language,
|
|
1251
1220
|
neetoFormQuestion: ramda.mergeLeft({
|
|
1252
1221
|
displayOrder: displayOrder
|
|
1253
1222
|
}, values)
|
|
1254
|
-
},
|
|
1223
|
+
}, {
|
|
1255
1224
|
onSuccess: function onSuccess(_ref2) {
|
|
1256
1225
|
var questions = _ref2.questions;
|
|
1257
1226
|
var newQuestion = neetoCist.findBy({
|
|
@@ -1271,11 +1240,11 @@ var Add = function Add(_ref) {
|
|
|
1271
1240
|
}), /*#__PURE__*/jsxRuntime.jsx(Form$2, {
|
|
1272
1241
|
formikProps: {
|
|
1273
1242
|
initialValues: INITIAL_VALUES,
|
|
1274
|
-
validationSchema: formValidationSchema(INITIAL_VALUES,
|
|
1243
|
+
validationSchema: formValidationSchema(INITIAL_VALUES, isFieldCodeEnabled),
|
|
1275
1244
|
onSubmit: handleSubmit
|
|
1276
1245
|
},
|
|
1277
1246
|
children: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1278
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Form$1, _objectSpread$
|
|
1247
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Form$1, _objectSpread$8({}, _objectSpread$8(_objectSpread$8({}, props), {}, {
|
|
1279
1248
|
question: question,
|
|
1280
1249
|
questions: questions
|
|
1281
1250
|
}))), /*#__PURE__*/jsxRuntime.jsx(Pane.Footer, {
|
|
@@ -1291,23 +1260,26 @@ var Add = function Add(_ref) {
|
|
|
1291
1260
|
});
|
|
1292
1261
|
};
|
|
1293
1262
|
|
|
1294
|
-
var _excluded$
|
|
1295
|
-
function ownKeys$
|
|
1296
|
-
function _objectSpread$
|
|
1263
|
+
var _excluded$4 = ["question", "isOpen", "onClose"];
|
|
1264
|
+
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; }
|
|
1265
|
+
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; }
|
|
1297
1266
|
var Edit = function Edit(_ref) {
|
|
1298
1267
|
var question = _ref.question,
|
|
1299
1268
|
isOpen = _ref.isOpen,
|
|
1300
1269
|
onClose = _ref.onClose,
|
|
1301
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1270
|
+
props = _objectWithoutProperties(_ref, _excluded$4);
|
|
1302
1271
|
var _useTranslation = reactI18next.useTranslation(),
|
|
1303
1272
|
t = _useTranslation.t;
|
|
1304
1273
|
var _useBuildFormStore = buildForm.useBuildFormStore(function (store) {
|
|
1305
|
-
var _store$formState;
|
|
1274
|
+
var _store$formState, _store$formState2;
|
|
1306
1275
|
return {
|
|
1307
|
-
selectedLanguage: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["selectedLanguage"]
|
|
1276
|
+
selectedLanguage: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["selectedLanguage"],
|
|
1277
|
+
onMutateSuccess: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["onMutateSuccess"]
|
|
1308
1278
|
};
|
|
1309
1279
|
}, shallow.shallow),
|
|
1310
|
-
language = _useBuildFormStore.selectedLanguage
|
|
1280
|
+
language = _useBuildFormStore.selectedLanguage,
|
|
1281
|
+
onMutateSuccess = _useBuildFormStore.onMutateSuccess;
|
|
1282
|
+
var isFieldCodeEnabled = buildForm.useBuildFormStore(ramda.path(["advancedFeatures", "fieldCode"]));
|
|
1311
1283
|
var _useUpdateQuestion = constants.useUpdateQuestion(question === null || question === void 0 ? void 0 : question.formId, language),
|
|
1312
1284
|
updateQuestion = _useUpdateQuestion.mutate,
|
|
1313
1285
|
isUpdating = _useUpdateQuestion.isPending;
|
|
@@ -1323,6 +1295,10 @@ var Edit = function Edit(_ref) {
|
|
|
1323
1295
|
payload: payload
|
|
1324
1296
|
}, {
|
|
1325
1297
|
onSuccess: function onSuccess() {
|
|
1298
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1299
|
+
args[_key] = arguments[_key];
|
|
1300
|
+
}
|
|
1301
|
+
onMutateSuccess === null || onMutateSuccess === void 0 || onMutateSuccess.apply(void 0, [constants$1.QUESTION_ACTIONS.EDIT].concat(args));
|
|
1326
1302
|
utils.showThumbsUpToastr();
|
|
1327
1303
|
onClose();
|
|
1328
1304
|
},
|
|
@@ -1341,11 +1317,11 @@ var Edit = function Edit(_ref) {
|
|
|
1341
1317
|
}), /*#__PURE__*/jsxRuntime.jsx(Form$2, {
|
|
1342
1318
|
formikProps: {
|
|
1343
1319
|
initialValues: question,
|
|
1344
|
-
validationSchema: formValidationSchema(question,
|
|
1320
|
+
validationSchema: formValidationSchema(question, isFieldCodeEnabled),
|
|
1345
1321
|
onSubmit: handleSubmit
|
|
1346
1322
|
},
|
|
1347
1323
|
children: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1348
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Form$1, _objectSpread$
|
|
1324
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Form$1, _objectSpread$7(_objectSpread$7({}, _objectSpread$7({
|
|
1349
1325
|
question: question
|
|
1350
1326
|
}, props)), {}, {
|
|
1351
1327
|
isEdit: true
|
|
@@ -1380,19 +1356,19 @@ var Captcha = reactUtils.withT(function (_ref) {
|
|
|
1380
1356
|
});
|
|
1381
1357
|
});
|
|
1382
1358
|
|
|
1383
|
-
var _excluded$
|
|
1384
|
-
function ownKeys$
|
|
1385
|
-
function _objectSpread$
|
|
1359
|
+
var _excluded$3 = ["name", "title", "className"];
|
|
1360
|
+
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; }
|
|
1361
|
+
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; }
|
|
1386
1362
|
var SwitchBlock = function SwitchBlock(_ref) {
|
|
1387
1363
|
var name = _ref.name,
|
|
1388
1364
|
title = _ref.title,
|
|
1389
1365
|
_ref$className = _ref.className,
|
|
1390
1366
|
className = _ref$className === void 0 ? "" : _ref$className,
|
|
1391
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$
|
|
1367
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$3);
|
|
1392
1368
|
return /*#__PURE__*/jsxRuntime.jsxs(Label, {
|
|
1393
1369
|
className: classnames("flex items-center justify-start gap-2 ", className),
|
|
1394
1370
|
"data-cy": "neeto-form-engine-".concat(neetoCist.hyphenate(title && name), "-toggle-label"),
|
|
1395
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Switch, _objectSpread$
|
|
1371
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Switch, _objectSpread$6(_objectSpread$6({}, _objectSpread$6(_objectSpread$6({}, otherProps), {}, {
|
|
1396
1372
|
name: name
|
|
1397
1373
|
})), {}, {
|
|
1398
1374
|
"data-cy": "neeto-form-engine-".concat(neetoCist.hyphenate(title && name), "-switch")
|
|
@@ -1404,15 +1380,15 @@ var SwitchBlock = function SwitchBlock(_ref) {
|
|
|
1404
1380
|
});
|
|
1405
1381
|
};
|
|
1406
1382
|
|
|
1407
|
-
function ownKeys$
|
|
1408
|
-
function _objectSpread$
|
|
1383
|
+
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; }
|
|
1384
|
+
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; }
|
|
1409
1385
|
var TitleWithHelpPopover = function TitleWithHelpPopover(_ref) {
|
|
1410
1386
|
var title = _ref.title,
|
|
1411
1387
|
description = _ref.description,
|
|
1412
1388
|
helpLink = _ref.helpLink;
|
|
1413
1389
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1414
1390
|
className: "flex gap-2",
|
|
1415
|
-
children: [title, /*#__PURE__*/jsxRuntime.jsx(HelpPopover, _objectSpread$
|
|
1391
|
+
children: [title, /*#__PURE__*/jsxRuntime.jsx(HelpPopover, _objectSpread$5({
|
|
1416
1392
|
description: description,
|
|
1417
1393
|
popoverProps: {
|
|
1418
1394
|
position: "top"
|
|
@@ -1438,9 +1414,9 @@ var DOMAIN_RESTRICTION_TRANSLATIONS = {
|
|
|
1438
1414
|
}
|
|
1439
1415
|
};
|
|
1440
1416
|
|
|
1441
|
-
var _excluded$
|
|
1442
|
-
function ownKeys$
|
|
1443
|
-
function _objectSpread$
|
|
1417
|
+
var _excluded$2 = ["children"];
|
|
1418
|
+
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; }
|
|
1419
|
+
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; }
|
|
1444
1420
|
var STYLES = {
|
|
1445
1421
|
border: {
|
|
1446
1422
|
"default": "1px solid rgb(var(--neeto-ui-gray-400))",
|
|
@@ -1452,8 +1428,8 @@ var STYLES = {
|
|
|
1452
1428
|
}
|
|
1453
1429
|
};
|
|
1454
1430
|
var MultiValueRemove = function MultiValueRemove(props) {
|
|
1455
|
-
return /*#__PURE__*/jsxRuntime.jsx(reactSelect.components.MultiValueRemove, _objectSpread$
|
|
1456
|
-
innerProps: _objectSpread$
|
|
1431
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactSelect.components.MultiValueRemove, _objectSpread$4(_objectSpread$4({}, props), {}, {
|
|
1432
|
+
innerProps: _objectSpread$4(_objectSpread$4({}, props.innerProps), {}, _defineProperty({}, "data-cy", "".concat(utils.hyphenize(props.data.label), "-remove-icon"))),
|
|
1457
1433
|
children: /*#__PURE__*/jsxRuntime.jsx(Close, {
|
|
1458
1434
|
size: 16
|
|
1459
1435
|
})
|
|
@@ -1461,7 +1437,7 @@ var MultiValueRemove = function MultiValueRemove(props) {
|
|
|
1461
1437
|
};
|
|
1462
1438
|
var ValueContainer = function ValueContainer(_ref) {
|
|
1463
1439
|
var children = _ref.children,
|
|
1464
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
1440
|
+
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
1465
1441
|
var _useTranslation = reactI18next.useTranslation(),
|
|
1466
1442
|
t = _useTranslation.t;
|
|
1467
1443
|
var getValue = props.getValue,
|
|
@@ -1473,8 +1449,8 @@ var ValueContainer = function ValueContainer(_ref) {
|
|
|
1473
1449
|
firstChild = _children[0],
|
|
1474
1450
|
rest = _children.slice(1);
|
|
1475
1451
|
var shouldCollapse = !isFocused && value.length > visibleDomainsCount;
|
|
1476
|
-
return /*#__PURE__*/jsxRuntime.jsxs(reactSelect.components.ValueContainer, _objectSpread$
|
|
1477
|
-
innerProps: _objectSpread$
|
|
1452
|
+
return /*#__PURE__*/jsxRuntime.jsxs(reactSelect.components.ValueContainer, _objectSpread$4(_objectSpread$4({}, props), {}, {
|
|
1453
|
+
innerProps: _objectSpread$4(_objectSpread$4({}, props.innerProps), {}, _defineProperty({}, "data-cy", "multi-domain-input-container")),
|
|
1478
1454
|
children: [shouldCollapse ? firstChild.slice(0, visibleDomainsCount) : firstChild, shouldCollapse && /*#__PURE__*/jsxRuntime.jsx(Tag, {
|
|
1479
1455
|
style: "secondary",
|
|
1480
1456
|
label: t("neetoForm.common.remainingItemsCount", {
|
|
@@ -1484,8 +1460,8 @@ var ValueContainer = function ValueContainer(_ref) {
|
|
|
1484
1460
|
}));
|
|
1485
1461
|
};
|
|
1486
1462
|
var ClearIndicator = function ClearIndicator(props) {
|
|
1487
|
-
return /*#__PURE__*/jsxRuntime.jsx(reactSelect.components.ClearIndicator, _objectSpread$
|
|
1488
|
-
innerProps: _objectSpread$
|
|
1463
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactSelect.components.ClearIndicator, _objectSpread$4(_objectSpread$4({}, props), {}, {
|
|
1464
|
+
innerProps: _objectSpread$4(_objectSpread$4({}, props.innerProps), {}, _defineProperty({}, "data-cy", "clear-all-button")),
|
|
1489
1465
|
children: /*#__PURE__*/jsxRuntime.jsx(Close, {
|
|
1490
1466
|
className: "cursor-pointer",
|
|
1491
1467
|
size: 16
|
|
@@ -1506,7 +1482,7 @@ var CUSTOM_STYLES = {
|
|
|
1506
1482
|
input: ramda.assoc("overflow", "hidden"),
|
|
1507
1483
|
multiValue: function multiValue(styles, _ref2) {
|
|
1508
1484
|
var valid = _ref2.data.valid;
|
|
1509
|
-
return _objectSpread$
|
|
1485
|
+
return _objectSpread$4(_objectSpread$4({}, styles), {}, {
|
|
1510
1486
|
border: valid ? STYLES.border["default"] : STYLES.border.error,
|
|
1511
1487
|
color: valid ? STYLES.color["default"] : STYLES.color.error
|
|
1512
1488
|
});
|
|
@@ -1548,9 +1524,9 @@ var formatErrorMessage = function formatErrorMessage(error) {
|
|
|
1548
1524
|
return removeDuplicateErrorMessages(error);
|
|
1549
1525
|
};
|
|
1550
1526
|
|
|
1551
|
-
var _excluded$
|
|
1552
|
-
function ownKeys$
|
|
1553
|
-
function _objectSpread$
|
|
1527
|
+
var _excluded$1 = ["label", "value", "onChange", "error", "onBlur"];
|
|
1528
|
+
function ownKeys$3(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; }
|
|
1529
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1554
1530
|
var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
1555
1531
|
var _ref$label = _ref.label,
|
|
1556
1532
|
label = _ref$label === void 0 ? "" : _ref$label,
|
|
@@ -1562,7 +1538,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1562
1538
|
error = _ref$error === void 0 ? "" : _ref$error,
|
|
1563
1539
|
_ref$onBlur = _ref.onBlur,
|
|
1564
1540
|
onBlur = _ref$onBlur === void 0 ? neetoCist.noop : _ref$onBlur,
|
|
1565
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$
|
|
1541
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$1);
|
|
1566
1542
|
var _useState = React.useState(""),
|
|
1567
1543
|
_useState2 = _slicedToArray(_useState, 2),
|
|
1568
1544
|
inputValue = _useState2[0],
|
|
@@ -1609,7 +1585,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1609
1585
|
"data-cy": "".concat(utils.hyphenize(label), "-input-label"),
|
|
1610
1586
|
children: label
|
|
1611
1587
|
})
|
|
1612
|
-
}), /*#__PURE__*/jsxRuntime.jsx(CreatableSelect, _objectSpread$
|
|
1588
|
+
}), /*#__PURE__*/jsxRuntime.jsx(CreatableSelect, _objectSpread$3({
|
|
1613
1589
|
isMulti: true,
|
|
1614
1590
|
required: true,
|
|
1615
1591
|
classNamePrefix: "neeto-ui-react-select",
|
|
@@ -1619,7 +1595,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1619
1595
|
className: classnames("neeto-ui-react-select__container neeto-ui-react-select__container--medium neeto-ui-email-input__select", {
|
|
1620
1596
|
"neeto-ui-react-select__container--error": !!error
|
|
1621
1597
|
}),
|
|
1622
|
-
styles: _objectSpread$
|
|
1598
|
+
styles: _objectSpread$3(_objectSpread$3({}, CUSTOM_STYLES), {}, {
|
|
1623
1599
|
control: ramda.mergeLeft({
|
|
1624
1600
|
maxHeight: "200px",
|
|
1625
1601
|
overflowY: "auto"
|
|
@@ -1631,7 +1607,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1631
1607
|
},
|
|
1632
1608
|
onInputChange: setInputValue,
|
|
1633
1609
|
onKeyDown: handleKeyDown
|
|
1634
|
-
}, _objectSpread$
|
|
1610
|
+
}, _objectSpread$3({
|
|
1635
1611
|
inputValue: inputValue,
|
|
1636
1612
|
isFocused: isFocused,
|
|
1637
1613
|
onChange: onChange,
|
|
@@ -1755,25 +1731,26 @@ var RestrictDomainsBlock = function RestrictDomainsBlock(_ref) {
|
|
|
1755
1731
|
};
|
|
1756
1732
|
|
|
1757
1733
|
var Email = function Email(_ref) {
|
|
1758
|
-
var
|
|
1759
|
-
enableDomainBlacklisting = _ref.enableDomainBlacklisting;
|
|
1734
|
+
var usesCustomSubmissionComponent = _ref.usesCustomSubmissionComponent;
|
|
1760
1735
|
var _useFormikContext = formik.useFormikContext(),
|
|
1761
1736
|
_useFormikContext$val = _useFormikContext.values,
|
|
1762
1737
|
_useFormikContext$val2 = _useFormikContext$val.isDomainWhitelistingEnabled,
|
|
1763
1738
|
isDomainWhitelistingEnabled = _useFormikContext$val2 === void 0 ? false : _useFormikContext$val2,
|
|
1764
1739
|
_useFormikContext$val3 = _useFormikContext$val.isDomainBlacklistingEnabled,
|
|
1765
1740
|
isDomainBlacklistingEnabled = _useFormikContext$val3 === void 0 ? false : _useFormikContext$val3;
|
|
1766
|
-
return /*#__PURE__*/jsxRuntime.
|
|
1767
|
-
className: "flex flex-col
|
|
1768
|
-
children:
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1741
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1742
|
+
className: "flex flex-col",
|
|
1743
|
+
children: !usesCustomSubmissionComponent && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1744
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(RestrictDomainsBlock, {
|
|
1745
|
+
domainName: "whitelistedDomains",
|
|
1746
|
+
isDomainRestrictionEnabled: isDomainWhitelistingEnabled,
|
|
1747
|
+
switchName: "isDomainWhitelistingEnabled"
|
|
1748
|
+
}), /*#__PURE__*/jsxRuntime.jsx(RestrictDomainsBlock, {
|
|
1749
|
+
domainName: "blacklistedDomains",
|
|
1750
|
+
isDomainRestrictionEnabled: isDomainBlacklistingEnabled,
|
|
1751
|
+
switchName: "isDomainBlacklistingEnabled"
|
|
1752
|
+
})]
|
|
1753
|
+
})
|
|
1777
1754
|
});
|
|
1778
1755
|
};
|
|
1779
1756
|
|
|
@@ -1861,8 +1838,8 @@ var FileUpload = function FileUpload() {
|
|
|
1861
1838
|
});
|
|
1862
1839
|
};
|
|
1863
1840
|
|
|
1864
|
-
function ownKeys$
|
|
1865
|
-
function _objectSpread$
|
|
1841
|
+
function ownKeys$2(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; }
|
|
1842
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1866
1843
|
var Options = function Options(_ref) {
|
|
1867
1844
|
var questionProps = _ref.questionProps;
|
|
1868
1845
|
var _useTranslation = reactI18next.useTranslation(),
|
|
@@ -1894,7 +1871,7 @@ var Options = function Options(_ref) {
|
|
|
1894
1871
|
var isRemoveOptionDisabled = disableRemoveOption || isManageOptionDisabled;
|
|
1895
1872
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1896
1873
|
className: "w-full",
|
|
1897
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Label, _objectSpread$
|
|
1874
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Label, _objectSpread$2(_objectSpread$2({
|
|
1898
1875
|
className: "mb-2 block"
|
|
1899
1876
|
}, optionLabelProps), {}, {
|
|
1900
1877
|
children: t("neetoForm.questions.common.questionFields.field.options")
|
|
@@ -2020,8 +1997,7 @@ var transformValueForOption = function transformValueForOption(_ref) {
|
|
|
2020
1997
|
var renderAdditionalData = function renderAdditionalData(_ref2) {
|
|
2021
1998
|
var kind = _ref2.kind,
|
|
2022
1999
|
questionProps = _ref2.questionProps,
|
|
2023
|
-
|
|
2024
|
-
enableDomainBlacklisting = _ref2.enableDomainBlacklisting;
|
|
2000
|
+
usesCustomSubmissionComponent = _ref2.usesCustomSubmissionComponent;
|
|
2025
2001
|
switch (kind) {
|
|
2026
2002
|
case CHECKBOX:
|
|
2027
2003
|
case RADIO:
|
|
@@ -2038,10 +2014,9 @@ var renderAdditionalData = function renderAdditionalData(_ref2) {
|
|
|
2038
2014
|
case CAPTCHA:
|
|
2039
2015
|
return /*#__PURE__*/jsxRuntime.jsx(Captcha, {});
|
|
2040
2016
|
case EMAIL:
|
|
2041
|
-
return
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
}) : null;
|
|
2017
|
+
return !usesCustomSubmissionComponent && /*#__PURE__*/jsxRuntime.jsx(Email, {
|
|
2018
|
+
usesCustomSubmissionComponent: usesCustomSubmissionComponent
|
|
2019
|
+
});
|
|
2045
2020
|
default:
|
|
2046
2021
|
return null;
|
|
2047
2022
|
}
|
|
@@ -2112,23 +2087,23 @@ var readOnlySwitchLabelProps = function readOnlySwitchLabelProps(helpUrl) {
|
|
|
2112
2087
|
};
|
|
2113
2088
|
};
|
|
2114
2089
|
|
|
2115
|
-
var _excluded
|
|
2116
|
-
function ownKeys$
|
|
2117
|
-
function _objectSpread$
|
|
2090
|
+
var _excluded = ["isOpen", "onClose", "action", "question", "availableQuestionKinds"];
|
|
2091
|
+
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; }
|
|
2092
|
+
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; }
|
|
2118
2093
|
var ManageQuestionPane = function ManageQuestionPane(_ref) {
|
|
2119
2094
|
var isOpen = _ref.isOpen,
|
|
2120
2095
|
onClose = _ref.onClose,
|
|
2121
2096
|
action = _ref.action,
|
|
2122
2097
|
question = _ref.question,
|
|
2123
2098
|
availableQuestionKinds = _ref.availableQuestionKinds,
|
|
2124
|
-
props = _objectWithoutProperties(_ref, _excluded
|
|
2099
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
2125
2100
|
var initialFocusRef = React.useRef(null);
|
|
2126
2101
|
var Component = resolveActionComponent(action);
|
|
2127
2102
|
return /*#__PURE__*/jsxRuntime.jsx(Pane, {
|
|
2128
2103
|
initialFocusRef: initialFocusRef,
|
|
2129
2104
|
isOpen: isOpen,
|
|
2130
2105
|
onClose: onClose,
|
|
2131
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Component, _objectSpread$
|
|
2106
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Component, _objectSpread$1({}, _objectSpread$1({
|
|
2132
2107
|
availableQuestionKinds: availableQuestionKinds,
|
|
2133
2108
|
initialFocusRef: initialFocusRef,
|
|
2134
2109
|
isOpen: isOpen,
|
|
@@ -2138,36 +2113,36 @@ var ManageQuestionPane = function ManageQuestionPane(_ref) {
|
|
|
2138
2113
|
});
|
|
2139
2114
|
};
|
|
2140
2115
|
|
|
2141
|
-
function ownKeys
|
|
2142
|
-
function _objectSpread
|
|
2116
|
+
function ownKeys(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; }
|
|
2117
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2143
2118
|
var AddQuestion = function AddQuestion(_ref) {
|
|
2144
2119
|
var onAdd = _ref.onAdd,
|
|
2145
2120
|
disabledAddButtonTooltipProps = _ref.disabledAddButtonTooltipProps,
|
|
2146
|
-
isDisabled = _ref.isDisabled
|
|
2121
|
+
isDisabled = _ref.isDisabled,
|
|
2122
|
+
addQuestionHelpProps = _ref.addQuestionHelpProps;
|
|
2147
2123
|
var tooltipProps = constants$1.buildDisabledAddButtonTooltipProps(isDisabled, disabledAddButtonTooltipProps);
|
|
2148
|
-
return /*#__PURE__*/jsxRuntime.
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2124
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2125
|
+
className: "mb-8 flex w-full items-center gap-x-1",
|
|
2126
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Tooltip, _objectSpread(_objectSpread({}, tooltipProps), {}, {
|
|
2127
|
+
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2128
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread({}, constants$1.buildAddQuestionButtonProps(onAdd, isDisabled)))
|
|
2129
|
+
})
|
|
2130
|
+
})), neetoCist.isPresent(addQuestionHelpProps) && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2131
|
+
children: /*#__PURE__*/jsxRuntime.jsx(HelpPopover, _objectSpread({}, addQuestionHelpProps))
|
|
2132
|
+
})]
|
|
2133
|
+
});
|
|
2153
2134
|
};
|
|
2154
2135
|
|
|
2155
|
-
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", "showReadOnlySwitch", "showResponseVisibleOnlyToHostSwitch", "buildRequestArgs", "enableDomainBlacklisting", "enableDomainWhitelisting", "helpDocUrls", "hostSpecificData", "questionsHelpProps", "isUsingDefaultQuestionKinds", "usesCustomSubmissionComponent"];
|
|
2156
|
-
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; }
|
|
2157
|
-
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; }
|
|
2158
2136
|
var Form = function Form(_ref) {
|
|
2159
2137
|
var questionKinds = _ref.questionKinds,
|
|
2160
2138
|
onValueChange = _ref.onValueChange,
|
|
2161
2139
|
formId = _ref.formId,
|
|
2162
2140
|
isDeletable = _ref.isDeletable,
|
|
2163
2141
|
isRequiredField = _ref.isRequiredField,
|
|
2164
|
-
submitButtonProps = _ref.submitButtonProps,
|
|
2165
|
-
cancelButtonProps = _ref.cancelButtonProps,
|
|
2166
2142
|
isKindAlreadyActive = _ref.isKindAlreadyActive,
|
|
2167
2143
|
getActiveKindDetails = _ref.getActiveKindDetails,
|
|
2168
2144
|
isDisabledFieldLabel = _ref.isDisabledFieldLabel,
|
|
2169
2145
|
disabledAddButtonTooltipProps = _ref.disabledAddButtonTooltipProps,
|
|
2170
|
-
enableFieldCode = _ref.enableFieldCode,
|
|
2171
2146
|
isFormEnabled = _ref.isFormEnabled,
|
|
2172
2147
|
savedTitle = _ref.savedTitle,
|
|
2173
2148
|
formTitle = _ref.formTitle,
|
|
@@ -2176,24 +2151,20 @@ var Form = function Form(_ref) {
|
|
|
2176
2151
|
availableLanguages = _ref.availableLanguages,
|
|
2177
2152
|
onLanguageChange = _ref.onLanguageChange,
|
|
2178
2153
|
additionalActionOptions = _ref.additionalActionOptions,
|
|
2179
|
-
|
|
2180
|
-
additionalQuestionKindPattern = _ref.additionalQuestionKindPattern,
|
|
2181
|
-
showActionBlock = _ref.showActionBlock,
|
|
2182
|
-
showReadOnlySwitch = _ref.showReadOnlySwitch,
|
|
2183
|
-
showResponseVisibleOnlyToHostSwitch = _ref.showResponseVisibleOnlyToHostSwitch,
|
|
2184
|
-
buildRequestArgs = _ref.buildRequestArgs,
|
|
2185
|
-
enableDomainBlacklisting = _ref.enableDomainBlacklisting,
|
|
2186
|
-
enableDomainWhitelisting = _ref.enableDomainWhitelisting,
|
|
2154
|
+
kindUniqueOn = _ref.kindUniqueOn,
|
|
2187
2155
|
helpDocUrls = _ref.helpDocUrls,
|
|
2188
2156
|
hostSpecificData = _ref.hostSpecificData,
|
|
2189
|
-
|
|
2157
|
+
addQuestionHelpProps = _ref.addQuestionHelpProps,
|
|
2190
2158
|
isUsingDefaultQuestionKinds = _ref.isUsingDefaultQuestionKinds,
|
|
2191
2159
|
usesCustomSubmissionComponent = _ref.usesCustomSubmissionComponent,
|
|
2192
|
-
|
|
2160
|
+
questionsFromCache = _ref.questionsFromCache,
|
|
2161
|
+
onMutateSuccess = _ref.onMutateSuccess,
|
|
2162
|
+
advancedFeatures = _ref.advancedFeatures;
|
|
2193
2163
|
var containerRef = React.useRef();
|
|
2194
|
-
var
|
|
2195
|
-
|
|
2196
|
-
|
|
2164
|
+
var _useStateWithDependen = reactUtils.useStateWithDependency(questionsFromCache),
|
|
2165
|
+
_useStateWithDependen2 = _slicedToArray(_useStateWithDependen, 2),
|
|
2166
|
+
questions = _useStateWithDependen2[0],
|
|
2167
|
+
setQuestions = _useStateWithDependen2[1];
|
|
2197
2168
|
var _useState = React.useState({}),
|
|
2198
2169
|
_useState2 = _slicedToArray(_useState, 2),
|
|
2199
2170
|
selectedQuestion = _useState2[0],
|
|
@@ -2214,43 +2185,57 @@ var Form = function Form(_ref) {
|
|
|
2214
2185
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
2215
2186
|
isManageQuestionPaneOpen = _useState10[0],
|
|
2216
2187
|
setIsManageQuestionPaneOpen = _useState10[1];
|
|
2217
|
-
var values = formikContext.values,
|
|
2218
|
-
setFieldValue = formikContext.setFieldValue,
|
|
2219
|
-
dirty = formikContext.dirty,
|
|
2220
|
-
isSubmitting = formikContext.isSubmitting,
|
|
2221
|
-
isValid = formikContext.isValid,
|
|
2222
|
-
errors = formikContext.errors,
|
|
2223
|
-
submitForm = formikContext.submitForm,
|
|
2224
|
-
resetForm = formikContext.resetForm;
|
|
2225
2188
|
var setFormData = buildForm.useBuildFormStore(ramda.prop("setFormData"));
|
|
2226
2189
|
var _useCreateQuestion = constants.useCreateQuestion(formId, selectedLanguage, {
|
|
2227
|
-
onSuccess:
|
|
2190
|
+
onSuccess: function onSuccess() {
|
|
2191
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2192
|
+
args[_key] = arguments[_key];
|
|
2193
|
+
}
|
|
2194
|
+
onMutateSuccess === null || onMutateSuccess === void 0 || onMutateSuccess.apply(void 0, [constants$1.QUESTION_ACTIONS.CLONE].concat(args));
|
|
2195
|
+
utils.showThumbsUpToastr();
|
|
2196
|
+
}
|
|
2228
2197
|
}),
|
|
2229
2198
|
createQuestion = _useCreateQuestion.mutate;
|
|
2199
|
+
var _useReorderQuestions = constants.useReorderQuestions(formId, selectedLanguage, {
|
|
2200
|
+
onSuccess: function onSuccess() {
|
|
2201
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
2202
|
+
args[_key2] = arguments[_key2];
|
|
2203
|
+
}
|
|
2204
|
+
onMutateSuccess === null || onMutateSuccess === void 0 || onMutateSuccess.apply(void 0, [constants$1.QUESTION_ACTIONS.REORDER].concat(args));
|
|
2205
|
+
setFormData({
|
|
2206
|
+
isReorderingQuestions: false
|
|
2207
|
+
});
|
|
2208
|
+
}
|
|
2209
|
+
}),
|
|
2210
|
+
reorderQuestions = _useReorderQuestions.mutate;
|
|
2211
|
+
var debouncedReorderQuestions = reactUtils.useFuncDebounce(reorderQuestions, 1000);
|
|
2212
|
+
var handleReorder = function handleReorder(questions) {
|
|
2213
|
+
var payload = {
|
|
2214
|
+
neetoFormQuestions: {
|
|
2215
|
+
questions: constants$1.buildReorderPayload(questions)
|
|
2216
|
+
},
|
|
2217
|
+
language: selectedLanguage
|
|
2218
|
+
};
|
|
2219
|
+
setFormData({
|
|
2220
|
+
isReorderingQuestions: true
|
|
2221
|
+
});
|
|
2222
|
+
debouncedReorderQuestions(payload);
|
|
2223
|
+
};
|
|
2230
2224
|
React.useEffect(function () {
|
|
2231
2225
|
setFormData({
|
|
2232
2226
|
formId: formId,
|
|
2233
2227
|
enabled: isFormEnabled,
|
|
2234
2228
|
title: savedTitle,
|
|
2235
|
-
values: values,
|
|
2236
|
-
dirty: dirty,
|
|
2237
|
-
isSubmitting: isSubmitting,
|
|
2238
|
-
isValid: isValid,
|
|
2239
|
-
errors: errors,
|
|
2240
|
-
submitForm: submitForm,
|
|
2241
|
-
resetForm: resetForm,
|
|
2242
2229
|
selectedLanguage: selectedLanguage,
|
|
2243
2230
|
helpDocUrls: helpDocUrls,
|
|
2244
|
-
enableDomainBlacklisting: enableDomainBlacklisting,
|
|
2245
|
-
enableDomainWhitelisting: enableDomainWhitelisting,
|
|
2246
2231
|
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds,
|
|
2247
|
-
showReadOnlySwitch: showReadOnlySwitch,
|
|
2248
|
-
showResponseVisibleOnlyToHostSwitch: showResponseVisibleOnlyToHostSwitch,
|
|
2249
2232
|
usesCustomSubmissionComponent: usesCustomSubmissionComponent,
|
|
2250
|
-
hostSpecificData: hostSpecificData
|
|
2233
|
+
hostSpecificData: hostSpecificData,
|
|
2234
|
+
onMutateSuccess: onMutateSuccess,
|
|
2235
|
+
advancedFeatures: advancedFeatures,
|
|
2236
|
+
onLanguageChange: onLanguageChange
|
|
2251
2237
|
});
|
|
2252
|
-
}, [formId, isFormEnabled, savedTitle, setFormData,
|
|
2253
|
-
var questions = values.questions;
|
|
2238
|
+
}, [formId, isFormEnabled, savedTitle, setFormData, selectedLanguage, helpDocUrls, isUsingDefaultQuestionKinds, usesCustomSubmissionComponent, hostSpecificData, onMutateSuccess, advancedFeatures, onLanguageChange]);
|
|
2254
2239
|
var handleSelect = function handleSelect(question) {
|
|
2255
2240
|
setSelectedQuestion(question);
|
|
2256
2241
|
};
|
|
@@ -2272,10 +2257,10 @@ var Form = function Form(_ref) {
|
|
|
2272
2257
|
var attributes = ramda.mergeLeft({
|
|
2273
2258
|
displayOrder: displayOrder
|
|
2274
2259
|
}, values);
|
|
2275
|
-
var payload =
|
|
2260
|
+
var payload = {
|
|
2276
2261
|
language: selectedLanguage,
|
|
2277
2262
|
neetoFormQuestion: formatQuestionAttributesForClone(attributes)
|
|
2278
|
-
}
|
|
2263
|
+
};
|
|
2279
2264
|
createQuestion(payload, {
|
|
2280
2265
|
onSuccess: function onSuccess(_ref2) {
|
|
2281
2266
|
var questions = _ref2.questions;
|
|
@@ -2306,22 +2291,6 @@ var Form = function Form(_ref) {
|
|
|
2306
2291
|
activeQuestions: questions,
|
|
2307
2292
|
isKindAlreadyActive: isKindAlreadyActive
|
|
2308
2293
|
});
|
|
2309
|
-
var hasActiveQuestions = questions && questions.length && questions.some(function (question) {
|
|
2310
|
-
return question._destroy !== true;
|
|
2311
|
-
});
|
|
2312
|
-
var handleLanguageChange = function handleLanguageChange(code) {
|
|
2313
|
-
resetForm();
|
|
2314
|
-
onLanguageChange(code);
|
|
2315
|
-
};
|
|
2316
|
-
var richTextQuestions = neetoCist.filterBy({
|
|
2317
|
-
kind: ramda.includes(ramda.__, constants$1.RICH_TEXT_QUESTIONS)
|
|
2318
|
-
}, questions);
|
|
2319
|
-
var resetFormData = function resetFormData() {
|
|
2320
|
-
resetForm();
|
|
2321
|
-
setFormData({
|
|
2322
|
-
richTextFieldsToReset: ramda.pluck("fieldCode", richTextQuestions)
|
|
2323
|
-
});
|
|
2324
|
-
};
|
|
2325
2294
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2326
2295
|
children: [/*#__PURE__*/jsxRuntime.jsx(DeleteAlert, {
|
|
2327
2296
|
handleSelect: handleSelect,
|
|
@@ -2337,20 +2306,16 @@ var Form = function Form(_ref) {
|
|
|
2337
2306
|
onClose: function onClose() {
|
|
2338
2307
|
return setIsDeleteSmsReminderModalOpen(false);
|
|
2339
2308
|
}
|
|
2340
|
-
}), /*#__PURE__*/jsxRuntime.jsxs(
|
|
2341
|
-
className: "neeto-form-nano-form-wrapper flex h-full flex-col"
|
|
2342
|
-
}, formDomProps), {}, {
|
|
2343
|
-
noValidate: true,
|
|
2309
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2310
|
+
className: "neeto-form-nano-form-wrapper flex h-full flex-col",
|
|
2344
2311
|
children: [formTitle && /*#__PURE__*/jsxRuntime.jsx(Overview, {
|
|
2345
2312
|
additionalActionOptions: additionalActionOptions,
|
|
2346
2313
|
availableLanguages: availableLanguages,
|
|
2347
|
-
selectedLanguage: selectedLanguage,
|
|
2348
2314
|
description: formDescription,
|
|
2349
|
-
title: formTitle
|
|
2350
|
-
onLanguageChange: handleLanguageChange
|
|
2315
|
+
title: formTitle
|
|
2351
2316
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2352
2317
|
className: "neeto-form-nano-form-wrapper__body min-h-0 w-full flex-grow space-y-6 overflow-y-auto pb-6",
|
|
2353
|
-
children:
|
|
2318
|
+
children: neetoCist.isPresent(questions) ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2354
2319
|
className: "space-y-6",
|
|
2355
2320
|
ref: containerRef,
|
|
2356
2321
|
children: [/*#__PURE__*/jsxRuntime.jsx(dnd.DragDropContext, {
|
|
@@ -2361,7 +2326,10 @@ var Form = function Form(_ref) {
|
|
|
2361
2326
|
source: source,
|
|
2362
2327
|
destination: destination,
|
|
2363
2328
|
items: questions,
|
|
2364
|
-
setValue:
|
|
2329
|
+
setValue: function setValue(orderedQuestions) {
|
|
2330
|
+
setQuestions(orderedQuestions);
|
|
2331
|
+
handleReorder(orderedQuestions);
|
|
2332
|
+
}
|
|
2365
2333
|
});
|
|
2366
2334
|
},
|
|
2367
2335
|
children: /*#__PURE__*/jsxRuntime.jsx(Questions, {
|
|
@@ -2375,40 +2343,27 @@ var Form = function Form(_ref) {
|
|
|
2375
2343
|
onEdit: handleEdit,
|
|
2376
2344
|
onSelect: handleSelect
|
|
2377
2345
|
})
|
|
2378
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
2346
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2379
2347
|
className: "mb-8 flex w-full items-center gap-x-1",
|
|
2380
|
-
children:
|
|
2348
|
+
children: /*#__PURE__*/jsxRuntime.jsx(AddQuestion, {
|
|
2349
|
+
addQuestionHelpProps: addQuestionHelpProps,
|
|
2381
2350
|
disabledAddButtonTooltipProps: disabledAddButtonTooltipProps,
|
|
2382
2351
|
isDisabled: ramda.isEmpty(availableQuestionKinds),
|
|
2383
2352
|
onAdd: handleAdd
|
|
2384
|
-
})
|
|
2385
|
-
children: /*#__PURE__*/jsxRuntime.jsx(HelpPopover, _objectSpread$1({}, questionsHelpProps))
|
|
2386
|
-
})]
|
|
2353
|
+
})
|
|
2387
2354
|
})]
|
|
2388
2355
|
}) : /*#__PURE__*/jsxRuntime.jsx(AddFirstQuestion, {
|
|
2389
2356
|
disabledAddButtonTooltipProps: disabledAddButtonTooltipProps,
|
|
2390
2357
|
isDisabled: ramda.isEmpty(availableQuestionKinds),
|
|
2391
2358
|
onAdd: handleAdd
|
|
2392
2359
|
})
|
|
2393
|
-
}), (showActionBlock || dirty) && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2394
|
-
className: "neeto-ui-border-gray-300 neeto-form-nano-form-wrapper__footer neeto-ui-bg-white sticky bottom-0 flex flex-shrink-0 justify-end border-t px-6 py-4",
|
|
2395
|
-
children: /*#__PURE__*/jsxRuntime.jsx(ActionBlock, {
|
|
2396
|
-
submitButtonProps: submitButtonProps,
|
|
2397
|
-
isSubmitting: isReordering,
|
|
2398
|
-
cancelButtonProps: _objectSpread$1({
|
|
2399
|
-
label: t("neetoForm.common.reset"),
|
|
2400
|
-
onClick: resetFormData
|
|
2401
|
-
}, cancelButtonProps)
|
|
2402
|
-
})
|
|
2403
2360
|
}), /*#__PURE__*/jsxRuntime.jsx(ManageQuestionPane, {
|
|
2404
|
-
additionalQuestionKindPattern: additionalQuestionKindPattern,
|
|
2405
2361
|
availableQuestionKinds: availableQuestionKinds,
|
|
2406
|
-
buildRequestArgs: buildRequestArgs,
|
|
2407
|
-
enableFieldCode: enableFieldCode,
|
|
2408
2362
|
getActiveKindDetails: getActiveKindDetails,
|
|
2409
2363
|
handleSelect: handleSelect,
|
|
2410
2364
|
isDisabledFieldLabel: isDisabledFieldLabel,
|
|
2411
2365
|
isRequiredField: isRequiredField,
|
|
2366
|
+
kindUniqueOn: kindUniqueOn,
|
|
2412
2367
|
questions: questions,
|
|
2413
2368
|
action: selectedAction,
|
|
2414
2369
|
allQuestionKinds: questionKinds,
|
|
@@ -2418,75 +2373,49 @@ var Form = function Form(_ref) {
|
|
|
2418
2373
|
return setIsManageQuestionPaneOpen(false);
|
|
2419
2374
|
}
|
|
2420
2375
|
})]
|
|
2421
|
-
})
|
|
2376
|
+
})]
|
|
2422
2377
|
});
|
|
2423
2378
|
};
|
|
2424
2379
|
|
|
2425
|
-
function ownKeys(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; }
|
|
2426
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2427
2380
|
var BuildForm = function BuildForm(_ref) {
|
|
2428
2381
|
var id = _ref.id,
|
|
2429
|
-
onUpdate = _ref.onUpdate,
|
|
2430
|
-
buildRequestArgs = _ref.buildRequestArgs,
|
|
2431
|
-
_ref$nonRemovableFiel = _ref.nonRemovableFields,
|
|
2432
|
-
nonRemovableFields = _ref$nonRemovableFiel === void 0 ? [] : _ref$nonRemovableFiel,
|
|
2433
|
-
_ref$requiredFields = _ref.requiredFields,
|
|
2434
|
-
requiredFields = _ref$requiredFields === void 0 ? [] : _ref$requiredFields,
|
|
2435
|
-
formDomProps = _ref.formDomProps,
|
|
2436
|
-
_ref$showActionBlock = _ref.showActionBlock,
|
|
2437
|
-
showActionBlock = _ref$showActionBlock === void 0 ? false : _ref$showActionBlock,
|
|
2438
|
-
submitButtonProps = _ref.submitButtonProps,
|
|
2439
|
-
cancelButtonProps = _ref.cancelButtonProps,
|
|
2440
2382
|
questionKinds = _ref.questionKinds,
|
|
2441
2383
|
_ref$isKindAlreadyAct = _ref.isKindAlreadyActive,
|
|
2442
2384
|
isKindAlreadyActive = _ref$isKindAlreadyAct === void 0 ? isQuestionKindAlreadyActive : _ref$isKindAlreadyAct,
|
|
2443
2385
|
_ref$getActiveKindDet = _ref.getActiveKindDetails,
|
|
2444
2386
|
getActiveKindDetails = _ref$getActiveKindDet === void 0 ? constants$1.getActiveQuestionKindDetails : _ref$getActiveKindDet,
|
|
2445
|
-
|
|
2446
|
-
|
|
2387
|
+
kindUniqueOn = _ref.kindUniqueOn,
|
|
2388
|
+
_ref$isQuestionDeleta = _ref.isQuestionDeletable,
|
|
2389
|
+
isQuestionDeletable = _ref$isQuestionDeleta === void 0 ? ramda.T : _ref$isQuestionDeleta,
|
|
2390
|
+
_ref$isFieldRequired = _ref.isFieldRequired,
|
|
2391
|
+
isFieldRequired = _ref$isFieldRequired === void 0 ? ramda.F : _ref$isFieldRequired,
|
|
2447
2392
|
isFieldLabelDisabled = _ref.isFieldLabelDisabled,
|
|
2448
|
-
_ref$showLoader = _ref.showLoader,
|
|
2449
|
-
showLoader = _ref$showLoader === void 0 ? false : _ref$showLoader,
|
|
2450
|
-
_ref$kindUniqueOn = _ref.kindUniqueOn,
|
|
2451
|
-
kindUniqueOn = _ref$kindUniqueOn === void 0 ? ["type"] : _ref$kindUniqueOn,
|
|
2452
|
-
_ref$allowAdditionalG = _ref.allowAdditionalGuests,
|
|
2453
|
-
allowAdditionalGuests = _ref$allowAdditionalG === void 0 ? false : _ref$allowAdditionalG,
|
|
2454
|
-
disabledAddButtonTooltipProps = _ref.disabledAddButtonTooltipProps,
|
|
2455
|
-
_ref$enableFieldCode = _ref.enableFieldCode,
|
|
2456
|
-
enableFieldCode = _ref$enableFieldCode === void 0 ? false : _ref$enableFieldCode,
|
|
2457
|
-
_ref$availableLanguag = _ref.availableLanguages,
|
|
2458
|
-
availableLanguages = _ref$availableLanguag === void 0 ? constants$1.DEFAULT_AVAILABLE_LANGUAGES : _ref$availableLanguag,
|
|
2459
|
-
formDescription = _ref.formDescription,
|
|
2460
2393
|
_ref$formTitle = _ref.formTitle,
|
|
2461
2394
|
formTitle = _ref$formTitle === void 0 ? "" : _ref$formTitle,
|
|
2395
|
+
formDescription = _ref.formDescription,
|
|
2396
|
+
_ref$availableLanguag = _ref.availableLanguages,
|
|
2397
|
+
availableLanguages = _ref$availableLanguag === void 0 ? constants$1.DEFAULT_AVAILABLE_LANGUAGES : _ref$availableLanguag,
|
|
2462
2398
|
_ref$selectedLanguage = _ref.selectedLanguage,
|
|
2463
2399
|
selectedLanguage = _ref$selectedLanguage === void 0 ? "en" : _ref$selectedLanguage,
|
|
2464
2400
|
_ref$onLanguageChange = _ref.onLanguageChange,
|
|
2465
2401
|
onLanguageChange = _ref$onLanguageChange === void 0 ? neetoCist.noop : _ref$onLanguageChange,
|
|
2402
|
+
_ref$addQuestionHelpP = _ref.addQuestionHelpProps,
|
|
2403
|
+
addQuestionHelpProps = _ref$addQuestionHelpP === void 0 ? {} : _ref$addQuestionHelpP,
|
|
2404
|
+
disabledAddButtonTooltipProps = _ref.disabledAddButtonTooltipProps,
|
|
2466
2405
|
_ref$additionalAction = _ref.additionalActionOptions,
|
|
2467
2406
|
additionalActionOptions = _ref$additionalAction === void 0 ? [] : _ref$additionalAction,
|
|
2468
|
-
|
|
2469
|
-
_ref$
|
|
2470
|
-
|
|
2471
|
-
_ref$
|
|
2472
|
-
enableDomainWhitelisting = _ref$enableDomainWhit === void 0 ? true : _ref$enableDomainWhit,
|
|
2407
|
+
_ref$allowAdditionalG = _ref.allowAdditionalGuests,
|
|
2408
|
+
allowAdditionalGuests = _ref$allowAdditionalG === void 0 ? false : _ref$allowAdditionalG,
|
|
2409
|
+
_ref$advancedFeatures = _ref.advancedFeatures,
|
|
2410
|
+
advancedFeatures = _ref$advancedFeatures === void 0 ? constants$1.DEFAULT_ADVANCED_FEATURES : _ref$advancedFeatures,
|
|
2473
2411
|
helpDocUrls = _ref.helpDocUrls,
|
|
2474
2412
|
className = _ref.className,
|
|
2475
|
-
_ref$questionsHelpPro = _ref.questionsHelpProps,
|
|
2476
|
-
questionsHelpProps = _ref$questionsHelpPro === void 0 ? {} : _ref$questionsHelpPro,
|
|
2477
|
-
hostSpecificData = _ref.hostSpecificData,
|
|
2478
|
-
_ref$showReadOnlySwit = _ref.showReadOnlySwitch,
|
|
2479
|
-
showReadOnlySwitch = _ref$showReadOnlySwit === void 0 ? false : _ref$showReadOnlySwit,
|
|
2480
|
-
_ref$showResponseVisi = _ref.showResponseVisibleOnlyToHostSwitch,
|
|
2481
|
-
showResponseVisibleOnlyToHostSwitch = _ref$showResponseVisi === void 0 ? false : _ref$showResponseVisi,
|
|
2482
2413
|
_ref$usesCustomSubmis = _ref.usesCustomSubmissionComponent,
|
|
2483
|
-
usesCustomSubmissionComponent = _ref$usesCustomSubmis === void 0 ? false : _ref$usesCustomSubmis
|
|
2414
|
+
usesCustomSubmissionComponent = _ref$usesCustomSubmis === void 0 ? false : _ref$usesCustomSubmis,
|
|
2415
|
+
_ref$onMutateSuccess = _ref.onMutateSuccess,
|
|
2416
|
+
onMutateSuccess = _ref$onMutateSuccess === void 0 ? neetoCist.noop : _ref$onMutateSuccess,
|
|
2417
|
+
hostSpecificData = _ref.hostSpecificData;
|
|
2484
2418
|
var queryClient = reactQuery.useQueryClient();
|
|
2485
|
-
var _useReorderQuestions = constants.useReorderQuestions(id, {
|
|
2486
|
-
onSuccess: utils.showThumbsUpToastr
|
|
2487
|
-
}),
|
|
2488
|
-
reorderQuestions = _useReorderQuestions.mutate,
|
|
2489
|
-
isReordering = _useReorderQuestions.isPending;
|
|
2490
2419
|
var _useForm = constants.useForm({
|
|
2491
2420
|
formId: id,
|
|
2492
2421
|
language: selectedLanguage
|
|
@@ -2497,33 +2426,14 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2497
2426
|
var _ref2 = data || constants$1.QUESTIONS_INITIAL_VALUE,
|
|
2498
2427
|
isFormEnabled = _ref2.enabled,
|
|
2499
2428
|
savedTitle = _ref2.title,
|
|
2500
|
-
|
|
2429
|
+
questionsFromCache = _ref2.questions,
|
|
2501
2430
|
isQuestionsLoading = _ref2.isQuestionsLoading;
|
|
2502
|
-
|
|
2503
|
-
if (data) {
|
|
2504
|
-
onUpdate === null || onUpdate === void 0 || onUpdate(data);
|
|
2505
|
-
}
|
|
2506
|
-
}, [data]);
|
|
2507
|
-
if (isLoading || showLoader && isQuestionsLoading && !isQuestionsPending) {
|
|
2431
|
+
if (isLoading || isQuestionsLoading && !isQuestionsPending) {
|
|
2508
2432
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2509
2433
|
className: "flex h-full w-full items-center justify-center py-6",
|
|
2510
2434
|
children: /*#__PURE__*/jsxRuntime.jsx(PageLoader, {})
|
|
2511
2435
|
});
|
|
2512
2436
|
}
|
|
2513
|
-
var handleSubmit = function handleSubmit(_ref3, _ref4) {
|
|
2514
|
-
var questions = _ref3.questions;
|
|
2515
|
-
var setSubmitting = _ref4.setSubmitting;
|
|
2516
|
-
var payload = {
|
|
2517
|
-
neetoFormQuestions: {
|
|
2518
|
-
questions: constants$1.buildReorderPayload(questions)
|
|
2519
|
-
}
|
|
2520
|
-
};
|
|
2521
|
-
reorderQuestions(payload, {
|
|
2522
|
-
onSettled: function onSettled() {
|
|
2523
|
-
return setSubmitting(false);
|
|
2524
|
-
}
|
|
2525
|
-
});
|
|
2526
|
-
};
|
|
2527
2437
|
var onValueChange = function onValueChange(questions) {
|
|
2528
2438
|
var _queryClient$getQuery = queryClient.getQueryState([constants.QUERY_KEYS.QUESTIONS, id, selectedLanguage]),
|
|
2529
2439
|
dataUpdateCount = _queryClient$getQuery.dataUpdateCount;
|
|
@@ -2531,13 +2441,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2531
2441
|
queryClient.setQueryData([constants.QUERY_KEYS.QUESTIONS, "preview/".concat(id), selectedLanguage], ramda.assoc("questions", questions));
|
|
2532
2442
|
}
|
|
2533
2443
|
};
|
|
2534
|
-
var
|
|
2535
|
-
return !nonRemovableFields.includes(question.kind);
|
|
2536
|
-
};
|
|
2537
|
-
var isRequiredField = isFieldRequired !== null && isFieldRequired !== void 0 ? isFieldRequired : function (_ref5) {
|
|
2538
|
-
var kind = _ref5.kind;
|
|
2539
|
-
return ramda.concat(constants$1.MANDATORY_KINDS, requiredFields).includes(kind);
|
|
2540
|
-
};
|
|
2444
|
+
var isRequiredField = ramda.either(constants$1.isMandatoryField, isFieldRequired);
|
|
2541
2445
|
var isDisabledFieldLabel = function isDisabledFieldLabel(field) {
|
|
2542
2446
|
return constants$1.isImmutableField(field) || (isFieldLabelDisabled !== null && isFieldLabelDisabled !== void 0 ? isFieldLabelDisabled : ramda.F)(field);
|
|
2543
2447
|
};
|
|
@@ -2545,63 +2449,36 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2545
2449
|
type: constants$1.QUESTION_KIND.ADDITIONAL_GUESTS.value
|
|
2546
2450
|
}, constants$1.QUESTION_KINDS);
|
|
2547
2451
|
var isUsingDefaultQuestionKinds = ramda.isNil(questionKinds);
|
|
2548
|
-
return /*#__PURE__*/jsxRuntime.
|
|
2452
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2549
2453
|
className: classnames("neeto-form-nano-form-outer-wrapper relative", className),
|
|
2550
|
-
children:
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
isReordering: isReordering,
|
|
2579
|
-
isRequiredField: isRequiredField,
|
|
2580
|
-
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds,
|
|
2581
|
-
kindUniqueOn: kindUniqueOn,
|
|
2582
|
-
onLanguageChange: onLanguageChange,
|
|
2583
|
-
onValueChange: onValueChange,
|
|
2584
|
-
questionsHelpProps: questionsHelpProps,
|
|
2585
|
-
savedTitle: savedTitle,
|
|
2586
|
-
selectedLanguage: selectedLanguage,
|
|
2587
|
-
showActionBlock: showActionBlock,
|
|
2588
|
-
showReadOnlySwitch: showReadOnlySwitch,
|
|
2589
|
-
showResponseVisibleOnlyToHostSwitch: showResponseVisibleOnlyToHostSwitch,
|
|
2590
|
-
submitButtonProps: submitButtonProps,
|
|
2591
|
-
usesCustomSubmissionComponent: usesCustomSubmissionComponent
|
|
2592
|
-
})), {}, {
|
|
2593
|
-
formId: id,
|
|
2594
|
-
questionKinds: isUsingDefaultQuestionKinds ? defaultQuestionKinds : questionKinds,
|
|
2595
|
-
onChange: function onChange(event) {
|
|
2596
|
-
if (ramda.isEmpty(errors)) return;
|
|
2597
|
-
setFieldError(event.target.name);
|
|
2598
|
-
}
|
|
2599
|
-
}));
|
|
2600
|
-
}
|
|
2601
|
-
}), isQuestionsLoading && !isQuestionsPending && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2602
|
-
className: "neeto-ui-bg-white absolute inset-0 flex items-center justify-center",
|
|
2603
|
-
children: /*#__PURE__*/jsxRuntime.jsx(PageLoader, {})
|
|
2604
|
-
})]
|
|
2454
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Form, {
|
|
2455
|
+
addQuestionHelpProps: addQuestionHelpProps,
|
|
2456
|
+
additionalActionOptions: additionalActionOptions,
|
|
2457
|
+
advancedFeatures: advancedFeatures,
|
|
2458
|
+
availableLanguages: availableLanguages,
|
|
2459
|
+
disabledAddButtonTooltipProps: disabledAddButtonTooltipProps,
|
|
2460
|
+
formDescription: formDescription,
|
|
2461
|
+
formTitle: formTitle,
|
|
2462
|
+
getActiveKindDetails: getActiveKindDetails,
|
|
2463
|
+
helpDocUrls: helpDocUrls,
|
|
2464
|
+
hostSpecificData: hostSpecificData,
|
|
2465
|
+
isDisabledFieldLabel: isDisabledFieldLabel,
|
|
2466
|
+
isFormEnabled: isFormEnabled,
|
|
2467
|
+
isKindAlreadyActive: isKindAlreadyActive,
|
|
2468
|
+
isRequiredField: isRequiredField,
|
|
2469
|
+
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds,
|
|
2470
|
+
kindUniqueOn: kindUniqueOn,
|
|
2471
|
+
onLanguageChange: onLanguageChange,
|
|
2472
|
+
onMutateSuccess: onMutateSuccess,
|
|
2473
|
+
onValueChange: onValueChange,
|
|
2474
|
+
questionsFromCache: questionsFromCache,
|
|
2475
|
+
savedTitle: savedTitle,
|
|
2476
|
+
selectedLanguage: selectedLanguage,
|
|
2477
|
+
usesCustomSubmissionComponent: usesCustomSubmissionComponent,
|
|
2478
|
+
formId: id,
|
|
2479
|
+
isDeletable: isQuestionDeletable,
|
|
2480
|
+
questionKinds: isUsingDefaultQuestionKinds ? defaultQuestionKinds : questionKinds
|
|
2481
|
+
})
|
|
2605
2482
|
});
|
|
2606
2483
|
};
|
|
2607
2484
|
|