@bigbinary/neeto-form-frontend 3.10.5 → 3.10.7

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.
@@ -193,9 +193,6 @@
193
193
  "helpText": "Press space, tab or enter key after adding a domain.",
194
194
  "removeInvalidDomains": "Click here to remove invalid domains.",
195
195
  "placeholder": "Please enter the email domains"
196
- },
197
- "smsReminder": {
198
- "popoverDescription": "This question is displayed because SMS reminders are enabled. To remove this question, please disable SMS reminders."
199
196
  }
200
197
  }
201
198
  }
@@ -193,9 +193,6 @@
193
193
  "helpText": "Premi la barra spaziatrice, il tasto Tab o il tasto Invio dopo aver aggiunto un dominio.",
194
194
  "removeInvalidDomains": "Clicca qui per rimuovere i domini non validi.",
195
195
  "placeholder": "Inserisci i domini email"
196
- },
197
- "smsReminder": {
198
- "popoverDescription": "Questa domanda viene visualizzata perché i promemoria SMS sono abilitati. "
199
196
  }
200
197
  }
201
198
  }
@@ -194,9 +194,6 @@
194
194
  "helpText": "Нажмите пробел, табуляцию или клавишу ввода после добавления домена.",
195
195
  "removeInvalidDomains": "Нажмите здесь, чтобы удалить недействительные домены.",
196
196
  "placeholder": "Пожалуйста, введите домены электронной почты"
197
- },
198
- "smsReminder": {
199
- "popoverDescription": "Этот вопрос отображается, поскольку включены напоминания по SMS. "
200
197
  }
201
198
  }
202
199
  }
package/dist/BuildForm.js CHANGED
@@ -9,7 +9,7 @@ import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
9
9
  import { equals, path, when, assoc, includes, isEmpty, reject, keys, pick, omit, evolve, map, modify, without, mergeLeft, isNil, pipe, filter, isNotNil, uniq, join, pluck, test, difference, prop, split, last, __, concat, F } from 'ramda';
10
10
  import { h as useDeleteQuestion, i as useFetchQuestions, j as useCreateQuestion, k as useUpdateQuestion, l as useReorderQuestions, Q as QUERY_KEYS } from './useFormApi-DtoxIPE7.js';
11
11
  import { Q as QUESTION_KIND } from './constants-DlRX5mcQ.js';
12
- import { I as INDEPENDENT_LABELS_MAP, i as isRichTextQuestion, h as htmlToPlainText, a as isElementOverflowing, D as Drag, b as QUESTION_TYPES, S as SELECTABLE_KINDS, c as isAutoGeneratedQuestion, N as NON_BASIC_LATIN_CHARACTERS_REGEX, R as RESERVED_FIELD_CODES, d as isDefaultLanguage, e as buildDisabledAddButtonTooltipProps, f as buildAddQuestionButtonProps, v as validateEditorContent, F as FIELD_CODES_REJECT_CHARS_REGEX, j as isImmutableField, Q as QUESTIONS_WITHOUT_FIELD_CODE, k as NON_HIDEABLE_FIELDS, l as RICH_TEXT_QUESTIONS, C as CAPTCHA_TYPES, m as FILE_TYPES_MAP, n as FILE_GROUPS, M as MINIMUM_OPTIONS, o as RATING_OPTIONS, p as STAR_RATING_MIN_VALUE_OPTIONS, q as STAR_RATING_MAX_VALUE_OPTIONS, r as STAR_RATING_ICONS_MAP, s as QUESTION_ACTIONS, t as QUESTION_KINDS, u as getActiveQuestionKindDetails, w as DEFAULT_AVAILABLE_LANGUAGES, x as QUESTIONS_INITIAL_VALUE, y as buildReorderPayload, z as IMMUTABLE_KINDS, A as MANDATORY_KINDS } from './constants-AohkxnRH.js';
12
+ import { I as INDEPENDENT_LABELS_MAP, i as isRichTextQuestion, h as htmlToPlainText, a as isElementOverflowing, D as Drag, S as SELECTABLE_KINDS, b as isAutoGeneratedQuestion, N as NON_BASIC_LATIN_CHARACTERS_REGEX, R as RESERVED_FIELD_CODES, c as isDefaultLanguage, d as buildDisabledAddButtonTooltipProps, e as buildAddQuestionButtonProps, f as QUESTION_TYPES, v as validateEditorContent, F as FIELD_CODES_REJECT_CHARS_REGEX, j as isImmutableField, Q as QUESTIONS_WITHOUT_FIELD_CODE, k as NON_HIDEABLE_FIELDS, l as RICH_TEXT_QUESTIONS, C as CAPTCHA_TYPES, m as FILE_TYPES_MAP, n as FILE_GROUPS, M as MINIMUM_OPTIONS, o as RATING_OPTIONS, p as STAR_RATING_MIN_VALUE_OPTIONS, q as STAR_RATING_MAX_VALUE_OPTIONS, r as STAR_RATING_ICONS_MAP, s as QUESTION_ACTIONS, t as QUESTION_KINDS, u as getActiveQuestionKindDetails, w as DEFAULT_AVAILABLE_LANGUAGES, x as QUESTIONS_INITIAL_VALUE, y as buildReorderPayload, z as MANDATORY_KINDS } from './constants-BL-0uUwk.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';
@@ -22,8 +22,9 @@ import { shallow } from 'zustand/shallow';
22
22
  import Alert from '@bigbinary/neetoui/Alert';
23
23
  import { f as fieldWithFallback, i as isFunction } from './index-BL5SirYx.js';
24
24
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
25
- import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
26
25
  import Typography from '@bigbinary/neetoui/Typography';
26
+ import Modal from '@bigbinary/neetoui/Modal';
27
+ import MoreDropdown from '@bigbinary/neeto-molecules/MoreDropdown';
27
28
  import Dropdown from '@bigbinary/neetoui/Dropdown';
28
29
  import Tooltip from '@bigbinary/neetoui/Tooltip';
29
30
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
@@ -124,6 +125,31 @@ var DeleteAlert = function DeleteAlert(_ref) {
124
125
  });
125
126
  };
126
127
 
128
+ var DeleteSmsReminderModal = function DeleteSmsReminderModal(_ref) {
129
+ var isOpen = _ref.isOpen,
130
+ onClose = _ref.onClose,
131
+ _ref$hostSpecificData = _ref.hostSpecificData,
132
+ hostSpecificData = _ref$hostSpecificData === void 0 ? {} : _ref$hostSpecificData;
133
+ return /*#__PURE__*/jsxs(Modal, {
134
+ isOpen: isOpen,
135
+ onClose: onClose,
136
+ children: [/*#__PURE__*/jsx(Modal.Header, {
137
+ children: /*#__PURE__*/jsx(Typography, {
138
+ "data-cy": "delete-sms-reminder-modal-header",
139
+ style: "h2",
140
+ weight: "medium",
141
+ children: path(["smsReminder", "deleteModal", "title"], hostSpecificData)
142
+ })
143
+ }), /*#__PURE__*/jsx(Modal.Body, {
144
+ children: /*#__PURE__*/jsx(Typography, {
145
+ "data-cy": "delete-sms-reminder-modal-description",
146
+ style: "body2",
147
+ children: path(["smsReminder", "deleteModal", "description"], hostSpecificData)
148
+ })
149
+ })]
150
+ });
151
+ };
152
+
127
153
  var ChangeLanguageDropdown = function ChangeLanguageDropdown(_ref) {
128
154
  var _findBy;
129
155
  var currentLanguage = _ref.currentLanguage,
@@ -233,8 +259,6 @@ var Overview = function Overview(_ref) {
233
259
  });
234
260
  };
235
261
 
236
- function ownKeys$f(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; }
237
- function _objectSpread$f(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$f(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$f(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
238
262
  var Card = function Card(_ref) {
239
263
  var _ref$question = _ref.question,
240
264
  question = _ref$question === void 0 ? {} : _ref$question,
@@ -252,14 +276,12 @@ var Card = function Card(_ref) {
252
276
  var questionLabelRef = useRef(null);
253
277
  var _useTranslation = useTranslation(),
254
278
  t = _useTranslation.t;
255
- var smsReminderHelpDocUrl = useBuildFormStore(path(["formState", "helpDocUrls", "smsReminder"]));
256
279
  var _getActiveKindDetails = getActiveKindDetails({
257
280
  allQuestionKinds: allQuestionKinds,
258
281
  item: question
259
282
  }),
260
283
  kind = _getActiveKindDetails.kind,
261
284
  isSingular = _getActiveKindDetails.isSingular;
262
- var isSmsReminderQuestion = kind === QUESTION_TYPES.SMS_REMINDER;
263
285
  var label = fieldWithFallback(question, "label");
264
286
  var questionLabel = isRichTextQuestion(kind) ? htmlToPlainText(label) : label;
265
287
  useEffect(function () {
@@ -293,43 +315,33 @@ var Card = function Card(_ref) {
293
315
  children: questionLabel
294
316
  })
295
317
  })]
296
- }), /*#__PURE__*/jsxs("div", {
297
- className: "flex items-center gap-1",
298
- children: [isSmsReminderQuestion && /*#__PURE__*/jsx(HelpPopover, _objectSpread$f({
299
- description: t("neetoForm.smsReminder.popoverDescription"),
300
- popoverProps: {
301
- position: "top"
302
- }
303
- }, smsReminderHelpDocUrl && {
304
- helpLinkProps: {
305
- href: smsReminderHelpDocUrl
318
+ }), /*#__PURE__*/jsx(MoreDropdown, {
319
+ dropdownButtonProps: {
320
+ className: "shrink-0"
321
+ },
322
+ dropdownProps: {
323
+ strategy: "fixed"
324
+ },
325
+ menuItems: [{
326
+ "data-cy": "edit-question",
327
+ key: "edit",
328
+ label: t("neetoForm.common.edit"),
329
+ onClick: onEdit
330
+ }, {
331
+ "data-cy": "clone-question",
332
+ key: "clone",
333
+ label: t("neetoForm.common.clone"),
334
+ isVisible: !isSingular && isFunction(onClone),
335
+ onClick: onClone
336
+ }, {
337
+ "data-cy": "delete-question",
338
+ key: "delete",
339
+ label: t("neetoForm.common.delete"),
340
+ isVisible: isFunction(onDelete),
341
+ onClick: function onClick() {
342
+ return onDelete(question);
306
343
  }
307
- })), /*#__PURE__*/jsx(MoreDropdown, {
308
- dropdownButtonProps: {
309
- className: "shrink-0"
310
- },
311
- dropdownProps: {
312
- strategy: "fixed"
313
- },
314
- menuItems: [{
315
- "data-cy": "edit-question",
316
- key: "edit",
317
- label: t("neetoForm.common.edit"),
318
- onClick: onEdit
319
- }, {
320
- "data-cy": "clone-question",
321
- key: "clone",
322
- label: t("neetoForm.common.clone"),
323
- isVisible: !isSingular && isFunction(onClone),
324
- onClick: onClone
325
- }, {
326
- "data-cy": "delete-question",
327
- key: "delete",
328
- label: t("neetoForm.common.delete"),
329
- isVisible: isFunction(onDelete),
330
- onClick: onDelete
331
- }]
332
- })]
344
+ }]
333
345
  })]
334
346
  });
335
347
  };
@@ -1933,7 +1945,7 @@ var AddQuestion = function AddQuestion(_ref) {
1933
1945
  }));
1934
1946
  };
1935
1947
 
1936
- 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", "questionsHelpProps", "isUsingDefaultQuestionKinds"];
1948
+ 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", "hostSpecificData", "questionsHelpProps", "isUsingDefaultQuestionKinds"];
1937
1949
  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; }
1938
1950
  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; }
1939
1951
  var Form = function Form(_ref) {
@@ -1964,6 +1976,7 @@ var Form = function Form(_ref) {
1964
1976
  enableDomainBlacklisting = _ref.enableDomainBlacklisting,
1965
1977
  enableDomainWhitelisting = _ref.enableDomainWhitelisting,
1966
1978
  helpDocUrls = _ref.helpDocUrls,
1979
+ hostSpecificData = _ref.hostSpecificData,
1967
1980
  questionsHelpProps = _ref.questionsHelpProps,
1968
1981
  isUsingDefaultQuestionKinds = _ref.isUsingDefaultQuestionKinds,
1969
1982
  formDomProps = _objectWithoutProperties(_ref, _excluded);
@@ -1985,8 +1998,12 @@ var Form = function Form(_ref) {
1985
1998
  setIsDeleteAlertOpen = _useState6[1];
1986
1999
  var _useState7 = useState(false),
1987
2000
  _useState8 = _slicedToArray(_useState7, 2),
1988
- isManageQuestionPaneOpen = _useState8[0],
1989
- setIsManageQuestionPaneOpen = _useState8[1];
2001
+ isDeleteSmsReminderModalOpen = _useState8[0],
2002
+ setIsDeleteSmsReminderModalOpen = _useState8[1];
2003
+ var _useState9 = useState(false),
2004
+ _useState10 = _slicedToArray(_useState9, 2),
2005
+ isManageQuestionPaneOpen = _useState10[0],
2006
+ setIsManageQuestionPaneOpen = _useState10[1];
1990
2007
  var values = formikContext.values,
1991
2008
  setFieldValue = formikContext.setFieldValue,
1992
2009
  dirty = formikContext.dirty,
@@ -2055,8 +2072,12 @@ var Form = function Form(_ref) {
2055
2072
  }
2056
2073
  });
2057
2074
  };
2058
- var handleDelete = function handleDelete() {
2059
- setIsDeleteAlertOpen(true);
2075
+ var handleDelete = function handleDelete(question) {
2076
+ if (question.kind === QUESTION_TYPES.SMS_REMINDER) {
2077
+ setIsDeleteSmsReminderModalOpen(true);
2078
+ } else {
2079
+ setIsDeleteAlertOpen(true);
2080
+ }
2060
2081
  };
2061
2082
  useOnClickOutside(containerRef, function () {
2062
2083
  return handleSelect(null);
@@ -2096,6 +2117,12 @@ var Form = function Form(_ref) {
2096
2117
  onClose: function onClose() {
2097
2118
  return setIsDeleteAlertOpen(false);
2098
2119
  }
2120
+ }), /*#__PURE__*/jsx(DeleteSmsReminderModal, {
2121
+ hostSpecificData: hostSpecificData,
2122
+ isOpen: isDeleteSmsReminderModalOpen,
2123
+ onClose: function onClose() {
2124
+ return setIsDeleteSmsReminderModalOpen(false);
2125
+ }
2099
2126
  }), /*#__PURE__*/jsxs(Form$3, _objectSpread$1(_objectSpread$1({
2100
2127
  className: "neeto-form-nano-form-wrapper flex h-full flex-col"
2101
2128
  }, formDomProps), {}, {
@@ -2232,7 +2259,9 @@ var BuildForm = function BuildForm(_ref) {
2232
2259
  helpDocUrls = _ref.helpDocUrls,
2233
2260
  className = _ref.className,
2234
2261
  _ref$questionsHelpPro = _ref.questionsHelpProps,
2235
- questionsHelpProps = _ref$questionsHelpPro === void 0 ? {} : _ref$questionsHelpPro;
2262
+ questionsHelpProps = _ref$questionsHelpPro === void 0 ? {} : _ref$questionsHelpPro,
2263
+ _ref$hostSpecificData = _ref.hostSpecificData,
2264
+ hostSpecificData = _ref$hostSpecificData === void 0 ? {} : _ref$hostSpecificData;
2236
2265
  var queryClient = useQueryClient();
2237
2266
  var _useReorderQuestions = useReorderQuestions(id, {
2238
2267
  onSuccess: showThumbsUpToastr
@@ -2284,7 +2313,7 @@ var BuildForm = function BuildForm(_ref) {
2284
2313
  }
2285
2314
  };
2286
2315
  var isDeletable = isQuestionDeletable !== null && isQuestionDeletable !== void 0 ? isQuestionDeletable : function (question) {
2287
- return !concat(IMMUTABLE_KINDS, nonRemovableFields).includes(question.kind);
2316
+ return !nonRemovableFields.includes(question.kind);
2288
2317
  };
2289
2318
  var isRequiredField = isFieldRequired !== null && isFieldRequired !== void 0 ? isFieldRequired : function (_ref5) {
2290
2319
  var kind = _ref5.kind;
@@ -2322,6 +2351,7 @@ var BuildForm = function BuildForm(_ref) {
2322
2351
  formTitle: formTitle,
2323
2352
  getActiveKindDetails: getActiveKindDetails,
2324
2353
  helpDocUrls: helpDocUrls,
2354
+ hostSpecificData: hostSpecificData,
2325
2355
  isDeletable: isDeletable,
2326
2356
  isDisabledFieldLabel: isDisabledFieldLabel,
2327
2357
  isFormEnabled: isFormEnabled,