@bigbinary/neeto-form-frontend 1.2.8 → 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/dist/index.cjs.js CHANGED
@@ -226,15 +226,15 @@ function _objectWithoutProperties(source, excluded) {
226
226
  return target;
227
227
  }
228
228
 
229
- var _excluded$e = ["size"],
230
- _excluded2$3 = ["size"],
229
+ var _excluded$f = ["size"],
230
+ _excluded2$2 = ["size"],
231
231
  _excluded3$2 = ["size"],
232
232
  _excluded4$1 = ["size"],
233
233
  _excluded5 = ["size"];
234
234
  var Star = function Star(props) {
235
235
  var _props$size = props.size,
236
236
  size = _props$size === void 0 ? 20 : _props$size,
237
- other = _objectWithoutProperties(props, _excluded$e);
237
+ other = _objectWithoutProperties(props, _excluded$f);
238
238
  return /*#__PURE__*/React__default["default"].createElement("svg", _extends$6({
239
239
  fill: "none",
240
240
  height: size,
@@ -252,7 +252,7 @@ var Star = function Star(props) {
252
252
  var Heart = function Heart(props) {
253
253
  var _props$size2 = props.size,
254
254
  size = _props$size2 === void 0 ? 20 : _props$size2,
255
- other = _objectWithoutProperties(props, _excluded2$3);
255
+ other = _objectWithoutProperties(props, _excluded2$2);
256
256
  return /*#__PURE__*/React__default["default"].createElement("svg", _extends$6({
257
257
  fill: "none",
258
258
  height: size,
@@ -576,14 +576,14 @@ var neetoFormApi = {
576
576
  updatePublicSubmission: updatePublicSubmission
577
577
  };
578
578
 
579
- var _excluded$d = ["formId", "preview"],
579
+ var _excluded$e = ["formId", "preview"],
580
580
  _excluded3$1 = ["formId", "submissionId"];
581
581
  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; }
582
582
  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; }
583
583
  var useForm = function useForm(_ref) {
584
584
  var formId = _ref.formId,
585
585
  preview = _ref.preview,
586
- options = _objectWithoutProperties(_ref, _excluded$d);
586
+ options = _objectWithoutProperties(_ref, _excluded$e);
587
587
  return reactQuery.useQuery([QUERY_KEYS.QUESTIONS, preview ? "preview/".concat(formId) : formId], function () {
588
588
  return neetoFormApi.getPublicQuestions(formId);
589
589
  }, _objectSpread$b({
@@ -1826,8 +1826,8 @@ reactIs_production_min.typeOf=y;
1826
1826
 
1827
1827
  var reactIsExports = reactIs.exports;
1828
1828
 
1829
- var _excluded$c = ["getDisplayName", "methodName", "renderCountProp", "shouldHandleStateChanges", "storeKey", "withRef", "forwardRef", "context"],
1830
- _excluded2$2 = ["reactReduxForwardedRef"];
1829
+ var _excluded$d = ["getDisplayName", "methodName", "renderCountProp", "shouldHandleStateChanges", "storeKey", "withRef", "forwardRef", "context"],
1830
+ _excluded2$1 = ["reactReduxForwardedRef"];
1831
1831
 
1832
1832
  var EMPTY_ARRAY = [];
1833
1833
  var NO_SUBSCRIPTION_ARRAY = [null, null];
@@ -1976,7 +1976,7 @@ _ref) {
1976
1976
  forwardRef = _ref2$forwardRef === void 0 ? false : _ref2$forwardRef,
1977
1977
  _ref2$context = _ref2.context,
1978
1978
  context = _ref2$context === void 0 ? ReactReduxContext : _ref2$context,
1979
- connectOptions = _objectWithoutPropertiesLoose(_ref2, _excluded$c);
1979
+ connectOptions = _objectWithoutPropertiesLoose(_ref2, _excluded$d);
1980
1980
 
1981
1981
  var Context = context;
1982
1982
  return function wrapWithConnect(WrappedComponent) {
@@ -2014,7 +2014,7 @@ _ref) {
2014
2014
  // and values needed to control behavior (forwarded refs, alternate context instances).
2015
2015
  // To maintain the wrapperProps object reference, memoize this destructuring.
2016
2016
  var reactReduxForwardedRef = props.reactReduxForwardedRef,
2017
- wrapperProps = _objectWithoutPropertiesLoose(props, _excluded2$2);
2017
+ wrapperProps = _objectWithoutPropertiesLoose(props, _excluded2$1);
2018
2018
 
2019
2019
  return [props.context, reactReduxForwardedRef, wrapperProps];
2020
2020
  }, [props]),
@@ -2335,7 +2335,7 @@ function whenMergePropsIsOmitted(mergeProps) {
2335
2335
  }
2336
2336
  var defaultMergePropsFactories = [whenMergePropsIsFunction, whenMergePropsIsOmitted];
2337
2337
 
2338
- var _excluded$b = ["initMapStateToProps", "initMapDispatchToProps", "initMergeProps"];
2338
+ var _excluded$c = ["initMapStateToProps", "initMapDispatchToProps", "initMergeProps"];
2339
2339
  function impureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch) {
2340
2340
  return function impureFinalPropsSelector(state, ownProps) {
2341
2341
  return mergeProps(mapStateToProps(state, ownProps), mapDispatchToProps(dispatch, ownProps), ownProps);
@@ -2408,7 +2408,7 @@ function finalPropsSelectorFactory(dispatch, _ref2) {
2408
2408
  var initMapStateToProps = _ref2.initMapStateToProps,
2409
2409
  initMapDispatchToProps = _ref2.initMapDispatchToProps,
2410
2410
  initMergeProps = _ref2.initMergeProps,
2411
- options = _objectWithoutPropertiesLoose(_ref2, _excluded$b);
2411
+ options = _objectWithoutPropertiesLoose(_ref2, _excluded$c);
2412
2412
 
2413
2413
  var mapStateToProps = initMapStateToProps(dispatch, options);
2414
2414
  var mapDispatchToProps = initMapDispatchToProps(dispatch, options);
@@ -2418,7 +2418,7 @@ function finalPropsSelectorFactory(dispatch, _ref2) {
2418
2418
  return selectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options);
2419
2419
  }
2420
2420
 
2421
- var _excluded$a = ["pure", "areStatesEqual", "areOwnPropsEqual", "areStatePropsEqual", "areMergedPropsEqual"];
2421
+ var _excluded$b = ["pure", "areStatesEqual", "areOwnPropsEqual", "areStatePropsEqual", "areMergedPropsEqual"];
2422
2422
  /*
2423
2423
  connect is a facade over connectAdvanced. It turns its args into a compatible
2424
2424
  selectorFactory, which has the signature:
@@ -2482,7 +2482,7 @@ function createConnect(_temp) {
2482
2482
  areStatePropsEqual = _ref3$areStatePropsEq === void 0 ? shallowEqual : _ref3$areStatePropsEq,
2483
2483
  _ref3$areMergedPropsE = _ref3.areMergedPropsEqual,
2484
2484
  areMergedPropsEqual = _ref3$areMergedPropsE === void 0 ? shallowEqual : _ref3$areMergedPropsE,
2485
- extraOptions = _objectWithoutPropertiesLoose(_ref3, _excluded$a);
2485
+ extraOptions = _objectWithoutPropertiesLoose(_ref3, _excluded$b);
2486
2486
 
2487
2487
  var initMapStateToProps = match(mapStateToProps, mapStateToPropsFactories, 'mapStateToProps');
2488
2488
  var initMapDispatchToProps = match(mapDispatchToProps, mapDispatchToPropsFactories, 'mapDispatchToProps');
@@ -10932,21 +10932,22 @@ var ListItem = function ListItem(_ref) {
10932
10932
  label = _ref.label,
10933
10933
  onClick = _ref.onClick;
10934
10934
  return /*#__PURE__*/React__default["default"].createElement("li", {
10935
+ onClick: onClick,
10935
10936
  className: "flex items-center gap-x-2",
10936
- onClick: onClick
10937
+ "data-cy": "neeto-form-engine-".concat(neetoCist.slugify(label))
10937
10938
  }, Icon && /*#__PURE__*/React__default["default"].createElement(Icon, null), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
10938
10939
  style: "body2"
10939
10940
  }, label));
10940
10941
  };
10941
10942
 
10942
- var _excluded$9 = ["size", "color"],
10943
- _excluded2$1 = ["size", "color"],
10943
+ var _excluded$a = ["size", "color"],
10944
+ _excluded2 = ["size", "color"],
10944
10945
  _excluded3 = ["size", "color"],
10945
10946
  _excluded4 = ["size", "color"];
10946
10947
  var BadSmiley = function BadSmiley(props) {
10947
10948
  var size = props.size,
10948
10949
  color = props.color,
10949
- other = _objectWithoutProperties(props, _excluded$9);
10950
+ other = _objectWithoutProperties(props, _excluded$a);
10950
10951
  return /*#__PURE__*/React__default["default"].createElement("svg", _extends$6({
10951
10952
  fill: "none",
10952
10953
  height: size,
@@ -10968,7 +10969,7 @@ BadSmiley.defaultProps = {
10968
10969
  var OkaySmiley = function OkaySmiley(props) {
10969
10970
  var size = props.size,
10970
10971
  color = props.color,
10971
- other = _objectWithoutProperties(props, _excluded2$1);
10972
+ other = _objectWithoutProperties(props, _excluded2);
10972
10973
  return /*#__PURE__*/React__default["default"].createElement("svg", _extends$6({
10973
10974
  fill: "none",
10974
10975
  height: size,
@@ -11160,10 +11161,10 @@ var Accordion = function Accordion(_ref) {
11160
11161
  }));
11161
11162
  };
11162
11163
 
11163
- var _excluded$8 = ["maxLength"];
11164
+ var _excluded$9 = ["maxLength"];
11164
11165
  var InputWithMaxLength = function InputWithMaxLength(_ref) {
11165
11166
  var maxLength = _ref.maxLength,
11166
- props = _objectWithoutProperties(_ref, _excluded$8);
11167
+ props = _objectWithoutProperties(_ref, _excluded$9);
11167
11168
  var _useField = formik.useField(props),
11168
11169
  _useField2 = _slicedToArray$1(_useField, 3),
11169
11170
  value = _useField2[0].value,
@@ -11179,10 +11180,10 @@ var InputWithMaxLength = function InputWithMaxLength(_ref) {
11179
11180
  }));
11180
11181
  };
11181
11182
 
11182
- var _excluded$7 = ["maxLength"];
11183
+ var _excluded$8 = ["maxLength"];
11183
11184
  var TextAreaWithMaxLength = function TextAreaWithMaxLength(_ref) {
11184
11185
  var maxLength = _ref.maxLength,
11185
- props = _objectWithoutProperties(_ref, _excluded$7);
11186
+ props = _objectWithoutProperties(_ref, _excluded$8);
11186
11187
  var _useField = formik.useField(props),
11187
11188
  _useField2 = _slicedToArray$1(_useField, 3),
11188
11189
  value = _useField2[0].value,
@@ -12401,7 +12402,7 @@ var List = function List(_ref) {
12401
12402
  })))));
12402
12403
  };
12403
12404
 
12404
- var _excluded$6 = ["questionKinds", "showAddQuestionDivider", "onValueChange", "showActionBlock", "formId", "isDeletable", "isRequiredField", "submitButtonProps", "cancelButtonProps", "isKindAlreadyActive", "getActiveKindDetails", "kindUniqueOn", "isDisabledFieldLabel", "disabledAddButtonTooltipProps"];
12405
+ var _excluded$7 = ["questionKinds", "showAddQuestionDivider", "onValueChange", "showActionBlock", "formId", "isDeletable", "isRequiredField", "submitButtonProps", "cancelButtonProps", "isKindAlreadyActive", "getActiveKindDetails", "kindUniqueOn", "isDisabledFieldLabel", "disabledAddButtonTooltipProps"];
12405
12406
  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; }
12406
12407
  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; }
12407
12408
  var Form = function Form(_ref) {
@@ -12420,7 +12421,7 @@ var Form = function Form(_ref) {
12420
12421
  kindUniqueOn = _ref.kindUniqueOn,
12421
12422
  isDisabledFieldLabel = _ref.isDisabledFieldLabel,
12422
12423
  disabledAddButtonTooltipProps = _ref.disabledAddButtonTooltipProps,
12423
- formDomProps = _objectWithoutProperties(_ref, _excluded$6);
12424
+ formDomProps = _objectWithoutProperties(_ref, _excluded$7);
12424
12425
  var _useTranslation = reactI18next.useTranslation(),
12425
12426
  t = _useTranslation.t;
12426
12427
  var _useState = React$2.useState({}),
@@ -13185,7 +13186,7 @@ var Spinner = function Spinner(_ref) {
13185
13186
  };
13186
13187
  var Spinner$1 = /*#__PURE__*/React__default["default"].memo(Spinner);
13187
13188
 
13188
- var _excluded$5 = ["label", "loading", "success", "className"];
13189
+ var _excluded$6 = ["label", "loading", "success", "className"];
13189
13190
  var Button = function Button(_ref) {
13190
13191
  var label = _ref.label,
13191
13192
  _ref$loading = _ref.loading,
@@ -13194,7 +13195,7 @@ var Button = function Button(_ref) {
13194
13195
  success = _ref$success === void 0 ? false : _ref$success,
13195
13196
  _ref$className = _ref.className,
13196
13197
  className = _ref$className === void 0 ? "" : _ref$className,
13197
- otherProps = _objectWithoutProperties(_ref, _excluded$5);
13198
+ otherProps = _objectWithoutProperties(_ref, _excluded$6);
13198
13199
  return /*#__PURE__*/React__default["default"].createElement("button", _extends$6({
13199
13200
  className: classnames__default["default"]("neeto-form-engine-button", className)
13200
13201
  }, otherProps), loading && /*#__PURE__*/React__default["default"].createElement(ButtonLoader, null), success && /*#__PURE__*/React__default["default"].createElement(Success$2, null), label);
@@ -13414,12 +13415,10 @@ var validateStarRatingField = function validateStarRatingField(_ref5) {
13414
13415
  return schema.trim();
13415
13416
  };
13416
13417
  var validateTermsField = function validateTermsField() {
13417
- var schema = yup__namespace["boolean"]().oneOf([true], i18next.t("neetoForm.common.mustAcceptTermsAndConditions"));
13418
- return schema;
13418
+ return yup__namespace["boolean"]().oneOf([true], i18next.t("neetoForm.common.mustAcceptTermsAndConditions"));
13419
13419
  };
13420
13420
  var validateConditionField = function validateConditionField() {
13421
- var schema = yup__namespace["boolean"]().oneOf([true], i18next.t("neetoForm.common.mustAcceptCondition"));
13422
- return schema;
13421
+ return yup__namespace["boolean"]().oneOf([true], i18next.t("neetoForm.common.mustAcceptCondition"));
13423
13422
  };
13424
13423
  var validateDateField = function validateDateField(_ref6) {
13425
13424
  var label = _ref6.label,
@@ -13451,53 +13450,49 @@ var validateRichTextField = function validateRichTextField(_ref8) {
13451
13450
  }
13452
13451
  return schema.trim();
13453
13452
  };
13454
- 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);
13453
+ 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);
13455
13454
  var validateFieldValue = function validateFieldValue(_ref9) {
13456
13455
  var kind = _ref9.kind,
13457
13456
  label = _ref9.label,
13458
13457
  isRequired = _ref9.isRequired,
13459
13458
  customValidator = _ref9.customValidator;
13460
- return (
13461
- // eslint-disable-next-line consistent-return
13462
- function (value) {
13463
- if (kind in fieldKindValidatorMap) {
13464
- var validator = fieldKindValidatorMap[kind];
13465
- var schema = customValidator || validator({
13466
- kind: kind,
13467
- label: label,
13468
- isRequired: isRequired
13469
- });
13459
+ return function (value) {
13460
+ if (!(kind in fieldKindValidatorMap)) return;
13461
+ var validator = fieldKindValidatorMap[kind];
13462
+ var schema = customValidator || validator({
13463
+ kind: kind,
13464
+ label: label,
13465
+ isRequired: isRequired
13466
+ });
13470
13467
 
13471
- // eslint-disable-next-line no-async-promise-executor
13472
- return new Promise( /*#__PURE__*/function () {
13473
- var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(resolve) {
13474
- return _regeneratorRuntime.wrap(function _callee$(_context) {
13475
- while (1) switch (_context.prev = _context.next) {
13476
- case 0:
13477
- _context.prev = 0;
13478
- _context.next = 3;
13479
- return schema.validate(value);
13480
- case 3:
13481
- resolve(undefined);
13482
- _context.next = 9;
13483
- break;
13484
- case 6:
13485
- _context.prev = 6;
13486
- _context.t0 = _context["catch"](0);
13487
- resolve(_context.t0.message);
13488
- case 9:
13489
- case "end":
13490
- return _context.stop();
13491
- }
13492
- }, _callee, null, [[0, 6]]);
13493
- }));
13494
- return function (_x) {
13495
- return _ref10.apply(this, arguments);
13496
- };
13497
- }());
13498
- }
13499
- }
13500
- );
13468
+ // eslint-disable-next-line consistent-return, no-async-promise-executor
13469
+ return new Promise( /*#__PURE__*/function () {
13470
+ var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(resolve) {
13471
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
13472
+ while (1) switch (_context.prev = _context.next) {
13473
+ case 0:
13474
+ _context.prev = 0;
13475
+ _context.next = 3;
13476
+ return schema.validate(value);
13477
+ case 3:
13478
+ resolve(undefined);
13479
+ _context.next = 9;
13480
+ break;
13481
+ case 6:
13482
+ _context.prev = 6;
13483
+ _context.t0 = _context["catch"](0);
13484
+ resolve(_context.t0.message);
13485
+ case 9:
13486
+ case "end":
13487
+ return _context.stop();
13488
+ }
13489
+ }, _callee, null, [[0, 6]]);
13490
+ }));
13491
+ return function (_x) {
13492
+ return _ref10.apply(this, arguments);
13493
+ };
13494
+ }());
13495
+ };
13501
13496
  };
13502
13497
 
13503
13498
  var MultipleEmailInput = function MultipleEmailInput(_ref) {
@@ -13554,30 +13549,31 @@ var MultipleEmailInput = function MultipleEmailInput(_ref) {
13554
13549
  })));
13555
13550
  };
13556
13551
 
13557
- var _excluded$4 = ["name", "label", "error", "value"];
13552
+ var _excluded$5 = ["name", "label", "error", "value"];
13558
13553
  var Condition = function Condition(_ref, ref) {
13559
13554
  var name = _ref.name,
13560
13555
  label = _ref.label,
13561
13556
  error = _ref.error,
13562
13557
  value = _ref.value,
13563
- otherProps = _objectWithoutProperties(_ref, _excluded$4);
13558
+ otherProps = _objectWithoutProperties(_ref, _excluded$5);
13564
13559
  return /*#__PURE__*/React__default["default"].createElement("div", {
13565
13560
  className: "neeto-form-engine-terms"
13566
13561
  }, /*#__PURE__*/React__default["default"].createElement("div", {
13567
13562
  className: "neeto-form-engine-choice"
13568
13563
  }, /*#__PURE__*/React__default["default"].createElement("input", _extends$6({
13564
+ name: name,
13565
+ ref: ref,
13566
+ value: value,
13569
13567
  required: true,
13570
13568
  "aria-invalid": !!error,
13571
13569
  id: "condition-".concat(name),
13572
- name: name,
13573
- ref: ref,
13574
- type: "checkbox",
13575
- value: value
13570
+ type: "checkbox"
13576
13571
  }, otherProps)), /*#__PURE__*/React__default["default"].createElement("label", {
13577
13572
  className: "neeto-form-engine-label font-normal",
13578
13573
  htmlFor: "condition-".concat(name)
13579
13574
  }, label)), !!error && typeof error === "string" && /*#__PURE__*/React__default["default"].createElement("p", {
13580
- className: "neeto-form-engine-input__error"
13575
+ className: "neeto-form-engine-input__error",
13576
+ "data-cy": "neeto-form-engine-condition-error"
13581
13577
  }, error));
13582
13578
  };
13583
13579
  var Condition$1 = /*#__PURE__*/React$2.memo( /*#__PURE__*/React$2.forwardRef(Condition));
@@ -16819,7 +16815,7 @@ var ConditionField = function ConditionField(_ref) {
16819
16815
  });
16820
16816
  };
16821
16817
 
16822
- var _excluded$3 = ["value"];
16818
+ var _excluded$4 = ["value"];
16823
16819
  dayjs__default["default"].extend(weekOfYear__default["default"]);
16824
16820
  dayjs__default["default"].extend(weekday__default["default"]);
16825
16821
  dayjs__default["default"].extend(localeData__default["default"]);
@@ -16863,7 +16859,7 @@ var DateField = function DateField(_ref) {
16863
16859
  var meta = _ref2.meta,
16864
16860
  _ref2$field = _ref2.field,
16865
16861
  value = _ref2$field.value,
16866
- field = _objectWithoutProperties(_ref2$field, _excluded$3),
16862
+ field = _objectWithoutProperties(_ref2$field, _excluded$4),
16867
16863
  form = _ref2.form;
16868
16864
  return /*#__PURE__*/React__default["default"].createElement(neetoui.DatePicker, _extends$6({
16869
16865
  dateFormat: "MMM D, YYYY",
@@ -16910,16 +16906,17 @@ var Choices = function Choices(_ref) {
16910
16906
  active: false
16911
16907
  })
16912
16908
  }, /*#__PURE__*/React__default["default"].createElement(Component, {
16909
+ onChange: onChange,
16910
+ type: type,
16913
16911
  id: option.id,
16914
16912
  label: option.label,
16915
16913
  name: isCheckBox ? "".concat(name, ".").concat(index) : name,
16916
- type: type,
16917
16914
  value: option.id,
16918
- checked: isCheckBox ? (_value$index = value === null || value === void 0 ? void 0 : value[index]) !== null && _value$index !== void 0 ? _value$index : false : value === option.id,
16919
- onChange: onChange
16915
+ checked: isCheckBox ? (_value$index = value === null || value === void 0 ? void 0 : value[index]) !== null && _value$index !== void 0 ? _value$index : false : value === option.id
16920
16916
  }));
16921
16917
  })), !!error && typeof error === "string" && /*#__PURE__*/React__default["default"].createElement("p", {
16922
- className: "neeto-form-engine-input__error"
16918
+ className: "neeto-form-engine-input__error",
16919
+ "data-cy": "neeto-form-engine-".concat(type, "-error")
16923
16920
  }, error));
16924
16921
  };
16925
16922
  var Choices$1 = /*#__PURE__*/React__default["default"].memo(Choices);
@@ -17014,7 +17011,7 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
17014
17011
  });
17015
17012
  };
17016
17013
 
17017
- var _excluded$2 = ["name", "label", "error", "lowestRatingLabel", "averageRatingLabel", "highestRatingLabel", "value"];
17014
+ var _excluded$3 = ["name", "label", "error", "lowestRatingLabel", "averageRatingLabel", "highestRatingLabel", "value"];
17018
17015
  var Rating = function Rating(_ref) {
17019
17016
  var name = _ref.name,
17020
17017
  label = _ref.label,
@@ -17023,7 +17020,7 @@ var Rating = function Rating(_ref) {
17023
17020
  averageRatingLabel = _ref.averageRatingLabel,
17024
17021
  highestRatingLabel = _ref.highestRatingLabel,
17025
17022
  value = _ref.value,
17026
- other = _objectWithoutProperties(_ref, _excluded$2);
17023
+ other = _objectWithoutProperties(_ref, _excluded$3);
17027
17024
  var handleClick = function handleClick(e) {
17028
17025
  return e.currentTarget.nextElementSibling.click();
17029
17026
  };
@@ -17044,9 +17041,9 @@ var Rating = function Rating(_ref) {
17044
17041
  }, /*#__PURE__*/React__default["default"].createElement(Icon, null), /*#__PURE__*/React__default["default"].createElement("label", {
17045
17042
  className: "neeto-form-engine-label"
17046
17043
  }, labels[index])), /*#__PURE__*/React__default["default"].createElement("input", _extends$6({
17044
+ name: name,
17047
17045
  hidden: true,
17048
17046
  checked: rating === value,
17049
- name: name,
17050
17047
  type: "radio",
17051
17048
  value: rating
17052
17049
  }, other)));
@@ -17059,7 +17056,8 @@ var Rating = function Rating(_ref) {
17059
17056
  }, label), /*#__PURE__*/React__default["default"].createElement("div", {
17060
17057
  className: "neeto-form-engine-rating__row"
17061
17058
  }, render()), !!error && typeof error === "string" && /*#__PURE__*/React__default["default"].createElement("p", {
17062
- className: "neeto-form-engine-input__error"
17059
+ className: "neeto-form-engine-input__error",
17060
+ "data-cy": "neeto-form-engine-rating-error"
17063
17061
  }, error));
17064
17062
  };
17065
17063
  var Rating$1 = /*#__PURE__*/React__default["default"].memo(Rating);
@@ -17098,8 +17096,11 @@ var RatingField = function RatingField(_ref) {
17098
17096
  var RichTextEditor = function RichTextEditor(_ref) {
17099
17097
  var editorRef = _ref.editorRef,
17100
17098
  question = _ref.question,
17099
+ preview = _ref.preview,
17101
17100
  _ref$editorProps = _ref.editorProps,
17102
17101
  editorProps = _ref$editorProps === void 0 ? {} : _ref$editorProps;
17102
+ var _useFormikContext = formik.useFormikContext(),
17103
+ errors = _useFormikContext.errors;
17103
17104
  var name = question.id,
17104
17105
  kind = question.kind,
17105
17106
  label = question.label,
@@ -17113,18 +17114,18 @@ var RichTextEditor = function RichTextEditor(_ref) {
17113
17114
  className: "neeto-form-engine-input__label-wrapper"
17114
17115
  }, label && /*#__PURE__*/React__default["default"].createElement("label", {
17115
17116
  className: "neeto-form-engine-label"
17116
- }, getLabel$1(label, isRequired))), /*#__PURE__*/React__default["default"].createElement(formik.FastField, {
17117
+ }, getLabel$1(label, isRequired))), /*#__PURE__*/React__default["default"].createElement(formik.FastField, _extends$6({
17117
17118
  debouncedPlaceholder: debouncedPlaceholder,
17119
+ error: errors[name],
17118
17120
  name: name || nodeId,
17119
17121
  validate: validateFieldValue({
17120
17122
  kind: kind,
17121
17123
  label: label,
17122
17124
  isRequired: isRequired
17123
- }),
17124
- shouldUpdate: function shouldUpdate(nextProps, prevProps) {
17125
- return nextProps.debouncedPlaceholder !== prevProps.debouncedPlaceholder;
17126
- }
17127
- }, function (_ref2) {
17125
+ })
17126
+ }, preview && {
17127
+ shouldUpdate: isPropsUnequal(["debouncedPlaceholder", "error"])
17128
+ }), function (_ref2) {
17128
17129
  var field = _ref2.field,
17129
17130
  form = _ref2.form,
17130
17131
  meta = _ref2.meta;
@@ -17146,8 +17147,7 @@ var RichTextEditor = function RichTextEditor(_ref) {
17146
17147
  }));
17147
17148
  };
17148
17149
 
17149
- var _excluded$1 = ["value", "shape", "label", "rating", "count"],
17150
- _excluded2 = ["label", "count", "shape", "error"];
17150
+ var _excluded$2 = ["value", "shape", "label", "rating", "count"];
17151
17151
  var RatingButton = function RatingButton(_ref) {
17152
17152
  var _ref$value = _ref.value,
17153
17153
  value = _ref$value === void 0 ? "0" : _ref$value,
@@ -17155,7 +17155,7 @@ var RatingButton = function RatingButton(_ref) {
17155
17155
  label = _ref.label,
17156
17156
  rating = _ref.rating,
17157
17157
  count = _ref.count,
17158
- otherProps = _objectWithoutProperties(_ref, _excluded$1);
17158
+ otherProps = _objectWithoutProperties(_ref, _excluded$2);
17159
17159
  var handleClick = function handleClick(e) {
17160
17160
  return e.currentTarget.nextElementSibling.click();
17161
17161
  };
@@ -17181,12 +17181,15 @@ var RatingButton = function RatingButton(_ref) {
17181
17181
  value: "".concat(rating, " / ").concat(count)
17182
17182
  }, otherProps)));
17183
17183
  };
17184
- var StarRating = function StarRating(_ref2) {
17185
- var label = _ref2.label,
17186
- count = _ref2.count,
17187
- shape = _ref2.shape,
17188
- error = _ref2.error,
17189
- props = _objectWithoutProperties(_ref2, _excluded2);
17184
+ var RatingButton$1 = /*#__PURE__*/React__default["default"].memo(RatingButton);
17185
+
17186
+ var _excluded$1 = ["label", "count", "shape", "error"];
17187
+ var StarRating = function StarRating(_ref) {
17188
+ var label = _ref.label,
17189
+ count = _ref.count,
17190
+ shape = _ref.shape,
17191
+ error = _ref.error,
17192
+ props = _objectWithoutProperties(_ref, _excluded$1);
17190
17193
  return /*#__PURE__*/React__default["default"].createElement("div", {
17191
17194
  className: "neeto-form-engine-input__wrapper neeto-form-engine-star-rating"
17192
17195
  }, /*#__PURE__*/React__default["default"].createElement("div", {
@@ -17196,15 +17199,16 @@ var StarRating = function StarRating(_ref2) {
17196
17199
  }, label)), /*#__PURE__*/React__default["default"].createElement("div", {
17197
17200
  className: "neeto-form-engine-star-rating__row"
17198
17201
  }, ramda.times(function (index) {
17199
- return /*#__PURE__*/React__default["default"].createElement(RatingButton, _extends$6({
17202
+ return /*#__PURE__*/React__default["default"].createElement(RatingButton$1, _extends$6({
17200
17203
  count: count,
17204
+ shape: shape,
17201
17205
  key: index,
17202
17206
  label: index + 1,
17203
- rating: index + 1,
17204
- shape: shape
17207
+ rating: index + 1
17205
17208
  }, props));
17206
17209
  }, count)), !!error && typeof error === "string" && /*#__PURE__*/React__default["default"].createElement("p", {
17207
- className: "neeto-form-engine-input__error"
17210
+ className: "neeto-form-engine-input__error",
17211
+ "data-cy": "neeto-form-engine-star-rating-error"
17208
17212
  }, error));
17209
17213
  };
17210
17214
  var StarRating$1 = /*#__PURE__*/React__default["default"].memo(StarRating);
@@ -17251,17 +17255,18 @@ var Terms = function Terms(_ref, ref) {
17251
17255
  }, /*#__PURE__*/React__default["default"].createElement("div", {
17252
17256
  className: "neeto-form-engine-choice"
17253
17257
  }, /*#__PURE__*/React__default["default"].createElement("input", _extends$6({
17258
+ name: name,
17259
+ ref: ref,
17260
+ value: value,
17254
17261
  required: true,
17255
17262
  "aria-invalid": !!error,
17256
17263
  id: "terms-and-condition",
17257
- name: name,
17258
- ref: ref,
17259
- type: "checkbox",
17260
- value: value
17264
+ type: "checkbox"
17261
17265
  }, otherProps)), /*#__PURE__*/React__default["default"].createElement(neetoEditor.EditorContent, {
17262
17266
  content: label
17263
17267
  })), !!error && typeof error === "string" && /*#__PURE__*/React__default["default"].createElement("p", {
17264
- className: "neeto-form-engine-input__error"
17268
+ className: "neeto-form-engine-input__error",
17269
+ "data-cy": "neeto-form-engine-terms-error"
17265
17270
  }, error));
17266
17271
  };
17267
17272
  var Terms$1 = /*#__PURE__*/React$2.memo( /*#__PURE__*/React$2.forwardRef(Terms));
@@ -17355,6 +17360,11 @@ var getFieldComponent = function getFieldComponent(_ref) {
17355
17360
  return null;
17356
17361
  };
17357
17362
  };
17363
+ var isPropsUnequal = function isPropsUnequal(props) {
17364
+ return function (nextProps, prevProps) {
17365
+ return neetoCist.notEqualsDeep(ramda.pick(props, nextProps), ramda.pick(props, prevProps));
17366
+ };
17367
+ };
17358
17368
 
17359
17369
  var _path, _defs;
17360
17370
  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); }
@@ -17684,10 +17694,10 @@ var ExternalForm = function ExternalForm(_ref) {
17684
17694
  style: "h4",
17685
17695
  weight: "semibold"
17686
17696
  }, titleProps), formTitle || title)), /*#__PURE__*/React__default["default"].createElement(formik.Formik, {
17697
+ onSubmit: onSubmit,
17687
17698
  enableReinitialize: true,
17688
17699
  innerRef: formikInnerRef,
17689
- initialValues: generateInitValues(questions, submission === null || submission === void 0 ? void 0 : submission.responses, preserveValues ? localValues : initialValues),
17690
- onSubmit: onSubmit
17700
+ initialValues: generateInitValues(questions, submission === null || submission === void 0 ? void 0 : submission.responses, preserveValues ? localValues : initialValues)
17691
17701
  }, function (_ref5) {
17692
17702
  var isSubmitting = _ref5.isSubmitting,
17693
17703
  errors = _ref5.errors,
@@ -17704,24 +17714,24 @@ var ExternalForm = function ExternalForm(_ref) {
17704
17714
  ref: mergeRefs(formRef, keyPressRef),
17705
17715
  className: classnames__default["default"]("neeto-form-engine-form relative space-y-4", _defineProperty$6({}, className, className)),
17706
17716
  onChange: function onChange(event) {
17707
- if (!ramda.isEmpty(errors)) {
17708
- setFieldError(event.target.name, "");
17709
- }
17717
+ if (ramda.isEmpty(errors)) return;
17718
+ setFieldError(event.target.name, "");
17710
17719
  }
17711
17720
  }, formDomProps, {
17712
17721
  onReset: function onReset(e) {
17713
17722
  return _onReset(e, handleReset);
17714
17723
  }
17715
17724
  }), (submission === null || submission === void 0 ? void 0 : submission.isLoading) && /*#__PURE__*/React__default["default"].createElement("div", {
17716
- className: "neeto-ui-bg-gray-100 absolute top-0 left-0 right-0 bottom-0 flex items-center justify-center opacity-75"
17725
+ className: "neeto-ui-bg-gray-100 absolute bottom-0 left-0 right-0 top-0 flex items-center justify-center opacity-75"
17717
17726
  }, /*#__PURE__*/React__default["default"].createElement(neetoui.Spinner, null)), renderedQuestions.map(function (question) {
17718
17727
  var _question$id;
17719
17728
  var FieldComponent = getFieldComponent(question);
17720
17729
  return /*#__PURE__*/React__default["default"].createElement(FieldComponent, {
17721
- customValidator: customValidator === null || customValidator === void 0 ? void 0 : customValidator(question),
17722
- editorRef: editorRef,
17723
17730
  editorProps: editorProps,
17731
+ editorRef: editorRef,
17732
+ preview: preview,
17724
17733
  question: question,
17734
+ customValidator: customValidator === null || customValidator === void 0 ? void 0 : customValidator(question),
17725
17735
  key: (_question$id = question.id) !== null && _question$id !== void 0 ? _question$id : question.nodeId,
17726
17736
  showPrefixIcon: showPrefixIcons
17727
17737
  });