@bigbinary/neeto-form-frontend 4.1.9 → 4.2.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 +5 -1
- package/dist/BuildForm.js +103 -60
- package/dist/BuildForm.js.map +1 -1
- package/dist/ExternalForm.js +5 -4
- package/dist/ExternalForm.js.map +1 -1
- package/dist/Submission.js +2 -2
- package/dist/Submission.js.map +1 -1
- package/dist/UrlBuilder.js +3 -2
- package/dist/UrlBuilder.js.map +1 -1
- package/dist/{buildForm-BwhLCvEE.js → buildForm-CooylMLL.js} +3 -2
- package/dist/buildForm-CooylMLL.js.map +1 -0
- package/dist/{buildForm-CsVQHcC7.js → buildForm-DcE5kFvR.js} +3 -2
- package/dist/buildForm-DcE5kFvR.js.map +1 -0
- package/dist/cjs/BuildForm.js +103 -60
- package/dist/cjs/BuildForm.js.map +1 -1
- package/dist/cjs/ExternalForm.js +5 -4
- package/dist/cjs/ExternalForm.js.map +1 -1
- package/dist/cjs/Submission.js +2 -2
- package/dist/cjs/Submission.js.map +1 -1
- package/dist/cjs/UrlBuilder.js +3 -2
- package/dist/cjs/UrlBuilder.js.map +1 -1
- package/dist/cjs/hooks.js +1 -1
- package/dist/cjs/index.js +5 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/{constants-DXeRH2r2.js → constants-BjWWA3Oq.js} +11 -2
- package/dist/constants-BjWWA3Oq.js.map +1 -0
- package/dist/{constants-D0zli_cv.js → constants-QPLZ_r-D.js} +10 -3
- package/dist/constants-QPLZ_r-D.js.map +1 -0
- package/dist/hooks.js +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/main.css +1 -1
- package/dist/main.css.map +1 -1
- package/dist/{utils-C-ermU02.js → utils-BwFLBXs2.js} +114 -39
- package/dist/utils-BwFLBXs2.js.map +1 -0
- package/dist/{utils-CdeIdZRi.js → utils-GRfGBny0.js} +114 -39
- package/dist/utils-GRfGBny0.js.map +1 -0
- package/package.json +17 -17
- package/dist/buildForm-BwhLCvEE.js.map +0 -1
- package/dist/buildForm-CsVQHcC7.js.map +0 -1
- package/dist/constants-D0zli_cv.js.map +0 -1
- package/dist/constants-DXeRH2r2.js.map +0 -1
- package/dist/utils-C-ermU02.js.map +0 -1
- package/dist/utils-CdeIdZRi.js.map +0 -1
|
@@ -140,7 +140,11 @@
|
|
|
140
140
|
"hideQuestionHelpDescription": "When enabled, this question will not be visible in the created form. It can be used to track \"reference ids\" and UTM parameters.",
|
|
141
141
|
"responseVisibleOnlyToHostHelpDescription": "When enabled, the response to this question will only be visible to the host",
|
|
142
142
|
"readOnlyHelpDescription": "When enabled, the client will only be able to see the answer of this question, but will not be able to change the answer of this question. Since you are marking this question as \"read-only\" you should pre-fill the question with an answer.",
|
|
143
|
-
"verifyHuman": "Verify that you are a human"
|
|
143
|
+
"verifyHuman": "Verify that you are a human",
|
|
144
|
+
"pictureChoiceSettings": "Picture choice settings",
|
|
145
|
+
"addPicturesToOptions": "Add pictures to options",
|
|
146
|
+
"fitImages": "Fit images",
|
|
147
|
+
"imageHeight": "Image height"
|
|
144
148
|
}
|
|
145
149
|
}
|
|
146
150
|
},
|
package/dist/BuildForm.js
CHANGED
|
@@ -4,13 +4,13 @@ import { isPresent, truncate, findBy, isNotPresent, slugify, existsBy, hyphenate
|
|
|
4
4
|
import Spinner from '@bigbinary/neetoui/Spinner';
|
|
5
5
|
import { equals, path, curry, assoc, prop, dissoc, when, includes, isEmpty, reject, keys, pick, omit, evolve, map, mergeLeft, isNil, pipe, filter, isNotNil, uniq, join, pluck, test, paths, difference, split, last, either, T, F } from 'ramda';
|
|
6
6
|
import { k as useDeleteQuestion, Q as QUESTION_TYPES, a as useForm, l as useCreateQuestion, m as useUpdateQuestion, C as CAPTCHA_TYPES, n as useReorderQuestions, i as QUERY_KEYS } from './constants-51SEJjzI.js';
|
|
7
|
-
import { f as buildDisplayLabel, h as INDEPENDENT_LABELS_MAP, i as QUESTION_ACTIONS, j as isElementOverflowing,
|
|
7
|
+
import { f as buildDisplayLabel, h as INDEPENDENT_LABELS_MAP, i as QUESTION_ACTIONS, j as isElementOverflowing, k as Drag, l as SELECTABLE_KINDS, m as isAutoGeneratedQuestion, n as isRichTextQuestion, N as NON_BASIC_LATIN_CHARACTERS_REGEX, o as RESERVED_FIELD_CODES, d as LABEL_FIELDS, p as isDefaultLanguage, q as buildAddQuestionButtonProps, v as validateEditorContent, F as FIELD_CODES_REJECT_CHARS_REGEX, r as isImmutableField, Q as QUESTIONS_WITHOUT_FIELD_CODE, s as NON_HIDEABLE_FIELDS, t as NON_READ_ONLY_FIELDS, u as RICH_TEXT_QUESTIONS, w as FILE_TYPES_MAP, x as FILE_GROUPS, D as DEFAULT_CHOICE_QUESTION_ATTRIBUTES, M as MINIMUM_OPTIONS, y as IMAGE_HEIGHT_SLIDER_DEFAULTS, z as RATING_OPTIONS, A as STAR_RATING_MIN_VALUE_OPTIONS, B as STAR_RATING_MAX_VALUE_OPTIONS, G as STAR_RATING_ICONS_MAP, H as buildDisabledAddButtonHelpPopoverProps, J as buildReorderPayload, K as isMandatoryField, O as QUESTION_KINDS, a as QUESTION_KIND, T as getActiveQuestionKindDetails, U as DEFAULT_AVAILABLE_LANGUAGES, V as DEFAULT_ADVANCED_FEATURES, W as QUESTIONS_INITIAL_VALUE } from './constants-QPLZ_r-D.js';
|
|
8
8
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
9
9
|
import { useState, useRef, useEffect, createElement } from 'react';
|
|
10
10
|
import { Droppable, Draggable, DragDropContext } from '@hello-pangea/dnd';
|
|
11
11
|
import { withT, isMetaKeyPressed, useStateWithDependency, useFuncDebounce, useOnClickOutside } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
12
12
|
import { showThumbsUpToastr, withEventTargetValue, hyphenize } from '@bigbinary/neeto-commons-frontend/utils';
|
|
13
|
-
import { a as useBuildFormStore } from './buildForm-
|
|
13
|
+
import { a as useBuildFormStore } from './buildForm-DcE5kFvR.js';
|
|
14
14
|
import { shallow } from 'zustand/shallow';
|
|
15
15
|
import Alert from '@bigbinary/neetoui/Alert';
|
|
16
16
|
import { useTranslation, Trans } from 'react-i18next';
|
|
@@ -53,6 +53,7 @@ import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
|
53
53
|
import Checkbox$1 from '@bigbinary/neetoui/formik/Checkbox';
|
|
54
54
|
import Checkbox from '@bigbinary/neetoui/Checkbox';
|
|
55
55
|
import OptionFields from '@bigbinary/neeto-molecules/OptionFields';
|
|
56
|
+
import Slider from '@bigbinary/neetoui/Slider';
|
|
56
57
|
import '@bigbinary/neeto-commons-frontend/constants';
|
|
57
58
|
import 'axios';
|
|
58
59
|
import 'dompurify';
|
|
@@ -140,14 +141,14 @@ var DeleteSmsReminderModal = function DeleteSmsReminderModal(_ref) {
|
|
|
140
141
|
onClose: onClose,
|
|
141
142
|
children: [/*#__PURE__*/jsx(Modal.Header, {
|
|
142
143
|
children: /*#__PURE__*/jsx(Typography, {
|
|
143
|
-
"data-
|
|
144
|
+
"data-testid": "delete-sms-reminder-modal-header",
|
|
144
145
|
style: "h2",
|
|
145
146
|
weight: "medium",
|
|
146
147
|
children: path(["smsReminder", "deleteModal", "title"], hostSpecificData)
|
|
147
148
|
})
|
|
148
149
|
}), /*#__PURE__*/jsx(Modal.Body, {
|
|
149
150
|
children: /*#__PURE__*/jsx(Typography, {
|
|
150
|
-
"data-
|
|
151
|
+
"data-testid": "delete-sms-reminder-modal-description",
|
|
151
152
|
style: "body2",
|
|
152
153
|
children: path(["smsReminder", "deleteModal", "description"], hostSpecificData)
|
|
153
154
|
})
|
|
@@ -209,7 +210,7 @@ var Overview = function Overview(_ref) {
|
|
|
209
210
|
children: [/*#__PURE__*/jsxs("div", {
|
|
210
211
|
className: "flex items-center justify-between",
|
|
211
212
|
children: [/*#__PURE__*/jsx(Typography, {
|
|
212
|
-
"data-
|
|
213
|
+
"data-testid": "neeto-form-engine-overview-title",
|
|
213
214
|
lineHeight: "neeto-ui-leading-normal",
|
|
214
215
|
style: "h2",
|
|
215
216
|
weight: "neeto-ui-font-semibold",
|
|
@@ -231,7 +232,7 @@ var Overview = function Overview(_ref) {
|
|
|
231
232
|
})]
|
|
232
233
|
})]
|
|
233
234
|
}), /*#__PURE__*/jsx(Typography, {
|
|
234
|
-
"data-
|
|
235
|
+
"data-testid": "neeto-form-engine-overview-description",
|
|
235
236
|
style: "body2",
|
|
236
237
|
children: description
|
|
237
238
|
})]
|
|
@@ -268,7 +269,7 @@ var Card = function Card(_ref) {
|
|
|
268
269
|
setIsTooltipEnabled(isElementOverflowing(element));
|
|
269
270
|
}, [questionLabel]);
|
|
270
271
|
return /*#__PURE__*/jsxs("div", {
|
|
271
|
-
"data-
|
|
272
|
+
"data-testid": "neeto-form-engine-".concat(slugify(questionLabel)),
|
|
272
273
|
className: classnames("neeto-ui-rounded neeto-ui-border-gray-300 neeto-ui-bg-white neeto-form-nano-form__card flex h-10 w-full items-center justify-between gap-1 border p-2", {
|
|
273
274
|
"neeto-ui-border-primary-500 neeto-form-nano-form__card--active": isActive
|
|
274
275
|
}),
|
|
@@ -285,7 +286,7 @@ var Card = function Card(_ref) {
|
|
|
285
286
|
position: "top",
|
|
286
287
|
children: /*#__PURE__*/jsx(Typography, {
|
|
287
288
|
className: "line-clamp-2 min-w-0 grow truncate break-words",
|
|
288
|
-
"data-
|
|
289
|
+
"data-testid": "".concat(slugify(questionLabel), "-question-card-label"),
|
|
289
290
|
lineHeight: "snug",
|
|
290
291
|
ref: questionLabelRef,
|
|
291
292
|
style: "body2",
|
|
@@ -301,18 +302,18 @@ var Card = function Card(_ref) {
|
|
|
301
302
|
strategy: "fixed"
|
|
302
303
|
},
|
|
303
304
|
menuItems: [{
|
|
304
|
-
"data-
|
|
305
|
+
"data-testid": "edit-question",
|
|
305
306
|
key: "edit",
|
|
306
307
|
label: t("neetoForm.common.edit"),
|
|
307
308
|
onClick: onEdit
|
|
308
309
|
}, {
|
|
309
|
-
"data-
|
|
310
|
+
"data-testid": "clone-question",
|
|
310
311
|
key: "clone",
|
|
311
312
|
label: t("neetoForm.common.clone"),
|
|
312
313
|
isVisible: !isSingular && isFunction(onClone),
|
|
313
314
|
onClick: onClone
|
|
314
315
|
}, {
|
|
315
|
-
"data-
|
|
316
|
+
"data-testid": "delete-question",
|
|
316
317
|
key: "delete",
|
|
317
318
|
label: t("neetoForm.common.delete"),
|
|
318
319
|
isVisible: isFunction(onDelete),
|
|
@@ -790,13 +791,13 @@ var Properties = function Properties(_ref) {
|
|
|
790
791
|
var Block = function Block(_ref) {
|
|
791
792
|
var title = _ref.title,
|
|
792
793
|
children = _ref.children,
|
|
793
|
-
|
|
794
|
+
dataTestid = _ref.dataTestid;
|
|
794
795
|
return /*#__PURE__*/jsxs("div", {
|
|
795
796
|
className: "mt-4 space-y-4",
|
|
796
|
-
"data-
|
|
797
|
+
"data-testid": dataTestid,
|
|
797
798
|
children: [/*#__PURE__*/jsx("div", {
|
|
798
799
|
className: "flex items-center justify-between",
|
|
799
|
-
"data-
|
|
800
|
+
"data-testid": "properties-header",
|
|
800
801
|
children: /*#__PURE__*/jsx(Typography, {
|
|
801
802
|
lineHeight: "normal",
|
|
802
803
|
style: "body1",
|
|
@@ -1084,7 +1085,7 @@ var Form$1 = function Form(_ref) {
|
|
|
1084
1085
|
kind: kind,
|
|
1085
1086
|
questionProps: questionProps
|
|
1086
1087
|
}), isSettingsBlockVisible && /*#__PURE__*/jsxs(Block, {
|
|
1087
|
-
|
|
1088
|
+
dataTestid: "settings-card",
|
|
1088
1089
|
title: t("neetoForm.common.settings"),
|
|
1089
1090
|
children: [!isImmutable && /*#__PURE__*/jsx(RequiredSwitch, {}), shouldShowHideSwitch && /*#__PURE__*/jsx(Switch, {
|
|
1090
1091
|
label: t("neetoForm.common.hideQuestion"),
|
|
@@ -1097,7 +1098,7 @@ var Form$1 = function Form(_ref) {
|
|
|
1097
1098
|
})]
|
|
1098
1099
|
}), (shouldShowFieldCode || canMarkResponsesAsReadOnly) && /*#__PURE__*/jsx(Accordion, {
|
|
1099
1100
|
className: "neeto-form-nano-advanced-properties-accordion",
|
|
1100
|
-
"data-
|
|
1101
|
+
"data-testid": "advanced-properties-card",
|
|
1101
1102
|
defaultActiveKey: isFieldCodeInvalid ? 0 : null // This is to open the accordion when field code is invalid
|
|
1102
1103
|
,
|
|
1103
1104
|
children: /*#__PURE__*/jsx(Accordion.Item, {
|
|
@@ -1234,7 +1235,7 @@ var Add = function Add(_ref) {
|
|
|
1234
1235
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
1235
1236
|
children: [/*#__PURE__*/jsx(Pane.Header, {
|
|
1236
1237
|
children: /*#__PURE__*/jsx(Typography, {
|
|
1237
|
-
"data-
|
|
1238
|
+
"data-testid": "add-question-pane-header",
|
|
1238
1239
|
style: "h2",
|
|
1239
1240
|
children: t("neetoForm.questions.common.primaryPanel.addQuestion")
|
|
1240
1241
|
})
|
|
@@ -1311,7 +1312,7 @@ var Edit = function Edit(_ref) {
|
|
|
1311
1312
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
1312
1313
|
children: [/*#__PURE__*/jsx(Pane.Header, {
|
|
1313
1314
|
children: /*#__PURE__*/jsx(Typography, {
|
|
1314
|
-
"data-
|
|
1315
|
+
"data-testid": "edit-question-pane-header",
|
|
1315
1316
|
style: "h2",
|
|
1316
1317
|
children: t("neetoForm.questions.common.editQuestion")
|
|
1317
1318
|
})
|
|
@@ -1368,11 +1369,11 @@ var SwitchBlock = function SwitchBlock(_ref) {
|
|
|
1368
1369
|
otherProps = _objectWithoutProperties(_ref, _excluded$3);
|
|
1369
1370
|
return /*#__PURE__*/jsxs(Label, {
|
|
1370
1371
|
className: classnames("flex items-center justify-start gap-2 ", className),
|
|
1371
|
-
"data-
|
|
1372
|
+
"data-testid": "neeto-form-engine-".concat(hyphenate(title && name), "-toggle-label"),
|
|
1372
1373
|
children: [/*#__PURE__*/jsx(Switch, _objectSpread$6(_objectSpread$6({}, _objectSpread$6(_objectSpread$6({}, otherProps), {}, {
|
|
1373
1374
|
name: name
|
|
1374
1375
|
})), {}, {
|
|
1375
|
-
"data-
|
|
1376
|
+
"data-testid": "neeto-form-engine-".concat(hyphenate(title && name), "-switch")
|
|
1376
1377
|
})), /*#__PURE__*/jsx(Typography, {
|
|
1377
1378
|
component: "span",
|
|
1378
1379
|
style: "body1",
|
|
@@ -1434,7 +1435,7 @@ var STYLES = {
|
|
|
1434
1435
|
};
|
|
1435
1436
|
var MultiValueRemove = function MultiValueRemove(props) {
|
|
1436
1437
|
return /*#__PURE__*/jsx(components.MultiValueRemove, _objectSpread$4(_objectSpread$4({}, props), {}, {
|
|
1437
|
-
innerProps: _objectSpread$4(_objectSpread$4({}, props.innerProps), {}, _defineProperty({}, "data-
|
|
1438
|
+
innerProps: _objectSpread$4(_objectSpread$4({}, props.innerProps), {}, _defineProperty({}, "data-testid", "".concat(hyphenize(props.data.label), "-remove-icon"))),
|
|
1438
1439
|
children: /*#__PURE__*/jsx(Close, {
|
|
1439
1440
|
size: 16
|
|
1440
1441
|
})
|
|
@@ -1455,7 +1456,7 @@ var ValueContainer = function ValueContainer(_ref) {
|
|
|
1455
1456
|
rest = _children.slice(1);
|
|
1456
1457
|
var shouldCollapse = !isFocused && value.length > visibleDomainsCount;
|
|
1457
1458
|
return /*#__PURE__*/jsxs(components.ValueContainer, _objectSpread$4(_objectSpread$4({}, props), {}, {
|
|
1458
|
-
innerProps: _objectSpread$4(_objectSpread$4({}, props.innerProps), {}, _defineProperty({}, "data-
|
|
1459
|
+
innerProps: _objectSpread$4(_objectSpread$4({}, props.innerProps), {}, _defineProperty({}, "data-testid", "multi-domain-input-container")),
|
|
1459
1460
|
children: [shouldCollapse ? firstChild.slice(0, visibleDomainsCount) : firstChild, shouldCollapse && /*#__PURE__*/jsx(Tag, {
|
|
1460
1461
|
style: "secondary",
|
|
1461
1462
|
label: t("neetoForm.common.remainingItemsCount", {
|
|
@@ -1466,7 +1467,7 @@ var ValueContainer = function ValueContainer(_ref) {
|
|
|
1466
1467
|
};
|
|
1467
1468
|
var ClearIndicator = function ClearIndicator(props) {
|
|
1468
1469
|
return /*#__PURE__*/jsx(components.ClearIndicator, _objectSpread$4(_objectSpread$4({}, props), {}, {
|
|
1469
|
-
innerProps: _objectSpread$4(_objectSpread$4({}, props.innerProps), {}, _defineProperty({}, "data-
|
|
1470
|
+
innerProps: _objectSpread$4(_objectSpread$4({}, props.innerProps), {}, _defineProperty({}, "data-testid", "clear-all-button")),
|
|
1470
1471
|
children: /*#__PURE__*/jsx(Close, {
|
|
1471
1472
|
className: "cursor-pointer",
|
|
1472
1473
|
size: 16
|
|
@@ -1587,7 +1588,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1587
1588
|
className: "neeto-ui-email-input__label-wrapper",
|
|
1588
1589
|
children: /*#__PURE__*/jsx(Label, {
|
|
1589
1590
|
className: "neeto-ui-email-input__label",
|
|
1590
|
-
"data-
|
|
1591
|
+
"data-testid": "".concat(hyphenize(label), "-input-label"),
|
|
1591
1592
|
children: label
|
|
1592
1593
|
})
|
|
1593
1594
|
}), /*#__PURE__*/jsx(CreatableSelect, _objectSpread$3({
|
|
@@ -1620,7 +1621,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1620
1621
|
value: value
|
|
1621
1622
|
}, otherProps))), !!error && /*#__PURE__*/jsxs("p", {
|
|
1622
1623
|
className: "neeto-ui-input__error",
|
|
1623
|
-
"data-
|
|
1624
|
+
"data-testid": "".concat(hyphenize(label), "-input-error"),
|
|
1624
1625
|
children: [formatErrorMessage(error), isFilterDomainsLinkVisible && /*#__PURE__*/jsxs("span", {
|
|
1625
1626
|
className: "neeto-ui-font-semibold cursor-pointer",
|
|
1626
1627
|
onClick: handleFilterDomains,
|
|
@@ -1628,7 +1629,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1628
1629
|
})]
|
|
1629
1630
|
}), /*#__PURE__*/jsx("p", {
|
|
1630
1631
|
className: "neeto-ui-input__help-text",
|
|
1631
|
-
"data-
|
|
1632
|
+
"data-testid": "".concat(hyphenize(label), "-input-help"),
|
|
1632
1633
|
children: t("neetoForm.domainRestriction.helpText")
|
|
1633
1634
|
})]
|
|
1634
1635
|
});
|
|
@@ -1719,7 +1720,7 @@ var RestrictDomainsBlock = function RestrictDomainsBlock(_ref) {
|
|
|
1719
1720
|
popoverDescription = _mergeLeft.popoverDescription;
|
|
1720
1721
|
return /*#__PURE__*/jsxs("div", {
|
|
1721
1722
|
className: "flex flex-col space-y-4",
|
|
1722
|
-
"data-
|
|
1723
|
+
"data-testid": "".concat(hyphenate(switchName), "-container"),
|
|
1723
1724
|
children: [/*#__PURE__*/jsx(SwitchBlock, {
|
|
1724
1725
|
name: switchName,
|
|
1725
1726
|
title: /*#__PURE__*/jsx(TitleWithHelpPopover, {
|
|
@@ -1743,7 +1744,7 @@ var VerifyEmails = function VerifyEmails() {
|
|
|
1743
1744
|
title = _mergeLeft.title,
|
|
1744
1745
|
popoverDescription = _mergeLeft.popoverDescription;
|
|
1745
1746
|
return /*#__PURE__*/jsx("div", {
|
|
1746
|
-
"data-
|
|
1747
|
+
"data-testid": "email-verification-switch-container",
|
|
1747
1748
|
children: /*#__PURE__*/jsx(Switch, {
|
|
1748
1749
|
name: "isVerificationEnabled",
|
|
1749
1750
|
label: /*#__PURE__*/jsx(Typography, {
|
|
@@ -1792,7 +1793,7 @@ var FileGroup = function FileGroup(_ref) {
|
|
|
1792
1793
|
checked: checked,
|
|
1793
1794
|
label: label,
|
|
1794
1795
|
name: name,
|
|
1795
|
-
"data-
|
|
1796
|
+
"data-testid": "neeto-form-engine-file-type-".concat(name),
|
|
1796
1797
|
id: name,
|
|
1797
1798
|
onChange: handleAllowedFileTypesChange
|
|
1798
1799
|
});
|
|
@@ -1874,12 +1875,17 @@ var Options = function Options(_ref) {
|
|
|
1874
1875
|
var _useTranslation = useTranslation(),
|
|
1875
1876
|
t = _useTranslation.t;
|
|
1876
1877
|
var _useBuildFormStore = useBuildFormStore(function (store) {
|
|
1877
|
-
var _store$formState;
|
|
1878
|
+
var _store$formState, _store$formState2;
|
|
1878
1879
|
return {
|
|
1879
|
-
selectedLanguage: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["selectedLanguage"]
|
|
1880
|
+
selectedLanguage: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["selectedLanguage"],
|
|
1881
|
+
isPictureChoiceEnabled: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["isPictureChoiceEnabled"]
|
|
1880
1882
|
};
|
|
1881
1883
|
}, shallow),
|
|
1882
|
-
selectedLanguage = _useBuildFormStore.selectedLanguage
|
|
1884
|
+
selectedLanguage = _useBuildFormStore.selectedLanguage,
|
|
1885
|
+
isPictureChoiceEnabled = _useBuildFormStore.isPictureChoiceEnabled;
|
|
1886
|
+
var _useFormikContext = useFormikContext(),
|
|
1887
|
+
values = _useFormikContext.values,
|
|
1888
|
+
setFieldValue = _useFormikContext.setFieldValue;
|
|
1883
1889
|
var name = "optionsAttributes";
|
|
1884
1890
|
var _useField = useField(name),
|
|
1885
1891
|
_useField2 = _slicedToArray(_useField, 3);
|
|
@@ -1898,24 +1904,56 @@ var Options = function Options(_ref) {
|
|
|
1898
1904
|
var isManageOptionDisabled = isFunction(freezeOptions) ? freezeOptions(selectedLanguage) : freezeOptions;
|
|
1899
1905
|
var isAddOptionDisabled = disableAddOption || isManageOptionDisabled;
|
|
1900
1906
|
var isRemoveOptionDisabled = disableRemoveOption || isManageOptionDisabled;
|
|
1907
|
+
var isDropdown = values.kind === QUESTION_TYPES.DROPDOWN;
|
|
1908
|
+
var isPictureChoice = isPictureChoiceEnabled && !isDropdown && (values.isPictureChoice || DEFAULT_CHOICE_QUESTION_ATTRIBUTES.isPictureChoice);
|
|
1909
|
+
var imageHeight = values.imageHeight || DEFAULT_CHOICE_QUESTION_ATTRIBUTES.imageHeight;
|
|
1910
|
+
var handleImageHeightChange = function handleImageHeightChange(value) {
|
|
1911
|
+
setFieldValue("imageHeight", value);
|
|
1912
|
+
};
|
|
1901
1913
|
return /*#__PURE__*/jsxs("div", {
|
|
1902
|
-
className: "w-full",
|
|
1903
|
-
children: [/*#__PURE__*/
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1914
|
+
className: "w-full space-y-4",
|
|
1915
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
1916
|
+
children: [/*#__PURE__*/jsx(Label, _objectSpread$2(_objectSpread$2({
|
|
1917
|
+
className: "mb-2 block"
|
|
1918
|
+
}, optionLabelProps), {}, {
|
|
1919
|
+
children: t("neetoForm.questions.common.questionFields.field.options")
|
|
1920
|
+
})), /*#__PURE__*/jsx(OptionFields, {
|
|
1921
|
+
isPictureChoice: isPictureChoice,
|
|
1922
|
+
name: name,
|
|
1923
|
+
shouldDestroy: true,
|
|
1924
|
+
destroyFlagName: "_destroy",
|
|
1925
|
+
disabled: isManageOptionDisabled,
|
|
1926
|
+
draggable: !isManageOptionDisabled,
|
|
1927
|
+
isAddOptionEnabled: !isAddOptionDisabled,
|
|
1928
|
+
isDeleteOptionEnabled: !isRemoveOptionDisabled,
|
|
1929
|
+
isNewItemsPrefilled: isDefaultLanguage(selectedLanguage),
|
|
1930
|
+
minOptions: MINIMUM_OPTIONS,
|
|
1931
|
+
shouldResetEmptyOptionOnBlur: false,
|
|
1932
|
+
onChange: setOptionsAttributes
|
|
1933
|
+
})]
|
|
1934
|
+
}), !isDropdown && isPictureChoiceEnabled && /*#__PURE__*/jsxs(Block, {
|
|
1935
|
+
title: t("neetoForm.questions.common.questionFields.field.pictureChoiceSettings"),
|
|
1936
|
+
children: [/*#__PURE__*/jsx(Switch, {
|
|
1937
|
+
name: "isPictureChoice",
|
|
1938
|
+
label: t("neetoForm.questions.common.questionFields.field.addPicturesToOptions")
|
|
1939
|
+
}), isPictureChoice && /*#__PURE__*/jsxs(Fragment, {
|
|
1940
|
+
children: [/*#__PURE__*/jsx(Switch, {
|
|
1941
|
+
name: "shouldFitImages",
|
|
1942
|
+
label: t("neetoForm.questions.common.questionFields.field.fitImages")
|
|
1943
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
1944
|
+
className: "mt-4",
|
|
1945
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
1946
|
+
style: "body2",
|
|
1947
|
+
weight: "medium",
|
|
1948
|
+
children: t("neetoForm.questions.common.questionFields.field.imageHeight")
|
|
1949
|
+
}), /*#__PURE__*/jsx(Slider, {
|
|
1950
|
+
max: IMAGE_HEIGHT_SLIDER_DEFAULTS.max,
|
|
1951
|
+
min: IMAGE_HEIGHT_SLIDER_DEFAULTS.min,
|
|
1952
|
+
value: imageHeight,
|
|
1953
|
+
onChange: handleImageHeightChange
|
|
1954
|
+
})]
|
|
1955
|
+
})]
|
|
1956
|
+
})]
|
|
1919
1957
|
})]
|
|
1920
1958
|
});
|
|
1921
1959
|
};
|
|
@@ -1944,7 +1982,7 @@ var Rating = function Rating() {
|
|
|
1944
1982
|
size: 48
|
|
1945
1983
|
}), /*#__PURE__*/jsx(InputWithMaxLength, {
|
|
1946
1984
|
name: name,
|
|
1947
|
-
"data-
|
|
1985
|
+
"data-testid": "neeto-form-engine-".concat(hyphenate(name))
|
|
1948
1986
|
})]
|
|
1949
1987
|
}, name);
|
|
1950
1988
|
})
|
|
@@ -1968,7 +2006,7 @@ var StarRating = function StarRating() {
|
|
|
1968
2006
|
className: "flex space-x-4",
|
|
1969
2007
|
children: [/*#__PURE__*/jsx(Select, {
|
|
1970
2008
|
className: "w-1/2",
|
|
1971
|
-
"data-
|
|
2009
|
+
"data-testid": "neeto-form-engine-star-rating-min-value",
|
|
1972
2010
|
label: t("neetoForm.common.start"),
|
|
1973
2011
|
name: "minValue",
|
|
1974
2012
|
options: STAR_RATING_MIN_VALUE_OPTIONS,
|
|
@@ -1977,7 +2015,7 @@ var StarRating = function StarRating() {
|
|
|
1977
2015
|
}
|
|
1978
2016
|
}), /*#__PURE__*/jsx(Select, {
|
|
1979
2017
|
className: "w-1/2",
|
|
1980
|
-
"data-
|
|
2018
|
+
"data-testid": "neeto-form-engine-star-rating-max-value",
|
|
1981
2019
|
label: t("neetoForm.common.end"),
|
|
1982
2020
|
name: "maxValue",
|
|
1983
2021
|
options: STAR_RATING_MAX_VALUE_OPTIONS,
|
|
@@ -1995,7 +2033,7 @@ var StarRating = function StarRating() {
|
|
|
1995
2033
|
IconType = _ref2[1];
|
|
1996
2034
|
var isActive = name === iconType;
|
|
1997
2035
|
return /*#__PURE__*/jsx("div", {
|
|
1998
|
-
"data-
|
|
2036
|
+
"data-testid": "neeto-form-engine-rating-icon-".concat(name),
|
|
1999
2037
|
className: classnames("flex h-10 w-10 items-center justify-center gap-2", "neeto-ui-border-gray-800 neeto-ui-rounded-full cursor-pointer border", "transition-all duration-300 ease-in-out", {
|
|
2000
2038
|
"neeto-ui-text-gray-800 neeto-ui-bg-gray-200": !isActive,
|
|
2001
2039
|
"neeto-ui-text-white neeto-ui-bg-gray-800": isActive
|
|
@@ -2079,7 +2117,7 @@ var buildDefaultValueForKind = function buildDefaultValueForKind(questionKind) {
|
|
|
2079
2117
|
var hideSwitchLabelProps = function hideSwitchLabelProps(helpUrl) {
|
|
2080
2118
|
return helpUrl ? {
|
|
2081
2119
|
helpIconProps: {
|
|
2082
|
-
"data-
|
|
2120
|
+
"data-testid": "help-popover-button",
|
|
2083
2121
|
popoverProps: {
|
|
2084
2122
|
description: t("neetoForm.questions.common.questionFields.field.hideQuestionHelpDescription"),
|
|
2085
2123
|
helpLinkProps: {
|
|
@@ -2093,7 +2131,7 @@ var hideSwitchLabelProps = function hideSwitchLabelProps(helpUrl) {
|
|
|
2093
2131
|
var responseVisibleOnlyToHostSwitchLabelProps = function responseVisibleOnlyToHostSwitchLabelProps(helpUrl) {
|
|
2094
2132
|
return {
|
|
2095
2133
|
helpIconProps: {
|
|
2096
|
-
"data-
|
|
2134
|
+
"data-testid": "help-popover-button",
|
|
2097
2135
|
popoverProps: {
|
|
2098
2136
|
description: t("neetoForm.questions.common.questionFields.field.responseVisibleOnlyToHostHelpDescription"),
|
|
2099
2137
|
helpLinkProps: {
|
|
@@ -2107,7 +2145,7 @@ var responseVisibleOnlyToHostSwitchLabelProps = function responseVisibleOnlyToHo
|
|
|
2107
2145
|
var readOnlySwitchLabelProps = function readOnlySwitchLabelProps(helpUrl) {
|
|
2108
2146
|
return {
|
|
2109
2147
|
helpIconProps: {
|
|
2110
|
-
"data-
|
|
2148
|
+
"data-testid": "help-popover-button",
|
|
2111
2149
|
popoverProps: {
|
|
2112
2150
|
description: t("neetoForm.questions.common.questionFields.field.readOnlyHelpDescription"),
|
|
2113
2151
|
helpLinkProps: helpUrl ? {
|
|
@@ -2188,7 +2226,8 @@ var Form = function Form(_ref) {
|
|
|
2188
2226
|
usesCustomSubmissionComponent = _ref.usesCustomSubmissionComponent,
|
|
2189
2227
|
questionsFromCache = _ref.questionsFromCache,
|
|
2190
2228
|
onMutateSuccess = _ref.onMutateSuccess,
|
|
2191
|
-
advancedFeatures = _ref.advancedFeatures
|
|
2229
|
+
advancedFeatures = _ref.advancedFeatures,
|
|
2230
|
+
isPictureChoiceEnabled = _ref.isPictureChoiceEnabled;
|
|
2192
2231
|
var containerRef = useRef();
|
|
2193
2232
|
var _useStateWithDependen = useStateWithDependency(questionsFromCache),
|
|
2194
2233
|
_useStateWithDependen2 = _slicedToArray(_useStateWithDependen, 2),
|
|
@@ -2262,9 +2301,10 @@ var Form = function Form(_ref) {
|
|
|
2262
2301
|
hostSpecificData: hostSpecificData,
|
|
2263
2302
|
onMutateSuccess: onMutateSuccess,
|
|
2264
2303
|
advancedFeatures: advancedFeatures,
|
|
2265
|
-
onLanguageChange: onLanguageChange
|
|
2304
|
+
onLanguageChange: onLanguageChange,
|
|
2305
|
+
isPictureChoiceEnabled: isPictureChoiceEnabled
|
|
2266
2306
|
});
|
|
2267
|
-
}, [formId, isFormEnabled, savedTitle, setFormData, selectedLanguage, helpDocUrls, isUsingDefaultQuestionKinds, usesCustomSubmissionComponent, hostSpecificData, onMutateSuccess, advancedFeatures, onLanguageChange]);
|
|
2307
|
+
}, [formId, isFormEnabled, savedTitle, setFormData, selectedLanguage, helpDocUrls, isUsingDefaultQuestionKinds, usesCustomSubmissionComponent, hostSpecificData, onMutateSuccess, advancedFeatures, onLanguageChange, isPictureChoiceEnabled]);
|
|
2268
2308
|
var handleSelect = function handleSelect(question) {
|
|
2269
2309
|
setSelectedQuestion(question);
|
|
2270
2310
|
};
|
|
@@ -2447,7 +2487,9 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2447
2487
|
onMutateSuccess = _ref$onMutateSuccess === void 0 ? noop : _ref$onMutateSuccess,
|
|
2448
2488
|
hostSpecificData = _ref.hostSpecificData,
|
|
2449
2489
|
_ref$canManageQuestio = _ref.canManageQuestions,
|
|
2450
|
-
canManageQuestions = _ref$canManageQuestio === void 0 ? false : _ref$canManageQuestio
|
|
2490
|
+
canManageQuestions = _ref$canManageQuestio === void 0 ? false : _ref$canManageQuestio,
|
|
2491
|
+
_ref$isPictureChoiceE = _ref.isPictureChoiceEnabled,
|
|
2492
|
+
isPictureChoiceEnabled = _ref$isPictureChoiceE === void 0 ? false : _ref$isPictureChoiceE;
|
|
2451
2493
|
var queryClient = useQueryClient();
|
|
2452
2494
|
var _useForm = useForm({
|
|
2453
2495
|
formId: id,
|
|
@@ -2499,6 +2541,7 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2499
2541
|
isDisabledFieldLabel: isDisabledFieldLabel,
|
|
2500
2542
|
isFormEnabled: isFormEnabled,
|
|
2501
2543
|
isKindAlreadyActive: isKindAlreadyActive,
|
|
2544
|
+
isPictureChoiceEnabled: isPictureChoiceEnabled,
|
|
2502
2545
|
isRequiredField: isRequiredField,
|
|
2503
2546
|
isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds,
|
|
2504
2547
|
kindUniqueOn: kindUniqueOn,
|