@bigbinary/neeto-form-frontend 1.2.8 → 1.2.10

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,
@@ -11857,10 +11858,14 @@ var Editor = function Editor(_ref) {
11857
11858
  return /*#__PURE__*/React__default["default"].createElement("div", {
11858
11859
  className: "w-full cursor-auto"
11859
11860
  }, /*#__PURE__*/React__default["default"].createElement(neetoEditor.Editor, {
11860
- disabled: isLabelDisabled,
11861
11861
  error: error,
11862
+ className: "px-2 pb-2",
11863
+ contentClassName: "border-none",
11864
+ disabled: isLabelDisabled,
11865
+ errorWrapperClassName: "border-none",
11862
11866
  id: "editor",
11863
11867
  initialValue: value,
11868
+ menuClassName: "border-none",
11864
11869
  name: fieldName,
11865
11870
  ref: editorRef,
11866
11871
  onChange: function onChange(text) {
@@ -12401,7 +12406,7 @@ var List = function List(_ref) {
12401
12406
  })))));
12402
12407
  };
12403
12408
 
12404
- var _excluded$6 = ["questionKinds", "showAddQuestionDivider", "onValueChange", "showActionBlock", "formId", "isDeletable", "isRequiredField", "submitButtonProps", "cancelButtonProps", "isKindAlreadyActive", "getActiveKindDetails", "kindUniqueOn", "isDisabledFieldLabel", "disabledAddButtonTooltipProps"];
12409
+ var _excluded$7 = ["questionKinds", "showAddQuestionDivider", "onValueChange", "showActionBlock", "formId", "isDeletable", "isRequiredField", "submitButtonProps", "cancelButtonProps", "isKindAlreadyActive", "getActiveKindDetails", "kindUniqueOn", "isDisabledFieldLabel", "disabledAddButtonTooltipProps"];
12405
12410
  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
12411
  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
12412
  var Form = function Form(_ref) {
@@ -12420,7 +12425,7 @@ var Form = function Form(_ref) {
12420
12425
  kindUniqueOn = _ref.kindUniqueOn,
12421
12426
  isDisabledFieldLabel = _ref.isDisabledFieldLabel,
12422
12427
  disabledAddButtonTooltipProps = _ref.disabledAddButtonTooltipProps,
12423
- formDomProps = _objectWithoutProperties(_ref, _excluded$6);
12428
+ formDomProps = _objectWithoutProperties(_ref, _excluded$7);
12424
12429
  var _useTranslation = reactI18next.useTranslation(),
12425
12430
  t = _useTranslation.t;
12426
12431
  var _useState = React$2.useState({}),
@@ -13185,7 +13190,7 @@ var Spinner = function Spinner(_ref) {
13185
13190
  };
13186
13191
  var Spinner$1 = /*#__PURE__*/React__default["default"].memo(Spinner);
13187
13192
 
13188
- var _excluded$5 = ["label", "loading", "success", "className"];
13193
+ var _excluded$6 = ["label", "loading", "success", "className"];
13189
13194
  var Button = function Button(_ref) {
13190
13195
  var label = _ref.label,
13191
13196
  _ref$loading = _ref.loading,
@@ -13194,7 +13199,7 @@ var Button = function Button(_ref) {
13194
13199
  success = _ref$success === void 0 ? false : _ref$success,
13195
13200
  _ref$className = _ref.className,
13196
13201
  className = _ref$className === void 0 ? "" : _ref$className,
13197
- otherProps = _objectWithoutProperties(_ref, _excluded$5);
13202
+ otherProps = _objectWithoutProperties(_ref, _excluded$6);
13198
13203
  return /*#__PURE__*/React__default["default"].createElement("button", _extends$6({
13199
13204
  className: classnames__default["default"]("neeto-form-engine-button", className)
13200
13205
  }, otherProps), loading && /*#__PURE__*/React__default["default"].createElement(ButtonLoader, null), success && /*#__PURE__*/React__default["default"].createElement(Success$2, null), label);
@@ -13414,12 +13419,10 @@ var validateStarRatingField = function validateStarRatingField(_ref5) {
13414
13419
  return schema.trim();
13415
13420
  };
13416
13421
  var validateTermsField = function validateTermsField() {
13417
- var schema = yup__namespace["boolean"]().oneOf([true], i18next.t("neetoForm.common.mustAcceptTermsAndConditions"));
13418
- return schema;
13422
+ return yup__namespace["boolean"]().oneOf([true], i18next.t("neetoForm.common.mustAcceptTermsAndConditions"));
13419
13423
  };
13420
13424
  var validateConditionField = function validateConditionField() {
13421
- var schema = yup__namespace["boolean"]().oneOf([true], i18next.t("neetoForm.common.mustAcceptCondition"));
13422
- return schema;
13425
+ return yup__namespace["boolean"]().oneOf([true], i18next.t("neetoForm.common.mustAcceptCondition"));
13423
13426
  };
13424
13427
  var validateDateField = function validateDateField(_ref6) {
13425
13428
  var label = _ref6.label,
@@ -13451,53 +13454,49 @@ var validateRichTextField = function validateRichTextField(_ref8) {
13451
13454
  }
13452
13455
  return schema.trim();
13453
13456
  };
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);
13457
+ 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
13458
  var validateFieldValue = function validateFieldValue(_ref9) {
13456
13459
  var kind = _ref9.kind,
13457
13460
  label = _ref9.label,
13458
13461
  isRequired = _ref9.isRequired,
13459
13462
  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
- });
13463
+ return function (value) {
13464
+ if (!(kind in fieldKindValidatorMap)) return;
13465
+ var validator = fieldKindValidatorMap[kind];
13466
+ var schema = customValidator || validator({
13467
+ kind: kind,
13468
+ label: label,
13469
+ isRequired: isRequired
13470
+ });
13470
13471
 
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
- );
13472
+ // eslint-disable-next-line consistent-return, no-async-promise-executor
13473
+ return new Promise( /*#__PURE__*/function () {
13474
+ var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(resolve) {
13475
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
13476
+ while (1) switch (_context.prev = _context.next) {
13477
+ case 0:
13478
+ _context.prev = 0;
13479
+ _context.next = 3;
13480
+ return schema.validate(value);
13481
+ case 3:
13482
+ resolve(undefined);
13483
+ _context.next = 9;
13484
+ break;
13485
+ case 6:
13486
+ _context.prev = 6;
13487
+ _context.t0 = _context["catch"](0);
13488
+ resolve(_context.t0.message);
13489
+ case 9:
13490
+ case "end":
13491
+ return _context.stop();
13492
+ }
13493
+ }, _callee, null, [[0, 6]]);
13494
+ }));
13495
+ return function (_x) {
13496
+ return _ref10.apply(this, arguments);
13497
+ };
13498
+ }());
13499
+ };
13501
13500
  };
13502
13501
 
13503
13502
  var MultipleEmailInput = function MultipleEmailInput(_ref) {
@@ -13554,30 +13553,31 @@ var MultipleEmailInput = function MultipleEmailInput(_ref) {
13554
13553
  })));
13555
13554
  };
13556
13555
 
13557
- var _excluded$4 = ["name", "label", "error", "value"];
13556
+ var _excluded$5 = ["name", "label", "error", "value"];
13558
13557
  var Condition = function Condition(_ref, ref) {
13559
13558
  var name = _ref.name,
13560
13559
  label = _ref.label,
13561
13560
  error = _ref.error,
13562
13561
  value = _ref.value,
13563
- otherProps = _objectWithoutProperties(_ref, _excluded$4);
13562
+ otherProps = _objectWithoutProperties(_ref, _excluded$5);
13564
13563
  return /*#__PURE__*/React__default["default"].createElement("div", {
13565
13564
  className: "neeto-form-engine-terms"
13566
13565
  }, /*#__PURE__*/React__default["default"].createElement("div", {
13567
13566
  className: "neeto-form-engine-choice"
13568
13567
  }, /*#__PURE__*/React__default["default"].createElement("input", _extends$6({
13568
+ name: name,
13569
+ ref: ref,
13570
+ value: value,
13569
13571
  required: true,
13570
13572
  "aria-invalid": !!error,
13571
13573
  id: "condition-".concat(name),
13572
- name: name,
13573
- ref: ref,
13574
- type: "checkbox",
13575
- value: value
13574
+ type: "checkbox"
13576
13575
  }, otherProps)), /*#__PURE__*/React__default["default"].createElement("label", {
13577
13576
  className: "neeto-form-engine-label font-normal",
13578
13577
  htmlFor: "condition-".concat(name)
13579
13578
  }, label)), !!error && typeof error === "string" && /*#__PURE__*/React__default["default"].createElement("p", {
13580
- className: "neeto-form-engine-input__error"
13579
+ className: "neeto-form-engine-input__error",
13580
+ "data-cy": "neeto-form-engine-condition-error"
13581
13581
  }, error));
13582
13582
  };
13583
13583
  var Condition$1 = /*#__PURE__*/React$2.memo( /*#__PURE__*/React$2.forwardRef(Condition));
@@ -16819,7 +16819,7 @@ var ConditionField = function ConditionField(_ref) {
16819
16819
  });
16820
16820
  };
16821
16821
 
16822
- var _excluded$3 = ["value"];
16822
+ var _excluded$4 = ["value"];
16823
16823
  dayjs__default["default"].extend(weekOfYear__default["default"]);
16824
16824
  dayjs__default["default"].extend(weekday__default["default"]);
16825
16825
  dayjs__default["default"].extend(localeData__default["default"]);
@@ -16863,7 +16863,7 @@ var DateField = function DateField(_ref) {
16863
16863
  var meta = _ref2.meta,
16864
16864
  _ref2$field = _ref2.field,
16865
16865
  value = _ref2$field.value,
16866
- field = _objectWithoutProperties(_ref2$field, _excluded$3),
16866
+ field = _objectWithoutProperties(_ref2$field, _excluded$4),
16867
16867
  form = _ref2.form;
16868
16868
  return /*#__PURE__*/React__default["default"].createElement(neetoui.DatePicker, _extends$6({
16869
16869
  dateFormat: "MMM D, YYYY",
@@ -16910,16 +16910,17 @@ var Choices = function Choices(_ref) {
16910
16910
  active: false
16911
16911
  })
16912
16912
  }, /*#__PURE__*/React__default["default"].createElement(Component, {
16913
+ onChange: onChange,
16914
+ type: type,
16913
16915
  id: option.id,
16914
16916
  label: option.label,
16915
16917
  name: isCheckBox ? "".concat(name, ".").concat(index) : name,
16916
- type: type,
16917
16918
  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
16919
+ 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
16920
  }));
16921
16921
  })), !!error && typeof error === "string" && /*#__PURE__*/React__default["default"].createElement("p", {
16922
- className: "neeto-form-engine-input__error"
16922
+ className: "neeto-form-engine-input__error",
16923
+ "data-cy": "neeto-form-engine-".concat(type, "-error")
16923
16924
  }, error));
16924
16925
  };
16925
16926
  var Choices$1 = /*#__PURE__*/React__default["default"].memo(Choices);
@@ -17014,7 +17015,7 @@ var PhoneNumberField = function PhoneNumberField(_ref) {
17014
17015
  });
17015
17016
  };
17016
17017
 
17017
- var _excluded$2 = ["name", "label", "error", "lowestRatingLabel", "averageRatingLabel", "highestRatingLabel", "value"];
17018
+ var _excluded$3 = ["name", "label", "error", "lowestRatingLabel", "averageRatingLabel", "highestRatingLabel", "value"];
17018
17019
  var Rating = function Rating(_ref) {
17019
17020
  var name = _ref.name,
17020
17021
  label = _ref.label,
@@ -17023,7 +17024,7 @@ var Rating = function Rating(_ref) {
17023
17024
  averageRatingLabel = _ref.averageRatingLabel,
17024
17025
  highestRatingLabel = _ref.highestRatingLabel,
17025
17026
  value = _ref.value,
17026
- other = _objectWithoutProperties(_ref, _excluded$2);
17027
+ other = _objectWithoutProperties(_ref, _excluded$3);
17027
17028
  var handleClick = function handleClick(e) {
17028
17029
  return e.currentTarget.nextElementSibling.click();
17029
17030
  };
@@ -17044,9 +17045,9 @@ var Rating = function Rating(_ref) {
17044
17045
  }, /*#__PURE__*/React__default["default"].createElement(Icon, null), /*#__PURE__*/React__default["default"].createElement("label", {
17045
17046
  className: "neeto-form-engine-label"
17046
17047
  }, labels[index])), /*#__PURE__*/React__default["default"].createElement("input", _extends$6({
17048
+ name: name,
17047
17049
  hidden: true,
17048
17050
  checked: rating === value,
17049
- name: name,
17050
17051
  type: "radio",
17051
17052
  value: rating
17052
17053
  }, other)));
@@ -17059,7 +17060,8 @@ var Rating = function Rating(_ref) {
17059
17060
  }, label), /*#__PURE__*/React__default["default"].createElement("div", {
17060
17061
  className: "neeto-form-engine-rating__row"
17061
17062
  }, render()), !!error && typeof error === "string" && /*#__PURE__*/React__default["default"].createElement("p", {
17062
- className: "neeto-form-engine-input__error"
17063
+ className: "neeto-form-engine-input__error",
17064
+ "data-cy": "neeto-form-engine-rating-error"
17063
17065
  }, error));
17064
17066
  };
17065
17067
  var Rating$1 = /*#__PURE__*/React__default["default"].memo(Rating);
@@ -17098,8 +17100,11 @@ var RatingField = function RatingField(_ref) {
17098
17100
  var RichTextEditor = function RichTextEditor(_ref) {
17099
17101
  var editorRef = _ref.editorRef,
17100
17102
  question = _ref.question,
17103
+ preview = _ref.preview,
17101
17104
  _ref$editorProps = _ref.editorProps,
17102
17105
  editorProps = _ref$editorProps === void 0 ? {} : _ref$editorProps;
17106
+ var _useFormikContext = formik.useFormikContext(),
17107
+ errors = _useFormikContext.errors;
17103
17108
  var name = question.id,
17104
17109
  kind = question.kind,
17105
17110
  label = question.label,
@@ -17113,18 +17118,18 @@ var RichTextEditor = function RichTextEditor(_ref) {
17113
17118
  className: "neeto-form-engine-input__label-wrapper"
17114
17119
  }, label && /*#__PURE__*/React__default["default"].createElement("label", {
17115
17120
  className: "neeto-form-engine-label"
17116
- }, getLabel$1(label, isRequired))), /*#__PURE__*/React__default["default"].createElement(formik.FastField, {
17121
+ }, getLabel$1(label, isRequired))), /*#__PURE__*/React__default["default"].createElement(formik.FastField, _extends$6({
17117
17122
  debouncedPlaceholder: debouncedPlaceholder,
17123
+ error: errors[name],
17118
17124
  name: name || nodeId,
17119
17125
  validate: validateFieldValue({
17120
17126
  kind: kind,
17121
17127
  label: label,
17122
17128
  isRequired: isRequired
17123
- }),
17124
- shouldUpdate: function shouldUpdate(nextProps, prevProps) {
17125
- return nextProps.debouncedPlaceholder !== prevProps.debouncedPlaceholder;
17126
- }
17127
- }, function (_ref2) {
17129
+ })
17130
+ }, preview && {
17131
+ shouldUpdate: isPropsUnequal(["debouncedPlaceholder", "error"])
17132
+ }), function (_ref2) {
17128
17133
  var field = _ref2.field,
17129
17134
  form = _ref2.form,
17130
17135
  meta = _ref2.meta;
@@ -17146,8 +17151,7 @@ var RichTextEditor = function RichTextEditor(_ref) {
17146
17151
  }));
17147
17152
  };
17148
17153
 
17149
- var _excluded$1 = ["value", "shape", "label", "rating", "count"],
17150
- _excluded2 = ["label", "count", "shape", "error"];
17154
+ var _excluded$2 = ["value", "shape", "label", "rating", "count"];
17151
17155
  var RatingButton = function RatingButton(_ref) {
17152
17156
  var _ref$value = _ref.value,
17153
17157
  value = _ref$value === void 0 ? "0" : _ref$value,
@@ -17155,7 +17159,7 @@ var RatingButton = function RatingButton(_ref) {
17155
17159
  label = _ref.label,
17156
17160
  rating = _ref.rating,
17157
17161
  count = _ref.count,
17158
- otherProps = _objectWithoutProperties(_ref, _excluded$1);
17162
+ otherProps = _objectWithoutProperties(_ref, _excluded$2);
17159
17163
  var handleClick = function handleClick(e) {
17160
17164
  return e.currentTarget.nextElementSibling.click();
17161
17165
  };
@@ -17181,12 +17185,15 @@ var RatingButton = function RatingButton(_ref) {
17181
17185
  value: "".concat(rating, " / ").concat(count)
17182
17186
  }, otherProps)));
17183
17187
  };
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);
17188
+ var RatingButton$1 = /*#__PURE__*/React__default["default"].memo(RatingButton);
17189
+
17190
+ var _excluded$1 = ["label", "count", "shape", "error"];
17191
+ var StarRating = function StarRating(_ref) {
17192
+ var label = _ref.label,
17193
+ count = _ref.count,
17194
+ shape = _ref.shape,
17195
+ error = _ref.error,
17196
+ props = _objectWithoutProperties(_ref, _excluded$1);
17190
17197
  return /*#__PURE__*/React__default["default"].createElement("div", {
17191
17198
  className: "neeto-form-engine-input__wrapper neeto-form-engine-star-rating"
17192
17199
  }, /*#__PURE__*/React__default["default"].createElement("div", {
@@ -17196,15 +17203,16 @@ var StarRating = function StarRating(_ref2) {
17196
17203
  }, label)), /*#__PURE__*/React__default["default"].createElement("div", {
17197
17204
  className: "neeto-form-engine-star-rating__row"
17198
17205
  }, ramda.times(function (index) {
17199
- return /*#__PURE__*/React__default["default"].createElement(RatingButton, _extends$6({
17206
+ return /*#__PURE__*/React__default["default"].createElement(RatingButton$1, _extends$6({
17200
17207
  count: count,
17208
+ shape: shape,
17201
17209
  key: index,
17202
17210
  label: index + 1,
17203
- rating: index + 1,
17204
- shape: shape
17211
+ rating: index + 1
17205
17212
  }, props));
17206
17213
  }, count)), !!error && typeof error === "string" && /*#__PURE__*/React__default["default"].createElement("p", {
17207
- className: "neeto-form-engine-input__error"
17214
+ className: "neeto-form-engine-input__error",
17215
+ "data-cy": "neeto-form-engine-star-rating-error"
17208
17216
  }, error));
17209
17217
  };
17210
17218
  var StarRating$1 = /*#__PURE__*/React__default["default"].memo(StarRating);
@@ -17251,17 +17259,18 @@ var Terms = function Terms(_ref, ref) {
17251
17259
  }, /*#__PURE__*/React__default["default"].createElement("div", {
17252
17260
  className: "neeto-form-engine-choice"
17253
17261
  }, /*#__PURE__*/React__default["default"].createElement("input", _extends$6({
17262
+ name: name,
17263
+ ref: ref,
17264
+ value: value,
17254
17265
  required: true,
17255
17266
  "aria-invalid": !!error,
17256
17267
  id: "terms-and-condition",
17257
- name: name,
17258
- ref: ref,
17259
- type: "checkbox",
17260
- value: value
17268
+ type: "checkbox"
17261
17269
  }, otherProps)), /*#__PURE__*/React__default["default"].createElement(neetoEditor.EditorContent, {
17262
17270
  content: label
17263
17271
  })), !!error && typeof error === "string" && /*#__PURE__*/React__default["default"].createElement("p", {
17264
- className: "neeto-form-engine-input__error"
17272
+ className: "neeto-form-engine-input__error",
17273
+ "data-cy": "neeto-form-engine-terms-error"
17265
17274
  }, error));
17266
17275
  };
17267
17276
  var Terms$1 = /*#__PURE__*/React$2.memo( /*#__PURE__*/React$2.forwardRef(Terms));
@@ -17355,6 +17364,11 @@ var getFieldComponent = function getFieldComponent(_ref) {
17355
17364
  return null;
17356
17365
  };
17357
17366
  };
17367
+ var isPropsUnequal = function isPropsUnequal(props) {
17368
+ return function (nextProps, prevProps) {
17369
+ return neetoCist.notEqualsDeep(ramda.pick(props, nextProps), ramda.pick(props, prevProps));
17370
+ };
17371
+ };
17358
17372
 
17359
17373
  var _path, _defs;
17360
17374
  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 +17698,10 @@ var ExternalForm = function ExternalForm(_ref) {
17684
17698
  style: "h4",
17685
17699
  weight: "semibold"
17686
17700
  }, titleProps), formTitle || title)), /*#__PURE__*/React__default["default"].createElement(formik.Formik, {
17701
+ onSubmit: onSubmit,
17687
17702
  enableReinitialize: true,
17688
17703
  innerRef: formikInnerRef,
17689
- initialValues: generateInitValues(questions, submission === null || submission === void 0 ? void 0 : submission.responses, preserveValues ? localValues : initialValues),
17690
- onSubmit: onSubmit
17704
+ initialValues: generateInitValues(questions, submission === null || submission === void 0 ? void 0 : submission.responses, preserveValues ? localValues : initialValues)
17691
17705
  }, function (_ref5) {
17692
17706
  var isSubmitting = _ref5.isSubmitting,
17693
17707
  errors = _ref5.errors,
@@ -17704,24 +17718,24 @@ var ExternalForm = function ExternalForm(_ref) {
17704
17718
  ref: mergeRefs(formRef, keyPressRef),
17705
17719
  className: classnames__default["default"]("neeto-form-engine-form relative space-y-4", _defineProperty$6({}, className, className)),
17706
17720
  onChange: function onChange(event) {
17707
- if (!ramda.isEmpty(errors)) {
17708
- setFieldError(event.target.name, "");
17709
- }
17721
+ if (ramda.isEmpty(errors)) return;
17722
+ setFieldError(event.target.name, "");
17710
17723
  }
17711
17724
  }, formDomProps, {
17712
17725
  onReset: function onReset(e) {
17713
17726
  return _onReset(e, handleReset);
17714
17727
  }
17715
17728
  }), (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"
17729
+ className: "neeto-ui-bg-gray-100 absolute bottom-0 left-0 right-0 top-0 flex items-center justify-center opacity-75"
17717
17730
  }, /*#__PURE__*/React__default["default"].createElement(neetoui.Spinner, null)), renderedQuestions.map(function (question) {
17718
17731
  var _question$id;
17719
17732
  var FieldComponent = getFieldComponent(question);
17720
17733
  return /*#__PURE__*/React__default["default"].createElement(FieldComponent, {
17721
- customValidator: customValidator === null || customValidator === void 0 ? void 0 : customValidator(question),
17722
- editorRef: editorRef,
17723
17734
  editorProps: editorProps,
17735
+ editorRef: editorRef,
17736
+ preview: preview,
17724
17737
  question: question,
17738
+ customValidator: customValidator === null || customValidator === void 0 ? void 0 : customValidator(question),
17725
17739
  key: (_question$id = question.id) !== null && _question$id !== void 0 ? _question$id : question.nodeId,
17726
17740
  showPrefixIcon: showPrefixIcons
17727
17741
  });