@bigbinary/neeto-form-frontend 4.4.6 → 4.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/app/javascript/src/translations/en.json +10 -1
- package/dist/BuildForm.js +51 -9
- package/dist/BuildForm.js.map +1 -1
- package/dist/ExternalForm.js +19 -11
- package/dist/ExternalForm.js.map +1 -1
- package/dist/Submission.js +1 -1
- package/dist/UrlBuilder.js +12 -4
- package/dist/UrlBuilder.js.map +1 -1
- package/dist/{buildForm-D-epUrZG.js → buildForm-CrOWLvLE.js} +2 -2
- package/dist/{buildForm-D-epUrZG.js.map → buildForm-CrOWLvLE.js.map} +1 -1
- package/dist/{buildForm-CgofRtEN.js → buildForm-DfMpfuSp.js} +2 -2
- package/dist/{buildForm-CgofRtEN.js.map → buildForm-DfMpfuSp.js.map} +1 -1
- package/dist/cjs/BuildForm.js +51 -9
- package/dist/cjs/BuildForm.js.map +1 -1
- package/dist/cjs/ExternalForm.js +19 -11
- package/dist/cjs/ExternalForm.js.map +1 -1
- package/dist/cjs/Submission.js +1 -1
- package/dist/cjs/UrlBuilder.js +12 -4
- package/dist/cjs/UrlBuilder.js.map +1 -1
- package/dist/cjs/hooks.js +4 -4
- package/dist/cjs/index.js +8 -7
- package/dist/cjs/index.js.map +1 -1
- package/dist/{constants-BNfHPNOx.js → constants-Cj0XxE8a.js} +2 -1
- package/dist/constants-Cj0XxE8a.js.map +1 -0
- package/dist/{constants-CfUZ9B6N.js → constants-D5JlvWws.js} +2 -1
- package/dist/constants-D5JlvWws.js.map +1 -0
- package/dist/hooks.js +4 -4
- package/dist/{index-0m1EzLFY.js → index-Beo6ztaM.js} +2 -2
- package/dist/{index-0m1EzLFY.js.map → index-Beo6ztaM.js.map} +1 -1
- package/dist/{index-y4GiXx7o.js → index-DhtQJpD_.js} +2 -2
- package/dist/{index-y4GiXx7o.js.map → index-DhtQJpD_.js.map} +1 -1
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/{useFormSubmission-DyS5Dm1q.js → useFormSubmission-D3O7sDHp.js} +2 -2
- package/dist/{useFormSubmission-DyS5Dm1q.js.map → useFormSubmission-D3O7sDHp.js.map} +1 -1
- package/dist/{useFormSubmission-Cx63P761.js → useFormSubmission-PLRMfzJ3.js} +2 -2
- package/dist/{useFormSubmission-Cx63P761.js.map → useFormSubmission-PLRMfzJ3.js.map} +1 -1
- package/dist/{utils-C9nDMm4c.js → utils-CI844li1.js} +112 -46
- package/dist/utils-CI844li1.js.map +1 -0
- package/dist/{utils-DEBFghm4.js → utils-baAzU7l8.js} +112 -46
- package/dist/utils-baAzU7l8.js.map +1 -0
- package/dist/{yup-Dx1WK2_p.js → yup-CSYHMEsr.js} +26 -7
- package/dist/yup-CSYHMEsr.js.map +1 -0
- package/dist/{yup-CMEoabdy.js → yup-DMlViLLB.js} +27 -6
- package/dist/yup-DMlViLLB.js.map +1 -0
- package/package.json +5 -5
- package/types.d.ts +1 -0
- package/dist/constants-BNfHPNOx.js.map +0 -1
- package/dist/constants-CfUZ9B6N.js.map +0 -1
- package/dist/utils-C9nDMm4c.js.map +0 -1
- package/dist/utils-DEBFghm4.js.map +0 -1
- package/dist/yup-CMEoabdy.js.map +0 -1
- package/dist/yup-Dx1WK2_p.js.map +0 -1
package/README.md
CHANGED
|
@@ -35,6 +35,9 @@ model. It also stores submissions.
|
|
|
35
35
|
# ...existing gems
|
|
36
36
|
|
|
37
37
|
gem 'neeto-form-engine'
|
|
38
|
+
|
|
39
|
+
# Use this for development:
|
|
40
|
+
# gem 'neeto-form-engine', path: "../neeto-form-nano"
|
|
38
41
|
end
|
|
39
42
|
```
|
|
40
43
|
|
|
@@ -217,7 +220,7 @@ The frontend package allows us to create forms across neeto products.
|
|
|
217
220
|
### Instructions for development
|
|
218
221
|
|
|
219
222
|
Check the
|
|
220
|
-
[Frontend package development guide](https://
|
|
223
|
+
[Frontend package development guide](https://neetozone.neetokb.com/p/a-d34cb4b0)
|
|
221
224
|
for step-by-step instructions to develop the frontend package.
|
|
222
225
|
|
|
223
226
|
### Usage
|
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
"fileUpload": "File upload",
|
|
87
87
|
"captcha": "Captcha",
|
|
88
88
|
"smsReminder": "SMS reminder",
|
|
89
|
+
"spot": "Number of group booking spots",
|
|
89
90
|
"opinionScale": "Opinion scale",
|
|
90
91
|
"address": "Address"
|
|
91
92
|
},
|
|
@@ -191,7 +192,15 @@
|
|
|
191
192
|
"postalZipCode": "Postal/Zip Code"
|
|
192
193
|
}
|
|
193
194
|
},
|
|
194
|
-
"changeLanguage": "Change language"
|
|
195
|
+
"changeLanguage": "Change language",
|
|
196
|
+
"spot": {
|
|
197
|
+
"defaultLabel": "How many spots would you like to book?",
|
|
198
|
+
"numberOfSpotsRequired": "Number of spots is required",
|
|
199
|
+
"mustBeInteger": "Must be a whole number",
|
|
200
|
+
"exceedsRemainingSpots": "Maximum number of spots remaining is {{count}}",
|
|
201
|
+
"remainingSlotsCount_one": "{{count}} spot remaining",
|
|
202
|
+
"remainingSlotsCount_other": "{{count}} spots remaining"
|
|
203
|
+
}
|
|
195
204
|
},
|
|
196
205
|
"error": {
|
|
197
206
|
"invalidField": "{{label}} is invalid",
|
package/dist/BuildForm.js
CHANGED
|
@@ -3,14 +3,14 @@ import classnames from 'classnames';
|
|
|
3
3
|
import { isPresent, truncate, findBy, isNotPresent, slugify, existsBy, findById, findIndexById, hyphenate, noop, nullSafe, modifyBy, removeBy } from '@bigbinary/neeto-cist';
|
|
4
4
|
import Spinner from '@bigbinary/neetoui/Spinner';
|
|
5
5
|
import { equals, path, when, assoc, includes, isEmpty, reject, keys, pick, omit, evolve, map, mergeLeft, isNil, pipe, filter, isNotNil, values, uniq, join, pathSatisfies, assocPath, dissoc, append, pluck, test, paths, difference, prop, startsWith, split, last, either, F, T } from 'ramda';
|
|
6
|
-
import { k as useDeleteQuestion, Q as QUESTION_TYPES, b as useForm, l as useCreateQuestion, m as useUpdateQuestion, C as CAPTCHA_TYPES, n as useReorderQuestions, i as QUERY_KEYS } from './constants-
|
|
7
|
-
import {
|
|
6
|
+
import { k as useDeleteQuestion, Q as QUESTION_TYPES, b as useForm, l as useCreateQuestion, m as useUpdateQuestion, C as CAPTCHA_TYPES, n as useReorderQuestions, i as QUERY_KEYS } from './constants-Cj0XxE8a.js';
|
|
7
|
+
import { j as QUESTION_ACTIONS, k as INDEPENDENT_LABELS_MAP, l as buildDisplayLabel, m as isElementOverflowing, n as Drag, o as SELECTABLE_KINDS, p as isAutoGeneratedQuestion, q as isRichTextQuestion, r as SPOT_QUESTION_FIELD_CODE, N as NON_BASIC_LATIN_CHARACTERS_REGEX, s as RESERVED_FIELD_CODES, t as renameKey, f as LABEL_FIELDS, u as isDefaultLanguage, v as buildAddQuestionButtonProps, w as validateEditorContent, F as FIELD_CODES_REJECT_CHARS_REGEX, x as isImmutableField, Q as QUESTIONS_WITHOUT_FIELD_CODE, y as NON_HIDEABLE_FIELDS, z as NON_READ_ONLY_FIELDS, O as OPINION_LABEL_MAX_LENGTH, B as RICH_TEXT_QUESTIONS, e as ADDRESS_FIELD_WIDTHS, A as ADDRESS_FIELD_TYPES, G as generateDefaultOptions, M as MINIMUM_ADDRESS_FIELDS, H as getDeletedRecords, J as randomId, K as getActiveRecords, T as FILE_TYPES_MAP, U as FILE_GROUPS, V as OPINION_SCALE_MIN_VALUE_OPTIONS, W as OPINION_SCALE_MAX_VALUE_OPTIONS, D as DEFAULT_CHOICE_QUESTION_ATTRIBUTES, X as MINIMUM_OPTIONS, Y as IMAGE_HEIGHT_SLIDER_DEFAULTS, Z as RATING_OPTIONS, _ as STAR_RATING_MIN_VALUE_OPTIONS, $ as STAR_RATING_MAX_VALUE_OPTIONS, a0 as STAR_RATING_ICONS_MAP, a1 as buildDisabledAddButtonHelpPopoverProps, a2 as buildReorderPayload, a3 as QUESTIONS_INITIAL_VALUE, a4 as isMandatoryField, a5 as QUESTION_KINDS, a as QUESTION_KIND, a6 as getActiveQuestionKindDetails, a7 as DEFAULT_AVAILABLE_LANGUAGES, a8 as DEFAULT_ADVANCED_FEATURES } from './yup-CSYHMEsr.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-CrOWLvLE.js';
|
|
14
14
|
import { shallow } from 'zustand/shallow';
|
|
15
15
|
import Alert from '@bigbinary/neetoui/Alert';
|
|
16
16
|
import { useTranslation, Trans } from 'react-i18next';
|
|
@@ -21,7 +21,7 @@ import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
|
|
|
21
21
|
import Dropdown from '@bigbinary/neetoui/Dropdown';
|
|
22
22
|
import Tooltip from '@bigbinary/neetoui/Tooltip';
|
|
23
23
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
24
|
-
import { i as isFunction, f as fieldWithFallback, c as isNameQuestion } from './index-
|
|
24
|
+
import { i as isFunction, f as fieldWithFallback, c as isNameQuestion } from './index-DhtQJpD_.js';
|
|
25
25
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
26
26
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
27
27
|
import { t } from 'i18next';
|
|
@@ -157,6 +157,33 @@ var DeleteSmsReminderModal = function DeleteSmsReminderModal(_ref) {
|
|
|
157
157
|
});
|
|
158
158
|
};
|
|
159
159
|
|
|
160
|
+
var DeleteSpotModal = function DeleteSpotModal(_ref) {
|
|
161
|
+
var isOpen = _ref.isOpen,
|
|
162
|
+
onClose = _ref.onClose,
|
|
163
|
+
_ref$hostSpecificData = _ref.hostSpecificData,
|
|
164
|
+
hostSpecificData = _ref$hostSpecificData === void 0 ? {} : _ref$hostSpecificData;
|
|
165
|
+
var title = path(["spot", "deleteModal", "title"], hostSpecificData);
|
|
166
|
+
var description = path(["spot", "deleteModal", "description"], hostSpecificData);
|
|
167
|
+
return /*#__PURE__*/jsxs(Modal, {
|
|
168
|
+
isOpen: isOpen,
|
|
169
|
+
onClose: onClose,
|
|
170
|
+
children: [/*#__PURE__*/jsx(Modal.Header, {
|
|
171
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
172
|
+
"data-testid": "delete-spot-modal-header",
|
|
173
|
+
style: "h2",
|
|
174
|
+
weight: "medium",
|
|
175
|
+
children: title
|
|
176
|
+
})
|
|
177
|
+
}), /*#__PURE__*/jsx(Modal.Body, {
|
|
178
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
179
|
+
"data-testid": "delete-spot-modal-description",
|
|
180
|
+
style: "body2",
|
|
181
|
+
children: description
|
|
182
|
+
})
|
|
183
|
+
})]
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
|
|
160
187
|
var ChangeLanguageDropdown = function ChangeLanguageDropdown(_ref) {
|
|
161
188
|
var _findBy;
|
|
162
189
|
var availableLanguages = _ref.availableLanguages;
|
|
@@ -416,6 +443,9 @@ var getUniqueNumbersFromExistingFieldCodes = function getUniqueNumbersFromExisti
|
|
|
416
443
|
});
|
|
417
444
|
};
|
|
418
445
|
var generateFieldCodePrefix = function generateFieldCodePrefix(label, kind) {
|
|
446
|
+
if (kind === QUESTION_TYPES.SPOT) {
|
|
447
|
+
return SPOT_QUESTION_FIELD_CODE;
|
|
448
|
+
}
|
|
419
449
|
var prefix;
|
|
420
450
|
if (isNameQuestion(kind) || NON_BASIC_LATIN_CHARACTERS_REGEX.test(label) || isEmpty(label)) {
|
|
421
451
|
prefix = kind;
|
|
@@ -1033,7 +1063,7 @@ var Form$1 = function Form(_ref) {
|
|
|
1033
1063
|
var canRestrictResponseVisibilityToHost = restrictResponseVisibilityToHost && !includes(kind, NON_HIDEABLE_FIELDS);
|
|
1034
1064
|
var canMarkResponsesAsReadOnly = markResponsesAsReadOnly && !includes(kind, NON_READ_ONLY_FIELDS);
|
|
1035
1065
|
var isBasicSettingsVisible = !isRequired && (!isImmutable || shouldShowHideSwitch);
|
|
1036
|
-
var isSettingsBlockVisible = isBasicSettingsVisible || canMarkResponsesAsReadOnly;
|
|
1066
|
+
var isSettingsBlockVisible = kind !== QUESTION_TYPES.SPOT && (isBasicSettingsVisible || canMarkResponsesAsReadOnly);
|
|
1037
1067
|
var handleKindChange = function handleKindChange(option) {
|
|
1038
1068
|
var data = buildQuestionData(option);
|
|
1039
1069
|
updateFormState(data);
|
|
@@ -1099,7 +1129,7 @@ var Form$1 = function Form(_ref) {
|
|
|
1099
1129
|
dataTestid: "settings-card",
|
|
1100
1130
|
title: t("neetoForm.common.settings"),
|
|
1101
1131
|
children: [isBasicSettingsVisible && /*#__PURE__*/jsxs(Fragment, {
|
|
1102
|
-
children: [!isImmutable && kind !== QUESTION_TYPES.ADDRESS && /*#__PURE__*/jsx(RequiredSwitch, {}), shouldShowHideSwitch && /*#__PURE__*/jsx(Switch, {
|
|
1132
|
+
children: [!isImmutable && kind !== QUESTION_TYPES.ADDRESS && kind !== QUESTION_TYPES.SPOT && /*#__PURE__*/jsx(RequiredSwitch, {}), shouldShowHideSwitch && /*#__PURE__*/jsx(Switch, {
|
|
1103
1133
|
label: t("neetoForm.common.hideQuestion"),
|
|
1104
1134
|
name: "isHidden",
|
|
1105
1135
|
labelProps: hideSwitchLabelProps(hideQuestionHelpDocUrl)
|
|
@@ -2723,8 +2753,12 @@ var Form = function Form(_ref) {
|
|
|
2723
2753
|
setIsDeleteSmsReminderModalOpen = _useState8[1];
|
|
2724
2754
|
var _useState9 = useState(false),
|
|
2725
2755
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
2726
|
-
|
|
2727
|
-
|
|
2756
|
+
isDeleteSpotModalOpen = _useState10[0],
|
|
2757
|
+
setIsDeleteSpotModalOpen = _useState10[1];
|
|
2758
|
+
var _useState11 = useState(false),
|
|
2759
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
2760
|
+
isManageQuestionPaneOpen = _useState12[0],
|
|
2761
|
+
setIsManageQuestionPaneOpen = _useState12[1];
|
|
2728
2762
|
var setFormData = useBuildFormStore(prop("setFormData"));
|
|
2729
2763
|
var _useCreateQuestion = useCreateQuestion(formId, selectedLanguage, {
|
|
2730
2764
|
onSuccess: function onSuccess() {
|
|
@@ -2815,6 +2849,8 @@ var Form = function Form(_ref) {
|
|
|
2815
2849
|
var handleDelete = function handleDelete(question) {
|
|
2816
2850
|
if (question.kind === QUESTION_TYPES.SMS_REMINDER) {
|
|
2817
2851
|
setIsDeleteSmsReminderModalOpen(true);
|
|
2852
|
+
} else if (question.kind === QUESTION_TYPES.SPOT) {
|
|
2853
|
+
setIsDeleteSpotModalOpen(true);
|
|
2818
2854
|
} else {
|
|
2819
2855
|
setIsDeleteAlertOpen(true);
|
|
2820
2856
|
}
|
|
@@ -2822,7 +2858,7 @@ var Form = function Form(_ref) {
|
|
|
2822
2858
|
useOnClickOutside(containerRef, function () {
|
|
2823
2859
|
return handleSelect({});
|
|
2824
2860
|
}, {
|
|
2825
|
-
enabled: !(isDeleteAlertOpen || isManageQuestionPaneOpen)
|
|
2861
|
+
enabled: !(isDeleteAlertOpen || isManageQuestionPaneOpen || isDeleteSmsReminderModalOpen || isDeleteSpotModalOpen)
|
|
2826
2862
|
});
|
|
2827
2863
|
useEffect(function () {
|
|
2828
2864
|
onValueChange === null || onValueChange === void 0 || onValueChange(questions);
|
|
@@ -2847,6 +2883,12 @@ var Form = function Form(_ref) {
|
|
|
2847
2883
|
onClose: function onClose() {
|
|
2848
2884
|
return setIsDeleteSmsReminderModalOpen(false);
|
|
2849
2885
|
}
|
|
2886
|
+
}), /*#__PURE__*/jsx(DeleteSpotModal, {
|
|
2887
|
+
hostSpecificData: hostSpecificData,
|
|
2888
|
+
isOpen: isDeleteSpotModalOpen,
|
|
2889
|
+
onClose: function onClose() {
|
|
2890
|
+
return setIsDeleteSpotModalOpen(false);
|
|
2891
|
+
}
|
|
2850
2892
|
}), /*#__PURE__*/jsxs("div", {
|
|
2851
2893
|
className: "neeto-form-nano-form-wrapper flex h-full flex-col",
|
|
2852
2894
|
children: [formTitle && /*#__PURE__*/jsx(Overview, {
|