@bigbinary/neeto-form-frontend 3.8.3 → 3.9.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.
Files changed (60) hide show
  1. package/app/javascript/src/translations/ar.json +3 -1
  2. package/app/javascript/src/translations/de.json +3 -1
  3. package/app/javascript/src/translations/en.json +12 -4
  4. package/app/javascript/src/translations/es.json +3 -1
  5. package/app/javascript/src/translations/fr.json +3 -1
  6. package/app/javascript/src/translations/it.json +201 -0
  7. package/app/javascript/src/translations/nl.json +3 -1
  8. package/app/javascript/src/translations/pl.json +3 -1
  9. package/app/javascript/src/translations/pt.json +3 -1
  10. package/app/javascript/src/translations/ru.json +202 -0
  11. package/dist/BuildForm.js +142 -132
  12. package/dist/BuildForm.js.map +1 -1
  13. package/dist/ExternalForm.js +12 -12
  14. package/dist/ExternalForm.js.map +1 -1
  15. package/dist/Submission.js +1 -1
  16. package/dist/Submission.js.map +1 -1
  17. package/dist/UrlBuilder.js +10 -10
  18. package/dist/UrlBuilder.js.map +1 -1
  19. package/dist/{buildForm-354c6d6d.js → buildForm-b8eb931e.js} +4 -2
  20. package/dist/buildForm-b8eb931e.js.map +1 -0
  21. package/dist/{buildForm-042737cb.js → buildForm-dfd708c6.js} +4 -2
  22. package/dist/buildForm-dfd708c6.js.map +1 -0
  23. package/dist/cjs/BuildForm.js +144 -134
  24. package/dist/cjs/BuildForm.js.map +1 -1
  25. package/dist/cjs/ExternalForm.js +12 -12
  26. package/dist/cjs/ExternalForm.js.map +1 -1
  27. package/dist/cjs/Submission.js +1 -1
  28. package/dist/cjs/Submission.js.map +1 -1
  29. package/dist/cjs/UrlBuilder.js +10 -10
  30. package/dist/cjs/UrlBuilder.js.map +1 -1
  31. package/dist/cjs/hooks.js +3 -3
  32. package/dist/cjs/index.js +6 -5
  33. package/dist/cjs/index.js.map +1 -1
  34. package/dist/constants-4d9fc943.js.map +1 -1
  35. package/dist/constants-75b78b3a.js.map +1 -1
  36. package/dist/{constants-56bf4022.js → constants-771cca31.js} +2 -3
  37. package/dist/{constants-56bf4022.js.map → constants-771cca31.js.map} +1 -1
  38. package/dist/{constants-d9148acf.js → constants-9538731d.js} +2 -3
  39. package/dist/{constants-d9148acf.js.map → constants-9538731d.js.map} +1 -1
  40. package/dist/hooks.js +3 -3
  41. package/dist/index.js +6 -5
  42. package/dist/index.js.map +1 -1
  43. package/dist/{useFormApi-408d0060.js → useFormApi-24e05ed2.js} +6 -6
  44. package/dist/{useFormApi-408d0060.js.map → useFormApi-24e05ed2.js.map} +1 -1
  45. package/dist/{useFormApi-e3476a20.js → useFormApi-dee63a95.js} +6 -6
  46. package/dist/{useFormApi-e3476a20.js.map → useFormApi-dee63a95.js.map} +1 -1
  47. package/dist/{useFormSubmission-e2e84587.js → useFormSubmission-8b23d7aa.js} +2 -2
  48. package/dist/{useFormSubmission-e2e84587.js.map → useFormSubmission-8b23d7aa.js.map} +1 -1
  49. package/dist/{useFormSubmission-46db678f.js → useFormSubmission-c4e42402.js} +2 -2
  50. package/dist/{useFormSubmission-46db678f.js.map → useFormSubmission-c4e42402.js.map} +1 -1
  51. package/dist/{utils-4918956b.js → utils-58566755.js} +52 -44
  52. package/dist/utils-58566755.js.map +1 -0
  53. package/dist/{utils-e4298243.js → utils-d5895099.js} +51 -43
  54. package/dist/utils-d5895099.js.map +1 -0
  55. package/package.json +101 -92
  56. package/types.d.ts +2 -1
  57. package/dist/buildForm-042737cb.js.map +0 -1
  58. package/dist/buildForm-354c6d6d.js.map +0 -1
  59. package/dist/utils-4918956b.js.map +0 -1
  60. package/dist/utils-e4298243.js.map +0 -1
package/dist/BuildForm.js CHANGED
@@ -7,16 +7,16 @@ import { isPresent, truncate, findBy, isNotPresent, slugify, filterBy, hyphenate
7
7
  import { showThumbsUpToastr, hyphenize } from '@bigbinary/neeto-commons-frontend/utils';
8
8
  import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
9
9
  import { equals, includes, __, reduce, assoc, path, when, isEmpty, reject, keys, pick, omit, pluck, modify, without, mergeLeft, isNil, pipe, filter, isNotNil, uniq, join, map, test, difference, prop, split, last, concat, F } from 'ramda';
10
- import { e as useDeleteQuestion, f as useFetchQuestions, g as useCreateQuestion, h as useUpdateQuestion, i as useReorderQuestions, Q as QUERY_KEYS } from './useFormApi-e3476a20.js';
10
+ import { e as useDeleteQuestion, f as useFetchQuestions, g as useCreateQuestion, h as useUpdateQuestion, i as useReorderQuestions, Q as QUERY_KEYS } from './useFormApi-dee63a95.js';
11
11
  import { Q as QUESTION_KIND } from './constants-75b78b3a.js';
12
- import { I as INDEPENDENT_LABELS_MAP, R as RICH_TEXT_QUESTIONS, A as AUTO_GENERATED_KINDS, a as IMMUTABLE_KINDS, h as htmlToPlainText, i as isElementOverflowing, D as Drag, Q as QUESTION_TYPES, S as SELECTABLE_KINDS, b as RESERVED_FIELD_CODES, c as QUESTIONS_WITHOUT_FIELD_CODE, N as NON_HIDEABLE_FIELDS, C as CAPTCHA_TYPES, F as FILE_TYPES_MAP, d as FILE_GROUPS, M as MINIMUM_OPTIONS, e as RATING_OPTIONS, f as STAR_RATING_MIN_VALUE_OPTIONS, g as STAR_RATING_MAX_VALUE_OPTIONS, j as STAR_RATING_ICONS_MAP, k as QUESTION_ACTIONS, l as QUESTION_KINDS, m as getActiveQuestionKindDetails, n as DEFAULT_AVAILABLE_LANGUAGES, o as QUESTIONS_INITIAL_VALUE, p as MANDATORY_KINDS } from './constants-d9148acf.js';
12
+ import { I as INDEPENDENT_LABELS_MAP, R as RICH_TEXT_QUESTIONS, A as AUTO_GENERATED_KINDS, a as IMMUTABLE_KINDS, h as htmlToPlainText, i as isElementOverflowing, D as Drag, Q as QUESTION_TYPES, S as SELECTABLE_KINDS, b as RESERVED_FIELD_CODES, c as QUESTIONS_WITHOUT_FIELD_CODE, N as NON_HIDEABLE_FIELDS, C as CAPTCHA_TYPES, F as FILE_TYPES_MAP, d as FILE_GROUPS, M as MINIMUM_OPTIONS, e as RATING_OPTIONS, f as STAR_RATING_MIN_VALUE_OPTIONS, g as STAR_RATING_MAX_VALUE_OPTIONS, j as STAR_RATING_ICONS_MAP, k as QUESTION_ACTIONS, l as QUESTION_KINDS, m as getActiveQuestionKindDetails, n as DEFAULT_AVAILABLE_LANGUAGES, o as QUESTIONS_INITIAL_VALUE, p as MANDATORY_KINDS } from './constants-9538731d.js';
13
13
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
14
14
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
15
15
  import { Droppable, Draggable, DragDropContext } from '@hello-pangea/dnd';
16
16
  import { isMetaKeyPressed, withT, useStateWithDependency, useOnClickOutside } from '@bigbinary/neeto-commons-frontend/react-utils';
17
17
  import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
18
18
  import { useTranslation, Trans } from 'react-i18next';
19
- import { a as useBuildFormStore } from './buildForm-042737cb.js';
19
+ import { a as useBuildFormStore } from './buildForm-dfd708c6.js';
20
20
  import { shallow } from 'zustand/shallow';
21
21
  import Alert from '@bigbinary/neetoui/Alert';
22
22
  import { f as fieldWithFallback, i as isFunction } from './index-2664c3e7.js';
@@ -29,6 +29,7 @@ import HelpPopover from '@bigbinary/neeto-molecules/HelpPopover';
29
29
  import { t } from 'i18next';
30
30
  import Plus from '@bigbinary/neeto-icons/Plus';
31
31
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
32
+ import { v4 } from 'uuid';
32
33
  import NoData from '@bigbinary/neetoui/NoData';
33
34
  import Pane from '@bigbinary/neetoui/Pane';
34
35
  import Form$2 from '@bigbinary/neetoui/formik/Form';
@@ -236,8 +237,8 @@ function ownKeys$h(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
236
237
  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; }
237
238
  var validateEditorContent = function validateEditorContent(editorRef) {
238
239
  return function () {
239
- var _editorRef$current;
240
- return (_editorRef$current = editorRef.current) !== null && _editorRef$current !== void 0 && (_editorRef$current = _editorRef$current.editor) !== null && _editorRef$current !== void 0 && _editorRef$current.isEmpty ? t("neetoForm.common.thisFieldIsRequired") : "";
240
+ var _editorRef$current, _editorRef$current$ed;
241
+ return (_editorRef$current = editorRef.current) !== null && _editorRef$current !== void 0 && (_editorRef$current$ed = _editorRef$current.editor) !== null && _editorRef$current$ed !== void 0 && _editorRef$current$ed.isEmpty ? t("neetoForm.common.thisFieldIsRequired") : "";
241
242
  };
242
243
  };
243
244
  var buildReorderPayload = function buildReorderPayload(questions) {
@@ -425,71 +426,6 @@ var Questions = function Questions(_ref) {
425
426
  });
426
427
  };
427
428
 
428
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
429
- // require the crypto API and do not support built-in fallback to lower quality random number
430
- // generators (like Math.random()).
431
- let getRandomValues;
432
- const rnds8 = new Uint8Array(16);
433
- function rng() {
434
- // lazy load so that environments that need to polyfill have a chance to do so
435
- if (!getRandomValues) {
436
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
437
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
438
-
439
- if (!getRandomValues) {
440
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
441
- }
442
- }
443
-
444
- return getRandomValues(rnds8);
445
- }
446
-
447
- /**
448
- * Convert array of 16 byte values to UUID string format of the form:
449
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
450
- */
451
-
452
- const byteToHex = [];
453
-
454
- for (let i = 0; i < 256; ++i) {
455
- byteToHex.push((i + 0x100).toString(16).slice(1));
456
- }
457
-
458
- function unsafeStringify(arr, offset = 0) {
459
- // Note: Be careful editing this code! It's been tuned for performance
460
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
461
- return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
462
- }
463
-
464
- const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
465
- var native = {
466
- randomUUID
467
- };
468
-
469
- function v4(options, buf, offset) {
470
- if (native.randomUUID && !buf && !options) {
471
- return native.randomUUID();
472
- }
473
-
474
- options = options || {};
475
- const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
476
-
477
- rnds[6] = rnds[6] & 0x0f | 0x40;
478
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
479
-
480
- if (buf) {
481
- offset = offset || 0;
482
-
483
- for (let i = 0; i < 16; ++i) {
484
- buf[offset + i] = rnds[i];
485
- }
486
-
487
- return buf;
488
- }
489
-
490
- return unsafeStringify(rnds);
491
- }
492
-
493
429
  var moveItem = function moveItem(arr, sourceIndex, destinationIndex) {
494
430
  if (sourceIndex === destinationIndex) return arr;
495
431
  if (arr instanceof Array && arr[sourceIndex] !== undefined) {
@@ -745,8 +681,8 @@ var useUpdateEditorContent = function useUpdateEditorContent(_ref) {
745
681
  return store.formState.richTextFieldsToReset.includes(fieldCode);
746
682
  });
747
683
  var setEditorContent = function setEditorContent(content) {
748
- var _editorRef$current$ed;
749
- return (_editorRef$current$ed = editorRef.current.editor) === null || _editorRef$current$ed === void 0 || (_editorRef$current$ed = _editorRef$current$ed.commands) === null || _editorRef$current$ed === void 0 ? void 0 : _editorRef$current$ed.setContent(content);
684
+ var _editorRef$current$ed, _editorRef$current$ed2;
685
+ return (_editorRef$current$ed = editorRef.current.editor) === null || _editorRef$current$ed === void 0 ? void 0 : (_editorRef$current$ed2 = _editorRef$current$ed.commands) === null || _editorRef$current$ed2 === void 0 ? void 0 : _editorRef$current$ed2.setContent(content);
750
686
  };
751
687
  if (shouldReset) {
752
688
  setEditorContent(initialValue);
@@ -893,7 +829,6 @@ var Form$1 = function Form(_ref) {
893
829
  availableQuestionKinds = _ref.availableQuestionKinds,
894
830
  getActiveKindDetails = _ref.getActiveKindDetails,
895
831
  additionalQuestionKindPattern = _ref.additionalQuestionKindPattern,
896
- enableDomainRestriction = _ref.enableDomainRestriction,
897
832
  _ref$isEdit = _ref.isEdit,
898
833
  isEdit = _ref$isEdit === void 0 ? false : _ref$isEdit;
899
834
  var _useTranslation = useTranslation(),
@@ -904,6 +839,15 @@ var Form$1 = function Form(_ref) {
904
839
  setErrors = _useFormikContext.setErrors,
905
840
  setTouched = _useFormikContext.setTouched;
906
841
  var hideQuestionHelpDoc = useBuildFormStore(path(["formState", "helpDocUrls", "hideQuestion"]));
842
+ var _useBuildFormStore = useBuildFormStore(function (store) {
843
+ var _store$formState, _store$formState2;
844
+ return {
845
+ enableDomainWhitelisting: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["enableDomainWhitelisting"],
846
+ enableDomainBlacklisting: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["enableDomainBlacklisting"]
847
+ };
848
+ }, shallow),
849
+ enableDomainWhitelisting = _useBuildFormStore.enableDomainWhitelisting,
850
+ enableDomainBlacklisting = _useBuildFormStore.enableDomainBlacklisting;
907
851
  var kind = values.kind;
908
852
  var questionKinds = isEdit ? allQuestionKinds : availableQuestionKinds;
909
853
  var questionKindUniquenessPattern = mergeLeft(isEdit && additionalQuestionKindPattern ? additionalQuestionKindPattern(values) : {}, {
@@ -983,7 +927,8 @@ var Form$1 = function Form(_ref) {
983
927
  }), hasAdditionalData && renderAdditionalData({
984
928
  kind: kind,
985
929
  questionProps: questionProps,
986
- enableDomainRestriction: enableDomainRestriction
930
+ enableDomainWhitelisting: enableDomainWhitelisting,
931
+ enableDomainBlacklisting: enableDomainBlacklisting
987
932
  })]
988
933
  }), isSettingsBlockVisible && /*#__PURE__*/jsxs(Block, {
989
934
  dataCy: "settings-card",
@@ -1216,11 +1161,11 @@ var SwitchBlock = function SwitchBlock(_ref) {
1216
1161
  otherProps = _objectWithoutProperties(_ref, _excluded$4);
1217
1162
  return /*#__PURE__*/jsxs(Label, {
1218
1163
  className: classnames("flex items-center justify-start gap-2 ", className),
1219
- "data-cy": "neeto-form-engine-".concat(hyphenate(title), "-toggle-label"),
1164
+ "data-cy": "neeto-form-engine-".concat(hyphenate(title && name), "-toggle-label"),
1220
1165
  children: [/*#__PURE__*/jsx(Switch, _objectSpread$9(_objectSpread$9({}, _objectSpread$9(_objectSpread$9({}, otherProps), {}, {
1221
1166
  name: name
1222
1167
  })), {}, {
1223
- "data-cy": "neeto-form-engine-".concat(hyphenate(title), "-switch")
1168
+ "data-cy": "neeto-form-engine-".concat(hyphenate(title && name), "-switch")
1224
1169
  })), /*#__PURE__*/jsx(Typography, {
1225
1170
  component: "span",
1226
1171
  style: "body1",
@@ -1229,9 +1174,43 @@ var SwitchBlock = function SwitchBlock(_ref) {
1229
1174
  });
1230
1175
  };
1231
1176
 
1232
- var _excluded$3 = ["children"];
1233
1177
  function ownKeys$8(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; }
1234
1178
  function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$8(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$8(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1179
+ var TitleWithHelpPopover = function TitleWithHelpPopover(_ref) {
1180
+ var title = _ref.title,
1181
+ description = _ref.description,
1182
+ helpLink = _ref.helpLink;
1183
+ return /*#__PURE__*/jsxs("div", {
1184
+ className: "flex gap-2",
1185
+ children: [title, /*#__PURE__*/jsx(HelpPopover, _objectSpread$8({
1186
+ description: description,
1187
+ popoverProps: {
1188
+ position: "top"
1189
+ }
1190
+ }, helpLink && {
1191
+ helpLinkProps: {
1192
+ href: helpLink
1193
+ }
1194
+ }))]
1195
+ });
1196
+ };
1197
+
1198
+ var DOMAIN_RESTRICTION_TRANSLATIONS = {
1199
+ whitelistedDomains: {
1200
+ title: t("neetoForm.domainRestriction.whitelistedDomains.label"),
1201
+ description: t("neetoForm.domainRestriction.whitelistedDomains.description"),
1202
+ popoverDescription: t("neetoForm.domainRestriction.whitelistedDomains.popoverDescription")
1203
+ },
1204
+ blacklistedDomains: {
1205
+ title: t("neetoForm.domainRestriction.blacklistedDomains.label"),
1206
+ description: t("neetoForm.domainRestriction.blacklistedDomains.description"),
1207
+ popoverDescription: t("neetoForm.domainRestriction.blacklistedDomains.popoverDescription")
1208
+ }
1209
+ };
1210
+
1211
+ var _excluded$3 = ["children"];
1212
+ function ownKeys$7(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; }
1213
+ function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1235
1214
  var STYLES = {
1236
1215
  border: {
1237
1216
  "default": "1px solid rgb(var(--neeto-ui-gray-400))",
@@ -1243,8 +1222,8 @@ var STYLES = {
1243
1222
  }
1244
1223
  };
1245
1224
  var MultiValueRemove = function MultiValueRemove(props) {
1246
- return /*#__PURE__*/jsx(components.MultiValueRemove, _objectSpread$8(_objectSpread$8({}, props), {}, {
1247
- innerProps: _objectSpread$8(_objectSpread$8({}, props.innerProps), {}, _defineProperty({}, "data-cy", "".concat(hyphenize(props.data.label), "-remove-icon"))),
1225
+ return /*#__PURE__*/jsx(components.MultiValueRemove, _objectSpread$7(_objectSpread$7({}, props), {}, {
1226
+ innerProps: _objectSpread$7(_objectSpread$7({}, props.innerProps), {}, _defineProperty({}, "data-cy", "".concat(hyphenize(props.data.label), "-remove-icon"))),
1248
1227
  children: /*#__PURE__*/jsx(Close, {
1249
1228
  size: 16
1250
1229
  })
@@ -1264,8 +1243,8 @@ var ValueContainer = function ValueContainer(_ref) {
1264
1243
  firstChild = _children[0],
1265
1244
  rest = _children.slice(1);
1266
1245
  var shouldCollapse = !isFocused && value.length > visibleDomainsCount;
1267
- return /*#__PURE__*/jsxs(components.ValueContainer, _objectSpread$8(_objectSpread$8({}, props), {}, {
1268
- innerProps: _objectSpread$8(_objectSpread$8({}, props.innerProps), {}, _defineProperty({}, "data-cy", "multi-domain-input-container")),
1246
+ return /*#__PURE__*/jsxs(components.ValueContainer, _objectSpread$7(_objectSpread$7({}, props), {}, {
1247
+ innerProps: _objectSpread$7(_objectSpread$7({}, props.innerProps), {}, _defineProperty({}, "data-cy", "multi-domain-input-container")),
1269
1248
  children: [shouldCollapse ? firstChild.slice(0, visibleDomainsCount) : firstChild, shouldCollapse && /*#__PURE__*/jsx(Tag, {
1270
1249
  style: "secondary",
1271
1250
  label: t("neetoForm.common.remainingItemsCount", {
@@ -1275,8 +1254,8 @@ var ValueContainer = function ValueContainer(_ref) {
1275
1254
  }));
1276
1255
  };
1277
1256
  var ClearIndicator = function ClearIndicator(props) {
1278
- return /*#__PURE__*/jsx(components.ClearIndicator, _objectSpread$8(_objectSpread$8({}, props), {}, {
1279
- innerProps: _objectSpread$8(_objectSpread$8({}, props.innerProps), {}, _defineProperty({}, "data-cy", "clear-all-button")),
1257
+ return /*#__PURE__*/jsx(components.ClearIndicator, _objectSpread$7(_objectSpread$7({}, props), {}, {
1258
+ innerProps: _objectSpread$7(_objectSpread$7({}, props.innerProps), {}, _defineProperty({}, "data-cy", "clear-all-button")),
1280
1259
  children: /*#__PURE__*/jsx(Close, {
1281
1260
  className: "cursor-pointer",
1282
1261
  size: 16
@@ -1297,7 +1276,7 @@ var CUSTOM_STYLES = {
1297
1276
  input: assoc("overflow", "hidden"),
1298
1277
  multiValue: function multiValue(styles, _ref2) {
1299
1278
  var valid = _ref2.data.valid;
1300
- return _objectSpread$8(_objectSpread$8({}, styles), {}, {
1279
+ return _objectSpread$7(_objectSpread$7({}, styles), {}, {
1301
1280
  border: valid ? STYLES.border["default"] : STYLES.border.error,
1302
1281
  color: valid ? STYLES.color["default"] : STYLES.color.error
1303
1282
  });
@@ -1340,8 +1319,8 @@ var formatErrorMessage = function formatErrorMessage(error) {
1340
1319
  };
1341
1320
 
1342
1321
  var _excluded$2 = ["label", "value", "onChange", "error", "onBlur"];
1343
- function ownKeys$7(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; }
1344
- function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1322
+ function ownKeys$6(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; }
1323
+ function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1345
1324
  var MultiDomainInput = function MultiDomainInput(_ref) {
1346
1325
  var _ref$label = _ref.label,
1347
1326
  label = _ref$label === void 0 ? "" : _ref$label,
@@ -1400,7 +1379,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
1400
1379
  "data-cy": "".concat(hyphenize(label), "-input-label"),
1401
1380
  children: label
1402
1381
  })
1403
- }), /*#__PURE__*/jsx(CreatableSelect, _objectSpread$7({
1382
+ }), /*#__PURE__*/jsx(CreatableSelect, _objectSpread$6({
1404
1383
  isMulti: true,
1405
1384
  required: true,
1406
1385
  classNamePrefix: "neeto-ui-react-select",
@@ -1410,7 +1389,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
1410
1389
  className: classnames("neeto-ui-react-select__container neeto-ui-react-select__container--medium neeto-ui-email-input__select", {
1411
1390
  "neeto-ui-react-select__container--error": !!error
1412
1391
  }),
1413
- styles: _objectSpread$7(_objectSpread$7({}, CUSTOM_STYLES), {}, {
1392
+ styles: _objectSpread$6(_objectSpread$6({}, CUSTOM_STYLES), {}, {
1414
1393
  control: mergeLeft({
1415
1394
  maxHeight: "200px",
1416
1395
  overflowY: "auto"
@@ -1422,7 +1401,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
1422
1401
  },
1423
1402
  onInputChange: setInputValue,
1424
1403
  onKeyDown: handleKeyDown
1425
- }, _objectSpread$7({
1404
+ }, _objectSpread$6({
1426
1405
  inputValue: inputValue,
1427
1406
  isFocused: isFocused,
1428
1407
  onChange: onChange,
@@ -1452,8 +1431,8 @@ var validateDomains = function validateDomains(value) {
1452
1431
  }));
1453
1432
 
1454
1433
  // eslint-disable-next-line no-async-promise-executor
1455
- return new Promise( /*#__PURE__*/function () {
1456
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(resolve) {
1434
+ return new Promise(/*#__PURE__*/function () {
1435
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(resolve) {
1457
1436
  return _regeneratorRuntime.wrap(function _callee$(_context) {
1458
1437
  while (1) switch (_context.prev = _context.next) {
1459
1438
  case 0:
@@ -1480,9 +1459,13 @@ var validateDomains = function validateDomains(value) {
1480
1459
  }());
1481
1460
  };
1482
1461
 
1483
- var RestrictedDomains = function RestrictedDomains() {
1462
+ var EmailDomains = function EmailDomains(_ref) {
1463
+ var name = _ref.name,
1464
+ label = _ref.label;
1465
+ var _useTranslation = useTranslation(),
1466
+ t = _useTranslation.t;
1484
1467
  var _useField = useField({
1485
- name: "restrictedDomains",
1468
+ name: name,
1486
1469
  validate: validateDomains
1487
1470
  }),
1488
1471
  _useField2 = _slicedToArray(_useField, 3),
@@ -1492,15 +1475,14 @@ var RestrictedDomains = function RestrictedDomains() {
1492
1475
  _useField2$ = _useField2[2],
1493
1476
  setValue = _useField2$.setValue,
1494
1477
  setTouched = _useField2$.setTouched;
1495
- var _useTranslation = useTranslation(),
1496
- t = _useTranslation.t;
1497
1478
  var formattedDomains = map(formatDomainInputOptions, domains);
1498
1479
  return /*#__PURE__*/jsx("div", {
1499
1480
  className: "mb-4",
1500
1481
  children: /*#__PURE__*/jsx(MultiDomainInput, {
1482
+ label: label,
1483
+ name: name,
1501
1484
  error: meta.touched ? meta.error : "",
1502
- label: t("neetoForm.domainRestriction.description"),
1503
- name: "restrictedDomains",
1485
+ placeholder: t("neetoForm.domainRestriction.placeholder"),
1504
1486
  value: formattedDomains,
1505
1487
  onBlur: function onBlur() {
1506
1488
  return setTouched(true);
@@ -1512,34 +1494,53 @@ var RestrictedDomains = function RestrictedDomains() {
1512
1494
  });
1513
1495
  };
1514
1496
 
1515
- function ownKeys$6(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; }
1516
- function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1517
- var Email = function Email() {
1518
- var _useFormikContext = useFormikContext(),
1519
- _useFormikContext$val = _useFormikContext.values.isDomainRestrictionEnabled,
1520
- isDomainRestrictionEnabled = _useFormikContext$val === void 0 ? false : _useFormikContext$val;
1521
- var helpDocUrl = useBuildFormStore(path(["formState", "helpDocUrls", "domainRestriction"]));
1522
- var _useTranslation = useTranslation(),
1523
- t = _useTranslation.t;
1497
+ var RestrictDomainsBlock = function RestrictDomainsBlock(_ref) {
1498
+ var switchName = _ref.switchName,
1499
+ domainName = _ref.domainName,
1500
+ isDomainRestrictionEnabled = _ref.isDomainRestrictionEnabled;
1501
+ var _DOMAIN_RESTRICTION_T = DOMAIN_RESTRICTION_TRANSLATIONS[domainName],
1502
+ title = _DOMAIN_RESTRICTION_T.title,
1503
+ description = _DOMAIN_RESTRICTION_T.description,
1504
+ popoverDescription = _DOMAIN_RESTRICTION_T.popoverDescription;
1505
+ var helpLink = useBuildFormStore(path(["formState", "helpDocUrls", domainName]));
1524
1506
  return /*#__PURE__*/jsxs("div", {
1525
1507
  className: "flex flex-col space-y-4",
1508
+ "data-cy": "".concat(hyphenate(switchName), "-container"),
1526
1509
  children: [/*#__PURE__*/jsx(SwitchBlock, {
1527
1510
  className: "mt-4",
1528
- name: "isDomainRestrictionEnabled",
1529
- title: /*#__PURE__*/jsxs("div", {
1530
- className: "flex gap-2",
1531
- children: [t("neetoForm.domainRestriction.label"), /*#__PURE__*/jsx(HelpPopover, _objectSpread$6({
1532
- description: t("neetoForm.domainRestriction.popoverDescription"),
1533
- popoverProps: {
1534
- position: "top"
1535
- }
1536
- }, helpDocUrl && {
1537
- helpLinkProps: {
1538
- href: helpDocUrl
1539
- }
1540
- }))]
1511
+ name: switchName,
1512
+ title: /*#__PURE__*/jsx(TitleWithHelpPopover, {
1513
+ helpLink: helpLink,
1514
+ title: title,
1515
+ description: popoverDescription
1541
1516
  })
1542
- }), isDomainRestrictionEnabled && /*#__PURE__*/jsx(RestrictedDomains, {})]
1517
+ }), isDomainRestrictionEnabled && /*#__PURE__*/jsx(EmailDomains, {
1518
+ label: description,
1519
+ name: domainName
1520
+ })]
1521
+ });
1522
+ };
1523
+
1524
+ var Email = function Email(_ref) {
1525
+ var enableDomainWhitelisting = _ref.enableDomainWhitelisting,
1526
+ enableDomainBlacklisting = _ref.enableDomainBlacklisting;
1527
+ var _useFormikContext = useFormikContext(),
1528
+ _useFormikContext$val = _useFormikContext.values,
1529
+ _useFormikContext$val2 = _useFormikContext$val.isDomainWhitelistingEnabled,
1530
+ isDomainWhitelistingEnabled = _useFormikContext$val2 === void 0 ? false : _useFormikContext$val2,
1531
+ _useFormikContext$val3 = _useFormikContext$val.isDomainBlacklistingEnabled,
1532
+ isDomainBlacklistingEnabled = _useFormikContext$val3 === void 0 ? false : _useFormikContext$val3;
1533
+ return /*#__PURE__*/jsxs("div", {
1534
+ className: "flex flex-col space-y-4",
1535
+ children: [enableDomainWhitelisting && /*#__PURE__*/jsx(RestrictDomainsBlock, {
1536
+ domainName: "whitelistedDomains",
1537
+ isDomainRestrictionEnabled: isDomainWhitelistingEnabled,
1538
+ switchName: "isDomainWhitelistingEnabled"
1539
+ }), enableDomainBlacklisting && /*#__PURE__*/jsx(RestrictDomainsBlock, {
1540
+ domainName: "blacklistedDomains",
1541
+ isDomainRestrictionEnabled: isDomainBlacklistingEnabled,
1542
+ switchName: "isDomainBlacklistingEnabled"
1543
+ })]
1543
1544
  });
1544
1545
  };
1545
1546
 
@@ -1897,7 +1898,8 @@ var transformValueForOption = function transformValueForOption(_ref) {
1897
1898
  var renderAdditionalData = function renderAdditionalData(_ref2) {
1898
1899
  var kind = _ref2.kind,
1899
1900
  questionProps = _ref2.questionProps,
1900
- enableDomainRestriction = _ref2.enableDomainRestriction;
1901
+ enableDomainWhitelisting = _ref2.enableDomainWhitelisting,
1902
+ enableDomainBlacklisting = _ref2.enableDomainBlacklisting;
1901
1903
  switch (kind) {
1902
1904
  case CHECKBOX:
1903
1905
  case RADIO:
@@ -1914,7 +1916,10 @@ var renderAdditionalData = function renderAdditionalData(_ref2) {
1914
1916
  case CAPTCHA:
1915
1917
  return /*#__PURE__*/jsx(Captcha, {});
1916
1918
  case EMAIL:
1917
- return enableDomainRestriction ? /*#__PURE__*/jsx(Email, {}) : null;
1919
+ return enableDomainWhitelisting || enableDomainBlacklisting ? /*#__PURE__*/jsx(Email, {
1920
+ enableDomainBlacklisting: enableDomainBlacklisting,
1921
+ enableDomainWhitelisting: enableDomainWhitelisting
1922
+ }) : null;
1918
1923
  default:
1919
1924
  return null;
1920
1925
  }
@@ -1999,7 +2004,7 @@ var AddQuestion = function AddQuestion(_ref) {
1999
2004
  }));
2000
2005
  };
2001
2006
 
2002
- var _excluded = ["questionKinds", "onValueChange", "formId", "isDeletable", "isRequiredField", "submitButtonProps", "cancelButtonProps", "isKindAlreadyActive", "getActiveKindDetails", "isDisabledFieldLabel", "disabledAddButtonTooltipProps", "enableFieldCode", "isFormEnabled", "savedTitle", "formTitle", "formDescription", "selectedLanguage", "availableLanguages", "onLanguageChange", "additionalActionOptions", "isReordering", "additionalQuestionKindPattern", "showActionBlock", "buildRequestArgs", "enableDomainRestriction", "helpDocUrls"];
2007
+ var _excluded = ["questionKinds", "onValueChange", "formId", "isDeletable", "isRequiredField", "submitButtonProps", "cancelButtonProps", "isKindAlreadyActive", "getActiveKindDetails", "isDisabledFieldLabel", "disabledAddButtonTooltipProps", "enableFieldCode", "isFormEnabled", "savedTitle", "formTitle", "formDescription", "selectedLanguage", "availableLanguages", "onLanguageChange", "additionalActionOptions", "isReordering", "additionalQuestionKindPattern", "showActionBlock", "buildRequestArgs", "enableDomainBlacklisting", "enableDomainWhitelisting", "helpDocUrls"];
2003
2008
  function ownKeys$1(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; }
2004
2009
  function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2005
2010
  var Form = function Form(_ref) {
@@ -2027,7 +2032,8 @@ var Form = function Form(_ref) {
2027
2032
  additionalQuestionKindPattern = _ref.additionalQuestionKindPattern,
2028
2033
  showActionBlock = _ref.showActionBlock,
2029
2034
  buildRequestArgs = _ref.buildRequestArgs,
2030
- enableDomainRestriction = _ref.enableDomainRestriction,
2035
+ enableDomainBlacklisting = _ref.enableDomainBlacklisting,
2036
+ enableDomainWhitelisting = _ref.enableDomainWhitelisting,
2031
2037
  helpDocUrls = _ref.helpDocUrls,
2032
2038
  formDomProps = _objectWithoutProperties(_ref, _excluded);
2033
2039
  var containerRef = useRef();
@@ -2076,9 +2082,11 @@ var Form = function Form(_ref) {
2076
2082
  submitForm: submitForm,
2077
2083
  resetForm: resetForm,
2078
2084
  selectedLanguage: selectedLanguage,
2079
- helpDocUrls: helpDocUrls
2085
+ helpDocUrls: helpDocUrls,
2086
+ enableDomainBlacklisting: enableDomainBlacklisting,
2087
+ enableDomainWhitelisting: enableDomainWhitelisting
2080
2088
  });
2081
- }, [formId, isFormEnabled, savedTitle, setFormData, values, dirty, isSubmitting, isValid, errors, submitForm, resetForm, selectedLanguage, helpDocUrls]);
2089
+ }, [formId, isFormEnabled, savedTitle, setFormData, values, dirty, isSubmitting, isValid, errors, submitForm, resetForm, selectedLanguage, helpDocUrls, enableDomainBlacklisting, enableDomainWhitelisting]);
2082
2090
  var questions = values.questions;
2083
2091
  var handleSelect = function handleSelect(question) {
2084
2092
  setSelectedQuestion(question);
@@ -2124,7 +2132,7 @@ var Form = function Form(_ref) {
2124
2132
  enabled: !(isDeleteAlertOpen || isManageQuestionPaneOpen)
2125
2133
  });
2126
2134
  useEffect(function () {
2127
- onValueChange === null || onValueChange === void 0 || onValueChange(questions);
2135
+ onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(questions);
2128
2136
  }, [questions]);
2129
2137
  var availableQuestionKinds = getAvailableQuestionKinds({
2130
2138
  allQuestionKinds: questionKinds,
@@ -2221,7 +2229,6 @@ var Form = function Form(_ref) {
2221
2229
  additionalQuestionKindPattern: additionalQuestionKindPattern,
2222
2230
  availableQuestionKinds: availableQuestionKinds,
2223
2231
  buildRequestArgs: buildRequestArgs,
2224
- enableDomainRestriction: enableDomainRestriction,
2225
2232
  enableFieldCode: enableFieldCode,
2226
2233
  getActiveKindDetails: getActiveKindDetails,
2227
2234
  handleSelect: handleSelect,
@@ -2284,8 +2291,10 @@ var BuildForm = function BuildForm(_ref) {
2284
2291
  _ref$additionalAction = _ref.additionalActionOptions,
2285
2292
  additionalActionOptions = _ref$additionalAction === void 0 ? [] : _ref$additionalAction,
2286
2293
  additionalQuestionKindPattern = _ref.additionalQuestionKindPattern,
2287
- _ref$enableDomainRest = _ref.enableDomainRestriction,
2288
- enableDomainRestriction = _ref$enableDomainRest === void 0 ? true : _ref$enableDomainRest,
2294
+ _ref$enableDomainBlac = _ref.enableDomainBlacklisting,
2295
+ enableDomainBlacklisting = _ref$enableDomainBlac === void 0 ? true : _ref$enableDomainBlac,
2296
+ _ref$enableDomainWhit = _ref.enableDomainWhitelisting,
2297
+ enableDomainWhitelisting = _ref$enableDomainWhit === void 0 ? true : _ref$enableDomainWhit,
2289
2298
  helpDocUrls = _ref.helpDocUrls,
2290
2299
  className = _ref.className;
2291
2300
  var queryClient = useQueryClient();
@@ -2308,7 +2317,7 @@ var BuildForm = function BuildForm(_ref) {
2308
2317
  isQuestionsLoading = _ref2.isQuestionsLoading;
2309
2318
  useEffect(function () {
2310
2319
  if (data) {
2311
- onUpdate === null || onUpdate === void 0 || onUpdate(data);
2320
+ onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(data);
2312
2321
  }
2313
2322
  }, [data]);
2314
2323
  if (isLoading || showLoader && isQuestionsLoading && !isQuestionsPending) {
@@ -2369,7 +2378,8 @@ var BuildForm = function BuildForm(_ref) {
2369
2378
  buildRequestArgs: buildRequestArgs,
2370
2379
  cancelButtonProps: cancelButtonProps,
2371
2380
  disabledAddButtonTooltipProps: disabledAddButtonTooltipProps,
2372
- enableDomainRestriction: enableDomainRestriction,
2381
+ enableDomainBlacklisting: enableDomainBlacklisting,
2382
+ enableDomainWhitelisting: enableDomainWhitelisting,
2373
2383
  enableFieldCode: enableFieldCode,
2374
2384
  formDescription: formDescription,
2375
2385
  formTitle: formTitle,