@bigbinary/neeto-form-frontend 1.2.7 → 1.2.9
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 +48 -316
- package/dist/index.cjs.js +131 -121
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +133 -123
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React$2 from 'react';
|
|
2
2
|
import React__default, { useLayoutEffect, useEffect, useMemo as useMemo$1, useContext, useReducer, useRef, useState, memo, forwardRef, Fragment } from 'react';
|
|
3
3
|
import { useField, useFormikContext, FieldArray, Form as Form$1, Formik, Field, FastField } from 'formik';
|
|
4
|
-
import { noop as noop$3, findBy, removeBy, isPresent, findById } from '@bigbinary/neeto-cist';
|
|
4
|
+
import { noop as noop$3, slugify, findBy, removeBy, isPresent, findById, notEqualsDeep } from '@bigbinary/neeto-cist';
|
|
5
5
|
import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
|
|
6
6
|
import { Typography, Dropdown as Dropdown$2, Tooltip, Button as Button$1, Label, Alert, Toastr, MultiEmailInput, DatePicker, Checkbox as Checkbox$2, Radio, Select, Textarea as Textarea$1, Input as Input$2, Spinner as Spinner$2 } from '@bigbinary/neetoui';
|
|
7
|
-
import { assoc, prop, isEmpty, path, reject, omit, insert, compose as compose$1, trim, either, isNil, values as values$1, equals, not, pluck, times } from 'ramda';
|
|
7
|
+
import { assoc, prop, isEmpty, path, reject, omit, insert, compose as compose$1, trim, either, isNil, values as values$1, equals, not, pluck, times, pick } from 'ramda';
|
|
8
8
|
import { useQuery, useQueryClient, useMutation } from 'react-query';
|
|
9
9
|
import i18next, { t as t$1 } from 'i18next';
|
|
10
10
|
import { Input, Email as Email$2, Phone as Phone$2, Up, Down, MenuHorizontal, Delete, Plus, NeetoInvisible, MultipleChoice as MultipleChoice$2, ListDot, Dropdown as Dropdown$3, Rating as Rating$4, Smiley, Checkbox as Checkbox$1, Calendar, Check, Close } from '@bigbinary/neeto-icons';
|
|
@@ -190,15 +190,15 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
190
190
|
return target;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
var _excluded$
|
|
194
|
-
_excluded2$
|
|
193
|
+
var _excluded$f = ["size"],
|
|
194
|
+
_excluded2$2 = ["size"],
|
|
195
195
|
_excluded3$2 = ["size"],
|
|
196
196
|
_excluded4$1 = ["size"],
|
|
197
197
|
_excluded5 = ["size"];
|
|
198
198
|
var Star = function Star(props) {
|
|
199
199
|
var _props$size = props.size,
|
|
200
200
|
size = _props$size === void 0 ? 20 : _props$size,
|
|
201
|
-
other = _objectWithoutProperties(props, _excluded$
|
|
201
|
+
other = _objectWithoutProperties(props, _excluded$f);
|
|
202
202
|
return /*#__PURE__*/React__default.createElement("svg", _extends$6({
|
|
203
203
|
fill: "none",
|
|
204
204
|
height: size,
|
|
@@ -216,7 +216,7 @@ var Star = function Star(props) {
|
|
|
216
216
|
var Heart = function Heart(props) {
|
|
217
217
|
var _props$size2 = props.size,
|
|
218
218
|
size = _props$size2 === void 0 ? 20 : _props$size2,
|
|
219
|
-
other = _objectWithoutProperties(props, _excluded2$
|
|
219
|
+
other = _objectWithoutProperties(props, _excluded2$2);
|
|
220
220
|
return /*#__PURE__*/React__default.createElement("svg", _extends$6({
|
|
221
221
|
fill: "none",
|
|
222
222
|
height: size,
|
|
@@ -540,14 +540,14 @@ var neetoFormApi = {
|
|
|
540
540
|
updatePublicSubmission: updatePublicSubmission
|
|
541
541
|
};
|
|
542
542
|
|
|
543
|
-
var _excluded$
|
|
543
|
+
var _excluded$e = ["formId", "preview"],
|
|
544
544
|
_excluded3$1 = ["formId", "submissionId"];
|
|
545
545
|
function ownKeys$c(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
546
546
|
function _objectSpread$b(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$c(Object(source), !0).forEach(function (key) { _defineProperty$6(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$c(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
547
547
|
var useForm = function useForm(_ref) {
|
|
548
548
|
var formId = _ref.formId,
|
|
549
549
|
preview = _ref.preview,
|
|
550
|
-
options = _objectWithoutProperties(_ref, _excluded$
|
|
550
|
+
options = _objectWithoutProperties(_ref, _excluded$e);
|
|
551
551
|
return useQuery([QUERY_KEYS.QUESTIONS, preview ? "preview/".concat(formId) : formId], function () {
|
|
552
552
|
return neetoFormApi.getPublicQuestions(formId);
|
|
553
553
|
}, _objectSpread$b({
|
|
@@ -1790,8 +1790,8 @@ reactIs_production_min.typeOf=y;
|
|
|
1790
1790
|
|
|
1791
1791
|
var reactIsExports = reactIs.exports;
|
|
1792
1792
|
|
|
1793
|
-
var _excluded$
|
|
1794
|
-
_excluded2$
|
|
1793
|
+
var _excluded$d = ["getDisplayName", "methodName", "renderCountProp", "shouldHandleStateChanges", "storeKey", "withRef", "forwardRef", "context"],
|
|
1794
|
+
_excluded2$1 = ["reactReduxForwardedRef"];
|
|
1795
1795
|
|
|
1796
1796
|
var EMPTY_ARRAY = [];
|
|
1797
1797
|
var NO_SUBSCRIPTION_ARRAY = [null, null];
|
|
@@ -1940,7 +1940,7 @@ _ref) {
|
|
|
1940
1940
|
forwardRef = _ref2$forwardRef === void 0 ? false : _ref2$forwardRef,
|
|
1941
1941
|
_ref2$context = _ref2.context,
|
|
1942
1942
|
context = _ref2$context === void 0 ? ReactReduxContext : _ref2$context,
|
|
1943
|
-
connectOptions = _objectWithoutPropertiesLoose(_ref2, _excluded$
|
|
1943
|
+
connectOptions = _objectWithoutPropertiesLoose(_ref2, _excluded$d);
|
|
1944
1944
|
|
|
1945
1945
|
var Context = context;
|
|
1946
1946
|
return function wrapWithConnect(WrappedComponent) {
|
|
@@ -1978,7 +1978,7 @@ _ref) {
|
|
|
1978
1978
|
// and values needed to control behavior (forwarded refs, alternate context instances).
|
|
1979
1979
|
// To maintain the wrapperProps object reference, memoize this destructuring.
|
|
1980
1980
|
var reactReduxForwardedRef = props.reactReduxForwardedRef,
|
|
1981
|
-
wrapperProps = _objectWithoutPropertiesLoose(props, _excluded2$
|
|
1981
|
+
wrapperProps = _objectWithoutPropertiesLoose(props, _excluded2$1);
|
|
1982
1982
|
|
|
1983
1983
|
return [props.context, reactReduxForwardedRef, wrapperProps];
|
|
1984
1984
|
}, [props]),
|
|
@@ -2299,7 +2299,7 @@ function whenMergePropsIsOmitted(mergeProps) {
|
|
|
2299
2299
|
}
|
|
2300
2300
|
var defaultMergePropsFactories = [whenMergePropsIsFunction, whenMergePropsIsOmitted];
|
|
2301
2301
|
|
|
2302
|
-
var _excluded$
|
|
2302
|
+
var _excluded$c = ["initMapStateToProps", "initMapDispatchToProps", "initMergeProps"];
|
|
2303
2303
|
function impureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch) {
|
|
2304
2304
|
return function impureFinalPropsSelector(state, ownProps) {
|
|
2305
2305
|
return mergeProps(mapStateToProps(state, ownProps), mapDispatchToProps(dispatch, ownProps), ownProps);
|
|
@@ -2372,7 +2372,7 @@ function finalPropsSelectorFactory(dispatch, _ref2) {
|
|
|
2372
2372
|
var initMapStateToProps = _ref2.initMapStateToProps,
|
|
2373
2373
|
initMapDispatchToProps = _ref2.initMapDispatchToProps,
|
|
2374
2374
|
initMergeProps = _ref2.initMergeProps,
|
|
2375
|
-
options = _objectWithoutPropertiesLoose(_ref2, _excluded$
|
|
2375
|
+
options = _objectWithoutPropertiesLoose(_ref2, _excluded$c);
|
|
2376
2376
|
|
|
2377
2377
|
var mapStateToProps = initMapStateToProps(dispatch, options);
|
|
2378
2378
|
var mapDispatchToProps = initMapDispatchToProps(dispatch, options);
|
|
@@ -2382,7 +2382,7 @@ function finalPropsSelectorFactory(dispatch, _ref2) {
|
|
|
2382
2382
|
return selectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options);
|
|
2383
2383
|
}
|
|
2384
2384
|
|
|
2385
|
-
var _excluded$
|
|
2385
|
+
var _excluded$b = ["pure", "areStatesEqual", "areOwnPropsEqual", "areStatePropsEqual", "areMergedPropsEqual"];
|
|
2386
2386
|
/*
|
|
2387
2387
|
connect is a facade over connectAdvanced. It turns its args into a compatible
|
|
2388
2388
|
selectorFactory, which has the signature:
|
|
@@ -2446,7 +2446,7 @@ function createConnect(_temp) {
|
|
|
2446
2446
|
areStatePropsEqual = _ref3$areStatePropsEq === void 0 ? shallowEqual : _ref3$areStatePropsEq,
|
|
2447
2447
|
_ref3$areMergedPropsE = _ref3.areMergedPropsEqual,
|
|
2448
2448
|
areMergedPropsEqual = _ref3$areMergedPropsE === void 0 ? shallowEqual : _ref3$areMergedPropsE,
|
|
2449
|
-
extraOptions = _objectWithoutPropertiesLoose(_ref3, _excluded$
|
|
2449
|
+
extraOptions = _objectWithoutPropertiesLoose(_ref3, _excluded$b);
|
|
2450
2450
|
|
|
2451
2451
|
var initMapStateToProps = match(mapStateToProps, mapStateToPropsFactories, 'mapStateToProps');
|
|
2452
2452
|
var initMapDispatchToProps = match(mapDispatchToProps, mapDispatchToPropsFactories, 'mapDispatchToProps');
|
|
@@ -10896,21 +10896,22 @@ var ListItem = function ListItem(_ref) {
|
|
|
10896
10896
|
label = _ref.label,
|
|
10897
10897
|
onClick = _ref.onClick;
|
|
10898
10898
|
return /*#__PURE__*/React__default.createElement("li", {
|
|
10899
|
+
onClick: onClick,
|
|
10899
10900
|
className: "flex items-center gap-x-2",
|
|
10900
|
-
|
|
10901
|
+
"data-cy": "neeto-form-engine-".concat(slugify(label))
|
|
10901
10902
|
}, Icon && /*#__PURE__*/React__default.createElement(Icon, null), /*#__PURE__*/React__default.createElement(Typography, {
|
|
10902
10903
|
style: "body2"
|
|
10903
10904
|
}, label));
|
|
10904
10905
|
};
|
|
10905
10906
|
|
|
10906
|
-
var _excluded$
|
|
10907
|
-
_excluded2
|
|
10907
|
+
var _excluded$a = ["size", "color"],
|
|
10908
|
+
_excluded2 = ["size", "color"],
|
|
10908
10909
|
_excluded3 = ["size", "color"],
|
|
10909
10910
|
_excluded4 = ["size", "color"];
|
|
10910
10911
|
var BadSmiley = function BadSmiley(props) {
|
|
10911
10912
|
var size = props.size,
|
|
10912
10913
|
color = props.color,
|
|
10913
|
-
other = _objectWithoutProperties(props, _excluded$
|
|
10914
|
+
other = _objectWithoutProperties(props, _excluded$a);
|
|
10914
10915
|
return /*#__PURE__*/React__default.createElement("svg", _extends$6({
|
|
10915
10916
|
fill: "none",
|
|
10916
10917
|
height: size,
|
|
@@ -10932,7 +10933,7 @@ BadSmiley.defaultProps = {
|
|
|
10932
10933
|
var OkaySmiley = function OkaySmiley(props) {
|
|
10933
10934
|
var size = props.size,
|
|
10934
10935
|
color = props.color,
|
|
10935
|
-
other = _objectWithoutProperties(props, _excluded2
|
|
10936
|
+
other = _objectWithoutProperties(props, _excluded2);
|
|
10936
10937
|
return /*#__PURE__*/React__default.createElement("svg", _extends$6({
|
|
10937
10938
|
fill: "none",
|
|
10938
10939
|
height: size,
|
|
@@ -11124,10 +11125,10 @@ var Accordion = function Accordion(_ref) {
|
|
|
11124
11125
|
}));
|
|
11125
11126
|
};
|
|
11126
11127
|
|
|
11127
|
-
var _excluded$
|
|
11128
|
+
var _excluded$9 = ["maxLength"];
|
|
11128
11129
|
var InputWithMaxLength = function InputWithMaxLength(_ref) {
|
|
11129
11130
|
var maxLength = _ref.maxLength,
|
|
11130
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
11131
|
+
props = _objectWithoutProperties(_ref, _excluded$9);
|
|
11131
11132
|
var _useField = useField(props),
|
|
11132
11133
|
_useField2 = _slicedToArray$1(_useField, 3),
|
|
11133
11134
|
value = _useField2[0].value,
|
|
@@ -11143,10 +11144,10 @@ var InputWithMaxLength = function InputWithMaxLength(_ref) {
|
|
|
11143
11144
|
}));
|
|
11144
11145
|
};
|
|
11145
11146
|
|
|
11146
|
-
var _excluded$
|
|
11147
|
+
var _excluded$8 = ["maxLength"];
|
|
11147
11148
|
var TextAreaWithMaxLength = function TextAreaWithMaxLength(_ref) {
|
|
11148
11149
|
var maxLength = _ref.maxLength,
|
|
11149
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
11150
|
+
props = _objectWithoutProperties(_ref, _excluded$8);
|
|
11150
11151
|
var _useField = useField(props),
|
|
11151
11152
|
_useField2 = _slicedToArray$1(_useField, 3),
|
|
11152
11153
|
value = _useField2[0].value,
|
|
@@ -12365,7 +12366,7 @@ var List = function List(_ref) {
|
|
|
12365
12366
|
})))));
|
|
12366
12367
|
};
|
|
12367
12368
|
|
|
12368
|
-
var _excluded$
|
|
12369
|
+
var _excluded$7 = ["questionKinds", "showAddQuestionDivider", "onValueChange", "showActionBlock", "formId", "isDeletable", "isRequiredField", "submitButtonProps", "cancelButtonProps", "isKindAlreadyActive", "getActiveKindDetails", "kindUniqueOn", "isDisabledFieldLabel", "disabledAddButtonTooltipProps"];
|
|
12369
12370
|
function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
12370
12371
|
function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$8(Object(source), !0).forEach(function (key) { _defineProperty$6(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
12371
12372
|
var Form = function Form(_ref) {
|
|
@@ -12384,7 +12385,7 @@ var Form = function Form(_ref) {
|
|
|
12384
12385
|
kindUniqueOn = _ref.kindUniqueOn,
|
|
12385
12386
|
isDisabledFieldLabel = _ref.isDisabledFieldLabel,
|
|
12386
12387
|
disabledAddButtonTooltipProps = _ref.disabledAddButtonTooltipProps,
|
|
12387
|
-
formDomProps = _objectWithoutProperties(_ref, _excluded$
|
|
12388
|
+
formDomProps = _objectWithoutProperties(_ref, _excluded$7);
|
|
12388
12389
|
var _useTranslation = useTranslation(),
|
|
12389
12390
|
t = _useTranslation.t;
|
|
12390
12391
|
var _useState = useState({}),
|
|
@@ -13149,7 +13150,7 @@ var Spinner = function Spinner(_ref) {
|
|
|
13149
13150
|
};
|
|
13150
13151
|
var Spinner$1 = /*#__PURE__*/React__default.memo(Spinner);
|
|
13151
13152
|
|
|
13152
|
-
var _excluded$
|
|
13153
|
+
var _excluded$6 = ["label", "loading", "success", "className"];
|
|
13153
13154
|
var Button = function Button(_ref) {
|
|
13154
13155
|
var label = _ref.label,
|
|
13155
13156
|
_ref$loading = _ref.loading,
|
|
@@ -13158,7 +13159,7 @@ var Button = function Button(_ref) {
|
|
|
13158
13159
|
success = _ref$success === void 0 ? false : _ref$success,
|
|
13159
13160
|
_ref$className = _ref.className,
|
|
13160
13161
|
className = _ref$className === void 0 ? "" : _ref$className,
|
|
13161
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$
|
|
13162
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$6);
|
|
13162
13163
|
return /*#__PURE__*/React__default.createElement("button", _extends$6({
|
|
13163
13164
|
className: classnames("neeto-form-engine-button", className)
|
|
13164
13165
|
}, otherProps), loading && /*#__PURE__*/React__default.createElement(ButtonLoader, null), success && /*#__PURE__*/React__default.createElement(Success$2, null), label);
|
|
@@ -13378,12 +13379,10 @@ var validateStarRatingField = function validateStarRatingField(_ref5) {
|
|
|
13378
13379
|
return schema.trim();
|
|
13379
13380
|
};
|
|
13380
13381
|
var validateTermsField = function validateTermsField() {
|
|
13381
|
-
|
|
13382
|
-
return schema;
|
|
13382
|
+
return yup["boolean"]().oneOf([true], t$1("neetoForm.common.mustAcceptTermsAndConditions"));
|
|
13383
13383
|
};
|
|
13384
13384
|
var validateConditionField = function validateConditionField() {
|
|
13385
|
-
|
|
13386
|
-
return schema;
|
|
13385
|
+
return yup["boolean"]().oneOf([true], t$1("neetoForm.common.mustAcceptCondition"));
|
|
13387
13386
|
};
|
|
13388
13387
|
var validateDateField = function validateDateField(_ref6) {
|
|
13389
13388
|
var label = _ref6.label,
|
|
@@ -13415,53 +13414,49 @@ var validateRichTextField = function validateRichTextField(_ref8) {
|
|
|
13415
13414
|
}
|
|
13416
13415
|
return schema.trim();
|
|
13417
13416
|
};
|
|
13418
|
-
var fieldKindValidatorMap = (_fieldKindValidatorMa = {}, _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.EMAIL.value, validateTextField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.PHONE.value, validateTextField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.TEXT.value, validateTextField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.NAME.value, validateTextField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.QUESTION.value, validateTextField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.TEXTAREA.value, validateTextField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.DROPDOWN.value, validateSingleChoiceField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.RADIO.value, validateSingleChoiceField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.CHECKBOX.value, validateMultiChoiceField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.RATING.value, validateRatingField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.TERMS.value, validateTermsField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.DATE.value, validateDateField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.STAR_RATING.value, validateStarRatingField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.ADDITIONAL_GUESTS.value, validateMultiEmailField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.RICH_TEXT.value, validateRichTextField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.CONDITION.value, validateConditionField), _fieldKindValidatorMa);
|
|
13417
|
+
var fieldKindValidatorMap = (_fieldKindValidatorMa = {}, _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.EMAIL.value, validateTextField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.PHONE.value, validateTextField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.TEXT.value, validateTextField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.NAME.value, validateTextField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.QUESTION.value, validateTextField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.TEXTAREA.value, validateTextField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.DECIMAL.value, validateTextField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.INTEGER.value, validateTextField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.DROPDOWN.value, validateSingleChoiceField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.RADIO.value, validateSingleChoiceField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.CHECKBOX.value, validateMultiChoiceField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.RATING.value, validateRatingField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.TERMS.value, validateTermsField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.DATE.value, validateDateField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.STAR_RATING.value, validateStarRatingField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.ADDITIONAL_GUESTS.value, validateMultiEmailField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.RICH_TEXT.value, validateRichTextField), _defineProperty$6(_fieldKindValidatorMa, QUESTION_KIND.CONDITION.value, validateConditionField), _fieldKindValidatorMa);
|
|
13419
13418
|
var validateFieldValue = function validateFieldValue(_ref9) {
|
|
13420
13419
|
var kind = _ref9.kind,
|
|
13421
13420
|
label = _ref9.label,
|
|
13422
13421
|
isRequired = _ref9.isRequired,
|
|
13423
13422
|
customValidator = _ref9.customValidator;
|
|
13424
|
-
return (
|
|
13425
|
-
|
|
13426
|
-
|
|
13427
|
-
|
|
13428
|
-
|
|
13429
|
-
|
|
13430
|
-
|
|
13431
|
-
|
|
13432
|
-
isRequired: isRequired
|
|
13433
|
-
});
|
|
13423
|
+
return function (value) {
|
|
13424
|
+
if (!(kind in fieldKindValidatorMap)) return;
|
|
13425
|
+
var validator = fieldKindValidatorMap[kind];
|
|
13426
|
+
var schema = customValidator || validator({
|
|
13427
|
+
kind: kind,
|
|
13428
|
+
label: label,
|
|
13429
|
+
isRequired: isRequired
|
|
13430
|
+
});
|
|
13434
13431
|
|
|
13435
|
-
|
|
13436
|
-
|
|
13437
|
-
|
|
13438
|
-
|
|
13439
|
-
|
|
13440
|
-
|
|
13441
|
-
|
|
13442
|
-
|
|
13443
|
-
|
|
13444
|
-
|
|
13445
|
-
|
|
13446
|
-
|
|
13447
|
-
|
|
13448
|
-
|
|
13449
|
-
|
|
13450
|
-
|
|
13451
|
-
|
|
13452
|
-
|
|
13453
|
-
|
|
13454
|
-
|
|
13455
|
-
|
|
13456
|
-
|
|
13457
|
-
|
|
13458
|
-
|
|
13459
|
-
|
|
13460
|
-
|
|
13461
|
-
|
|
13462
|
-
|
|
13463
|
-
}
|
|
13464
|
-
);
|
|
13432
|
+
// eslint-disable-next-line consistent-return, no-async-promise-executor
|
|
13433
|
+
return new Promise( /*#__PURE__*/function () {
|
|
13434
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(resolve) {
|
|
13435
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
13436
|
+
while (1) switch (_context.prev = _context.next) {
|
|
13437
|
+
case 0:
|
|
13438
|
+
_context.prev = 0;
|
|
13439
|
+
_context.next = 3;
|
|
13440
|
+
return schema.validate(value);
|
|
13441
|
+
case 3:
|
|
13442
|
+
resolve(undefined);
|
|
13443
|
+
_context.next = 9;
|
|
13444
|
+
break;
|
|
13445
|
+
case 6:
|
|
13446
|
+
_context.prev = 6;
|
|
13447
|
+
_context.t0 = _context["catch"](0);
|
|
13448
|
+
resolve(_context.t0.message);
|
|
13449
|
+
case 9:
|
|
13450
|
+
case "end":
|
|
13451
|
+
return _context.stop();
|
|
13452
|
+
}
|
|
13453
|
+
}, _callee, null, [[0, 6]]);
|
|
13454
|
+
}));
|
|
13455
|
+
return function (_x) {
|
|
13456
|
+
return _ref10.apply(this, arguments);
|
|
13457
|
+
};
|
|
13458
|
+
}());
|
|
13459
|
+
};
|
|
13465
13460
|
};
|
|
13466
13461
|
|
|
13467
13462
|
var MultipleEmailInput = function MultipleEmailInput(_ref) {
|
|
@@ -13518,30 +13513,31 @@ var MultipleEmailInput = function MultipleEmailInput(_ref) {
|
|
|
13518
13513
|
})));
|
|
13519
13514
|
};
|
|
13520
13515
|
|
|
13521
|
-
var _excluded$
|
|
13516
|
+
var _excluded$5 = ["name", "label", "error", "value"];
|
|
13522
13517
|
var Condition = function Condition(_ref, ref) {
|
|
13523
13518
|
var name = _ref.name,
|
|
13524
13519
|
label = _ref.label,
|
|
13525
13520
|
error = _ref.error,
|
|
13526
13521
|
value = _ref.value,
|
|
13527
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$
|
|
13522
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$5);
|
|
13528
13523
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
13529
13524
|
className: "neeto-form-engine-terms"
|
|
13530
13525
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
13531
13526
|
className: "neeto-form-engine-choice"
|
|
13532
13527
|
}, /*#__PURE__*/React__default.createElement("input", _extends$6({
|
|
13528
|
+
name: name,
|
|
13529
|
+
ref: ref,
|
|
13530
|
+
value: value,
|
|
13533
13531
|
required: true,
|
|
13534
13532
|
"aria-invalid": !!error,
|
|
13535
13533
|
id: "condition-".concat(name),
|
|
13536
|
-
|
|
13537
|
-
ref: ref,
|
|
13538
|
-
type: "checkbox",
|
|
13539
|
-
value: value
|
|
13534
|
+
type: "checkbox"
|
|
13540
13535
|
}, otherProps)), /*#__PURE__*/React__default.createElement("label", {
|
|
13541
13536
|
className: "neeto-form-engine-label font-normal",
|
|
13542
13537
|
htmlFor: "condition-".concat(name)
|
|
13543
13538
|
}, label)), !!error && typeof error === "string" && /*#__PURE__*/React__default.createElement("p", {
|
|
13544
|
-
className: "neeto-form-engine-input__error"
|
|
13539
|
+
className: "neeto-form-engine-input__error",
|
|
13540
|
+
"data-cy": "neeto-form-engine-condition-error"
|
|
13545
13541
|
}, error));
|
|
13546
13542
|
};
|
|
13547
13543
|
var Condition$1 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(Condition));
|
|
@@ -16783,7 +16779,7 @@ var ConditionField = function ConditionField(_ref) {
|
|
|
16783
16779
|
});
|
|
16784
16780
|
};
|
|
16785
16781
|
|
|
16786
|
-
var _excluded$
|
|
16782
|
+
var _excluded$4 = ["value"];
|
|
16787
16783
|
dayjs.extend(weekOfYear);
|
|
16788
16784
|
dayjs.extend(weekday);
|
|
16789
16785
|
dayjs.extend(localeData);
|
|
@@ -16827,7 +16823,7 @@ var DateField = function DateField(_ref) {
|
|
|
16827
16823
|
var meta = _ref2.meta,
|
|
16828
16824
|
_ref2$field = _ref2.field,
|
|
16829
16825
|
value = _ref2$field.value,
|
|
16830
|
-
field = _objectWithoutProperties(_ref2$field, _excluded$
|
|
16826
|
+
field = _objectWithoutProperties(_ref2$field, _excluded$4),
|
|
16831
16827
|
form = _ref2.form;
|
|
16832
16828
|
return /*#__PURE__*/React__default.createElement(DatePicker, _extends$6({
|
|
16833
16829
|
dateFormat: "MMM D, YYYY",
|
|
@@ -16874,16 +16870,17 @@ var Choices = function Choices(_ref) {
|
|
|
16874
16870
|
active: false
|
|
16875
16871
|
})
|
|
16876
16872
|
}, /*#__PURE__*/React__default.createElement(Component, {
|
|
16873
|
+
onChange: onChange,
|
|
16874
|
+
type: type,
|
|
16877
16875
|
id: option.id,
|
|
16878
16876
|
label: option.label,
|
|
16879
16877
|
name: isCheckBox ? "".concat(name, ".").concat(index) : name,
|
|
16880
|
-
type: type,
|
|
16881
16878
|
value: option.id,
|
|
16882
|
-
checked: isCheckBox ? (_value$index = value === null || value === void 0 ? void 0 : value[index]) !== null && _value$index !== void 0 ? _value$index : false : value === option.id
|
|
16883
|
-
onChange: onChange
|
|
16879
|
+
checked: isCheckBox ? (_value$index = value === null || value === void 0 ? void 0 : value[index]) !== null && _value$index !== void 0 ? _value$index : false : value === option.id
|
|
16884
16880
|
}));
|
|
16885
16881
|
})), !!error && typeof error === "string" && /*#__PURE__*/React__default.createElement("p", {
|
|
16886
|
-
className: "neeto-form-engine-input__error"
|
|
16882
|
+
className: "neeto-form-engine-input__error",
|
|
16883
|
+
"data-cy": "neeto-form-engine-".concat(type, "-error")
|
|
16887
16884
|
}, error));
|
|
16888
16885
|
};
|
|
16889
16886
|
var Choices$1 = /*#__PURE__*/React__default.memo(Choices);
|
|
@@ -16978,7 +16975,7 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
|
|
|
16978
16975
|
});
|
|
16979
16976
|
};
|
|
16980
16977
|
|
|
16981
|
-
var _excluded$
|
|
16978
|
+
var _excluded$3 = ["name", "label", "error", "lowestRatingLabel", "averageRatingLabel", "highestRatingLabel", "value"];
|
|
16982
16979
|
var Rating = function Rating(_ref) {
|
|
16983
16980
|
var name = _ref.name,
|
|
16984
16981
|
label = _ref.label,
|
|
@@ -16987,7 +16984,7 @@ var Rating = function Rating(_ref) {
|
|
|
16987
16984
|
averageRatingLabel = _ref.averageRatingLabel,
|
|
16988
16985
|
highestRatingLabel = _ref.highestRatingLabel,
|
|
16989
16986
|
value = _ref.value,
|
|
16990
|
-
other = _objectWithoutProperties(_ref, _excluded$
|
|
16987
|
+
other = _objectWithoutProperties(_ref, _excluded$3);
|
|
16991
16988
|
var handleClick = function handleClick(e) {
|
|
16992
16989
|
return e.currentTarget.nextElementSibling.click();
|
|
16993
16990
|
};
|
|
@@ -17008,9 +17005,9 @@ var Rating = function Rating(_ref) {
|
|
|
17008
17005
|
}, /*#__PURE__*/React__default.createElement(Icon, null), /*#__PURE__*/React__default.createElement("label", {
|
|
17009
17006
|
className: "neeto-form-engine-label"
|
|
17010
17007
|
}, labels[index])), /*#__PURE__*/React__default.createElement("input", _extends$6({
|
|
17008
|
+
name: name,
|
|
17011
17009
|
hidden: true,
|
|
17012
17010
|
checked: rating === value,
|
|
17013
|
-
name: name,
|
|
17014
17011
|
type: "radio",
|
|
17015
17012
|
value: rating
|
|
17016
17013
|
}, other)));
|
|
@@ -17023,7 +17020,8 @@ var Rating = function Rating(_ref) {
|
|
|
17023
17020
|
}, label), /*#__PURE__*/React__default.createElement("div", {
|
|
17024
17021
|
className: "neeto-form-engine-rating__row"
|
|
17025
17022
|
}, render()), !!error && typeof error === "string" && /*#__PURE__*/React__default.createElement("p", {
|
|
17026
|
-
className: "neeto-form-engine-input__error"
|
|
17023
|
+
className: "neeto-form-engine-input__error",
|
|
17024
|
+
"data-cy": "neeto-form-engine-rating-error"
|
|
17027
17025
|
}, error));
|
|
17028
17026
|
};
|
|
17029
17027
|
var Rating$1 = /*#__PURE__*/React__default.memo(Rating);
|
|
@@ -17062,8 +17060,11 @@ var RatingField = function RatingField(_ref) {
|
|
|
17062
17060
|
var RichTextEditor = function RichTextEditor(_ref) {
|
|
17063
17061
|
var editorRef = _ref.editorRef,
|
|
17064
17062
|
question = _ref.question,
|
|
17063
|
+
preview = _ref.preview,
|
|
17065
17064
|
_ref$editorProps = _ref.editorProps,
|
|
17066
17065
|
editorProps = _ref$editorProps === void 0 ? {} : _ref$editorProps;
|
|
17066
|
+
var _useFormikContext = useFormikContext(),
|
|
17067
|
+
errors = _useFormikContext.errors;
|
|
17067
17068
|
var name = question.id,
|
|
17068
17069
|
kind = question.kind,
|
|
17069
17070
|
label = question.label,
|
|
@@ -17077,18 +17078,18 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
17077
17078
|
className: "neeto-form-engine-input__label-wrapper"
|
|
17078
17079
|
}, label && /*#__PURE__*/React__default.createElement("label", {
|
|
17079
17080
|
className: "neeto-form-engine-label"
|
|
17080
|
-
}, getLabel$1(label, isRequired))), /*#__PURE__*/React__default.createElement(FastField, {
|
|
17081
|
+
}, getLabel$1(label, isRequired))), /*#__PURE__*/React__default.createElement(FastField, _extends$6({
|
|
17081
17082
|
debouncedPlaceholder: debouncedPlaceholder,
|
|
17083
|
+
error: errors[name],
|
|
17082
17084
|
name: name || nodeId,
|
|
17083
17085
|
validate: validateFieldValue({
|
|
17084
17086
|
kind: kind,
|
|
17085
17087
|
label: label,
|
|
17086
17088
|
isRequired: isRequired
|
|
17087
|
-
})
|
|
17088
|
-
|
|
17089
|
-
|
|
17090
|
-
|
|
17091
|
-
}, function (_ref2) {
|
|
17089
|
+
})
|
|
17090
|
+
}, preview && {
|
|
17091
|
+
shouldUpdate: isPropsUnequal(["debouncedPlaceholder", "error"])
|
|
17092
|
+
}), function (_ref2) {
|
|
17092
17093
|
var field = _ref2.field,
|
|
17093
17094
|
form = _ref2.form,
|
|
17094
17095
|
meta = _ref2.meta;
|
|
@@ -17110,8 +17111,7 @@ var RichTextEditor = function RichTextEditor(_ref) {
|
|
|
17110
17111
|
}));
|
|
17111
17112
|
};
|
|
17112
17113
|
|
|
17113
|
-
var _excluded$
|
|
17114
|
-
_excluded2 = ["label", "count", "shape", "error"];
|
|
17114
|
+
var _excluded$2 = ["value", "shape", "label", "rating", "count"];
|
|
17115
17115
|
var RatingButton = function RatingButton(_ref) {
|
|
17116
17116
|
var _ref$value = _ref.value,
|
|
17117
17117
|
value = _ref$value === void 0 ? "0" : _ref$value,
|
|
@@ -17119,7 +17119,7 @@ var RatingButton = function RatingButton(_ref) {
|
|
|
17119
17119
|
label = _ref.label,
|
|
17120
17120
|
rating = _ref.rating,
|
|
17121
17121
|
count = _ref.count,
|
|
17122
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$
|
|
17122
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$2);
|
|
17123
17123
|
var handleClick = function handleClick(e) {
|
|
17124
17124
|
return e.currentTarget.nextElementSibling.click();
|
|
17125
17125
|
};
|
|
@@ -17145,12 +17145,15 @@ var RatingButton = function RatingButton(_ref) {
|
|
|
17145
17145
|
value: "".concat(rating, " / ").concat(count)
|
|
17146
17146
|
}, otherProps)));
|
|
17147
17147
|
};
|
|
17148
|
-
var
|
|
17149
|
-
|
|
17150
|
-
|
|
17151
|
-
|
|
17152
|
-
|
|
17153
|
-
|
|
17148
|
+
var RatingButton$1 = /*#__PURE__*/React__default.memo(RatingButton);
|
|
17149
|
+
|
|
17150
|
+
var _excluded$1 = ["label", "count", "shape", "error"];
|
|
17151
|
+
var StarRating = function StarRating(_ref) {
|
|
17152
|
+
var label = _ref.label,
|
|
17153
|
+
count = _ref.count,
|
|
17154
|
+
shape = _ref.shape,
|
|
17155
|
+
error = _ref.error,
|
|
17156
|
+
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
17154
17157
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
17155
17158
|
className: "neeto-form-engine-input__wrapper neeto-form-engine-star-rating"
|
|
17156
17159
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
@@ -17160,15 +17163,16 @@ var StarRating = function StarRating(_ref2) {
|
|
|
17160
17163
|
}, label)), /*#__PURE__*/React__default.createElement("div", {
|
|
17161
17164
|
className: "neeto-form-engine-star-rating__row"
|
|
17162
17165
|
}, times(function (index) {
|
|
17163
|
-
return /*#__PURE__*/React__default.createElement(RatingButton, _extends$6({
|
|
17166
|
+
return /*#__PURE__*/React__default.createElement(RatingButton$1, _extends$6({
|
|
17164
17167
|
count: count,
|
|
17168
|
+
shape: shape,
|
|
17165
17169
|
key: index,
|
|
17166
17170
|
label: index + 1,
|
|
17167
|
-
rating: index + 1
|
|
17168
|
-
shape: shape
|
|
17171
|
+
rating: index + 1
|
|
17169
17172
|
}, props));
|
|
17170
17173
|
}, count)), !!error && typeof error === "string" && /*#__PURE__*/React__default.createElement("p", {
|
|
17171
|
-
className: "neeto-form-engine-input__error"
|
|
17174
|
+
className: "neeto-form-engine-input__error",
|
|
17175
|
+
"data-cy": "neeto-form-engine-star-rating-error"
|
|
17172
17176
|
}, error));
|
|
17173
17177
|
};
|
|
17174
17178
|
var StarRating$1 = /*#__PURE__*/React__default.memo(StarRating);
|
|
@@ -17215,17 +17219,18 @@ var Terms = function Terms(_ref, ref) {
|
|
|
17215
17219
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
17216
17220
|
className: "neeto-form-engine-choice"
|
|
17217
17221
|
}, /*#__PURE__*/React__default.createElement("input", _extends$6({
|
|
17222
|
+
name: name,
|
|
17223
|
+
ref: ref,
|
|
17224
|
+
value: value,
|
|
17218
17225
|
required: true,
|
|
17219
17226
|
"aria-invalid": !!error,
|
|
17220
17227
|
id: "terms-and-condition",
|
|
17221
|
-
|
|
17222
|
-
ref: ref,
|
|
17223
|
-
type: "checkbox",
|
|
17224
|
-
value: value
|
|
17228
|
+
type: "checkbox"
|
|
17225
17229
|
}, otherProps)), /*#__PURE__*/React__default.createElement(EditorContent, {
|
|
17226
17230
|
content: label
|
|
17227
17231
|
})), !!error && typeof error === "string" && /*#__PURE__*/React__default.createElement("p", {
|
|
17228
|
-
className: "neeto-form-engine-input__error"
|
|
17232
|
+
className: "neeto-form-engine-input__error",
|
|
17233
|
+
"data-cy": "neeto-form-engine-terms-error"
|
|
17229
17234
|
}, error));
|
|
17230
17235
|
};
|
|
17231
17236
|
var Terms$1 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(Terms));
|
|
@@ -17319,6 +17324,11 @@ var getFieldComponent = function getFieldComponent(_ref) {
|
|
|
17319
17324
|
return null;
|
|
17320
17325
|
};
|
|
17321
17326
|
};
|
|
17327
|
+
var isPropsUnequal = function isPropsUnequal(props) {
|
|
17328
|
+
return function (nextProps, prevProps) {
|
|
17329
|
+
return notEqualsDeep(pick(props, nextProps), pick(props, prevProps));
|
|
17330
|
+
};
|
|
17331
|
+
};
|
|
17322
17332
|
|
|
17323
17333
|
var _path, _defs;
|
|
17324
17334
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
@@ -17648,10 +17658,10 @@ var ExternalForm = function ExternalForm(_ref) {
|
|
|
17648
17658
|
style: "h4",
|
|
17649
17659
|
weight: "semibold"
|
|
17650
17660
|
}, titleProps), formTitle || title)), /*#__PURE__*/React__default.createElement(Formik, {
|
|
17661
|
+
onSubmit: onSubmit,
|
|
17651
17662
|
enableReinitialize: true,
|
|
17652
17663
|
innerRef: formikInnerRef,
|
|
17653
|
-
initialValues: generateInitValues(questions, submission === null || submission === void 0 ? void 0 : submission.responses, preserveValues ? localValues : initialValues)
|
|
17654
|
-
onSubmit: onSubmit
|
|
17664
|
+
initialValues: generateInitValues(questions, submission === null || submission === void 0 ? void 0 : submission.responses, preserveValues ? localValues : initialValues)
|
|
17655
17665
|
}, function (_ref5) {
|
|
17656
17666
|
var isSubmitting = _ref5.isSubmitting,
|
|
17657
17667
|
errors = _ref5.errors,
|
|
@@ -17668,24 +17678,24 @@ var ExternalForm = function ExternalForm(_ref) {
|
|
|
17668
17678
|
ref: mergeRefs(formRef, keyPressRef),
|
|
17669
17679
|
className: classnames("neeto-form-engine-form relative space-y-4", _defineProperty$6({}, className, className)),
|
|
17670
17680
|
onChange: function onChange(event) {
|
|
17671
|
-
if (
|
|
17672
|
-
|
|
17673
|
-
}
|
|
17681
|
+
if (isEmpty(errors)) return;
|
|
17682
|
+
setFieldError(event.target.name, "");
|
|
17674
17683
|
}
|
|
17675
17684
|
}, formDomProps, {
|
|
17676
17685
|
onReset: function onReset(e) {
|
|
17677
17686
|
return _onReset(e, handleReset);
|
|
17678
17687
|
}
|
|
17679
17688
|
}), (submission === null || submission === void 0 ? void 0 : submission.isLoading) && /*#__PURE__*/React__default.createElement("div", {
|
|
17680
|
-
className: "neeto-ui-bg-gray-100 absolute
|
|
17689
|
+
className: "neeto-ui-bg-gray-100 absolute bottom-0 left-0 right-0 top-0 flex items-center justify-center opacity-75"
|
|
17681
17690
|
}, /*#__PURE__*/React__default.createElement(Spinner$2, null)), renderedQuestions.map(function (question) {
|
|
17682
17691
|
var _question$id;
|
|
17683
17692
|
var FieldComponent = getFieldComponent(question);
|
|
17684
17693
|
return /*#__PURE__*/React__default.createElement(FieldComponent, {
|
|
17685
|
-
customValidator: customValidator === null || customValidator === void 0 ? void 0 : customValidator(question),
|
|
17686
|
-
editorRef: editorRef,
|
|
17687
17694
|
editorProps: editorProps,
|
|
17695
|
+
editorRef: editorRef,
|
|
17696
|
+
preview: preview,
|
|
17688
17697
|
question: question,
|
|
17698
|
+
customValidator: customValidator === null || customValidator === void 0 ? void 0 : customValidator(question),
|
|
17689
17699
|
key: (_question$id = question.id) !== null && _question$id !== void 0 ? _question$id : question.nodeId,
|
|
17690
17700
|
showPrefixIcon: showPrefixIcons
|
|
17691
17701
|
});
|