@bigbinary/neeto-form-frontend 3.11.1 → 3.12.0

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.
@@ -27,6 +27,7 @@
27
27
  "required": "Required",
28
28
  "hideQuestion": "Hide question",
29
29
  "readOnly": "Read-only",
30
+ "responseVisibleOnlyToHost": "Response visible only to host",
30
31
  "invalidURL": "Invalid URL",
31
32
  "generateLink": "Generate link",
32
33
  "paragraphCantBeEmpty": "Paragraph can't be empty",
@@ -89,7 +90,8 @@
89
90
  },
90
91
  "callouts": {
91
92
  "submitError": "Couldn't submit the form",
92
- "hiddenQuestion": "This field is hidden to the public. However you can still edit it."
93
+ "hiddenQuestion": "This field is hidden to the public. However you can still edit it.",
94
+ "responseVisibleOnlyToHost": "This field is visible to everyone. But its response will only be visible to the host."
93
95
  },
94
96
  "successPage": {
95
97
  "title1": "Thank You.",
@@ -137,6 +139,7 @@
137
139
  "fieldCodeHelpDescription": "If you change the field code, any existing shared links containing the old field code as query parameter, will not work correctly. <Link>View help article</Link> for more information.",
138
140
  "questionType": "Question type",
139
141
  "hideQuestionHelpDescription": "When enabled, this question will not be visible in the created form. It can be used to track \"reference ids\" and UTM parameters.",
142
+ "responseVisibleOnlyToHostHelpDescription": "When enabled, the response to this question will only be visible to the host",
140
143
  "readOnlyHelpDescription": "When enabled, the client will only be able to see the answer of this question, but will not be able to change the answer of this question. Since you are marking this question as \"read-only\" you should pre-fill the question with an answer.",
141
144
  "verifyHuman": "Verify that you are a human"
142
145
  }
package/dist/BuildForm.js CHANGED
@@ -17,7 +17,7 @@ import { isMetaKeyPressed, withT, useStateWithDependency, useOnClickOutside } fr
17
17
  import HelpPopover from '@bigbinary/neeto-molecules/HelpPopover';
18
18
  import ActionBlock from '@bigbinary/neetoui/formik/ActionBlock';
19
19
  import { useTranslation, Trans } from 'react-i18next';
20
- import { a as useBuildFormStore } from './buildForm-CuAJYr6B.js';
20
+ import { a as useBuildFormStore } from './buildForm-C8ATbuv6.js';
21
21
  import { shallow } from 'zustand/shallow';
22
22
  import Alert from '@bigbinary/neetoui/Alert';
23
23
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -991,15 +991,18 @@ var Form$1 = function Form(_ref) {
991
991
  setFieldValue = _useFormikContext.setFieldValue;
992
992
  var hideQuestionHelpDoc = useBuildFormStore(path(["formState", "helpDocUrls", "hideQuestion"]));
993
993
  var readOnlyHelpDoc = useBuildFormStore(path(["formState", "helpDocUrls", "readOnly"]));
994
+ var responseVisibleOnlyToHostHelpDoc = useBuildFormStore(path(["formState", "helpDocUrls", "responseVisibleOnlyToHost"]));
994
995
  var _useBuildFormStore = useBuildFormStore(function (store) {
995
- var _store$formState, _store$formState2, _store$formState3;
996
+ var _store$formState, _store$formState2, _store$formState3, _store$formState4;
996
997
  return {
997
998
  showReadOnlySwitch: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["showReadOnlySwitch"],
998
- selectedLanguage: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["selectedLanguage"],
999
- isUsingDefaultQuestionKinds: (_store$formState3 = store["formState"]) === null || _store$formState3 === void 0 ? void 0 : _store$formState3["isUsingDefaultQuestionKinds"]
999
+ showResponseVisibleOnlyToHostSwitch: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["showResponseVisibleOnlyToHostSwitch"],
1000
+ selectedLanguage: (_store$formState3 = store["formState"]) === null || _store$formState3 === void 0 ? void 0 : _store$formState3["selectedLanguage"],
1001
+ isUsingDefaultQuestionKinds: (_store$formState4 = store["formState"]) === null || _store$formState4 === void 0 ? void 0 : _store$formState4["isUsingDefaultQuestionKinds"]
1000
1002
  };
1001
1003
  }, shallow),
1002
1004
  showReadOnlySwitch = _useBuildFormStore.showReadOnlySwitch,
1005
+ showResponseVisibleOnlyToHostSwitch = _useBuildFormStore.showResponseVisibleOnlyToHostSwitch,
1003
1006
  selectedLanguage = _useBuildFormStore.selectedLanguage,
1004
1007
  isUsingDefaultQuestionKinds = _useBuildFormStore.isUsingDefaultQuestionKinds;
1005
1008
  var kind = values.kind;
@@ -1021,6 +1024,7 @@ var Form$1 = function Form(_ref) {
1021
1024
  var isImmutable = questionKind && isImmutableField(questionKind);
1022
1025
  var shouldShowFieldCode = enableFieldCode && !includes(kind, QUESTIONS_WITHOUT_FIELD_CODE);
1023
1026
  var shouldShowHideSwitch = !includes(kind, NON_HIDEABLE_FIELDS);
1027
+ var shouldShowResponseVisibleOnlyToHostSwitch = showResponseVisibleOnlyToHostSwitch && !includes(kind, NON_HIDEABLE_FIELDS);
1024
1028
  var shouldShowReadOnlySwitch = showReadOnlySwitch && !includes(kind, NON_READ_ONLY_FIELDS);
1025
1029
  var isSettingsBlockVisible = !isRequired && (!isImmutable || shouldShowHideSwitch);
1026
1030
  var handleKindChange = function handleKindChange(option) {
@@ -1091,6 +1095,10 @@ var Form$1 = function Form(_ref) {
1091
1095
  label: t("neetoForm.common.hideQuestion"),
1092
1096
  labelProps: hideSwitchLabelProps(hideQuestionHelpDoc),
1093
1097
  name: "isHidden"
1098
+ }), shouldShowResponseVisibleOnlyToHostSwitch && /*#__PURE__*/jsx(Switch, {
1099
+ label: t("neetoForm.common.responseVisibleOnlyToHost"),
1100
+ name: "isResponseVisibleOnlyToHost",
1101
+ labelProps: responseVisibleOnlyToHostSwitchLabelProps(responseVisibleOnlyToHostHelpDoc)
1094
1102
  })]
1095
1103
  }), (shouldShowFieldCode || shouldShowReadOnlySwitch) && /*#__PURE__*/jsx(Accordion, {
1096
1104
  className: "neeto-form-nano-advanced-properties-accordion",
@@ -2041,6 +2049,19 @@ var hideSwitchLabelProps = function hideSwitchLabelProps(helpUrl) {
2041
2049
  }
2042
2050
  } : undefined;
2043
2051
  };
2052
+ var responseVisibleOnlyToHostSwitchLabelProps = function responseVisibleOnlyToHostSwitchLabelProps(helpUrl) {
2053
+ return {
2054
+ helpIconProps: {
2055
+ popoverProps: {
2056
+ description: t("neetoForm.questions.common.questionFields.field.responseVisibleOnlyToHostHelpDescription"),
2057
+ helpLinkProps: {
2058
+ href: helpUrl,
2059
+ label: t("neetoForm.common.viewHelpArticle")
2060
+ }
2061
+ }
2062
+ }
2063
+ };
2064
+ };
2044
2065
  var readOnlySwitchLabelProps = function readOnlySwitchLabelProps(helpUrl) {
2045
2066
  return {
2046
2067
  helpIconProps: {
@@ -2095,7 +2116,7 @@ var AddQuestion = function AddQuestion(_ref) {
2095
2116
  }));
2096
2117
  };
2097
2118
 
2098
- 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", "showReadOnlySwitch", "buildRequestArgs", "enableDomainBlacklisting", "enableDomainWhitelisting", "helpDocUrls", "hostSpecificData", "questionsHelpProps", "isUsingDefaultQuestionKinds", "usesCustomSubmissionComponent"];
2119
+ 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", "showReadOnlySwitch", "showResponseVisibleOnlyToHostSwitch", "buildRequestArgs", "enableDomainBlacklisting", "enableDomainWhitelisting", "helpDocUrls", "hostSpecificData", "questionsHelpProps", "isUsingDefaultQuestionKinds", "usesCustomSubmissionComponent"];
2099
2120
  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; }
2100
2121
  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; }
2101
2122
  var Form = function Form(_ref) {
@@ -2123,6 +2144,7 @@ var Form = function Form(_ref) {
2123
2144
  additionalQuestionKindPattern = _ref.additionalQuestionKindPattern,
2124
2145
  showActionBlock = _ref.showActionBlock,
2125
2146
  showReadOnlySwitch = _ref.showReadOnlySwitch,
2147
+ showResponseVisibleOnlyToHostSwitch = _ref.showResponseVisibleOnlyToHostSwitch,
2126
2148
  buildRequestArgs = _ref.buildRequestArgs,
2127
2149
  enableDomainBlacklisting = _ref.enableDomainBlacklisting,
2128
2150
  enableDomainWhitelisting = _ref.enableDomainWhitelisting,
@@ -2187,9 +2209,10 @@ var Form = function Form(_ref) {
2187
2209
  enableDomainWhitelisting: enableDomainWhitelisting,
2188
2210
  isUsingDefaultQuestionKinds: isUsingDefaultQuestionKinds,
2189
2211
  showReadOnlySwitch: showReadOnlySwitch,
2212
+ showResponseVisibleOnlyToHostSwitch: showResponseVisibleOnlyToHostSwitch,
2190
2213
  usesCustomSubmissionComponent: usesCustomSubmissionComponent
2191
2214
  });
2192
- }, [formId, isFormEnabled, savedTitle, setFormData, values, dirty, isSubmitting, isValid, errors, submitForm, resetForm, selectedLanguage, helpDocUrls, enableDomainBlacklisting, enableDomainWhitelisting, isUsingDefaultQuestionKinds, showReadOnlySwitch, usesCustomSubmissionComponent]);
2215
+ }, [formId, isFormEnabled, savedTitle, setFormData, values, dirty, isSubmitting, isValid, errors, submitForm, resetForm, selectedLanguage, helpDocUrls, enableDomainBlacklisting, enableDomainWhitelisting, isUsingDefaultQuestionKinds, showReadOnlySwitch, showResponseVisibleOnlyToHostSwitch, usesCustomSubmissionComponent]);
2193
2216
  var questions = values.questions;
2194
2217
  var handleSelect = function handleSelect(question) {
2195
2218
  setSelectedQuestion(question);
@@ -2418,6 +2441,8 @@ var BuildForm = function BuildForm(_ref) {
2418
2441
  hostSpecificData = _ref$hostSpecificData === void 0 ? {} : _ref$hostSpecificData,
2419
2442
  _ref$showReadOnlySwit = _ref.showReadOnlySwitch,
2420
2443
  showReadOnlySwitch = _ref$showReadOnlySwit === void 0 ? false : _ref$showReadOnlySwit,
2444
+ _ref$showResponseVisi = _ref.showResponseVisibleOnlyToHostSwitch,
2445
+ showResponseVisibleOnlyToHostSwitch = _ref$showResponseVisi === void 0 ? false : _ref$showResponseVisi,
2421
2446
  _ref$usesCustomSubmis = _ref.usesCustomSubmissionComponent,
2422
2447
  usesCustomSubmissionComponent = _ref$usesCustomSubmis === void 0 ? false : _ref$usesCustomSubmis;
2423
2448
  var queryClient = useQueryClient();
@@ -2525,6 +2550,7 @@ var BuildForm = function BuildForm(_ref) {
2525
2550
  selectedLanguage: selectedLanguage,
2526
2551
  showActionBlock: showActionBlock,
2527
2552
  showReadOnlySwitch: showReadOnlySwitch,
2553
+ showResponseVisibleOnlyToHostSwitch: showResponseVisibleOnlyToHostSwitch,
2528
2554
  submitButtonProps: submitButtonProps,
2529
2555
  usesCustomSubmissionComponent: usesCustomSubmissionComponent
2530
2556
  })), {}, {