@bigbinary/neeto-form-frontend 3.1.0 → 3.2.1

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.js CHANGED
@@ -1,19 +1,19 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import * as React$2 from 'react';
3
- import React__default, { memo, useState, createElement, useRef, useEffect, useCallback, Fragment as Fragment$1 } from 'react';
3
+ import React__default, { memo, useState, createElement, useRef, useEffect, useImperativeHandle, useCallback, Fragment as Fragment$1 } from 'react';
4
4
  import { useQuery, useQueryClient, useMutation, keepPreviousData } from '@tanstack/react-query';
5
5
  import classnames from 'classnames';
6
6
  import { useFormikContext, useField, FieldArray, Form as Form$3, Formik, Field, FastField } from 'formik';
7
- import { filterNonNull, noop, findBy, toLabelAndValue, isPresent, truncate, slugify, filterBy, hyphenate, removeBy, isNotPresent, isNotEmpty, findById, notEqualsDeep } from '@bigbinary/neeto-cist';
7
+ import { filterNonNull, noop, findBy, toLabelAndValue, isPresent, truncate, slugify, filterBy, hyphenate, removeBy, isNotPresent, isNotEmpty, findById, getRandomInt, randomPick, notEqualsDeep } from '@bigbinary/neeto-cist';
8
8
  import { buildUrl, showThumbsUpToastr, withEventTargetValue, getQueryParams, dateFormat } from '@bigbinary/neeto-commons-frontend/utils';
9
9
  import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
10
- import { assoc, mergeLeft, compose, isEmpty, trim, useWith, path, split, isNotNil, either, isNil, values, equals, modify, prop, range, includes, __, reduce, reject, keys, pick, omit, pluck, without, difference, pipe, last, not, toLower, map, clamp, identity, filter } from 'ramda';
10
+ import { assoc, mergeLeft, compose, isEmpty, trim, useWith, path, split, isNotNil, either, isNil, values, equals, modify, prop, range, includes, __, reduce, when, reject, keys, pick, omit, pluck, without, difference, pipe, last, concat, not, toLower, map, clamp, identity, filter } from 'ramda';
11
11
  import i18next, { t as t$3 } from 'i18next';
12
12
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
13
13
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
14
14
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
15
15
  import { DEFAULT_PAGE_INDEX, DEFAULT_PAGE_SIZE } from '@bigbinary/neeto-commons-frontend/constants';
16
- import { useMutationWithInvalidation, withImmutableActions, withT, useStateWithDependency, useOnClickOutside, useDebounce } from '@bigbinary/neeto-commons-frontend/react-utils';
16
+ import { useMutationWithInvalidation, withImmutableActions, isMetaKeyPressed, withT, useStateWithDependency, useOnClickOutside, useUpdateEffect, useDebounce } from '@bigbinary/neeto-commons-frontend/react-utils';
17
17
  import axios from 'axios';
18
18
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
19
19
  import { Droppable, Draggable, DragDropContext } from '@hello-pangea/dnd';
@@ -39,6 +39,7 @@ import Button$1 from '@bigbinary/neetoui/Button';
39
39
  import Accordion from '@bigbinary/neetoui/Accordion';
40
40
  import Input from '@bigbinary/neetoui/formik/Input';
41
41
  import * as yup from 'yup';
42
+ import Radio from '@bigbinary/neetoui/formik/Radio';
42
43
  import Checkbox$1 from '@bigbinary/neetoui/formik/Checkbox';
43
44
  import Checkbox from '@bigbinary/neetoui/Checkbox';
44
45
  import Delete from '@bigbinary/neeto-icons/Delete';
@@ -58,19 +59,22 @@ import { parsePhoneNumber } from 'libphonenumber-js';
58
59
  import EditorContent from '@bigbinary/neeto-editor/EditorContent';
59
60
  import NeetoUIMultiEmailInput from '@bigbinary/neetoui/MultiEmailInput';
60
61
  import { validation, PhoneNumberInput, PhoneNumber } from '@bigbinary/neeto-molecules/PhoneNumber';
62
+ import path$1 from 'path';
63
+ import Refresh from '@bigbinary/neeto-icons/Refresh';
64
+ import Input$1 from '@bigbinary/neetoui/Input';
65
+ import { globalProps } from '@bigbinary/neeto-commons-frontend/initializers';
66
+ import ReCAPTCHA from 'react-google-recaptcha';
61
67
  import localeData from 'dayjs/plugin/localeData';
62
68
  import utc from 'dayjs/plugin/utc';
63
69
  import weekday from 'dayjs/plugin/weekday';
64
70
  import weekOfYear from 'dayjs/plugin/weekOfYear';
65
71
  import DatePicker from '@bigbinary/neetoui/DatePicker';
66
- import path$1 from 'path';
67
- import Input$1 from '@bigbinary/neetoui/Input';
68
72
  import { DirectUpload } from '@rails/activestorage';
69
73
  import { useDropzone } from 'react-dropzone';
70
74
  import FileGeneric from '@bigbinary/neeto-icons/FileGeneric';
71
75
  import { motion } from 'framer-motion';
72
76
  import Select$1 from '@bigbinary/neetoui/Select';
73
- import Radio from '@bigbinary/neetoui/Radio';
77
+ import Radio$1 from '@bigbinary/neetoui/Radio';
74
78
  import Textarea$1 from '@bigbinary/neetoui/Textarea';
75
79
  import { renderToString } from 'react-dom/server';
76
80
 
@@ -382,6 +386,9 @@ var QUESTION_KIND = {
382
386
  },
383
387
  FILE_UPLOAD: {
384
388
  value: "file_upload"
389
+ },
390
+ CAPTCHA: {
391
+ value: "captcha"
385
392
  }
386
393
  };
387
394
  var RATING_VALUES = {
@@ -875,7 +882,12 @@ var QUESTION_TYPES = {
875
882
  STAR_RATING: "star_rating",
876
883
  RATING: "rating",
877
884
  DATE: "date",
878
- FILE_UPLOAD: "file_upload"
885
+ FILE_UPLOAD: "file_upload",
886
+ CAPTCHA: "captcha"
887
+ };
888
+ var CAPTCHA_TYPES = {
889
+ RECAPTCHA_V2: "recaptcha_v2",
890
+ MATH_CAPTCHA: "math_captcha"
879
891
  };
880
892
 
881
893
  var PARAGRAPH$1 = QUESTION_TYPES.PARAGRAPH,
@@ -884,12 +896,14 @@ var PARAGRAPH$1 = QUESTION_TYPES.PARAGRAPH,
884
896
  CHECKBOX$2 = QUESTION_TYPES.CHECKBOX,
885
897
  RADIO$2 = QUESTION_TYPES.RADIO,
886
898
  DROPDOWN$2 = QUESTION_TYPES.DROPDOWN,
887
- FILE_UPLOAD$3 = QUESTION_TYPES.FILE_UPLOAD;
899
+ FILE_UPLOAD$3 = QUESTION_TYPES.FILE_UPLOAD,
900
+ CAPTCHA$3 = QUESTION_TYPES.CAPTCHA;
888
901
  var DEFAULT_AVAILABLE_LANGUAGES = [{
889
902
  code: "en",
890
903
  name: "English"
891
904
  }];
892
- var QUESTIONS_WITHOUT_FIELD_CODE = [PARAGRAPH$1, TERMS_AND_CONDITION$1, CONDITION$1, FILE_UPLOAD$3];
905
+ var MANDATORY_KINDS = [CAPTCHA$3];
906
+ var QUESTIONS_WITHOUT_FIELD_CODE = [PARAGRAPH$1, TERMS_AND_CONDITION$1, CONDITION$1, FILE_UPLOAD$3, CAPTCHA$3];
893
907
  var QUESTIONS_INITIAL_VALUE = {
894
908
  enabled: false,
895
909
  questions: [{
@@ -1174,7 +1188,8 @@ var NAME$1 = QUESTION_TYPES.NAME,
1174
1188
  STAR_RATING$2 = QUESTION_TYPES.STAR_RATING,
1175
1189
  RATING$2 = QUESTION_TYPES.RATING,
1176
1190
  DATE$1 = QUESTION_TYPES.DATE,
1177
- FILE_UPLOAD$2 = QUESTION_TYPES.FILE_UPLOAD;
1191
+ FILE_UPLOAD$2 = QUESTION_TYPES.FILE_UPLOAD,
1192
+ CAPTCHA$2 = QUESTION_TYPES.CAPTCHA;
1178
1193
  var DEFAULT_OPTIONS = new Array(MINIMUM_OPTIONS).fill({
1179
1194
  label: ""
1180
1195
  });
@@ -1331,6 +1346,15 @@ var QUESTION_KINDS = [{
1331
1346
  multipleFilesAllowed: true,
1332
1347
  allowedFileTypes: DEFAULT_ALLOWED_FILE_TYPES
1333
1348
  }
1349
+ }, {
1350
+ type: CAPTCHA$2,
1351
+ label: t$3("neetoForm.fields.captcha"),
1352
+ isSingular: true,
1353
+ defaults: {
1354
+ label: "",
1355
+ isRequired: true,
1356
+ variant: CAPTCHA_TYPES.RECAPTCHA_V2
1357
+ }
1334
1358
  }];
1335
1359
 
1336
1360
  // To show the question type as label in accordion
@@ -1726,6 +1750,9 @@ var arrayHelpers = {
1726
1750
 
1727
1751
  function ownKeys$v(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1728
1752
  function _objectSpread$v(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$v(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$v(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1753
+ var isChoiceQuestion = function isChoiceQuestion(question) {
1754
+ return includes(question === null || question === void 0 ? void 0 : question.kind, SELECTABLE_KINDS);
1755
+ };
1729
1756
  var generateUniqueFieldCode = function generateUniqueFieldCode(type, questions) {
1730
1757
  var fieldCodes = pluck("fieldCode", filterBy({
1731
1758
  kind: type
@@ -1823,6 +1850,7 @@ var getAvailableQuestionKinds = function getAvailableQuestionKinds(_ref5) {
1823
1850
  });
1824
1851
  }, allQuestionKinds);
1825
1852
  };
1853
+ var formatQuestionAttributesForClone = when(isChoiceQuestion, assoc("isCloning", true));
1826
1854
 
1827
1855
  var _path$2, _path2, _path3, _path4, _path5, _path6, _path7;
1828
1856
  function _extends$2() { _extends$2 = 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$2.apply(this, arguments); }
@@ -1878,8 +1906,9 @@ var NAME = QUESTION_TYPES.NAME,
1878
1906
  STAR_RATING$1 = QUESTION_TYPES.STAR_RATING,
1879
1907
  RATING$1 = QUESTION_TYPES.RATING,
1880
1908
  DATE = QUESTION_TYPES.DATE,
1881
- FILE_UPLOAD$1 = QUESTION_TYPES.FILE_UPLOAD;
1882
- var QUESTIONS_WITH_ADDITIONAL_DATA = [].concat(_toConsumableArray(SELECTABLE_KINDS), [STAR_RATING$1, RATING$1, FILE_UPLOAD$1]);
1909
+ FILE_UPLOAD$1 = QUESTION_TYPES.FILE_UPLOAD,
1910
+ CAPTCHA$1 = QUESTION_TYPES.CAPTCHA;
1911
+ var QUESTIONS_WITH_ADDITIONAL_DATA = [].concat(_toConsumableArray(SELECTABLE_KINDS), [STAR_RATING$1, RATING$1, FILE_UPLOAD$1, CAPTCHA$1]);
1883
1912
  var QUESTIONS_WITH_PLACEHOLDERS = [NAME, PHONE, EMAIL, ADDITIONAL_GUESTS, TEXT, TEXTAREA, RICH_TEXT, INTEGER, DECIMAL, DATE];
1884
1913
  var DEFAULT_PLACEHOLDERS = {
1885
1914
  CHECKBOX: t$3("neetoForm.questions.common.questionFields.field.labelExample", {
@@ -1906,11 +1935,14 @@ var FormikAdaptiveInput = function FormikAdaptiveInput(_ref) {
1906
1935
  name = _ref.name,
1907
1936
  otherProps = _objectWithoutProperties(_ref, _excluded$b);
1908
1937
  var _useFormikContext = useFormikContext(),
1938
+ dirty = _useFormikContext.dirty,
1939
+ isValid = _useFormikContext.isValid,
1909
1940
  submitForm = _useFormikContext.submitForm;
1910
1941
  var handleKeyDown = function handleKeyDown(event) {
1911
1942
  if (event.key !== "Enter" || event.shiftKey) return;
1912
1943
  event.preventDefault();
1913
- submitForm();
1944
+ if (isMetaKeyPressed(event)) return;
1945
+ dirty && isValid && submitForm();
1914
1946
  };
1915
1947
  var handleFocus = function handleFocus(element) {
1916
1948
  var end = element.value.length;
@@ -2424,6 +2456,24 @@ var Edit = function Edit(_ref) {
2424
2456
  });
2425
2457
  };
2426
2458
 
2459
+ var Captcha = withT(function (_ref) {
2460
+ var t = _ref.t;
2461
+ return /*#__PURE__*/jsxs(Radio, {
2462
+ label: t("neetoForm.common.captchaType"),
2463
+ labelProps: {
2464
+ required: true
2465
+ },
2466
+ name: "variant",
2467
+ children: [/*#__PURE__*/jsx(Radio.Item, {
2468
+ label: t("neetoForm.common.reCaptchaV2"),
2469
+ value: CAPTCHA_TYPES.RECAPTCHA_V2
2470
+ }), /*#__PURE__*/jsx(Radio.Item, {
2471
+ label: t("neetoForm.common.mathCaptcha"),
2472
+ value: CAPTCHA_TYPES.MATH_CAPTCHA
2473
+ })]
2474
+ });
2475
+ });
2476
+
2427
2477
  var FileGroup = function FileGroup(_ref) {
2428
2478
  var name = _ref.name,
2429
2479
  label = _ref.label,
@@ -2753,7 +2803,8 @@ var CHECKBOX = QUESTION_TYPES.CHECKBOX,
2753
2803
  DROPDOWN = QUESTION_TYPES.DROPDOWN,
2754
2804
  STAR_RATING = QUESTION_TYPES.STAR_RATING,
2755
2805
  RATING = QUESTION_TYPES.RATING,
2756
- FILE_UPLOAD = QUESTION_TYPES.FILE_UPLOAD;
2806
+ FILE_UPLOAD = QUESTION_TYPES.FILE_UPLOAD,
2807
+ CAPTCHA = QUESTION_TYPES.CAPTCHA;
2757
2808
  var transformValueForOption = function transformValueForOption(_ref) {
2758
2809
  var label = _ref.label,
2759
2810
  type = _ref.type;
@@ -2775,6 +2826,8 @@ var renderAdditionalData = function renderAdditionalData(_ref2) {
2775
2826
  return /*#__PURE__*/jsx(StarRating$2, {});
2776
2827
  case FILE_UPLOAD:
2777
2828
  return /*#__PURE__*/jsx(FileUpload$1, {});
2829
+ case CAPTCHA:
2830
+ return /*#__PURE__*/jsx(Captcha, {});
2778
2831
  default:
2779
2832
  return null;
2780
2833
  }
@@ -2955,12 +3008,11 @@ var Form = function Form(_ref) {
2955
3008
  });
2956
3009
  var displayOrder = selectedQuestion.displayOrder + 1;
2957
3010
  var attributes = mergeLeft({
2958
- displayOrder: displayOrder,
2959
- isCloning: true
3011
+ displayOrder: displayOrder
2960
3012
  }, values);
2961
3013
  var payload = _objectSpread$n({
2962
3014
  language: selectedLanguage,
2963
- neetoFormQuestion: attributes
3015
+ neetoFormQuestion: formatQuestionAttributesForClone(attributes)
2964
3016
  }, buildRequestArgs);
2965
3017
  createQuestion(payload, {
2966
3018
  onSuccess: function onSuccess(_ref2) {
@@ -3200,7 +3252,7 @@ var BuildForm = function BuildForm(_ref) {
3200
3252
  };
3201
3253
  var isRequiredField = isFieldRequired !== null && isFieldRequired !== void 0 ? isFieldRequired : function (_ref5) {
3202
3254
  var kind = _ref5.kind;
3203
- return requiredFields.includes(kind);
3255
+ return concat(MANDATORY_KINDS, requiredFields).includes(kind);
3204
3256
  };
3205
3257
  var isDisabledFieldLabel = isFieldLabelDisabled !== null && isFieldLabelDisabled !== void 0 ? isFieldLabelDisabled : function () {
3206
3258
  return false;
@@ -3514,7 +3566,7 @@ var getInvalidTypeError = function getInvalidTypeError(label, type) {
3514
3566
  });
3515
3567
  };
3516
3568
 
3517
- var _excluded$4 = ["kind", "label", "isRequired", "customValidator"];
3569
+ var _excluded$4 = ["kind", "customValidator"];
3518
3570
  var _fieldKindValidatorMa;
3519
3571
  function ownKeys$j(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3520
3572
  function _objectSpread$j(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$j(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$j(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -3659,25 +3711,29 @@ var validateFileUploadField = function validateFileUploadField(_ref13) {
3659
3711
  files: files_schema
3660
3712
  });
3661
3713
  };
3662
- var fieldKindValidatorMap = (_fieldKindValidatorMa = {}, _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.EMAIL.value, validateEmailField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.NAME.value, validateNameField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.PHONE.value, validateTextField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.TEXT.value, validateTextField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.QUESTION.value, validateTextField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.TEXTAREA.value, validateTextField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.DECIMAL.value, validateTextField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.INTEGER.value, validateTextField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.DROPDOWN.value, validateSingleChoiceField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.RADIO.value, validateSingleChoiceField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.CHECKBOX.value, validateMultiChoiceField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.RATING.value, validateRatingField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.TERMS.value, validateTermsField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.DATE.value, validateDateField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.STAR_RATING.value, validateStarRatingField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.ADDITIONAL_GUESTS.value, validateMultiEmailField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.RICH_TEXT.value, validateRichTextField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.CONDITION.value, validateConditionField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.FILE_UPLOAD.value, validateFileUploadField), _fieldKindValidatorMa);
3663
- var validateFieldValue = function validateFieldValue(_ref14) {
3664
- var kind = _ref14.kind,
3665
- label = _ref14.label,
3666
- isRequired = _ref14.isRequired,
3667
- customValidator = _ref14.customValidator,
3668
- otherProps = _objectWithoutProperties(_ref14, _excluded$4);
3714
+ var validateCaptchaField = function validateCaptchaField(_ref14) {
3715
+ var variant = _ref14.variant;
3716
+ return variant === CAPTCHA_TYPES.MATH_CAPTCHA ? yup.mixed().test("verification failed", t$1("neetoForm.error.captchaVerificationFailed"), function (value) {
3717
+ return isNotPresent(value) || value;
3718
+ }).transform(function (value) {
3719
+ return value === "" ? null : value;
3720
+ }).required(t$1("neetoForm.error.incompleteCaptcha")) : yup.string().trim().required(t$1("neetoForm.error.incompleteCaptcha"));
3721
+ };
3722
+ var fieldKindValidatorMap = (_fieldKindValidatorMa = {}, _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.EMAIL.value, validateEmailField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.NAME.value, validateNameField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.PHONE.value, validateTextField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.TEXT.value, validateTextField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.QUESTION.value, validateTextField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.TEXTAREA.value, validateTextField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.DECIMAL.value, validateTextField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.INTEGER.value, validateTextField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.DROPDOWN.value, validateSingleChoiceField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.RADIO.value, validateSingleChoiceField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.CHECKBOX.value, validateMultiChoiceField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.RATING.value, validateRatingField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.TERMS.value, validateTermsField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.DATE.value, validateDateField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.STAR_RATING.value, validateStarRatingField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.ADDITIONAL_GUESTS.value, validateMultiEmailField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.RICH_TEXT.value, validateRichTextField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.CONDITION.value, validateConditionField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.FILE_UPLOAD.value, validateFileUploadField), _defineProperty(_fieldKindValidatorMa, QUESTION_KIND.CAPTCHA.value, validateCaptchaField), _fieldKindValidatorMa);
3723
+ var validateFieldValue = function validateFieldValue(_ref15) {
3724
+ var kind = _ref15.kind,
3725
+ customValidator = _ref15.customValidator,
3726
+ otherProps = _objectWithoutProperties(_ref15, _excluded$4);
3669
3727
  return function (value) {
3670
3728
  if (!(kind in fieldKindValidatorMap)) return;
3671
3729
  var validator = fieldKindValidatorMap[kind];
3672
3730
  var schema = customValidator || validator(_objectSpread$j({
3673
- kind: kind,
3674
- label: label,
3675
- isRequired: isRequired
3731
+ kind: kind
3676
3732
  }, otherProps));
3677
3733
 
3678
3734
  // eslint-disable-next-line consistent-return, no-async-promise-executor
3679
3735
  return new Promise( /*#__PURE__*/function () {
3680
- var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(resolve) {
3736
+ var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(resolve) {
3681
3737
  return _regeneratorRuntime.wrap(function _callee$(_context) {
3682
3738
  while (1) switch (_context.prev = _context.next) {
3683
3739
  case 0:
@@ -3699,7 +3755,7 @@ var validateFieldValue = function validateFieldValue(_ref14) {
3699
3755
  }, _callee, null, [[0, 6]]);
3700
3756
  }));
3701
3757
  return function (_x) {
3702
- return _ref15.apply(this, arguments);
3758
+ return _ref16.apply(this, arguments);
3703
3759
  };
3704
3760
  }());
3705
3761
  };
@@ -3762,39 +3818,6 @@ var MultipleEmailInput = function MultipleEmailInput(_ref) {
3762
3818
 
3763
3819
  function ownKeys$i(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3764
3820
  function _objectSpread$i(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$i(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$i(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3765
- var ConditionField = function ConditionField(_ref) {
3766
- var question = _ref.question,
3767
- customValidator = _ref.customValidator;
3768
- var name = question.id,
3769
- kind = question.kind,
3770
- isRequired = question.isRequired,
3771
- nodeId = question.nodeId;
3772
- var label = fieldWithFallback(question, "label");
3773
- return /*#__PURE__*/jsx(Field, {
3774
- name: name || nodeId,
3775
- validate: validateFieldValue({
3776
- kind: kind,
3777
- label: label,
3778
- isRequired: isRequired,
3779
- customValidator: customValidator
3780
- }),
3781
- children: function children(_ref2) {
3782
- var meta = _ref2.meta,
3783
- field = _ref2.field;
3784
- return /*#__PURE__*/jsx(Checkbox, _objectSpread$i(_objectSpread$i({}, _objectSpread$i(_objectSpread$i({}, field), {}, {
3785
- label: label,
3786
- name: name
3787
- })), {}, {
3788
- checked: field.value,
3789
- error: meta.touched ? meta.error : "",
3790
- required: isRequired
3791
- }));
3792
- }
3793
- });
3794
- };
3795
-
3796
- function ownKeys$h(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3797
- function _objectSpread$h(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$h(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$h(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3798
3821
  var t = clientI18nInstance.t;
3799
3822
  var toEmailValues = function toEmailValues() {
3800
3823
  var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
@@ -3888,7 +3911,7 @@ var generateInitValues = function generateInitValues(_ref7) {
3888
3911
  var valuesMap = {};
3889
3912
  if (initialValues) {
3890
3913
  valuesMap = initialValues.reduce(function (acc, answer) {
3891
- return _objectSpread$h(_objectSpread$h({}, acc), {}, _defineProperty({}, answer.questionId, {
3914
+ return _objectSpread$i(_objectSpread$i({}, acc), {}, _defineProperty({}, answer.questionId, {
3892
3915
  value: answer.value,
3893
3916
  optionIds: answer.optionIds
3894
3917
  }));
@@ -4117,6 +4140,211 @@ var getSelectedRating = function getSelectedRating(value) {
4117
4140
  return isNaN(parsedValue) ? -1 : parsedValue;
4118
4141
  };
4119
4142
 
4143
+ var CaptchaField = function CaptchaField(_ref) {
4144
+ var question = _ref.question,
4145
+ preview = _ref.preview,
4146
+ customValidator = _ref.customValidator,
4147
+ captchaRef = _ref.captchaRef;
4148
+ var name = question.id,
4149
+ kind = question.kind,
4150
+ isRequired = question.isRequired,
4151
+ variant = question.variant,
4152
+ nodeId = question.nodeId;
4153
+ var label = fieldWithFallback(question, "label");
4154
+ var _useField = useField({
4155
+ name: name || nodeId,
4156
+ validate: validateFieldValue({
4157
+ kind: kind,
4158
+ label: label,
4159
+ isRequired: isRequired,
4160
+ customValidator: customValidator,
4161
+ variant: variant
4162
+ })
4163
+ }),
4164
+ _useField2 = _slicedToArray(_useField, 3);
4165
+ _useField2[0];
4166
+ var _useField2$ = _useField2[1],
4167
+ touched = _useField2$.touched,
4168
+ error = _useField2$.error,
4169
+ _useField2$2 = _useField2[2],
4170
+ setValue = _useField2$2.setValue,
4171
+ setTouched = _useField2$2.setTouched;
4172
+ var handleVerifyCaptcha = function handleVerifyCaptcha(response) {
4173
+ setTouched(true);
4174
+ setValue(response);
4175
+ };
4176
+ var Component = CAPTCHA_COMPONENT_MAP[variant];
4177
+ return /*#__PURE__*/jsxs("div", {
4178
+ className: "neeto-form-engine-input__wrapper",
4179
+ children: [/*#__PURE__*/jsx("div", {
4180
+ className: "neeto-form-engine-input__label-wrapper",
4181
+ children: label && /*#__PURE__*/jsx("label", {
4182
+ className: "neeto-form-engine-label",
4183
+ children: getLabel(label, isRequired)
4184
+ })
4185
+ }), /*#__PURE__*/jsx("div", {
4186
+ className: classnames({
4187
+ "pointer-events-none": preview
4188
+ }),
4189
+ children: /*#__PURE__*/jsx(Component, {
4190
+ captchaRef: captchaRef,
4191
+ handleVerifyCaptcha: handleVerifyCaptcha,
4192
+ handleBlur: function handleBlur() {
4193
+ return setTouched(true);
4194
+ }
4195
+ })
4196
+ }), touched && error && /*#__PURE__*/jsx("p", {
4197
+ className: "neeto-form-engine-input__error",
4198
+ "data-cy": "neeto-form-engine-captcha-error",
4199
+ children: error
4200
+ })]
4201
+ });
4202
+ };
4203
+
4204
+ var MATH_OPERATORS = {
4205
+ PLUS: "+",
4206
+ MINUS: "-"
4207
+ };
4208
+
4209
+ var generateRandomOperation = function generateRandomOperation() {
4210
+ var firstNumber = getRandomInt(1, 50);
4211
+ var secondNumber = getRandomInt(1, 50);
4212
+ var operator = randomPick.apply(void 0, _toConsumableArray(values(MATH_OPERATORS)));
4213
+ return {
4214
+ firstNumber: firstNumber,
4215
+ secondNumber: secondNumber,
4216
+ operator: operator
4217
+ };
4218
+ };
4219
+
4220
+ var MathCaptcha = function MathCaptcha(_ref) {
4221
+ var captchaRef = _ref.captchaRef,
4222
+ handleVerifyCaptcha = _ref.handleVerifyCaptcha,
4223
+ handleBlur = _ref.handleBlur;
4224
+ var _useState = useState(generateRandomOperation()),
4225
+ _useState2 = _slicedToArray(_useState, 2),
4226
+ operation = _useState2[0],
4227
+ setOperation = _useState2[1];
4228
+ var _useState3 = useState(""),
4229
+ _useState4 = _slicedToArray(_useState3, 2),
4230
+ userInput = _useState4[0],
4231
+ setUserInput = _useState4[1];
4232
+ var firstNumber = operation.firstNumber,
4233
+ secondNumber = operation.secondNumber,
4234
+ operator = operation.operator;
4235
+ var resetCaptcha = function resetCaptcha() {
4236
+ setOperation(generateRandomOperation());
4237
+ setUserInput("");
4238
+ };
4239
+ useImperativeHandle(captchaRef, function () {
4240
+ return {
4241
+ reset: resetCaptcha
4242
+ };
4243
+ });
4244
+ var calculateResult = function calculateResult() {
4245
+ switch (operator) {
4246
+ case MATH_OPERATORS.PLUS:
4247
+ return firstNumber + secondNumber;
4248
+ case MATH_OPERATORS.MINUS:
4249
+ return firstNumber - secondNumber;
4250
+ default:
4251
+ return null;
4252
+ }
4253
+ };
4254
+ var verifyCaptcha = function verifyCaptcha() {
4255
+ var result = calculateResult();
4256
+ if (result === null) return;
4257
+ handleVerifyCaptcha(result === Number(userInput));
4258
+ };
4259
+ useUpdateEffect(function () {
4260
+ verifyCaptcha();
4261
+ }, [userInput]);
4262
+ return /*#__PURE__*/jsxs("div", {
4263
+ className: "neeto-form-nano-math-captcha",
4264
+ ref: captchaRef,
4265
+ children: [/*#__PURE__*/jsx("button", {
4266
+ className: "neeto-form-nano-math-captcha__button",
4267
+ type: "button",
4268
+ onClick: resetCaptcha,
4269
+ children: /*#__PURE__*/jsx(Refresh, {})
4270
+ }), /*#__PURE__*/jsxs("div", {
4271
+ className: "neeto-form-nano-math-captcha__equation",
4272
+ children: [/*#__PURE__*/jsx("span", {
4273
+ children: firstNumber
4274
+ }), /*#__PURE__*/jsx("span", {
4275
+ children: operator
4276
+ }), /*#__PURE__*/jsx("span", {
4277
+ children: secondNumber
4278
+ }), /*#__PURE__*/jsx("span", {
4279
+ children: "="
4280
+ })]
4281
+ }), /*#__PURE__*/jsx(Input$1, {
4282
+ required: true,
4283
+ className: "neeto-form-nano-math-captcha__input",
4284
+ value: userInput,
4285
+ onBlur: handleBlur,
4286
+ onChange: withEventTargetValue(setUserInput)
4287
+ })]
4288
+ });
4289
+ };
4290
+
4291
+ var Recaptcha = function Recaptcha(_ref) {
4292
+ var captchaRef = _ref.captchaRef,
4293
+ handleVerifyCaptcha = _ref.handleVerifyCaptcha;
4294
+ var verifyRecaptcha = function verifyRecaptcha(response) {
4295
+ if (response === null) {
4296
+ return;
4297
+ }
4298
+ handleVerifyCaptcha(response);
4299
+ };
4300
+ var expiredRecaptcha = function expiredRecaptcha() {
4301
+ var _captchaRef$current;
4302
+ captchaRef === null || captchaRef === void 0 || (_captchaRef$current = captchaRef.current) === null || _captchaRef$current === void 0 || _captchaRef$current.reset();
4303
+ handleVerifyCaptcha("");
4304
+ };
4305
+ return /*#__PURE__*/jsx(ReCAPTCHA, {
4306
+ hl: clientI18nInstance.language,
4307
+ ref: captchaRef,
4308
+ sitekey: globalProps.formNanoRecaptchaV2SiteKey,
4309
+ onChange: verifyRecaptcha,
4310
+ onErrored: noop,
4311
+ onExpired: expiredRecaptcha
4312
+ }, clientI18nInstance.language);
4313
+ };
4314
+
4315
+ function ownKeys$h(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4316
+ function _objectSpread$h(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$h(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$h(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4317
+ var ConditionField = function ConditionField(_ref) {
4318
+ var question = _ref.question,
4319
+ customValidator = _ref.customValidator;
4320
+ var name = question.id,
4321
+ kind = question.kind,
4322
+ isRequired = question.isRequired,
4323
+ nodeId = question.nodeId;
4324
+ var label = fieldWithFallback(question, "label");
4325
+ return /*#__PURE__*/jsx(Field, {
4326
+ name: name || nodeId,
4327
+ validate: validateFieldValue({
4328
+ kind: kind,
4329
+ label: label,
4330
+ isRequired: isRequired,
4331
+ customValidator: customValidator
4332
+ }),
4333
+ children: function children(_ref2) {
4334
+ var meta = _ref2.meta,
4335
+ field = _ref2.field;
4336
+ return /*#__PURE__*/jsx(Checkbox, _objectSpread$h(_objectSpread$h({}, _objectSpread$h(_objectSpread$h({}, field), {}, {
4337
+ label: label,
4338
+ name: name
4339
+ })), {}, {
4340
+ checked: field.value,
4341
+ error: meta.touched ? meta.error : "",
4342
+ required: isRequired
4343
+ }));
4344
+ }
4345
+ });
4346
+ };
4347
+
4120
4348
  var _excluded$3 = ["value"];
4121
4349
  function ownKeys$g(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4122
4350
  function _objectSpread$g(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$g(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$g(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -4626,15 +4854,15 @@ var FilePreview = withT(function (_ref) {
4626
4854
  }) : ""
4627
4855
  })]
4628
4856
  }), /*#__PURE__*/jsxs("div", {
4629
- className: classnames("neeto-form-engine-file-upload__actions"),
4857
+ className: "neeto-form-engine-file-upload__actions",
4630
4858
  children: [/*#__PURE__*/jsx("span", {
4631
4859
  className: classnames("neeto-form-engine-file-upload__success-indicator", {
4632
4860
  "neeto-form-engine-file-upload__success-indicator--active": file.url
4633
4861
  }),
4634
4862
  children: file.url && /*#__PURE__*/jsx(Check, {})
4635
4863
  }), /*#__PURE__*/jsx("button", {
4864
+ className: "neeto-form-engine-file-upload__button--red neeto-form-engine-file-upload__remove-button",
4636
4865
  type: "button",
4637
- className: classnames("neeto-form-engine-file-upload__button--red neeto-form-engine-file-upload__remove-button"),
4638
4866
  onClick: cancel,
4639
4867
  children: /*#__PURE__*/jsx(Close, {})
4640
4868
  })]
@@ -4785,8 +5013,8 @@ var Choices = function Choices(_ref) {
4785
5013
  onChange = _ref.onChange,
4786
5014
  error = _ref.error;
4787
5015
  var isCheckBox = type === "checkbox";
4788
- var ChoiceWrapper = isCheckBox ? "div" : Radio;
4789
- var Component = isCheckBox ? Checkbox : Radio.Item;
5016
+ var ChoiceWrapper = isCheckBox ? "div" : Radio$1;
5017
+ var Component = isCheckBox ? Checkbox : Radio$1.Item;
4790
5018
  return /*#__PURE__*/jsxs("div", {
4791
5019
  className: "neeto-form-engine-choices__wrapper",
4792
5020
  "data-cy": "".concat(hyphenate(label), "-select-container-wrapper"),
@@ -5278,13 +5506,14 @@ var TextField = function TextField(_ref) {
5278
5506
  }));
5279
5507
  };
5280
5508
 
5281
- var _QUESTION_TO_COMPONEN;
5509
+ var _QUESTION_TO_COMPONEN, _CAPTCHA_COMPONENT_MA;
5282
5510
  var QUESTION_TO_COMPONENT_MAP = (_QUESTION_TO_COMPONEN = {}, _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.TEXT.value, TextField), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.NAME.value, NameField), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.EMAIL.value, EmailField), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.INTEGER.value, TextField), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.DECIMAL.value, TextField), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.PHONE.value, PhoneNumberField), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.QUESTION.value, TextField), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.TEXTAREA.value, TextField), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.CHECKBOX.value, OptionsField), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.RADIO.value, OptionsField), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.DROPDOWN.value, OptionsField), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.RATING.value, RatingField), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.PARAGRAPH.value, function (_ref) {
5283
5511
  var question = _ref.question;
5284
5512
  return /*#__PURE__*/jsx(EditorContent, {
5285
5513
  content: fieldWithFallback(question, "label", true)
5286
5514
  });
5287
- }), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.TERMS.value, TermsField), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.DATE.value, DateField), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.STAR_RATING.value, StarRatingField), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.ADDITIONAL_GUESTS.value, MultipleEmailInput), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.RICH_TEXT.value, RichTextEditor), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.CONDITION.value, ConditionField), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.FILE_UPLOAD.value, FileUploadField), _QUESTION_TO_COMPONEN);
5515
+ }), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.TERMS.value, TermsField), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.DATE.value, DateField), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.STAR_RATING.value, StarRatingField), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.ADDITIONAL_GUESTS.value, MultipleEmailInput), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.RICH_TEXT.value, RichTextEditor), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.CONDITION.value, ConditionField), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.FILE_UPLOAD.value, FileUploadField), _defineProperty(_QUESTION_TO_COMPONEN, QUESTION_KIND.CAPTCHA.value, CaptchaField), _QUESTION_TO_COMPONEN);
5516
+ var CAPTCHA_COMPONENT_MAP = (_CAPTCHA_COMPONENT_MA = {}, _defineProperty(_CAPTCHA_COMPONENT_MA, CAPTCHA_TYPES.RECAPTCHA_V2, Recaptcha), _defineProperty(_CAPTCHA_COMPONENT_MA, CAPTCHA_TYPES.MATH_CAPTCHA, MathCaptcha), _CAPTCHA_COMPONENT_MA);
5288
5517
 
5289
5518
  var getFieldComponent = function getFieldComponent(_ref) {
5290
5519
  var kind = _ref.kind;
@@ -5336,9 +5565,8 @@ const SvgSuccess = props => /*#__PURE__*/React$2.createElement("svg", _extends({
5336
5565
  height: 344
5337
5566
  }))));
5338
5567
 
5339
- var Success = function Success() {
5340
- var _useTranslation = useTranslation(),
5341
- t = _useTranslation.t;
5568
+ var Success = withT(function (_ref) {
5569
+ var t = _ref.t;
5342
5570
  return /*#__PURE__*/jsxs("div", {
5343
5571
  className: "flex h-full w-full flex-col items-center justify-center space-y-4",
5344
5572
  children: [/*#__PURE__*/jsx(SvgSuccess, {}), /*#__PURE__*/jsx(Typography, {
@@ -5349,7 +5577,7 @@ var Success = function Success() {
5349
5577
  children: t("neetoForm.successPage.title2")
5350
5578
  })]
5351
5579
  });
5352
- };
5580
+ });
5353
5581
  var Success$1 = /*#__PURE__*/memo(Success);
5354
5582
 
5355
5583
  function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
@@ -5421,6 +5649,7 @@ var ExternalForm = function ExternalForm(_ref) {
5421
5649
  var formRef = useRef();
5422
5650
  var formikInnerRef = useRef();
5423
5651
  var editorRef = useRef();
5652
+ var captchaRef = useRef(null);
5424
5653
  var queryClient = useQueryClient();
5425
5654
  useEffect(function () {
5426
5655
  if (equals(language, clientI18nInstance.resolvedLanguage)) return;
@@ -5577,7 +5806,7 @@ var ExternalForm = function ExternalForm(_ref) {
5577
5806
  };
5578
5807
  }();
5579
5808
  var _onReset = function onReset(e, handleReset) {
5580
- var _editorRef$current, _formDomProps$onReset;
5809
+ var _editorRef$current, _captchaRef$current, _formDomProps$onReset;
5581
5810
  if (clearValuesOnReset) {
5582
5811
  clearLocalStorageValues("".concat(formId, "/values"));
5583
5812
  setLocalValues(generateInitValues({
@@ -5588,6 +5817,7 @@ var ExternalForm = function ExternalForm(_ref) {
5588
5817
  });
5589
5818
  }
5590
5819
  editorRef === null || editorRef === void 0 || (_editorRef$current = editorRef.current) === null || _editorRef$current === void 0 || (_editorRef$current = _editorRef$current.editor) === null || _editorRef$current === void 0 || (_editorRef$current = _editorRef$current.commands) === null || _editorRef$current === void 0 || _editorRef$current.setContent("");
5820
+ (_captchaRef$current = captchaRef.current) === null || _captchaRef$current === void 0 || _captchaRef$current.reset();
5591
5821
  handleReset(e);
5592
5822
  formDomProps === null || formDomProps === void 0 || (_formDomProps$onReset = formDomProps.onReset) === null || _formDomProps$onReset === void 0 || _formDomProps$onReset.call(formDomProps, e);
5593
5823
  };
@@ -5704,6 +5934,7 @@ var ExternalForm = function ExternalForm(_ref) {
5704
5934
  var FieldComponent = getFieldComponent(question);
5705
5935
  return /*#__PURE__*/jsxs(Fragment$1, {
5706
5936
  children: [/*#__PURE__*/jsx(FieldComponent, {
5937
+ captchaRef: captchaRef,
5707
5938
  editorProps: editorProps,
5708
5939
  editorRef: editorRef,
5709
5940
  preview: preview,
@@ -8295,7 +8526,13 @@ var linkifyDecorator = function linkifyDecorator(decoratedHref, decoratedText, k
8295
8526
  children: decoratedText
8296
8527
  }, key);
8297
8528
  };
8298
- var filterResponses = removeBy({
8529
+ var filterResponses = function filterResponses(responses, kinds) {
8530
+ var filteredResponses = removeBy({
8531
+ kind: includes(__, kinds)
8532
+ }, responses);
8533
+ return filterAdditionalGuestResponses(filteredResponses);
8534
+ };
8535
+ var filterAdditionalGuestResponses = removeBy({
8299
8536
  kind: QUESTION_KIND.ADDITIONAL_GUESTS.value,
8300
8537
  value: isNotPresent
8301
8538
  });
@@ -8336,7 +8573,7 @@ var getValue = function getValue(_ref) {
8336
8573
  return value === null || value === void 0 ? void 0 : value.join(", ");
8337
8574
  }
8338
8575
  if (kind === QUESTION_KIND.CONDITION.value) {
8339
- return value ? t$3("neetoForm.common.yes") : t$3("neetoForm.common.no");
8576
+ return (value === null || value === void 0 ? void 0 : value.toLowerCase()) === "true" ? t$3("neetoForm.common.yes") : t$3("neetoForm.common.no");
8340
8577
  }
8341
8578
  return value;
8342
8579
  };
@@ -8358,7 +8595,9 @@ var Submission = function Submission(_ref2) {
8358
8595
  _ref2$questionLabelPr = _ref2.questionLabelProps,
8359
8596
  questionLabelProps = _ref2$questionLabelPr === void 0 ? {} : _ref2$questionLabelPr,
8360
8597
  _ref2$answerProps = _ref2.answerProps,
8361
- answerProps = _ref2$answerProps === void 0 ? {} : _ref2$answerProps;
8598
+ answerProps = _ref2$answerProps === void 0 ? {} : _ref2$answerProps,
8599
+ _ref2$omitKinds = _ref2.omitKinds,
8600
+ omitKinds = _ref2$omitKinds === void 0 ? [] : _ref2$omitKinds;
8362
8601
  var _useSubmission = useSubmission({
8363
8602
  formId: formId,
8364
8603
  submissionId: submissionId,
@@ -8371,7 +8610,7 @@ var Submission = function Submission(_ref2) {
8371
8610
  } : _useSubmission$data,
8372
8611
  isLoading = _useSubmission.isLoading;
8373
8612
  var responses = submission.responses;
8374
- var filteredResponses = filterResponses(responses);
8613
+ var filteredResponses = filterResponses(responses, omitKinds);
8375
8614
  var renderSubmittedValue = function renderSubmittedValue(kind, value) {
8376
8615
  switch (kind) {
8377
8616
  case QUESTION_KIND.RICH_TEXT.value: