@bigbinary/neeto-form-frontend 3.10.6 → 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.
@@ -26,7 +26,7 @@ import { a as isBlank, g as getComponentDisplayName, p as parseServerError } fro
26
26
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
27
27
  import Check from '@bigbinary/neeto-icons/Check';
28
28
  import { jsx, jsxs } from 'react/jsx-runtime';
29
- import { c as clientI18nInstance, d as getWithExpiry, g as generateInitValues, F as FormikWrap, a as getFieldComponent, b as buildAutoCompleteAttribute, r as renderButtonsInOrder, m as mergeRefs, e as generateFormResponse, f as clearLocalStorageValues } from './utils-DI6tmFqX.js';
29
+ import { c as clientI18nInstance, d as getWithExpiry, g as generateInitValues, F as FormikWrap, a as getFieldComponent, b as buildAutoCompleteAttribute, r as renderButtonsInOrder, m as mergeRefs, e as generateFormResponse, f as clearLocalStorageValues } from './utils-Bo2ljfJm.js';
30
30
  import { withT } from '@bigbinary/neeto-commons-frontend/react-utils';
31
31
  import '@babel/runtime/helpers/toConsumableArray';
32
32
  import '@bigbinary/neeto-commons-frontend/constants';
@@ -35,7 +35,7 @@ import '@babel/runtime/helpers/typeof';
35
35
  import '@bigbinary/neeto-editor/utils';
36
36
  import 'libphonenumber-js';
37
37
  import '@bigbinary/neeto-editor/EditorContent';
38
- import './constants-AohkxnRH.js';
38
+ import './constants-BL-0uUwk.js';
39
39
  import './constants-DlRX5mcQ.js';
40
40
  import 'dompurify';
41
41
  import '@bigbinary/neeto-icons/Plus';
@@ -10,10 +10,10 @@ import Button from '@bigbinary/neetoui/Button';
10
10
  import NoData from '@bigbinary/neetoui/NoData';
11
11
  import { map, assoc, filter, pluck, isEmpty } from 'ramda';
12
12
  import { useTranslation } from 'react-i18next';
13
- import { g as generateInitValues, F as FormikWrap, a as getFieldComponent, b as buildAutoCompleteAttribute, m as mergeRefs } from './utils-DI6tmFqX.js';
13
+ import { g as generateInitValues, F as FormikWrap, a as getFieldComponent, b as buildAutoCompleteAttribute, m as mergeRefs } from './utils-Bo2ljfJm.js';
14
14
  import { a as useForm } from './useFormApi-DtoxIPE7.js';
15
15
  import { parsePhoneNumber } from 'libphonenumber-js';
16
- import { Q as QUESTIONS_WITHOUT_FIELD_CODE } from './constants-AohkxnRH.js';
16
+ import { Q as QUESTIONS_WITHOUT_FIELD_CODE } from './constants-BL-0uUwk.js';
17
17
  import { Q as QUESTION_KIND } from './constants-DlRX5mcQ.js';
18
18
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
19
19
  import './index-BL5SirYx.js';
@@ -11,7 +11,7 @@ var PageLoader = require('@bigbinary/neeto-molecules/PageLoader');
11
11
  var ramda = require('ramda');
12
12
  var useFormApi = require('../useFormApi-CWHgrz3I.js');
13
13
  var constants$1 = require('../constants-D-XSuLo2.js');
14
- var constants = require('../constants-CCpt0hVT.js');
14
+ var constants = require('../constants-BUAlqO79.js');
15
15
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
16
16
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
17
17
  var dnd = require('@hello-pangea/dnd');
@@ -24,8 +24,9 @@ var shallow = require('zustand/shallow');
24
24
  var Alert = require('@bigbinary/neetoui/Alert');
25
25
  var index = require('../index-2caW4Cx0.js');
26
26
  var jsxRuntime = require('react/jsx-runtime');
27
- var MoreDropdown = require('@bigbinary/neeto-molecules/MoreDropdown');
28
27
  var Typography = require('@bigbinary/neetoui/Typography');
28
+ var Modal = require('@bigbinary/neetoui/Modal');
29
+ var MoreDropdown = require('@bigbinary/neeto-molecules/MoreDropdown');
29
30
  var Dropdown = require('@bigbinary/neetoui/Dropdown');
30
31
  var Tooltip = require('@bigbinary/neetoui/Tooltip');
31
32
  var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
@@ -145,6 +146,31 @@ var DeleteAlert = function DeleteAlert(_ref) {
145
146
  });
146
147
  };
147
148
 
149
+ var DeleteSmsReminderModal = function DeleteSmsReminderModal(_ref) {
150
+ var isOpen = _ref.isOpen,
151
+ onClose = _ref.onClose,
152
+ _ref$hostSpecificData = _ref.hostSpecificData,
153
+ hostSpecificData = _ref$hostSpecificData === void 0 ? {} : _ref$hostSpecificData;
154
+ return /*#__PURE__*/jsxRuntime.jsxs(Modal, {
155
+ isOpen: isOpen,
156
+ onClose: onClose,
157
+ children: [/*#__PURE__*/jsxRuntime.jsx(Modal.Header, {
158
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
159
+ "data-cy": "delete-sms-reminder-modal-header",
160
+ style: "h2",
161
+ weight: "medium",
162
+ children: ramda.path(["smsReminder", "deleteModal", "title"], hostSpecificData)
163
+ })
164
+ }), /*#__PURE__*/jsxRuntime.jsx(Modal.Body, {
165
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
166
+ "data-cy": "delete-sms-reminder-modal-description",
167
+ style: "body2",
168
+ children: ramda.path(["smsReminder", "deleteModal", "description"], hostSpecificData)
169
+ })
170
+ })]
171
+ });
172
+ };
173
+
148
174
  var ChangeLanguageDropdown = function ChangeLanguageDropdown(_ref) {
149
175
  var _findBy;
150
176
  var currentLanguage = _ref.currentLanguage,
@@ -254,8 +280,6 @@ var Overview = function Overview(_ref) {
254
280
  });
255
281
  };
256
282
 
257
- 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; }
258
- 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; }
259
283
  var Card = function Card(_ref) {
260
284
  var _ref$question = _ref.question,
261
285
  question = _ref$question === void 0 ? {} : _ref$question,
@@ -273,14 +297,12 @@ var Card = function Card(_ref) {
273
297
  var questionLabelRef = React.useRef(null);
274
298
  var _useTranslation = reactI18next.useTranslation(),
275
299
  t = _useTranslation.t;
276
- var smsReminderHelpDocUrl = buildForm.useBuildFormStore(ramda.path(["formState", "helpDocUrls", "smsReminder"]));
277
300
  var _getActiveKindDetails = getActiveKindDetails({
278
301
  allQuestionKinds: allQuestionKinds,
279
302
  item: question
280
303
  }),
281
304
  kind = _getActiveKindDetails.kind,
282
305
  isSingular = _getActiveKindDetails.isSingular;
283
- var isSmsReminderQuestion = kind === constants.QUESTION_TYPES.SMS_REMINDER;
284
306
  var label = index.fieldWithFallback(question, "label");
285
307
  var questionLabel = constants.isRichTextQuestion(kind) ? constants.htmlToPlainText(label) : label;
286
308
  React.useEffect(function () {
@@ -314,43 +336,33 @@ var Card = function Card(_ref) {
314
336
  children: questionLabel
315
337
  })
316
338
  })]
317
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
318
- className: "flex items-center gap-1",
319
- children: [isSmsReminderQuestion && /*#__PURE__*/jsxRuntime.jsx(HelpPopover, _objectSpread$f({
320
- description: t("neetoForm.smsReminder.popoverDescription"),
321
- popoverProps: {
322
- position: "top"
323
- }
324
- }, smsReminderHelpDocUrl && {
325
- helpLinkProps: {
326
- href: smsReminderHelpDocUrl
339
+ }), /*#__PURE__*/jsxRuntime.jsx(MoreDropdown, {
340
+ dropdownButtonProps: {
341
+ className: "shrink-0"
342
+ },
343
+ dropdownProps: {
344
+ strategy: "fixed"
345
+ },
346
+ menuItems: [{
347
+ "data-cy": "edit-question",
348
+ key: "edit",
349
+ label: t("neetoForm.common.edit"),
350
+ onClick: onEdit
351
+ }, {
352
+ "data-cy": "clone-question",
353
+ key: "clone",
354
+ label: t("neetoForm.common.clone"),
355
+ isVisible: !isSingular && index.isFunction(onClone),
356
+ onClick: onClone
357
+ }, {
358
+ "data-cy": "delete-question",
359
+ key: "delete",
360
+ label: t("neetoForm.common.delete"),
361
+ isVisible: index.isFunction(onDelete),
362
+ onClick: function onClick() {
363
+ return onDelete(question);
327
364
  }
328
- })), /*#__PURE__*/jsxRuntime.jsx(MoreDropdown, {
329
- dropdownButtonProps: {
330
- className: "shrink-0"
331
- },
332
- dropdownProps: {
333
- strategy: "fixed"
334
- },
335
- menuItems: [{
336
- "data-cy": "edit-question",
337
- key: "edit",
338
- label: t("neetoForm.common.edit"),
339
- onClick: onEdit
340
- }, {
341
- "data-cy": "clone-question",
342
- key: "clone",
343
- label: t("neetoForm.common.clone"),
344
- isVisible: !isSingular && index.isFunction(onClone),
345
- onClick: onClone
346
- }, {
347
- "data-cy": "delete-question",
348
- key: "delete",
349
- label: t("neetoForm.common.delete"),
350
- isVisible: index.isFunction(onDelete),
351
- onClick: onDelete
352
- }]
353
- })]
365
+ }]
354
366
  })]
355
367
  });
356
368
  };
@@ -1954,7 +1966,7 @@ var AddQuestion = function AddQuestion(_ref) {
1954
1966
  }));
1955
1967
  };
1956
1968
 
1957
- 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"];
1969
+ 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"];
1958
1970
  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; }
1959
1971
  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; }
1960
1972
  var Form = function Form(_ref) {
@@ -1985,6 +1997,7 @@ var Form = function Form(_ref) {
1985
1997
  enableDomainBlacklisting = _ref.enableDomainBlacklisting,
1986
1998
  enableDomainWhitelisting = _ref.enableDomainWhitelisting,
1987
1999
  helpDocUrls = _ref.helpDocUrls,
2000
+ hostSpecificData = _ref.hostSpecificData,
1988
2001
  questionsHelpProps = _ref.questionsHelpProps,
1989
2002
  isUsingDefaultQuestionKinds = _ref.isUsingDefaultQuestionKinds,
1990
2003
  formDomProps = _objectWithoutProperties(_ref, _excluded);
@@ -2006,8 +2019,12 @@ var Form = function Form(_ref) {
2006
2019
  setIsDeleteAlertOpen = _useState6[1];
2007
2020
  var _useState7 = React.useState(false),
2008
2021
  _useState8 = _slicedToArray(_useState7, 2),
2009
- isManageQuestionPaneOpen = _useState8[0],
2010
- setIsManageQuestionPaneOpen = _useState8[1];
2022
+ isDeleteSmsReminderModalOpen = _useState8[0],
2023
+ setIsDeleteSmsReminderModalOpen = _useState8[1];
2024
+ var _useState9 = React.useState(false),
2025
+ _useState10 = _slicedToArray(_useState9, 2),
2026
+ isManageQuestionPaneOpen = _useState10[0],
2027
+ setIsManageQuestionPaneOpen = _useState10[1];
2011
2028
  var values = formikContext.values,
2012
2029
  setFieldValue = formikContext.setFieldValue,
2013
2030
  dirty = formikContext.dirty,
@@ -2076,8 +2093,12 @@ var Form = function Form(_ref) {
2076
2093
  }
2077
2094
  });
2078
2095
  };
2079
- var handleDelete = function handleDelete() {
2080
- setIsDeleteAlertOpen(true);
2096
+ var handleDelete = function handleDelete(question) {
2097
+ if (question.kind === constants.QUESTION_TYPES.SMS_REMINDER) {
2098
+ setIsDeleteSmsReminderModalOpen(true);
2099
+ } else {
2100
+ setIsDeleteAlertOpen(true);
2101
+ }
2081
2102
  };
2082
2103
  reactUtils.useOnClickOutside(containerRef, function () {
2083
2104
  return handleSelect(null);
@@ -2117,6 +2138,12 @@ var Form = function Form(_ref) {
2117
2138
  onClose: function onClose() {
2118
2139
  return setIsDeleteAlertOpen(false);
2119
2140
  }
2141
+ }), /*#__PURE__*/jsxRuntime.jsx(DeleteSmsReminderModal, {
2142
+ hostSpecificData: hostSpecificData,
2143
+ isOpen: isDeleteSmsReminderModalOpen,
2144
+ onClose: function onClose() {
2145
+ return setIsDeleteSmsReminderModalOpen(false);
2146
+ }
2120
2147
  }), /*#__PURE__*/jsxRuntime.jsxs(formik.Form, _objectSpread$1(_objectSpread$1({
2121
2148
  className: "neeto-form-nano-form-wrapper flex h-full flex-col"
2122
2149
  }, formDomProps), {}, {
@@ -2253,7 +2280,9 @@ var BuildForm = function BuildForm(_ref) {
2253
2280
  helpDocUrls = _ref.helpDocUrls,
2254
2281
  className = _ref.className,
2255
2282
  _ref$questionsHelpPro = _ref.questionsHelpProps,
2256
- questionsHelpProps = _ref$questionsHelpPro === void 0 ? {} : _ref$questionsHelpPro;
2283
+ questionsHelpProps = _ref$questionsHelpPro === void 0 ? {} : _ref$questionsHelpPro,
2284
+ _ref$hostSpecificData = _ref.hostSpecificData,
2285
+ hostSpecificData = _ref$hostSpecificData === void 0 ? {} : _ref$hostSpecificData;
2257
2286
  var queryClient = reactQuery.useQueryClient();
2258
2287
  var _useReorderQuestions = useFormApi.useReorderQuestions(id, {
2259
2288
  onSuccess: utils.showThumbsUpToastr
@@ -2305,7 +2334,7 @@ var BuildForm = function BuildForm(_ref) {
2305
2334
  }
2306
2335
  };
2307
2336
  var isDeletable = isQuestionDeletable !== null && isQuestionDeletable !== void 0 ? isQuestionDeletable : function (question) {
2308
- return !ramda.concat(constants.IMMUTABLE_KINDS, nonRemovableFields).includes(question.kind);
2337
+ return !nonRemovableFields.includes(question.kind);
2309
2338
  };
2310
2339
  var isRequiredField = isFieldRequired !== null && isFieldRequired !== void 0 ? isFieldRequired : function (_ref5) {
2311
2340
  var kind = _ref5.kind;
@@ -2343,6 +2372,7 @@ var BuildForm = function BuildForm(_ref) {
2343
2372
  formTitle: formTitle,
2344
2373
  getActiveKindDetails: getActiveKindDetails,
2345
2374
  helpDocUrls: helpDocUrls,
2375
+ hostSpecificData: hostSpecificData,
2346
2376
  isDeletable: isDeletable,
2347
2377
  isDisabledFieldLabel: isDisabledFieldLabel,
2348
2378
  isFormEnabled: isFormEnabled,