@bigbinary/neeto-form-frontend 4.1.8 → 4.1.10

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/BuildForm.js CHANGED
@@ -4,7 +4,7 @@ import { isPresent, truncate, findBy, isNotPresent, slugify, existsBy, hyphenate
4
4
  import Spinner from '@bigbinary/neetoui/Spinner';
5
5
  import { equals, path, curry, assoc, prop, dissoc, when, includes, isEmpty, reject, keys, pick, omit, evolve, map, mergeLeft, isNil, pipe, filter, isNotNil, uniq, join, pluck, test, paths, difference, split, last, either, T, F } from 'ramda';
6
6
  import { k as useDeleteQuestion, Q as QUESTION_TYPES, a as useForm, l as useCreateQuestion, m as useUpdateQuestion, C as CAPTCHA_TYPES, n as useReorderQuestions, i as QUERY_KEYS } from './constants-51SEJjzI.js';
7
- import { f as buildDisplayLabel, h as INDEPENDENT_LABELS_MAP, i as QUESTION_ACTIONS, j as isElementOverflowing, D as Drag, k as SELECTABLE_KINDS, l as isAutoGeneratedQuestion, m as isRichTextQuestion, N as NON_BASIC_LATIN_CHARACTERS_REGEX, n as RESERVED_FIELD_CODES, d as LABEL_FIELDS, o as isDefaultLanguage, p as buildAddQuestionButtonProps, v as validateEditorContent, F as FIELD_CODES_REJECT_CHARS_REGEX, q as isImmutableField, Q as QUESTIONS_WITHOUT_FIELD_CODE, r as NON_HIDEABLE_FIELDS, s as NON_READ_ONLY_FIELDS, t as RICH_TEXT_QUESTIONS, u as FILE_TYPES_MAP, w as FILE_GROUPS, M as MINIMUM_OPTIONS, x as RATING_OPTIONS, y as STAR_RATING_MIN_VALUE_OPTIONS, z as STAR_RATING_MAX_VALUE_OPTIONS, A as STAR_RATING_ICONS_MAP, B as buildDisabledAddButtonHelpPopoverProps, G as buildReorderPayload, H as isMandatoryField, J as QUESTION_KINDS, a as QUESTION_KIND, K as getActiveQuestionKindDetails, O as DEFAULT_AVAILABLE_LANGUAGES, T as DEFAULT_ADVANCED_FEATURES, U as QUESTIONS_INITIAL_VALUE } from './constants-D0zli_cv.js';
7
+ import { f as buildDisplayLabel, h as INDEPENDENT_LABELS_MAP, i as QUESTION_ACTIONS, j as isElementOverflowing, D as Drag, k as SELECTABLE_KINDS, l as isAutoGeneratedQuestion, m as isRichTextQuestion, N as NON_BASIC_LATIN_CHARACTERS_REGEX, n as RESERVED_FIELD_CODES, d as LABEL_FIELDS, o as isDefaultLanguage, p as buildAddQuestionButtonProps, v as validateEditorContent, F as FIELD_CODES_REJECT_CHARS_REGEX, q as isImmutableField, Q as QUESTIONS_WITHOUT_FIELD_CODE, r as NON_HIDEABLE_FIELDS, s as NON_READ_ONLY_FIELDS, t as RICH_TEXT_QUESTIONS, u as FILE_TYPES_MAP, w as FILE_GROUPS, M as MINIMUM_OPTIONS, x as RATING_OPTIONS, y as STAR_RATING_MIN_VALUE_OPTIONS, z as STAR_RATING_MAX_VALUE_OPTIONS, A as STAR_RATING_ICONS_MAP, B as buildDisabledAddButtonHelpPopoverProps, G as buildReorderPayload, H as isMandatoryField, J as QUESTION_KINDS, a as QUESTION_KIND, K as getActiveQuestionKindDetails, O as DEFAULT_AVAILABLE_LANGUAGES, T as DEFAULT_ADVANCED_FEATURES, U as QUESTIONS_INITIAL_VALUE } from './constants-Da_Y-J4N.js';
8
8
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
9
9
  import { useState, useRef, useEffect, createElement } from 'react';
10
10
  import { Droppable, Draggable, DragDropContext } from '@hello-pangea/dnd';
@@ -140,14 +140,14 @@ var DeleteSmsReminderModal = function DeleteSmsReminderModal(_ref) {
140
140
  onClose: onClose,
141
141
  children: [/*#__PURE__*/jsx(Modal.Header, {
142
142
  children: /*#__PURE__*/jsx(Typography, {
143
- "data-cy": "delete-sms-reminder-modal-header",
143
+ "data-testid": "delete-sms-reminder-modal-header",
144
144
  style: "h2",
145
145
  weight: "medium",
146
146
  children: path(["smsReminder", "deleteModal", "title"], hostSpecificData)
147
147
  })
148
148
  }), /*#__PURE__*/jsx(Modal.Body, {
149
149
  children: /*#__PURE__*/jsx(Typography, {
150
- "data-cy": "delete-sms-reminder-modal-description",
150
+ "data-testid": "delete-sms-reminder-modal-description",
151
151
  style: "body2",
152
152
  children: path(["smsReminder", "deleteModal", "description"], hostSpecificData)
153
153
  })
@@ -209,7 +209,7 @@ var Overview = function Overview(_ref) {
209
209
  children: [/*#__PURE__*/jsxs("div", {
210
210
  className: "flex items-center justify-between",
211
211
  children: [/*#__PURE__*/jsx(Typography, {
212
- "data-cy": "neeto-form-engine-overview-title",
212
+ "data-testid": "neeto-form-engine-overview-title",
213
213
  lineHeight: "neeto-ui-leading-normal",
214
214
  style: "h2",
215
215
  weight: "neeto-ui-font-semibold",
@@ -231,7 +231,7 @@ var Overview = function Overview(_ref) {
231
231
  })]
232
232
  })]
233
233
  }), /*#__PURE__*/jsx(Typography, {
234
- "data-cy": "neeto-form-engine-overview-description",
234
+ "data-testid": "neeto-form-engine-overview-description",
235
235
  style: "body2",
236
236
  children: description
237
237
  })]
@@ -268,7 +268,7 @@ var Card = function Card(_ref) {
268
268
  setIsTooltipEnabled(isElementOverflowing(element));
269
269
  }, [questionLabel]);
270
270
  return /*#__PURE__*/jsxs("div", {
271
- "data-cy": "neeto-form-engine-".concat(slugify(questionLabel)),
271
+ "data-testid": "neeto-form-engine-".concat(slugify(questionLabel)),
272
272
  className: classnames("neeto-ui-rounded neeto-ui-border-gray-300 neeto-ui-bg-white neeto-form-nano-form__card flex h-10 w-full items-center justify-between gap-1 border p-2", {
273
273
  "neeto-ui-border-primary-500 neeto-form-nano-form__card--active": isActive
274
274
  }),
@@ -285,7 +285,7 @@ var Card = function Card(_ref) {
285
285
  position: "top",
286
286
  children: /*#__PURE__*/jsx(Typography, {
287
287
  className: "line-clamp-2 min-w-0 grow truncate break-words",
288
- "data-cy": "".concat(slugify(questionLabel), "-question-card-label"),
288
+ "data-testid": "".concat(slugify(questionLabel), "-question-card-label"),
289
289
  lineHeight: "snug",
290
290
  ref: questionLabelRef,
291
291
  style: "body2",
@@ -301,18 +301,18 @@ var Card = function Card(_ref) {
301
301
  strategy: "fixed"
302
302
  },
303
303
  menuItems: [{
304
- "data-cy": "edit-question",
304
+ "data-testid": "edit-question",
305
305
  key: "edit",
306
306
  label: t("neetoForm.common.edit"),
307
307
  onClick: onEdit
308
308
  }, {
309
- "data-cy": "clone-question",
309
+ "data-testid": "clone-question",
310
310
  key: "clone",
311
311
  label: t("neetoForm.common.clone"),
312
312
  isVisible: !isSingular && isFunction(onClone),
313
313
  onClick: onClone
314
314
  }, {
315
- "data-cy": "delete-question",
315
+ "data-testid": "delete-question",
316
316
  key: "delete",
317
317
  label: t("neetoForm.common.delete"),
318
318
  isVisible: isFunction(onDelete),
@@ -790,13 +790,13 @@ var Properties = function Properties(_ref) {
790
790
  var Block = function Block(_ref) {
791
791
  var title = _ref.title,
792
792
  children = _ref.children,
793
- dataCy = _ref.dataCy;
793
+ dataTestid = _ref.dataTestid;
794
794
  return /*#__PURE__*/jsxs("div", {
795
795
  className: "mt-4 space-y-4",
796
- "data-cy": dataCy,
796
+ "data-testid": dataTestid,
797
797
  children: [/*#__PURE__*/jsx("div", {
798
798
  className: "flex items-center justify-between",
799
- "data-cy": "properties-header",
799
+ "data-testid": "properties-header",
800
800
  children: /*#__PURE__*/jsx(Typography, {
801
801
  lineHeight: "normal",
802
802
  style: "body1",
@@ -1084,7 +1084,7 @@ var Form$1 = function Form(_ref) {
1084
1084
  kind: kind,
1085
1085
  questionProps: questionProps
1086
1086
  }), isSettingsBlockVisible && /*#__PURE__*/jsxs(Block, {
1087
- dataCy: "settings-card",
1087
+ dataTestid: "settings-card",
1088
1088
  title: t("neetoForm.common.settings"),
1089
1089
  children: [!isImmutable && /*#__PURE__*/jsx(RequiredSwitch, {}), shouldShowHideSwitch && /*#__PURE__*/jsx(Switch, {
1090
1090
  label: t("neetoForm.common.hideQuestion"),
@@ -1097,7 +1097,7 @@ var Form$1 = function Form(_ref) {
1097
1097
  })]
1098
1098
  }), (shouldShowFieldCode || canMarkResponsesAsReadOnly) && /*#__PURE__*/jsx(Accordion, {
1099
1099
  className: "neeto-form-nano-advanced-properties-accordion",
1100
- "data-cy": "advanced-properties-card",
1100
+ "data-testid": "advanced-properties-card",
1101
1101
  defaultActiveKey: isFieldCodeInvalid ? 0 : null // This is to open the accordion when field code is invalid
1102
1102
  ,
1103
1103
  children: /*#__PURE__*/jsx(Accordion.Item, {
@@ -1234,7 +1234,7 @@ var Add = function Add(_ref) {
1234
1234
  return /*#__PURE__*/jsxs(Fragment, {
1235
1235
  children: [/*#__PURE__*/jsx(Pane.Header, {
1236
1236
  children: /*#__PURE__*/jsx(Typography, {
1237
- "data-cy": "add-question-pane-header",
1237
+ "data-testid": "add-question-pane-header",
1238
1238
  style: "h2",
1239
1239
  children: t("neetoForm.questions.common.primaryPanel.addQuestion")
1240
1240
  })
@@ -1311,7 +1311,7 @@ var Edit = function Edit(_ref) {
1311
1311
  return /*#__PURE__*/jsxs(Fragment, {
1312
1312
  children: [/*#__PURE__*/jsx(Pane.Header, {
1313
1313
  children: /*#__PURE__*/jsx(Typography, {
1314
- "data-cy": "edit-question-pane-header",
1314
+ "data-testid": "edit-question-pane-header",
1315
1315
  style: "h2",
1316
1316
  children: t("neetoForm.questions.common.editQuestion")
1317
1317
  })
@@ -1368,11 +1368,11 @@ var SwitchBlock = function SwitchBlock(_ref) {
1368
1368
  otherProps = _objectWithoutProperties(_ref, _excluded$3);
1369
1369
  return /*#__PURE__*/jsxs(Label, {
1370
1370
  className: classnames("flex items-center justify-start gap-2 ", className),
1371
- "data-cy": "neeto-form-engine-".concat(hyphenate(title && name), "-toggle-label"),
1371
+ "data-testid": "neeto-form-engine-".concat(hyphenate(title && name), "-toggle-label"),
1372
1372
  children: [/*#__PURE__*/jsx(Switch, _objectSpread$6(_objectSpread$6({}, _objectSpread$6(_objectSpread$6({}, otherProps), {}, {
1373
1373
  name: name
1374
1374
  })), {}, {
1375
- "data-cy": "neeto-form-engine-".concat(hyphenate(title && name), "-switch")
1375
+ "data-testid": "neeto-form-engine-".concat(hyphenate(title && name), "-switch")
1376
1376
  })), /*#__PURE__*/jsx(Typography, {
1377
1377
  component: "span",
1378
1378
  style: "body1",
@@ -1434,7 +1434,7 @@ var STYLES = {
1434
1434
  };
1435
1435
  var MultiValueRemove = function MultiValueRemove(props) {
1436
1436
  return /*#__PURE__*/jsx(components.MultiValueRemove, _objectSpread$4(_objectSpread$4({}, props), {}, {
1437
- innerProps: _objectSpread$4(_objectSpread$4({}, props.innerProps), {}, _defineProperty({}, "data-cy", "".concat(hyphenize(props.data.label), "-remove-icon"))),
1437
+ innerProps: _objectSpread$4(_objectSpread$4({}, props.innerProps), {}, _defineProperty({}, "data-testid", "".concat(hyphenize(props.data.label), "-remove-icon"))),
1438
1438
  children: /*#__PURE__*/jsx(Close, {
1439
1439
  size: 16
1440
1440
  })
@@ -1455,7 +1455,7 @@ var ValueContainer = function ValueContainer(_ref) {
1455
1455
  rest = _children.slice(1);
1456
1456
  var shouldCollapse = !isFocused && value.length > visibleDomainsCount;
1457
1457
  return /*#__PURE__*/jsxs(components.ValueContainer, _objectSpread$4(_objectSpread$4({}, props), {}, {
1458
- innerProps: _objectSpread$4(_objectSpread$4({}, props.innerProps), {}, _defineProperty({}, "data-cy", "multi-domain-input-container")),
1458
+ innerProps: _objectSpread$4(_objectSpread$4({}, props.innerProps), {}, _defineProperty({}, "data-testid", "multi-domain-input-container")),
1459
1459
  children: [shouldCollapse ? firstChild.slice(0, visibleDomainsCount) : firstChild, shouldCollapse && /*#__PURE__*/jsx(Tag, {
1460
1460
  style: "secondary",
1461
1461
  label: t("neetoForm.common.remainingItemsCount", {
@@ -1466,7 +1466,7 @@ var ValueContainer = function ValueContainer(_ref) {
1466
1466
  };
1467
1467
  var ClearIndicator = function ClearIndicator(props) {
1468
1468
  return /*#__PURE__*/jsx(components.ClearIndicator, _objectSpread$4(_objectSpread$4({}, props), {}, {
1469
- innerProps: _objectSpread$4(_objectSpread$4({}, props.innerProps), {}, _defineProperty({}, "data-cy", "clear-all-button")),
1469
+ innerProps: _objectSpread$4(_objectSpread$4({}, props.innerProps), {}, _defineProperty({}, "data-testid", "clear-all-button")),
1470
1470
  children: /*#__PURE__*/jsx(Close, {
1471
1471
  className: "cursor-pointer",
1472
1472
  size: 16
@@ -1587,7 +1587,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
1587
1587
  className: "neeto-ui-email-input__label-wrapper",
1588
1588
  children: /*#__PURE__*/jsx(Label, {
1589
1589
  className: "neeto-ui-email-input__label",
1590
- "data-cy": "".concat(hyphenize(label), "-input-label"),
1590
+ "data-testid": "".concat(hyphenize(label), "-input-label"),
1591
1591
  children: label
1592
1592
  })
1593
1593
  }), /*#__PURE__*/jsx(CreatableSelect, _objectSpread$3({
@@ -1620,7 +1620,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
1620
1620
  value: value
1621
1621
  }, otherProps))), !!error && /*#__PURE__*/jsxs("p", {
1622
1622
  className: "neeto-ui-input__error",
1623
- "data-cy": "".concat(hyphenize(label), "-input-error"),
1623
+ "data-testid": "".concat(hyphenize(label), "-input-error"),
1624
1624
  children: [formatErrorMessage(error), isFilterDomainsLinkVisible && /*#__PURE__*/jsxs("span", {
1625
1625
  className: "neeto-ui-font-semibold cursor-pointer",
1626
1626
  onClick: handleFilterDomains,
@@ -1628,7 +1628,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
1628
1628
  })]
1629
1629
  }), /*#__PURE__*/jsx("p", {
1630
1630
  className: "neeto-ui-input__help-text",
1631
- "data-cy": "".concat(hyphenize(label), "-input-help"),
1631
+ "data-testid": "".concat(hyphenize(label), "-input-help"),
1632
1632
  children: t("neetoForm.domainRestriction.helpText")
1633
1633
  })]
1634
1634
  });
@@ -1719,7 +1719,7 @@ var RestrictDomainsBlock = function RestrictDomainsBlock(_ref) {
1719
1719
  popoverDescription = _mergeLeft.popoverDescription;
1720
1720
  return /*#__PURE__*/jsxs("div", {
1721
1721
  className: "flex flex-col space-y-4",
1722
- "data-cy": "".concat(hyphenate(switchName), "-container"),
1722
+ "data-testid": "".concat(hyphenate(switchName), "-container"),
1723
1723
  children: [/*#__PURE__*/jsx(SwitchBlock, {
1724
1724
  name: switchName,
1725
1725
  title: /*#__PURE__*/jsx(TitleWithHelpPopover, {
@@ -1742,15 +1742,18 @@ var VerifyEmails = function VerifyEmails() {
1742
1742
  var _mergeLeft = mergeLeft(hostSpecificTranslations, EMAIL_VERIFICATION_TRANSLATIONS),
1743
1743
  title = _mergeLeft.title,
1744
1744
  popoverDescription = _mergeLeft.popoverDescription;
1745
- return /*#__PURE__*/jsx(Switch, {
1746
- name: "isVerificationEnabled",
1747
- label: /*#__PURE__*/jsx(Typography, {
1748
- component: "span",
1749
- style: "body1",
1750
- children: /*#__PURE__*/jsx(TitleWithHelpPopover, {
1751
- helpLink: helpLink,
1752
- title: title,
1753
- description: popoverDescription
1745
+ return /*#__PURE__*/jsx("div", {
1746
+ "data-testid": "email-verification-switch-container",
1747
+ children: /*#__PURE__*/jsx(Switch, {
1748
+ name: "isVerificationEnabled",
1749
+ label: /*#__PURE__*/jsx(Typography, {
1750
+ component: "span",
1751
+ style: "body1",
1752
+ children: /*#__PURE__*/jsx(TitleWithHelpPopover, {
1753
+ helpLink: helpLink,
1754
+ title: title,
1755
+ description: popoverDescription
1756
+ })
1754
1757
  })
1755
1758
  })
1756
1759
  });
@@ -1789,7 +1792,7 @@ var FileGroup = function FileGroup(_ref) {
1789
1792
  checked: checked,
1790
1793
  label: label,
1791
1794
  name: name,
1792
- "data-cy": "neeto-form-engine-file-type-".concat(name),
1795
+ "data-testid": "neeto-form-engine-file-type-".concat(name),
1793
1796
  id: name,
1794
1797
  onChange: handleAllowedFileTypesChange
1795
1798
  });
@@ -1941,7 +1944,7 @@ var Rating = function Rating() {
1941
1944
  size: 48
1942
1945
  }), /*#__PURE__*/jsx(InputWithMaxLength, {
1943
1946
  name: name,
1944
- "data-cy": "neeto-form-engine-".concat(hyphenate(name))
1947
+ "data-testid": "neeto-form-engine-".concat(hyphenate(name))
1945
1948
  })]
1946
1949
  }, name);
1947
1950
  })
@@ -1965,7 +1968,7 @@ var StarRating = function StarRating() {
1965
1968
  className: "flex space-x-4",
1966
1969
  children: [/*#__PURE__*/jsx(Select, {
1967
1970
  className: "w-1/2",
1968
- "data-cy": "neeto-form-engine-star-rating-min-value",
1971
+ "data-testid": "neeto-form-engine-star-rating-min-value",
1969
1972
  label: t("neetoForm.common.start"),
1970
1973
  name: "minValue",
1971
1974
  options: STAR_RATING_MIN_VALUE_OPTIONS,
@@ -1974,7 +1977,7 @@ var StarRating = function StarRating() {
1974
1977
  }
1975
1978
  }), /*#__PURE__*/jsx(Select, {
1976
1979
  className: "w-1/2",
1977
- "data-cy": "neeto-form-engine-star-rating-max-value",
1980
+ "data-testid": "neeto-form-engine-star-rating-max-value",
1978
1981
  label: t("neetoForm.common.end"),
1979
1982
  name: "maxValue",
1980
1983
  options: STAR_RATING_MAX_VALUE_OPTIONS,
@@ -1992,7 +1995,7 @@ var StarRating = function StarRating() {
1992
1995
  IconType = _ref2[1];
1993
1996
  var isActive = name === iconType;
1994
1997
  return /*#__PURE__*/jsx("div", {
1995
- "data-cy": "neeto-form-engine-rating-icon-".concat(name),
1998
+ "data-testid": "neeto-form-engine-rating-icon-".concat(name),
1996
1999
  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", {
1997
2000
  "neeto-ui-text-gray-800 neeto-ui-bg-gray-200": !isActive,
1998
2001
  "neeto-ui-text-white neeto-ui-bg-gray-800": isActive
@@ -2076,7 +2079,7 @@ var buildDefaultValueForKind = function buildDefaultValueForKind(questionKind) {
2076
2079
  var hideSwitchLabelProps = function hideSwitchLabelProps(helpUrl) {
2077
2080
  return helpUrl ? {
2078
2081
  helpIconProps: {
2079
- "data-cy": "help-popover-button",
2082
+ "data-testid": "help-popover-button",
2080
2083
  popoverProps: {
2081
2084
  description: t("neetoForm.questions.common.questionFields.field.hideQuestionHelpDescription"),
2082
2085
  helpLinkProps: {
@@ -2090,7 +2093,7 @@ var hideSwitchLabelProps = function hideSwitchLabelProps(helpUrl) {
2090
2093
  var responseVisibleOnlyToHostSwitchLabelProps = function responseVisibleOnlyToHostSwitchLabelProps(helpUrl) {
2091
2094
  return {
2092
2095
  helpIconProps: {
2093
- "data-cy": "help-popover-button",
2096
+ "data-testid": "help-popover-button",
2094
2097
  popoverProps: {
2095
2098
  description: t("neetoForm.questions.common.questionFields.field.responseVisibleOnlyToHostHelpDescription"),
2096
2099
  helpLinkProps: {
@@ -2104,7 +2107,7 @@ var responseVisibleOnlyToHostSwitchLabelProps = function responseVisibleOnlyToHo
2104
2107
  var readOnlySwitchLabelProps = function readOnlySwitchLabelProps(helpUrl) {
2105
2108
  return {
2106
2109
  helpIconProps: {
2107
- "data-cy": "help-popover-button",
2110
+ "data-testid": "help-popover-button",
2108
2111
  popoverProps: {
2109
2112
  description: t("neetoForm.questions.common.questionFields.field.readOnlyHelpDescription"),
2110
2113
  helpLinkProps: helpUrl ? {