@bigbinary/neeto-form-frontend 2.2.0-beta1 → 2.2.0-beta3

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
@@ -4,7 +4,7 @@ import React__default, { useState, createElement, useRef, useEffect, forwardRef,
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 as noop$1, findBy, toLabelAndValue, isPresent as isPresent$1, truncate, slugify, filterBy, removeBy, isNotPresent, isNotEmpty, findById, notEqualsDeep } from '@bigbinary/neeto-cist';
7
+ import { filterNonNull, noop as noop$1, findBy, toLabelAndValue, isPresent as isPresent$1, truncate, slugify, filterBy, hyphenate, removeBy, isNotPresent, isNotEmpty, findById, 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
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 as pipe$1, last, not, toLower, map, clamp as clamp$2, identity, filter as filter$1 } from 'ramda';
@@ -21,7 +21,7 @@ import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
21
21
  import { useTranslation, Trans, I18nextProvider } from 'react-i18next';
22
22
  import { create } from 'zustand';
23
23
  import '@babel/runtime/helpers/typeof';
24
- import { isEditorEmpty, Editor as Editor$1, EditorContent } from '@bigbinary/neeto-editor';
24
+ import { isEditorEmpty } from '@bigbinary/neeto-editor/utils';
25
25
  import { shallow } from 'zustand/shallow';
26
26
  import Alert from '@bigbinary/neetoui/Alert';
27
27
  import DOMPurify from 'dompurify';
@@ -33,13 +33,15 @@ import Pane from '@bigbinary/neetoui/Pane';
33
33
  import Form$2 from '@bigbinary/neetoui/formik/Form';
34
34
  import Select from '@bigbinary/neetoui/formik/Select';
35
35
  import Textarea from '@bigbinary/neetoui/formik/Textarea';
36
+ import NeetoEditor from '@bigbinary/neeto-editor/Editor';
36
37
  import Switch from '@bigbinary/neetoui/formik/Switch';
37
- import { Info, Delete, Plus, Check, Close, FileGeneric } from '@bigbinary/neeto-icons';
38
38
  import Button$1 from '@bigbinary/neetoui/Button';
39
+ import Accordion from '@bigbinary/neetoui/Accordion';
39
40
  import Input from '@bigbinary/neetoui/formik/Input';
40
41
  import * as yup from 'yup';
41
42
  import Checkbox$1 from '@bigbinary/neetoui/formik/Checkbox';
42
43
  import Checkbox from '@bigbinary/neetoui/Checkbox';
44
+ import { Delete, Plus, Check, Close, FileGeneric } from '@bigbinary/neeto-icons';
43
45
  import Label from '@bigbinary/neetoui/Label';
44
46
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
45
47
  import _regeneratorRuntime from '@babel/runtime/regenerator';
@@ -48,6 +50,7 @@ import Toastr from '@bigbinary/neetoui/Toastr';
48
50
  import Spinner$2 from '@bigbinary/neetoui/Spinner';
49
51
  import dayjs from 'dayjs';
50
52
  import { parsePhoneNumber } from 'libphonenumber-js';
53
+ import EditorContent from '@bigbinary/neeto-editor/EditorContent';
51
54
  import NeetoUIMultiEmailInput from '@bigbinary/neetoui/MultiEmailInput';
52
55
  import { validation, PhoneNumberInput, PhoneNumber } from '@bigbinary/neeto-molecules/PhoneNumber';
53
56
  import localeData from 'dayjs/plugin/localeData';
@@ -389,7 +392,7 @@ var RATING_VALUES = {
389
392
  }
390
393
  };
391
394
  var SCHEMA_LESS_QUESTION_KINDS = [QUESTION_KIND.PARAGRAPH.value];
392
- var RATING_OPTIONS = [{
395
+ var RATING_OPTIONS$1 = [{
393
396
  icon: SvgHappyFace,
394
397
  modifier: "happy",
395
398
  value: RATING_VALUES.GOOD.value
@@ -554,10 +557,10 @@ var handleQuestionMutationSuccess = function handleQuestionMutationSuccess(_ref)
554
557
  var _args = _slicedToArray$2(args, 1),
555
558
  data = _args[0];
556
559
  queryClient.invalidateQueries({
557
- queryKey: [QUERY_KEYS.QUESTIONS, formId, language]
560
+ queryKey: [QUERY_KEYS.QUESTIONS, formId]
558
561
  });
559
562
  queryClient.invalidateQueries({
560
- queryKey: [QUERY_KEYS.QUESTIONS, "preview/".concat(formId), language]
563
+ queryKey: [QUERY_KEYS.QUESTIONS, "preview/".concat(formId)]
561
564
  });
562
565
  queryClient.setQueryData([QUERY_KEYS.QUESTIONS, formId, language], assoc("questions", data.questions));
563
566
  queryClient.setQueryData([QUERY_KEYS.QUESTIONS, "preview/".concat(formId), language], assoc("questions", data.questions));
@@ -881,8 +884,17 @@ var DEFAULT_AVAILABLE_LANGUAGES = [{
881
884
  var QUESTIONS_WITHOUT_FIELD_CODE = [PARAGRAPH$1, TERMS_AND_CONDITION$1, CONDITION$1, FILE_UPLOAD$3];
882
885
  var QUESTIONS_INITIAL_VALUE = {
883
886
  enabled: false,
884
- questions: [],
885
- title: ""
887
+ questions: [{
888
+ label: "",
889
+ kind: "text",
890
+ nodeId: "1"
891
+ }, {
892
+ label: "",
893
+ kind: "email",
894
+ nodeId: "2"
895
+ }],
896
+ title: "",
897
+ isQuestionsLoading: true
886
898
  };
887
899
  var RESERVED_FIELD_CODES = ["month", "date", "time"];
888
900
  var SELECTABLE_KINDS = [RADIO$2, CHECKBOX$2, DROPDOWN$2];
@@ -951,6 +963,121 @@ var useBuildFormState = function useBuildFormState() {
951
963
  return useBuildFormStore(prop("formState"));
952
964
  };
953
965
 
966
+ var _excluded$c = ["size", "color"],
967
+ _excluded2 = ["size", "color"],
968
+ _excluded3 = ["size", "color"],
969
+ _excluded4 = ["size", "color"];
970
+ function ownKeys$y(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; }
971
+ function _objectSpread$y(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$y(Object(t), !0).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$y(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
972
+ var BadSmiley = function BadSmiley(props) {
973
+ var size = props.size,
974
+ color = props.color,
975
+ other = _objectWithoutProperties$1(props, _excluded$c);
976
+ return /*#__PURE__*/jsxs("svg", _objectSpread$y(_objectSpread$y({
977
+ fill: "none",
978
+ height: size,
979
+ viewBox: "0 0 48 48",
980
+ width: size
981
+ }, other), {}, {
982
+ children: [/*#__PURE__*/jsx("path", {
983
+ d: "M24 0C10.767 0 0 10.767 0 24s10.767 24 24 24c13.234 0 24-10.767 24-24S37.234 0 24 0zm0 45.913c-12.084 0-21.913-9.83-21.913-21.913 0-12.084 9.83-21.913 21.913-21.913 12.082 0 21.913 9.83 21.913 21.913 0 12.084-9.83 21.913-21.913 21.913z",
984
+ fill: color
985
+ }), /*#__PURE__*/jsx("path", {
986
+ d: "M18.783 19.826a3.134 3.134 0 00-3.13-3.13 3.134 3.134 0 00-3.131 3.13 3.134 3.134 0 003.13 3.13 3.134 3.134 0 003.13-3.13zm-4.174 0c0-.575.468-1.044 1.043-1.044s1.044.469 1.044 1.044c0 .575-.469 1.043-1.044 1.043a1.045 1.045 0 01-1.043-1.043zm17.739-3.13a3.134 3.134 0 00-3.13 3.13 3.134 3.134 0 003.13 3.13 3.134 3.134 0 003.13-3.13 3.134 3.134 0 00-3.13-3.13zm0 4.173a1.045 1.045 0 010-2.087 1.045 1.045 0 010 2.087zM24 29.218a13.677 13.677 0 00-10.168 4.52 1.043 1.043 0 101.553 1.394A11.587 11.587 0 0124 31.305c3.3 0 6.44 1.394 8.614 3.826a1.045 1.045 0 001.473.082 1.044 1.044 0 00.082-1.473c-2.57-2.874-6.277-4.523-10.169-4.523z",
987
+ fill: color
988
+ })]
989
+ }));
990
+ };
991
+ BadSmiley.defaultProps = {
992
+ color: "currentColor",
993
+ size: 24,
994
+ strokeWidth: "1.5"
995
+ };
996
+ var OkaySmiley = function OkaySmiley(props) {
997
+ var size = props.size,
998
+ color = props.color,
999
+ other = _objectWithoutProperties$1(props, _excluded2);
1000
+ return /*#__PURE__*/jsxs("svg", _objectSpread$y(_objectSpread$y({
1001
+ fill: "none",
1002
+ height: size,
1003
+ viewBox: "0 0 48 48",
1004
+ width: size
1005
+ }, other), {}, {
1006
+ children: [/*#__PURE__*/jsx("path", {
1007
+ d: "M24 0C10.767 0 0 10.767 0 24s10.767 24 24 24 24-10.767 24-24S37.233 0 24 0zm0 45.913c-12.084 0-21.913-9.83-21.913-21.913 0-12.084 9.83-21.913 21.913-21.913 12.084 0 21.913 9.83 21.913 21.913 0 12.084-9.83 21.913-21.913 21.913z",
1008
+ fill: color
1009
+ }), /*#__PURE__*/jsx("path", {
1010
+ d: "M15.652 22.956a3.134 3.134 0 003.13-3.13 3.134 3.134 0 00-3.13-3.13 3.134 3.134 0 00-3.13 3.13 3.134 3.134 0 003.13 3.13zm0-4.174c.575 0 1.044.469 1.044 1.044 0 .575-.469 1.043-1.044 1.043a1.045 1.045 0 01-1.043-1.043c0-.575.468-1.044 1.043-1.044zm16.696-2.086a3.134 3.134 0 00-3.13 3.13 3.134 3.134 0 003.13 3.13 3.134 3.134 0 003.13-3.13 3.134 3.134 0 00-3.13-3.13zm0 4.173a1.045 1.045 0 01-1.044-1.043c0-.575.469-1.044 1.044-1.044a1.044 1.044 0 010 2.087zm2.087 8.349h-20.87a1.044 1.044 0 000 2.086h20.87a1.044 1.044 0 000-2.086z",
1011
+ fill: color
1012
+ })]
1013
+ }));
1014
+ };
1015
+ OkaySmiley.defaultProps = {
1016
+ color: "currentColor",
1017
+ size: 24,
1018
+ strokeWidth: "1.5"
1019
+ };
1020
+ var GoodSmiley = function GoodSmiley(props) {
1021
+ var size = props.size,
1022
+ color = props.color,
1023
+ other = _objectWithoutProperties$1(props, _excluded3);
1024
+ return /*#__PURE__*/jsxs("svg", _objectSpread$y(_objectSpread$y({
1025
+ fill: "none",
1026
+ height: size,
1027
+ viewBox: "0 0 48 48",
1028
+ width: size
1029
+ }, other), {}, {
1030
+ children: [/*#__PURE__*/jsx("path", {
1031
+ d: "M24 0C10.767 0 0 10.767 0 24s10.767 24 24 24 24-10.767 24-24S37.233 0 24 0zm0 45.913c-12.084 0-21.913-9.83-21.913-21.913 0-12.084 9.83-21.913 21.913-21.913 12.084 0 21.913 9.83 21.913 21.913 0 12.084-9.83 21.913-21.913 21.913z",
1032
+ fill: color
1033
+ }), /*#__PURE__*/jsx("path", {
1034
+ d: "M18.783 19.826a3.134 3.134 0 00-3.13-3.13 3.134 3.134 0 00-3.131 3.13 3.134 3.134 0 003.13 3.13 3.134 3.134 0 003.13-3.13zm-4.174 0a1.044 1.044 0 012.087 0c0 .575-.469 1.044-1.044 1.044a1.045 1.045 0 01-1.043-1.044zm17.739-3.13a3.134 3.134 0 00-3.13 3.13 3.134 3.134 0 003.13 3.13 3.134 3.134 0 003.13-3.13 3.134 3.134 0 00-3.13-3.13zm0 4.174a1.045 1.045 0 01-1.044-1.044 1.044 1.044 0 111.044 1.044zm.265 8.695c-2.175 2.432-5.314 3.826-8.613 3.826a11.59 11.59 0 01-8.615-3.827 1.043 1.043 0 10-1.553 1.394A13.677 13.677 0 0024 35.478c3.892 0 7.599-1.648 10.17-4.521a1.043 1.043 0 10-1.557-1.392z",
1035
+ fill: color
1036
+ })]
1037
+ }));
1038
+ };
1039
+ GoodSmiley.defaultProps = {
1040
+ color: "currentColor",
1041
+ size: 24,
1042
+ strokeWidth: "1.5"
1043
+ };
1044
+ var Drag = function Drag(props) {
1045
+ var size = props.size,
1046
+ color = props.color,
1047
+ other = _objectWithoutProperties$1(props, _excluded4);
1048
+ return /*#__PURE__*/jsxs("svg", _objectSpread$y(_objectSpread$y({
1049
+ fill: "none",
1050
+ height: size,
1051
+ viewBox: "0 0 24 24",
1052
+ width: size
1053
+ }, other), {}, {
1054
+ children: [/*#__PURE__*/jsx("g", {
1055
+ clipPath: "url(#clip0_6290_43)",
1056
+ fill: color,
1057
+ stroke: color,
1058
+ strokeLinecap: "round",
1059
+ strokeLinejoin: "round",
1060
+ strokeWidth: "1.5",
1061
+ children: /*#__PURE__*/jsx("path", {
1062
+ d: "M8 12a1 1 0 102 0 1 1 0 00-2 0zM8 18a1 1 0 102 0 1 1 0 00-2 0zM8 6a1 1 0 102 0 1 1 0 00-2 0zM14 12a1 1 0 102 0 1 1 0 00-2 0zM14 18a1 1 0 102 0 1 1 0 00-2 0zM14 6a1 1 0 102 0 1 1 0 00-2 0z"
1063
+ })
1064
+ }), /*#__PURE__*/jsx("defs", {
1065
+ children: /*#__PURE__*/jsx("clipPath", {
1066
+ id: "clip0_6290_43",
1067
+ children: /*#__PURE__*/jsx("path", {
1068
+ d: "M0 0H24V24H0z",
1069
+ fill: color
1070
+ })
1071
+ })
1072
+ })]
1073
+ }));
1074
+ };
1075
+ Drag.defaultProps = {
1076
+ color: "currentColor",
1077
+ size: 24,
1078
+ strokeWidth: "1.5"
1079
+ };
1080
+
954
1081
  var getActiveQuestionKindDetails = function getActiveQuestionKindDetails(_ref) {
955
1082
  var allQuestionKinds = _ref.allQuestionKinds,
956
1083
  item = _ref.item;
@@ -1007,6 +1134,19 @@ var FILE_GROUPS = [{
1007
1134
  label: t$3("neetoForm.fileTypes.audioVideo"),
1008
1135
  name: FILE_TYPES.AUDIO_VIDEO
1009
1136
  }];
1137
+ var RATING_OPTIONS = [{
1138
+ icon: GoodSmiley,
1139
+ name: "highestRatingLabel",
1140
+ color: "#00ba88"
1141
+ }, {
1142
+ icon: OkaySmiley,
1143
+ name: "averageRatingLabel",
1144
+ color: "#f3cd82"
1145
+ }, {
1146
+ icon: BadSmiley,
1147
+ name: "lowestRatingLabel",
1148
+ color: "#f56a58"
1149
+ }];
1010
1150
 
1011
1151
  var NAME$1 = QUESTION_TYPES.NAME,
1012
1152
  PHONE$1 = QUESTION_TYPES.PHONE,
@@ -1365,121 +1505,6 @@ var Overview = function Overview(_ref) {
1365
1505
  });
1366
1506
  };
1367
1507
 
1368
- var _excluded$c = ["size", "color"],
1369
- _excluded2 = ["size", "color"],
1370
- _excluded3 = ["size", "color"],
1371
- _excluded4 = ["size", "color"];
1372
- function ownKeys$y(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; }
1373
- function _objectSpread$y(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$y(Object(t), !0).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$y(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1374
- var BadSmiley = function BadSmiley(props) {
1375
- var size = props.size,
1376
- color = props.color,
1377
- other = _objectWithoutProperties$1(props, _excluded$c);
1378
- return /*#__PURE__*/jsxs("svg", _objectSpread$y(_objectSpread$y({
1379
- fill: "none",
1380
- height: size,
1381
- viewBox: "0 0 48 48",
1382
- width: size
1383
- }, other), {}, {
1384
- children: [/*#__PURE__*/jsx("path", {
1385
- d: "M24 0C10.767 0 0 10.767 0 24s10.767 24 24 24c13.234 0 24-10.767 24-24S37.234 0 24 0zm0 45.913c-12.084 0-21.913-9.83-21.913-21.913 0-12.084 9.83-21.913 21.913-21.913 12.082 0 21.913 9.83 21.913 21.913 0 12.084-9.83 21.913-21.913 21.913z",
1386
- fill: color
1387
- }), /*#__PURE__*/jsx("path", {
1388
- d: "M18.783 19.826a3.134 3.134 0 00-3.13-3.13 3.134 3.134 0 00-3.131 3.13 3.134 3.134 0 003.13 3.13 3.134 3.134 0 003.13-3.13zm-4.174 0c0-.575.468-1.044 1.043-1.044s1.044.469 1.044 1.044c0 .575-.469 1.043-1.044 1.043a1.045 1.045 0 01-1.043-1.043zm17.739-3.13a3.134 3.134 0 00-3.13 3.13 3.134 3.134 0 003.13 3.13 3.134 3.134 0 003.13-3.13 3.134 3.134 0 00-3.13-3.13zm0 4.173a1.045 1.045 0 010-2.087 1.045 1.045 0 010 2.087zM24 29.218a13.677 13.677 0 00-10.168 4.52 1.043 1.043 0 101.553 1.394A11.587 11.587 0 0124 31.305c3.3 0 6.44 1.394 8.614 3.826a1.045 1.045 0 001.473.082 1.044 1.044 0 00.082-1.473c-2.57-2.874-6.277-4.523-10.169-4.523z",
1389
- fill: color
1390
- })]
1391
- }));
1392
- };
1393
- BadSmiley.defaultProps = {
1394
- color: "currentColor",
1395
- size: 24,
1396
- strokeWidth: "1.5"
1397
- };
1398
- var OkaySmiley = function OkaySmiley(props) {
1399
- var size = props.size,
1400
- color = props.color,
1401
- other = _objectWithoutProperties$1(props, _excluded2);
1402
- return /*#__PURE__*/jsxs("svg", _objectSpread$y(_objectSpread$y({
1403
- fill: "none",
1404
- height: size,
1405
- viewBox: "0 0 48 48",
1406
- width: size
1407
- }, other), {}, {
1408
- children: [/*#__PURE__*/jsx("path", {
1409
- d: "M24 0C10.767 0 0 10.767 0 24s10.767 24 24 24 24-10.767 24-24S37.233 0 24 0zm0 45.913c-12.084 0-21.913-9.83-21.913-21.913 0-12.084 9.83-21.913 21.913-21.913 12.084 0 21.913 9.83 21.913 21.913 0 12.084-9.83 21.913-21.913 21.913z",
1410
- fill: color
1411
- }), /*#__PURE__*/jsx("path", {
1412
- d: "M15.652 22.956a3.134 3.134 0 003.13-3.13 3.134 3.134 0 00-3.13-3.13 3.134 3.134 0 00-3.13 3.13 3.134 3.134 0 003.13 3.13zm0-4.174c.575 0 1.044.469 1.044 1.044 0 .575-.469 1.043-1.044 1.043a1.045 1.045 0 01-1.043-1.043c0-.575.468-1.044 1.043-1.044zm16.696-2.086a3.134 3.134 0 00-3.13 3.13 3.134 3.134 0 003.13 3.13 3.134 3.134 0 003.13-3.13 3.134 3.134 0 00-3.13-3.13zm0 4.173a1.045 1.045 0 01-1.044-1.043c0-.575.469-1.044 1.044-1.044a1.044 1.044 0 010 2.087zm2.087 8.349h-20.87a1.044 1.044 0 000 2.086h20.87a1.044 1.044 0 000-2.086z",
1413
- fill: color
1414
- })]
1415
- }));
1416
- };
1417
- OkaySmiley.defaultProps = {
1418
- color: "currentColor",
1419
- size: 24,
1420
- strokeWidth: "1.5"
1421
- };
1422
- var GoodSmiley = function GoodSmiley(props) {
1423
- var size = props.size,
1424
- color = props.color,
1425
- other = _objectWithoutProperties$1(props, _excluded3);
1426
- return /*#__PURE__*/jsxs("svg", _objectSpread$y(_objectSpread$y({
1427
- fill: "none",
1428
- height: size,
1429
- viewBox: "0 0 48 48",
1430
- width: size
1431
- }, other), {}, {
1432
- children: [/*#__PURE__*/jsx("path", {
1433
- d: "M24 0C10.767 0 0 10.767 0 24s10.767 24 24 24 24-10.767 24-24S37.233 0 24 0zm0 45.913c-12.084 0-21.913-9.83-21.913-21.913 0-12.084 9.83-21.913 21.913-21.913 12.084 0 21.913 9.83 21.913 21.913 0 12.084-9.83 21.913-21.913 21.913z",
1434
- fill: color
1435
- }), /*#__PURE__*/jsx("path", {
1436
- d: "M18.783 19.826a3.134 3.134 0 00-3.13-3.13 3.134 3.134 0 00-3.131 3.13 3.134 3.134 0 003.13 3.13 3.134 3.134 0 003.13-3.13zm-4.174 0a1.044 1.044 0 012.087 0c0 .575-.469 1.044-1.044 1.044a1.045 1.045 0 01-1.043-1.044zm17.739-3.13a3.134 3.134 0 00-3.13 3.13 3.134 3.134 0 003.13 3.13 3.134 3.134 0 003.13-3.13 3.134 3.134 0 00-3.13-3.13zm0 4.174a1.045 1.045 0 01-1.044-1.044 1.044 1.044 0 111.044 1.044zm.265 8.695c-2.175 2.432-5.314 3.826-8.613 3.826a11.59 11.59 0 01-8.615-3.827 1.043 1.043 0 10-1.553 1.394A13.677 13.677 0 0024 35.478c3.892 0 7.599-1.648 10.17-4.521a1.043 1.043 0 10-1.557-1.392z",
1437
- fill: color
1438
- })]
1439
- }));
1440
- };
1441
- GoodSmiley.defaultProps = {
1442
- color: "currentColor",
1443
- size: 24,
1444
- strokeWidth: "1.5"
1445
- };
1446
- var Drag = function Drag(props) {
1447
- var size = props.size,
1448
- color = props.color,
1449
- other = _objectWithoutProperties$1(props, _excluded4);
1450
- return /*#__PURE__*/jsxs("svg", _objectSpread$y(_objectSpread$y({
1451
- fill: "none",
1452
- height: size,
1453
- viewBox: "0 0 24 24",
1454
- width: size
1455
- }, other), {}, {
1456
- children: [/*#__PURE__*/jsx("g", {
1457
- clipPath: "url(#clip0_6290_43)",
1458
- fill: color,
1459
- stroke: color,
1460
- strokeLinecap: "round",
1461
- strokeLinejoin: "round",
1462
- strokeWidth: "1.5",
1463
- children: /*#__PURE__*/jsx("path", {
1464
- d: "M8 12a1 1 0 102 0 1 1 0 00-2 0zM8 18a1 1 0 102 0 1 1 0 00-2 0zM8 6a1 1 0 102 0 1 1 0 00-2 0zM14 12a1 1 0 102 0 1 1 0 00-2 0zM14 18a1 1 0 102 0 1 1 0 00-2 0zM14 6a1 1 0 102 0 1 1 0 00-2 0z"
1465
- })
1466
- }), /*#__PURE__*/jsx("defs", {
1467
- children: /*#__PURE__*/jsx("clipPath", {
1468
- id: "clip0_6290_43",
1469
- children: /*#__PURE__*/jsx("path", {
1470
- d: "M0 0H24V24H0z",
1471
- fill: color
1472
- })
1473
- })
1474
- })]
1475
- }));
1476
- };
1477
- Drag.defaultProps = {
1478
- color: "currentColor",
1479
- size: 24,
1480
- strokeWidth: "1.5"
1481
- };
1482
-
1483
1508
  var validateEditorContent = function validateEditorContent(editorRef) {
1484
1509
  return function () {
1485
1510
  var _editorRef$current;
@@ -2011,7 +2036,7 @@ var Editor = function Editor() {
2011
2036
  });
2012
2037
  return /*#__PURE__*/jsx("div", {
2013
2038
  className: "w-full cursor-auto",
2014
- children: /*#__PURE__*/jsx(Editor$1, {
2039
+ children: /*#__PURE__*/jsx(NeetoEditor, {
2015
2040
  required: true,
2016
2041
  error: touched ? error : "",
2017
2042
  id: "editor",
@@ -2060,31 +2085,27 @@ var InputWithMaxLength = function InputWithMaxLength(_ref) {
2060
2085
 
2061
2086
  var FieldCode = withT(function (_ref) {
2062
2087
  var t = _ref.t;
2063
- return /*#__PURE__*/jsx("div", {
2064
- children: /*#__PURE__*/jsx(InputWithMaxLength, {
2065
- required: true,
2066
- label: t("neetoForm.questions.common.questionFields.field.fieldCode"),
2067
- name: "fieldCode",
2068
- helpText: /*#__PURE__*/jsx(Trans, {
2069
- i18nKey: "neetoForm.questions.common.questionFields.field.fieldCodeHelpDescription",
2070
- components: {
2071
- Link: /*#__PURE__*/jsx(Button$1, {
2072
- className: "text-xs",
2073
- href: FIELD_CODE_DOC,
2074
- style: "link",
2075
- target: "_blank"
2076
- })
2077
- }
2078
- }),
2079
- labelProps: {
2080
- helpIconProps: {
2081
- icon: Info,
2082
- className: "cursor-pointer",
2083
- onClick: function onClick() {
2084
- return window.open(FIELD_CODE_DOC, "_blank");
2088
+ return /*#__PURE__*/jsx(Accordion, {
2089
+ className: "neeto-form-nano-advanced-properties-accordion",
2090
+ "data-cy": "advanced-properties-card",
2091
+ children: /*#__PURE__*/jsx(Accordion.Item, {
2092
+ title: t("neetoForm.common.advancedProperties"),
2093
+ children: /*#__PURE__*/jsx(InputWithMaxLength, {
2094
+ required: true,
2095
+ label: t("neetoForm.questions.common.questionFields.field.fieldCode"),
2096
+ name: "fieldCode",
2097
+ helpText: /*#__PURE__*/jsx(Trans, {
2098
+ i18nKey: "neetoForm.questions.common.questionFields.field.fieldCodeHelpDescription",
2099
+ components: {
2100
+ Link: /*#__PURE__*/jsx(Button$1, {
2101
+ className: "text-xs",
2102
+ href: FIELD_CODE_DOC,
2103
+ style: "link",
2104
+ target: "_blank"
2105
+ })
2085
2106
  }
2086
- }
2087
- }
2107
+ })
2108
+ })
2088
2109
  })
2089
2110
  });
2090
2111
  });
@@ -2127,19 +2148,28 @@ var Form$1 = function Form(_ref) {
2127
2148
  var shouldShowPlaceholder = includes(kind, QUESTIONS_WITH_PLACEHOLDERS);
2128
2149
  var hasAdditionalData = includes(kind, QUESTIONS_WITH_ADDITIONAL_DATA);
2129
2150
  var shouldShowFieldCode = enableFieldCode && !includes(kind, QUESTIONS_WITHOUT_FIELD_CODE);
2130
- var handleKindChange = function handleKindChange(_ref3) {
2131
- var label = _ref3.label,
2132
- value = _ref3.value;
2151
+ var handleKindChange = function handleKindChange(option) {
2152
+ var data = buildQuestionData(option);
2153
+ updateFormState(data);
2154
+ };
2155
+ var buildQuestionData = function buildQuestionData(option) {
2156
+ if (isNil(option)) {
2157
+ return INITIAL_VALUES;
2158
+ }
2159
+ var label = option.label,
2160
+ value = option.value;
2133
2161
  var kind = extractKindFromOption(value);
2134
2162
  var questionKind = getQuestionKind(availableQuestionKinds, {
2135
2163
  type: kind,
2136
2164
  label: label
2137
2165
  });
2138
- var data = createFieldData({
2166
+ return createFieldData({
2139
2167
  kind: questionKind,
2140
2168
  isRequired: isRequired,
2141
2169
  questions: questions
2142
2170
  });
2171
+ };
2172
+ var updateFormState = function updateFormState(data) {
2143
2173
  setValues(data);
2144
2174
  setErrors({});
2145
2175
  setTouched({});
@@ -2180,11 +2210,7 @@ var Form$1 = function Form(_ref) {
2180
2210
  dataCy: "settings-card",
2181
2211
  title: t("neetoForm.common.settings"),
2182
2212
  children: /*#__PURE__*/jsx(RequiredSwitch, {})
2183
- }), shouldShowFieldCode && /*#__PURE__*/jsx(Block, {
2184
- dataCy: "advanced-properties-card",
2185
- title: t("neetoForm.common.advancedProperties"),
2186
- children: /*#__PURE__*/jsx(FieldCode, {})
2187
- })]
2213
+ }), shouldShowFieldCode && /*#__PURE__*/jsx(FieldCode, {})]
2188
2214
  })]
2189
2215
  })
2190
2216
  });
@@ -2387,6 +2413,7 @@ var FileGroup = function FileGroup(_ref) {
2387
2413
  checked: checked,
2388
2414
  label: label,
2389
2415
  name: name,
2416
+ "data-cy": "neeto-form-engine-file-type-".concat(name),
2390
2417
  id: name,
2391
2418
  onChange: handleAllowedFileTypesChange
2392
2419
  });
@@ -2565,6 +2592,7 @@ var Options = function Options(_ref) {
2565
2592
  var _option$id;
2566
2593
  return !option._destroy && /*#__PURE__*/jsxs("div", {
2567
2594
  className: "flex items-start gap-1",
2595
+ "data-cy": "neeto-form-engine-option-".concat(index),
2568
2596
  children: [/*#__PURE__*/jsx(InputWithMaxLength, {
2569
2597
  required: true,
2570
2598
  disabled: freezeOptions,
@@ -2593,6 +2621,7 @@ var Options = function Options(_ref) {
2593
2621
  }), !freezeOptions && /*#__PURE__*/jsx("div", {
2594
2622
  className: "mt-3 w-full",
2595
2623
  children: /*#__PURE__*/jsx(Button$1, {
2624
+ "data-cy": "neeto-form-engine-add-option-button",
2596
2625
  icon: Plus,
2597
2626
  iconPosition: "left",
2598
2627
  size: "small",
@@ -2621,30 +2650,22 @@ var Rating$2 = function Rating() {
2621
2650
  className: "flex flex-col",
2622
2651
  children: /*#__PURE__*/jsx("div", {
2623
2652
  className: "w-full",
2624
- children: /*#__PURE__*/jsxs("div", {
2653
+ children: /*#__PURE__*/jsx("div", {
2625
2654
  className: "flex gap-6",
2626
- children: [/*#__PURE__*/jsxs(RatingItem, {
2627
- children: [/*#__PURE__*/jsx(GoodSmiley, {
2628
- color: "#00ba88",
2629
- size: 48
2630
- }), /*#__PURE__*/jsx(InputWithMaxLength, {
2631
- name: "highestRatingLabel"
2632
- })]
2633
- }), /*#__PURE__*/jsxs(RatingItem, {
2634
- children: [/*#__PURE__*/jsx(OkaySmiley, {
2635
- color: "#f3cd82",
2636
- size: 48
2637
- }), /*#__PURE__*/jsx(InputWithMaxLength, {
2638
- name: "averageRatingLabel"
2639
- })]
2640
- }), /*#__PURE__*/jsxs(RatingItem, {
2641
- children: [/*#__PURE__*/jsx(BadSmiley, {
2642
- color: "#f56a58",
2643
- size: 48
2644
- }), /*#__PURE__*/jsx(InputWithMaxLength, {
2645
- name: "lowestRatingLabel"
2646
- })]
2647
- })]
2655
+ children: RATING_OPTIONS.map(function (_ref2) {
2656
+ var Icon = _ref2.icon,
2657
+ name = _ref2.name,
2658
+ color = _ref2.color;
2659
+ return /*#__PURE__*/jsxs(RatingItem, {
2660
+ children: [/*#__PURE__*/jsx(Icon, {
2661
+ color: color,
2662
+ size: 48
2663
+ }), /*#__PURE__*/jsx(InputWithMaxLength, {
2664
+ name: name,
2665
+ "data-cy": "neeto-form-engine-".concat(hyphenate(name))
2666
+ })]
2667
+ }, name);
2668
+ })
2648
2669
  })
2649
2670
  })
2650
2671
  });
@@ -2665,6 +2686,7 @@ var StarRating$2 = function StarRating() {
2665
2686
  className: "flex space-x-4",
2666
2687
  children: [/*#__PURE__*/jsx(Select, {
2667
2688
  className: "w-1/2",
2689
+ "data-cy": "neeto-form-engine-star-rating-min-value",
2668
2690
  label: t("neetoForm.common.start"),
2669
2691
  name: "minValue",
2670
2692
  options: STAR_RATING_MIN_VALUE_OPTIONS,
@@ -2673,6 +2695,7 @@ var StarRating$2 = function StarRating() {
2673
2695
  }
2674
2696
  }), /*#__PURE__*/jsx(Select, {
2675
2697
  className: "w-1/2",
2698
+ "data-cy": "neeto-form-engine-star-rating-max-value",
2676
2699
  label: t("neetoForm.common.end"),
2677
2700
  name: "maxValue",
2678
2701
  options: STAR_RATING_MAX_VALUE_OPTIONS,
@@ -2690,6 +2713,7 @@ var StarRating$2 = function StarRating() {
2690
2713
  IconType = _ref2[1];
2691
2714
  var isActive = name === iconType;
2692
2715
  return /*#__PURE__*/jsx("div", {
2716
+ "data-cy": "neeto-form-engine-rating-icon-".concat(name),
2693
2717
  className: classnames("flex h-10 w-10 items-center justify-center gap-2", "neeto-ui-border-gray-800 neeto-ui-rounded-full cursor-pointer border", "transition-all duration-300 ease-in-out", {
2694
2718
  "neeto-ui-text-gray-800 neeto-ui-bg-gray-200": !isActive,
2695
2719
  "neeto-ui-text-white neeto-ui-bg-gray-800": isActive
@@ -2799,6 +2823,7 @@ var AddQuestion = withT(function (_ref) {
2799
2823
  content: (disabledAddButtonTooltipProps === null || disabledAddButtonTooltipProps === void 0 ? void 0 : disabledAddButtonTooltipProps.content) || t("neetoForm.questions.common.primaryPanel.noQuestionLeft"),
2800
2824
  children: /*#__PURE__*/jsx("span", {
2801
2825
  children: /*#__PURE__*/jsx(Button$1, {
2826
+ "data-cy": "neeto-form-engine-add-question",
2802
2827
  disabled: isDisabled,
2803
2828
  icon: Plus,
2804
2829
  iconPosition: "left",
@@ -3102,31 +3127,22 @@ var BuildForm = function BuildForm(_ref) {
3102
3127
  isReordering = _useReorderQuestions.isPending;
3103
3128
  var _useFetchQuestions = useFetchQuestions({
3104
3129
  formId: id,
3105
- language: selectedLanguage,
3106
- placeholderData: {
3107
- isQuestionsLoading: true,
3108
- questions: [{
3109
- label: "",
3110
- kind: "text",
3111
- nodeId: "1"
3112
- }, {
3113
- label: "",
3114
- kind: "email",
3115
- nodeId: "2"
3116
- }]
3117
- }
3130
+ language: selectedLanguage
3118
3131
  }),
3119
3132
  data = _useFetchQuestions.data,
3120
- isLoading = _useFetchQuestions.isLoading;
3133
+ isLoading = _useFetchQuestions.isLoading,
3134
+ isQuestionsPending = _useFetchQuestions.isPending;
3121
3135
  var _ref2 = data || QUESTIONS_INITIAL_VALUE,
3122
3136
  isFormEnabled = _ref2.enabled,
3123
3137
  savedTitle = _ref2.title,
3124
3138
  questions = _ref2.questions,
3125
3139
  isQuestionsLoading = _ref2.isQuestionsLoading;
3126
3140
  useEffect(function () {
3127
- onUpdate === null || onUpdate === void 0 || onUpdate(data);
3141
+ if (data) {
3142
+ onUpdate === null || onUpdate === void 0 || onUpdate(data);
3143
+ }
3128
3144
  }, [data]);
3129
- if (isLoading || showLoader && isQuestionsLoading) {
3145
+ if (isLoading || showLoader && isQuestionsLoading && !isQuestionsPending) {
3130
3146
  return /*#__PURE__*/jsx("div", {
3131
3147
  className: "flex h-full w-full items-center justify-center py-6",
3132
3148
  children: /*#__PURE__*/jsx(PageLoader, {})
@@ -3210,7 +3226,7 @@ var BuildForm = function BuildForm(_ref) {
3210
3226
  }
3211
3227
  }));
3212
3228
  }
3213
- }), isQuestionsLoading && /*#__PURE__*/jsx("div", {
3229
+ }), isQuestionsLoading && !isQuestionsPending && /*#__PURE__*/jsx("div", {
3214
3230
  className: "neeto-ui-bg-white absolute inset-0 flex items-center justify-center",
3215
3231
  children: /*#__PURE__*/jsx(PageLoader, {})
3216
3232
  })]
@@ -13473,6 +13489,7 @@ var Choices = function Choices(_ref) {
13473
13489
  var Component = isCheckBox ? Checkbox : Radio.Item;
13474
13490
  return /*#__PURE__*/jsxs("div", {
13475
13491
  className: "neeto-form-engine-choices__wrapper",
13492
+ "data-cy": "".concat(hyphenate(label), "-select-container-wrapper"),
13476
13493
  children: [/*#__PURE__*/jsx("label", {
13477
13494
  className: "neeto-form-engine-label",
13478
13495
  children: label
@@ -13628,7 +13645,7 @@ var Rating = function Rating(_ref) {
13628
13645
  };
13629
13646
  var render = function render() {
13630
13647
  var labels = [highestRatingLabel, averageRatingLabel, lowestRatingLabel];
13631
- return RATING_OPTIONS.map(function (_ref2, index) {
13648
+ return RATING_OPTIONS$1.map(function (_ref2, index) {
13632
13649
  var Icon = _ref2.icon,
13633
13650
  modifier = _ref2.modifier,
13634
13651
  rating = _ref2.value;
@@ -13741,7 +13758,7 @@ var RichTextEditor = function RichTextEditor(_ref) {
13741
13758
  var field = _ref2.field,
13742
13759
  form = _ref2.form,
13743
13760
  meta = _ref2.meta;
13744
- return /*#__PURE__*/jsx(Editor$1, _objectSpread$8({
13761
+ return /*#__PURE__*/jsx(NeetoEditor, _objectSpread$8({
13745
13762
  className: "neeto-form-engine-rich-text-input",
13746
13763
  error: meta.touched ? meta.error : "",
13747
13764
  initialValue: field.value,
@@ -14300,15 +14317,13 @@ var ExternalForm = function ExternalForm(_ref) {
14300
14317
  var _useForm = useForm({
14301
14318
  formId: formId,
14302
14319
  language: language,
14303
- enabled: !preview,
14304
- placeholderData: {
14305
- isQuestionsLoading: true
14306
- }
14320
+ enabled: !preview
14307
14321
  }),
14308
14322
  _useForm$data = _useForm.data,
14309
14323
  form = _useForm$data === void 0 ? {
14310
14324
  title: "",
14311
- questions: []
14325
+ questions: [],
14326
+ isQuestionsLoading: true
14312
14327
  } : _useForm$data,
14313
14328
  isLoading = _useForm.isLoading;
14314
14329
  var _queryClient$getQuery = queryClient.getQueryState([QUERY_KEYS.QUESTIONS, formId, language]),