@bigbinary/neeto-form-frontend 3.8.3 → 3.9.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.
- package/app/javascript/src/translations/en.json +12 -4
- package/dist/BuildForm.js +128 -55
- package/dist/BuildForm.js.map +1 -1
- package/dist/ExternalForm.js +1 -1
- package/dist/UrlBuilder.js +1 -1
- package/dist/{buildForm-354c6d6d.js → buildForm-b8eb931e.js} +4 -2
- package/dist/buildForm-b8eb931e.js.map +1 -0
- package/dist/{buildForm-042737cb.js → buildForm-dfd708c6.js} +4 -2
- package/dist/buildForm-dfd708c6.js.map +1 -0
- package/dist/cjs/BuildForm.js +128 -55
- package/dist/cjs/BuildForm.js.map +1 -1
- package/dist/cjs/ExternalForm.js +1 -1
- package/dist/cjs/UrlBuilder.js +1 -1
- package/dist/cjs/hooks.js +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/hooks.js +1 -1
- package/dist/index.js +2 -2
- package/dist/{utils-e4298243.js → utils-3eb74c1b.js} +17 -8
- package/dist/utils-3eb74c1b.js.map +1 -0
- package/dist/{utils-4918956b.js → utils-6039d7d2.js} +18 -9
- package/dist/utils-6039d7d2.js.map +1 -0
- package/package.json +1 -1
- package/types.d.ts +2 -1
- package/dist/buildForm-042737cb.js.map +0 -1
- package/dist/buildForm-354c6d6d.js.map +0 -1
- package/dist/utils-4918956b.js.map +0 -1
- package/dist/utils-e4298243.js.map +0 -1
package/dist/ExternalForm.js
CHANGED
|
@@ -27,7 +27,7 @@ import { a as isBlank, g as getComponentDisplayName, p as parseServerError } fro
|
|
|
27
27
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
28
28
|
import Check from '@bigbinary/neeto-icons/Check';
|
|
29
29
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
30
|
-
import { c as clientI18nInstance, g as getWithExpiry, a as generateInitValues, F as FormikWrap, b as getFieldComponent, d as buildAutoCompleteAttribute, r as renderButtonsInOrder, m as mergeRefs, e as generateFormResponse, f as clearLocalStorageValues } from './utils-
|
|
30
|
+
import { c as clientI18nInstance, g as getWithExpiry, a as generateInitValues, F as FormikWrap, b as getFieldComponent, d as buildAutoCompleteAttribute, r as renderButtonsInOrder, m as mergeRefs, e as generateFormResponse, f as clearLocalStorageValues } from './utils-6039d7d2.js';
|
|
31
31
|
import { withT } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
32
32
|
import '@babel/runtime/helpers/toConsumableArray';
|
|
33
33
|
import '@bigbinary/neeto-commons-frontend/constants';
|
package/dist/UrlBuilder.js
CHANGED
|
@@ -10,7 +10,7 @@ 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 { a as generateInitValues, F as FormikWrap, b as getFieldComponent, d as buildAutoCompleteAttribute, m as mergeRefs } from './utils-
|
|
13
|
+
import { a as generateInitValues, F as FormikWrap, b as getFieldComponent, d as buildAutoCompleteAttribute, m as mergeRefs } from './utils-6039d7d2.js';
|
|
14
14
|
import { a as useForm } from './useFormApi-e3476a20.js';
|
|
15
15
|
import { parsePhoneNumber } from 'libphonenumber-js';
|
|
16
16
|
import { c as QUESTIONS_WITHOUT_FIELD_CODE } from './constants-d9148acf.js';
|
|
@@ -27,7 +27,9 @@ var useBuildFormStore = zustand.create(reactUtils.withImmutableActions(function
|
|
|
27
27
|
enabled: false,
|
|
28
28
|
title: "",
|
|
29
29
|
richTextFieldsToReset: [],
|
|
30
|
-
helpDocUrls: {}
|
|
30
|
+
helpDocUrls: {},
|
|
31
|
+
enableDomainBlacklisting: true,
|
|
32
|
+
enableDomainWhitelisting: true
|
|
31
33
|
},
|
|
32
34
|
setFormData: function setFormData(arg) {
|
|
33
35
|
return set(ramda.modify("formState", index.isFunction(arg) ? arg : ramda.mergeLeft(arg)));
|
|
@@ -40,4 +42,4 @@ var useBuildFormState = function useBuildFormState() {
|
|
|
40
42
|
|
|
41
43
|
exports.useBuildFormState = useBuildFormState;
|
|
42
44
|
exports.useBuildFormStore = useBuildFormStore;
|
|
43
|
-
//# sourceMappingURL=buildForm-
|
|
45
|
+
//# sourceMappingURL=buildForm-b8eb931e.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildForm-b8eb931e.js","sources":["../app/javascript/src/stores/buildForm.js"],"sourcesContent":["import i18next from \"i18next\";\nimport { noop } from \"neetocist\";\nimport { withImmutableActions } from \"neetocommons/react-utils\";\nimport { mergeLeft, modify, prop } from \"ramda\";\nimport { create } from \"zustand\";\n\nimport { isFunction } from \"utils\";\n\n/** @type {import(\"neetocommons/react-utils\").ZustandStoreHook} */\nconst useBuildFormStore = create(\n withImmutableActions(set => ({\n formState: {\n values: {},\n dirty: false,\n isSubmitting: false,\n isValid: true,\n errors: [],\n submitForm: noop,\n resetForm: noop,\n selectedLanguage: i18next.resolvedLanguage,\n formId: null,\n enabled: false,\n title: \"\",\n richTextFieldsToReset: [],\n helpDocUrls: {},\n enableDomainBlacklisting: true,\n enableDomainWhitelisting: true,\n },\n\n setFormData: arg =>\n set(modify(\"formState\", isFunction(arg) ? arg : mergeLeft(arg))),\n }))\n);\n\nexport const useBuildFormState = () => useBuildFormStore(prop(\"formState\"));\n\nexport default useBuildFormStore;\n"],"names":["useBuildFormStore","create","withImmutableActions","set","formState","values","dirty","isSubmitting","isValid","errors","submitForm","noop","resetForm","selectedLanguage","i18next","resolvedLanguage","formId","enabled","title","richTextFieldsToReset","helpDocUrls","enableDomainBlacklisting","enableDomainWhitelisting","setFormData","arg","modify","isFunction","mergeLeft","useBuildFormState","prop"],"mappings":";;;;;;;;;;;;;AAQA;AACA,IAAMA,iBAAiB,GAAGC,cAAM,CAC9BC,+BAAoB,CAAC,UAAAC,GAAG,EAAA;EAAA,OAAK;AAC3BC,IAAAA,SAAS,EAAE;MACTC,MAAM,EAAE,EAAE;AACVC,MAAAA,KAAK,EAAE,KAAK;AACZC,MAAAA,YAAY,EAAE,KAAK;AACnBC,MAAAA,OAAO,EAAE,IAAI;AACbC,MAAAA,MAAM,EAAE,EAAE;AACVC,MAAAA,UAAU,EAAEC,cAAI;AAChBC,MAAAA,SAAS,EAAED,cAAI;MACfE,gBAAgB,EAAEC,2BAAO,CAACC,gBAAgB;AAC1CC,MAAAA,MAAM,EAAE,IAAI;AACZC,MAAAA,OAAO,EAAE,KAAK;AACdC,MAAAA,KAAK,EAAE,EAAE;AACTC,MAAAA,qBAAqB,EAAE,EAAE;MACzBC,WAAW,EAAE,EAAE;AACfC,MAAAA,wBAAwB,EAAE,IAAI;AAC9BC,MAAAA,wBAAwB,EAAE,IAAA;KAC3B;IAEDC,WAAW,EAAE,SAAAA,WAAAA,CAAAC,GAAG,EAAA;AAAA,MAAA,OACdrB,GAAG,CAACsB,YAAM,CAAC,WAAW,EAAEC,gBAAU,CAACF,GAAG,CAAC,GAAGA,GAAG,GAAGG,eAAS,CAACH,GAAG,CAAC,CAAC,CAAC,CAAA;AAAA,KAAA;GACnE,CAAA;AAAA,CAAC,CACJ,EAAC;AAEYI,IAAAA,iBAAiB,GAAG,SAApBA,iBAAiBA,GAAA;AAAA,EAAA,OAAS5B,iBAAiB,CAAC6B,UAAI,CAAC,WAAW,CAAC,CAAC,CAAA;AAAA;;;;;"}
|
|
@@ -21,7 +21,9 @@ var useBuildFormStore = create(withImmutableActions(function (set) {
|
|
|
21
21
|
enabled: false,
|
|
22
22
|
title: "",
|
|
23
23
|
richTextFieldsToReset: [],
|
|
24
|
-
helpDocUrls: {}
|
|
24
|
+
helpDocUrls: {},
|
|
25
|
+
enableDomainBlacklisting: true,
|
|
26
|
+
enableDomainWhitelisting: true
|
|
25
27
|
},
|
|
26
28
|
setFormData: function setFormData(arg) {
|
|
27
29
|
return set(modify("formState", isFunction(arg) ? arg : mergeLeft(arg)));
|
|
@@ -33,4 +35,4 @@ var useBuildFormState = function useBuildFormState() {
|
|
|
33
35
|
};
|
|
34
36
|
|
|
35
37
|
export { useBuildFormStore as a, useBuildFormState as u };
|
|
36
|
-
//# sourceMappingURL=buildForm-
|
|
38
|
+
//# sourceMappingURL=buildForm-dfd708c6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildForm-dfd708c6.js","sources":["../app/javascript/src/stores/buildForm.js"],"sourcesContent":["import i18next from \"i18next\";\nimport { noop } from \"neetocist\";\nimport { withImmutableActions } from \"neetocommons/react-utils\";\nimport { mergeLeft, modify, prop } from \"ramda\";\nimport { create } from \"zustand\";\n\nimport { isFunction } from \"utils\";\n\n/** @type {import(\"neetocommons/react-utils\").ZustandStoreHook} */\nconst useBuildFormStore = create(\n withImmutableActions(set => ({\n formState: {\n values: {},\n dirty: false,\n isSubmitting: false,\n isValid: true,\n errors: [],\n submitForm: noop,\n resetForm: noop,\n selectedLanguage: i18next.resolvedLanguage,\n formId: null,\n enabled: false,\n title: \"\",\n richTextFieldsToReset: [],\n helpDocUrls: {},\n enableDomainBlacklisting: true,\n enableDomainWhitelisting: true,\n },\n\n setFormData: arg =>\n set(modify(\"formState\", isFunction(arg) ? arg : mergeLeft(arg))),\n }))\n);\n\nexport const useBuildFormState = () => useBuildFormStore(prop(\"formState\"));\n\nexport default useBuildFormStore;\n"],"names":["useBuildFormStore","create","withImmutableActions","set","formState","values","dirty","isSubmitting","isValid","errors","submitForm","noop","resetForm","selectedLanguage","i18next","resolvedLanguage","formId","enabled","title","richTextFieldsToReset","helpDocUrls","enableDomainBlacklisting","enableDomainWhitelisting","setFormData","arg","modify","isFunction","mergeLeft","useBuildFormState","prop"],"mappings":";;;;;;;AAQA;AACA,IAAMA,iBAAiB,GAAGC,MAAM,CAC9BC,oBAAoB,CAAC,UAAAC,GAAG,EAAA;EAAA,OAAK;AAC3BC,IAAAA,SAAS,EAAE;MACTC,MAAM,EAAE,EAAE;AACVC,MAAAA,KAAK,EAAE,KAAK;AACZC,MAAAA,YAAY,EAAE,KAAK;AACnBC,MAAAA,OAAO,EAAE,IAAI;AACbC,MAAAA,MAAM,EAAE,EAAE;AACVC,MAAAA,UAAU,EAAEC,IAAI;AAChBC,MAAAA,SAAS,EAAED,IAAI;MACfE,gBAAgB,EAAEC,OAAO,CAACC,gBAAgB;AAC1CC,MAAAA,MAAM,EAAE,IAAI;AACZC,MAAAA,OAAO,EAAE,KAAK;AACdC,MAAAA,KAAK,EAAE,EAAE;AACTC,MAAAA,qBAAqB,EAAE,EAAE;MACzBC,WAAW,EAAE,EAAE;AACfC,MAAAA,wBAAwB,EAAE,IAAI;AAC9BC,MAAAA,wBAAwB,EAAE,IAAA;KAC3B;IAEDC,WAAW,EAAE,SAAAA,WAAAA,CAAAC,GAAG,EAAA;AAAA,MAAA,OACdrB,GAAG,CAACsB,MAAM,CAAC,WAAW,EAAEC,UAAU,CAACF,GAAG,CAAC,GAAGA,GAAG,GAAGG,SAAS,CAACH,GAAG,CAAC,CAAC,CAAC,CAAA;AAAA,KAAA;GACnE,CAAA;AAAA,CAAC,CACJ,EAAC;AAEYI,IAAAA,iBAAiB,GAAG,SAApBA,iBAAiBA,GAAA;AAAA,EAAA,OAAS5B,iBAAiB,CAAC6B,IAAI,CAAC,WAAW,CAAC,CAAC,CAAA;AAAA;;;;"}
|
package/dist/cjs/BuildForm.js
CHANGED
|
@@ -18,7 +18,7 @@ var dnd = require('@hello-pangea/dnd');
|
|
|
18
18
|
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
19
19
|
var ActionBlock = require('@bigbinary/neetoui/formik/ActionBlock');
|
|
20
20
|
var reactI18next = require('react-i18next');
|
|
21
|
-
var buildForm = require('../buildForm-
|
|
21
|
+
var buildForm = require('../buildForm-b8eb931e.js');
|
|
22
22
|
var shallow = require('zustand/shallow');
|
|
23
23
|
var Alert = require('@bigbinary/neetoui/Alert');
|
|
24
24
|
var index = require('../index-b6bb805c.js');
|
|
@@ -952,7 +952,6 @@ var Form$1 = function Form(_ref) {
|
|
|
952
952
|
availableQuestionKinds = _ref.availableQuestionKinds,
|
|
953
953
|
getActiveKindDetails = _ref.getActiveKindDetails,
|
|
954
954
|
additionalQuestionKindPattern = _ref.additionalQuestionKindPattern,
|
|
955
|
-
enableDomainRestriction = _ref.enableDomainRestriction,
|
|
956
955
|
_ref$isEdit = _ref.isEdit,
|
|
957
956
|
isEdit = _ref$isEdit === void 0 ? false : _ref$isEdit;
|
|
958
957
|
var _useTranslation = reactI18next.useTranslation(),
|
|
@@ -963,6 +962,15 @@ var Form$1 = function Form(_ref) {
|
|
|
963
962
|
setErrors = _useFormikContext.setErrors,
|
|
964
963
|
setTouched = _useFormikContext.setTouched;
|
|
965
964
|
var hideQuestionHelpDoc = buildForm.useBuildFormStore(ramda.path(["formState", "helpDocUrls", "hideQuestion"]));
|
|
965
|
+
var _useBuildFormStore = buildForm.useBuildFormStore(function (store) {
|
|
966
|
+
var _store$formState, _store$formState2;
|
|
967
|
+
return {
|
|
968
|
+
enableDomainWhitelisting: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["enableDomainWhitelisting"],
|
|
969
|
+
enableDomainBlacklisting: (_store$formState2 = store["formState"]) === null || _store$formState2 === void 0 ? void 0 : _store$formState2["enableDomainBlacklisting"]
|
|
970
|
+
};
|
|
971
|
+
}, shallow.shallow),
|
|
972
|
+
enableDomainWhitelisting = _useBuildFormStore.enableDomainWhitelisting,
|
|
973
|
+
enableDomainBlacklisting = _useBuildFormStore.enableDomainBlacklisting;
|
|
966
974
|
var kind = values.kind;
|
|
967
975
|
var questionKinds = isEdit ? allQuestionKinds : availableQuestionKinds;
|
|
968
976
|
var questionKindUniquenessPattern = ramda.mergeLeft(isEdit && additionalQuestionKindPattern ? additionalQuestionKindPattern(values) : {}, {
|
|
@@ -1042,7 +1050,8 @@ var Form$1 = function Form(_ref) {
|
|
|
1042
1050
|
}), hasAdditionalData && renderAdditionalData({
|
|
1043
1051
|
kind: kind,
|
|
1044
1052
|
questionProps: questionProps,
|
|
1045
|
-
|
|
1053
|
+
enableDomainWhitelisting: enableDomainWhitelisting,
|
|
1054
|
+
enableDomainBlacklisting: enableDomainBlacklisting
|
|
1046
1055
|
})]
|
|
1047
1056
|
}), isSettingsBlockVisible && /*#__PURE__*/jsxRuntime.jsxs(Block, {
|
|
1048
1057
|
dataCy: "settings-card",
|
|
@@ -1288,9 +1297,43 @@ var SwitchBlock = function SwitchBlock(_ref) {
|
|
|
1288
1297
|
});
|
|
1289
1298
|
};
|
|
1290
1299
|
|
|
1291
|
-
var _excluded$3 = ["children"];
|
|
1292
1300
|
function ownKeys$8(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; }
|
|
1293
1301
|
function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$8(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$8(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1302
|
+
var TitleWithHelpPopover = function TitleWithHelpPopover(_ref) {
|
|
1303
|
+
var title = _ref.title,
|
|
1304
|
+
description = _ref.description,
|
|
1305
|
+
helpLink = _ref.helpLink;
|
|
1306
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1307
|
+
className: "flex gap-2",
|
|
1308
|
+
children: [title, /*#__PURE__*/jsxRuntime.jsx(HelpPopover__default["default"], _objectSpread$8({
|
|
1309
|
+
description: description,
|
|
1310
|
+
popoverProps: {
|
|
1311
|
+
position: "top"
|
|
1312
|
+
}
|
|
1313
|
+
}, helpLink && {
|
|
1314
|
+
helpLinkProps: {
|
|
1315
|
+
href: helpLink
|
|
1316
|
+
}
|
|
1317
|
+
}))]
|
|
1318
|
+
});
|
|
1319
|
+
};
|
|
1320
|
+
|
|
1321
|
+
var DOMAIN_RESTRICTION_TRANSLATIONS = {
|
|
1322
|
+
whitelistedDomains: {
|
|
1323
|
+
title: i18next.t("neetoForm.domainRestriction.whitelistedDomains.label"),
|
|
1324
|
+
description: i18next.t("neetoForm.domainRestriction.whitelistedDomains.description"),
|
|
1325
|
+
popoverDescription: i18next.t("neetoForm.domainRestriction.whitelistedDomains.popoverDescription")
|
|
1326
|
+
},
|
|
1327
|
+
blacklistedDomains: {
|
|
1328
|
+
title: i18next.t("neetoForm.domainRestriction.blacklistedDomains.label"),
|
|
1329
|
+
description: i18next.t("neetoForm.domainRestriction.blacklistedDomains.description"),
|
|
1330
|
+
popoverDescription: i18next.t("neetoForm.domainRestriction.blacklistedDomains.popoverDescription")
|
|
1331
|
+
}
|
|
1332
|
+
};
|
|
1333
|
+
|
|
1334
|
+
var _excluded$3 = ["children"];
|
|
1335
|
+
function ownKeys$7(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; }
|
|
1336
|
+
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$7(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$7(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1294
1337
|
var STYLES = {
|
|
1295
1338
|
border: {
|
|
1296
1339
|
"default": "1px solid rgb(var(--neeto-ui-gray-400))",
|
|
@@ -1302,8 +1345,8 @@ var STYLES = {
|
|
|
1302
1345
|
}
|
|
1303
1346
|
};
|
|
1304
1347
|
var MultiValueRemove = function MultiValueRemove(props) {
|
|
1305
|
-
return /*#__PURE__*/jsxRuntime.jsx(reactSelect.components.MultiValueRemove, _objectSpread$
|
|
1306
|
-
innerProps: _objectSpread$
|
|
1348
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactSelect.components.MultiValueRemove, _objectSpread$7(_objectSpread$7({}, props), {}, {
|
|
1349
|
+
innerProps: _objectSpread$7(_objectSpread$7({}, props.innerProps), {}, _defineProperty__default["default"]({}, "data-cy", "".concat(utils.hyphenize(props.data.label), "-remove-icon"))),
|
|
1307
1350
|
children: /*#__PURE__*/jsxRuntime.jsx(Close__default["default"], {
|
|
1308
1351
|
size: 16
|
|
1309
1352
|
})
|
|
@@ -1323,8 +1366,8 @@ var ValueContainer = function ValueContainer(_ref) {
|
|
|
1323
1366
|
firstChild = _children[0],
|
|
1324
1367
|
rest = _children.slice(1);
|
|
1325
1368
|
var shouldCollapse = !isFocused && value.length > visibleDomainsCount;
|
|
1326
|
-
return /*#__PURE__*/jsxRuntime.jsxs(reactSelect.components.ValueContainer, _objectSpread$
|
|
1327
|
-
innerProps: _objectSpread$
|
|
1369
|
+
return /*#__PURE__*/jsxRuntime.jsxs(reactSelect.components.ValueContainer, _objectSpread$7(_objectSpread$7({}, props), {}, {
|
|
1370
|
+
innerProps: _objectSpread$7(_objectSpread$7({}, props.innerProps), {}, _defineProperty__default["default"]({}, "data-cy", "multi-domain-input-container")),
|
|
1328
1371
|
children: [shouldCollapse ? firstChild.slice(0, visibleDomainsCount) : firstChild, shouldCollapse && /*#__PURE__*/jsxRuntime.jsx(Tag__default["default"], {
|
|
1329
1372
|
style: "secondary",
|
|
1330
1373
|
label: t("neetoForm.common.remainingItemsCount", {
|
|
@@ -1334,8 +1377,8 @@ var ValueContainer = function ValueContainer(_ref) {
|
|
|
1334
1377
|
}));
|
|
1335
1378
|
};
|
|
1336
1379
|
var ClearIndicator = function ClearIndicator(props) {
|
|
1337
|
-
return /*#__PURE__*/jsxRuntime.jsx(reactSelect.components.ClearIndicator, _objectSpread$
|
|
1338
|
-
innerProps: _objectSpread$
|
|
1380
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactSelect.components.ClearIndicator, _objectSpread$7(_objectSpread$7({}, props), {}, {
|
|
1381
|
+
innerProps: _objectSpread$7(_objectSpread$7({}, props.innerProps), {}, _defineProperty__default["default"]({}, "data-cy", "clear-all-button")),
|
|
1339
1382
|
children: /*#__PURE__*/jsxRuntime.jsx(Close__default["default"], {
|
|
1340
1383
|
className: "cursor-pointer",
|
|
1341
1384
|
size: 16
|
|
@@ -1356,7 +1399,7 @@ var CUSTOM_STYLES = {
|
|
|
1356
1399
|
input: ramda.assoc("overflow", "hidden"),
|
|
1357
1400
|
multiValue: function multiValue(styles, _ref2) {
|
|
1358
1401
|
var valid = _ref2.data.valid;
|
|
1359
|
-
return _objectSpread$
|
|
1402
|
+
return _objectSpread$7(_objectSpread$7({}, styles), {}, {
|
|
1360
1403
|
border: valid ? STYLES.border["default"] : STYLES.border.error,
|
|
1361
1404
|
color: valid ? STYLES.color["default"] : STYLES.color.error
|
|
1362
1405
|
});
|
|
@@ -1399,8 +1442,8 @@ var formatErrorMessage = function formatErrorMessage(error) {
|
|
|
1399
1442
|
};
|
|
1400
1443
|
|
|
1401
1444
|
var _excluded$2 = ["label", "value", "onChange", "error", "onBlur"];
|
|
1402
|
-
function ownKeys$
|
|
1403
|
-
function _objectSpread$
|
|
1445
|
+
function ownKeys$6(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; }
|
|
1446
|
+
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1404
1447
|
var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
1405
1448
|
var _ref$label = _ref.label,
|
|
1406
1449
|
label = _ref$label === void 0 ? "" : _ref$label,
|
|
@@ -1459,7 +1502,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1459
1502
|
"data-cy": "".concat(utils.hyphenize(label), "-input-label"),
|
|
1460
1503
|
children: label
|
|
1461
1504
|
})
|
|
1462
|
-
}), /*#__PURE__*/jsxRuntime.jsx(CreatableSelect__default["default"], _objectSpread$
|
|
1505
|
+
}), /*#__PURE__*/jsxRuntime.jsx(CreatableSelect__default["default"], _objectSpread$6({
|
|
1463
1506
|
isMulti: true,
|
|
1464
1507
|
required: true,
|
|
1465
1508
|
classNamePrefix: "neeto-ui-react-select",
|
|
@@ -1469,7 +1512,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1469
1512
|
className: classnames__default["default"]("neeto-ui-react-select__container neeto-ui-react-select__container--medium neeto-ui-email-input__select", {
|
|
1470
1513
|
"neeto-ui-react-select__container--error": !!error
|
|
1471
1514
|
}),
|
|
1472
|
-
styles: _objectSpread$
|
|
1515
|
+
styles: _objectSpread$6(_objectSpread$6({}, CUSTOM_STYLES), {}, {
|
|
1473
1516
|
control: ramda.mergeLeft({
|
|
1474
1517
|
maxHeight: "200px",
|
|
1475
1518
|
overflowY: "auto"
|
|
@@ -1481,7 +1524,7 @@ var MultiDomainInput = function MultiDomainInput(_ref) {
|
|
|
1481
1524
|
},
|
|
1482
1525
|
onInputChange: setInputValue,
|
|
1483
1526
|
onKeyDown: handleKeyDown
|
|
1484
|
-
}, _objectSpread$
|
|
1527
|
+
}, _objectSpread$6({
|
|
1485
1528
|
inputValue: inputValue,
|
|
1486
1529
|
isFocused: isFocused,
|
|
1487
1530
|
onChange: onChange,
|
|
@@ -1539,9 +1582,13 @@ var validateDomains = function validateDomains(value) {
|
|
|
1539
1582
|
}());
|
|
1540
1583
|
};
|
|
1541
1584
|
|
|
1542
|
-
var
|
|
1585
|
+
var EmailDomains = function EmailDomains(_ref) {
|
|
1586
|
+
var name = _ref.name,
|
|
1587
|
+
label = _ref.label;
|
|
1588
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
1589
|
+
t = _useTranslation.t;
|
|
1543
1590
|
var _useField = formik.useField({
|
|
1544
|
-
name:
|
|
1591
|
+
name: name,
|
|
1545
1592
|
validate: validateDomains
|
|
1546
1593
|
}),
|
|
1547
1594
|
_useField2 = _slicedToArray__default["default"](_useField, 3),
|
|
@@ -1551,15 +1598,14 @@ var RestrictedDomains = function RestrictedDomains() {
|
|
|
1551
1598
|
_useField2$ = _useField2[2],
|
|
1552
1599
|
setValue = _useField2$.setValue,
|
|
1553
1600
|
setTouched = _useField2$.setTouched;
|
|
1554
|
-
var _useTranslation = reactI18next.useTranslation(),
|
|
1555
|
-
t = _useTranslation.t;
|
|
1556
1601
|
var formattedDomains = ramda.map(formatDomainInputOptions, domains);
|
|
1557
1602
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1558
1603
|
className: "mb-4",
|
|
1559
1604
|
children: /*#__PURE__*/jsxRuntime.jsx(MultiDomainInput, {
|
|
1605
|
+
label: label,
|
|
1606
|
+
name: name,
|
|
1560
1607
|
error: meta.touched ? meta.error : "",
|
|
1561
|
-
|
|
1562
|
-
name: "restrictedDomains",
|
|
1608
|
+
placeholder: t("neetoForm.domainRestriction.placeholder"),
|
|
1563
1609
|
value: formattedDomains,
|
|
1564
1610
|
onBlur: function onBlur() {
|
|
1565
1611
|
return setTouched(true);
|
|
@@ -1571,34 +1617,52 @@ var RestrictedDomains = function RestrictedDomains() {
|
|
|
1571
1617
|
});
|
|
1572
1618
|
};
|
|
1573
1619
|
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1620
|
+
var RestrictDomainsBlock = function RestrictDomainsBlock(_ref) {
|
|
1621
|
+
var switchName = _ref.switchName,
|
|
1622
|
+
domainName = _ref.domainName,
|
|
1623
|
+
isDomainRestrictionEnabled = _ref.isDomainRestrictionEnabled;
|
|
1624
|
+
var _DOMAIN_RESTRICTION_T = DOMAIN_RESTRICTION_TRANSLATIONS[domainName],
|
|
1625
|
+
title = _DOMAIN_RESTRICTION_T.title,
|
|
1626
|
+
description = _DOMAIN_RESTRICTION_T.description,
|
|
1627
|
+
popoverDescription = _DOMAIN_RESTRICTION_T.popoverDescription;
|
|
1628
|
+
var helpLink = buildForm.useBuildFormStore(ramda.path(["formState", "helpDocUrls", domainName]));
|
|
1583
1629
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1584
1630
|
className: "flex flex-col space-y-4",
|
|
1585
1631
|
children: [/*#__PURE__*/jsxRuntime.jsx(SwitchBlock, {
|
|
1586
1632
|
className: "mt-4",
|
|
1587
|
-
name:
|
|
1588
|
-
title: /*#__PURE__*/jsxRuntime.
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
popoverProps: {
|
|
1593
|
-
position: "top"
|
|
1594
|
-
}
|
|
1595
|
-
}, helpDocUrl && {
|
|
1596
|
-
helpLinkProps: {
|
|
1597
|
-
href: helpDocUrl
|
|
1598
|
-
}
|
|
1599
|
-
}))]
|
|
1633
|
+
name: switchName,
|
|
1634
|
+
title: /*#__PURE__*/jsxRuntime.jsx(TitleWithHelpPopover, {
|
|
1635
|
+
helpLink: helpLink,
|
|
1636
|
+
title: title,
|
|
1637
|
+
description: popoverDescription
|
|
1600
1638
|
})
|
|
1601
|
-
}), isDomainRestrictionEnabled && /*#__PURE__*/jsxRuntime.jsx(
|
|
1639
|
+
}), isDomainRestrictionEnabled && /*#__PURE__*/jsxRuntime.jsx(EmailDomains, {
|
|
1640
|
+
label: description,
|
|
1641
|
+
name: domainName
|
|
1642
|
+
})]
|
|
1643
|
+
});
|
|
1644
|
+
};
|
|
1645
|
+
|
|
1646
|
+
var Email = function Email(_ref) {
|
|
1647
|
+
var enableDomainWhitelisting = _ref.enableDomainWhitelisting,
|
|
1648
|
+
enableDomainBlacklisting = _ref.enableDomainBlacklisting;
|
|
1649
|
+
var _useFormikContext = formik.useFormikContext(),
|
|
1650
|
+
_useFormikContext$val = _useFormikContext.values,
|
|
1651
|
+
_useFormikContext$val2 = _useFormikContext$val.isDomainWhitelistingEnabled,
|
|
1652
|
+
isDomainWhitelistingEnabled = _useFormikContext$val2 === void 0 ? false : _useFormikContext$val2,
|
|
1653
|
+
_useFormikContext$val3 = _useFormikContext$val.isDomainBlacklistingEnabled,
|
|
1654
|
+
isDomainBlacklistingEnabled = _useFormikContext$val3 === void 0 ? false : _useFormikContext$val3;
|
|
1655
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1656
|
+
className: "flex flex-col space-y-4",
|
|
1657
|
+
children: [enableDomainWhitelisting && /*#__PURE__*/jsxRuntime.jsx(RestrictDomainsBlock, {
|
|
1658
|
+
domainName: "whitelistedDomains",
|
|
1659
|
+
isDomainRestrictionEnabled: isDomainWhitelistingEnabled,
|
|
1660
|
+
switchName: "isDomainWhitelistingEnabled"
|
|
1661
|
+
}), enableDomainBlacklisting && /*#__PURE__*/jsxRuntime.jsx(RestrictDomainsBlock, {
|
|
1662
|
+
domainName: "blacklistedDomains",
|
|
1663
|
+
isDomainRestrictionEnabled: isDomainBlacklistingEnabled,
|
|
1664
|
+
switchName: "isDomainBlacklistingEnabled"
|
|
1665
|
+
})]
|
|
1602
1666
|
});
|
|
1603
1667
|
};
|
|
1604
1668
|
|
|
@@ -1956,7 +2020,8 @@ var transformValueForOption = function transformValueForOption(_ref) {
|
|
|
1956
2020
|
var renderAdditionalData = function renderAdditionalData(_ref2) {
|
|
1957
2021
|
var kind = _ref2.kind,
|
|
1958
2022
|
questionProps = _ref2.questionProps,
|
|
1959
|
-
|
|
2023
|
+
enableDomainWhitelisting = _ref2.enableDomainWhitelisting,
|
|
2024
|
+
enableDomainBlacklisting = _ref2.enableDomainBlacklisting;
|
|
1960
2025
|
switch (kind) {
|
|
1961
2026
|
case CHECKBOX:
|
|
1962
2027
|
case RADIO:
|
|
@@ -1973,7 +2038,10 @@ var renderAdditionalData = function renderAdditionalData(_ref2) {
|
|
|
1973
2038
|
case CAPTCHA:
|
|
1974
2039
|
return /*#__PURE__*/jsxRuntime.jsx(Captcha, {});
|
|
1975
2040
|
case EMAIL:
|
|
1976
|
-
return
|
|
2041
|
+
return enableDomainWhitelisting || enableDomainBlacklisting ? /*#__PURE__*/jsxRuntime.jsx(Email, {
|
|
2042
|
+
enableDomainBlacklisting: enableDomainBlacklisting,
|
|
2043
|
+
enableDomainWhitelisting: enableDomainWhitelisting
|
|
2044
|
+
}) : null;
|
|
1977
2045
|
default:
|
|
1978
2046
|
return null;
|
|
1979
2047
|
}
|
|
@@ -2058,7 +2126,7 @@ var AddQuestion = function AddQuestion(_ref) {
|
|
|
2058
2126
|
}));
|
|
2059
2127
|
};
|
|
2060
2128
|
|
|
2061
|
-
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", "
|
|
2129
|
+
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"];
|
|
2062
2130
|
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; }
|
|
2063
2131
|
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__default["default"](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; }
|
|
2064
2132
|
var Form = function Form(_ref) {
|
|
@@ -2086,7 +2154,8 @@ var Form = function Form(_ref) {
|
|
|
2086
2154
|
additionalQuestionKindPattern = _ref.additionalQuestionKindPattern,
|
|
2087
2155
|
showActionBlock = _ref.showActionBlock,
|
|
2088
2156
|
buildRequestArgs = _ref.buildRequestArgs,
|
|
2089
|
-
|
|
2157
|
+
enableDomainBlacklisting = _ref.enableDomainBlacklisting,
|
|
2158
|
+
enableDomainWhitelisting = _ref.enableDomainWhitelisting,
|
|
2090
2159
|
helpDocUrls = _ref.helpDocUrls,
|
|
2091
2160
|
formDomProps = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
2092
2161
|
var containerRef = React.useRef();
|
|
@@ -2135,9 +2204,11 @@ var Form = function Form(_ref) {
|
|
|
2135
2204
|
submitForm: submitForm,
|
|
2136
2205
|
resetForm: resetForm,
|
|
2137
2206
|
selectedLanguage: selectedLanguage,
|
|
2138
|
-
helpDocUrls: helpDocUrls
|
|
2207
|
+
helpDocUrls: helpDocUrls,
|
|
2208
|
+
enableDomainBlacklisting: enableDomainBlacklisting,
|
|
2209
|
+
enableDomainWhitelisting: enableDomainWhitelisting
|
|
2139
2210
|
});
|
|
2140
|
-
}, [formId, isFormEnabled, savedTitle, setFormData, values, dirty, isSubmitting, isValid, errors, submitForm, resetForm, selectedLanguage, helpDocUrls]);
|
|
2211
|
+
}, [formId, isFormEnabled, savedTitle, setFormData, values, dirty, isSubmitting, isValid, errors, submitForm, resetForm, selectedLanguage, helpDocUrls, enableDomainBlacklisting, enableDomainWhitelisting]);
|
|
2141
2212
|
var questions = values.questions;
|
|
2142
2213
|
var handleSelect = function handleSelect(question) {
|
|
2143
2214
|
setSelectedQuestion(question);
|
|
@@ -2280,7 +2351,6 @@ var Form = function Form(_ref) {
|
|
|
2280
2351
|
additionalQuestionKindPattern: additionalQuestionKindPattern,
|
|
2281
2352
|
availableQuestionKinds: availableQuestionKinds,
|
|
2282
2353
|
buildRequestArgs: buildRequestArgs,
|
|
2283
|
-
enableDomainRestriction: enableDomainRestriction,
|
|
2284
2354
|
enableFieldCode: enableFieldCode,
|
|
2285
2355
|
getActiveKindDetails: getActiveKindDetails,
|
|
2286
2356
|
handleSelect: handleSelect,
|
|
@@ -2343,8 +2413,10 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2343
2413
|
_ref$additionalAction = _ref.additionalActionOptions,
|
|
2344
2414
|
additionalActionOptions = _ref$additionalAction === void 0 ? [] : _ref$additionalAction,
|
|
2345
2415
|
additionalQuestionKindPattern = _ref.additionalQuestionKindPattern,
|
|
2346
|
-
_ref$
|
|
2347
|
-
|
|
2416
|
+
_ref$enableDomainBlac = _ref.enableDomainBlacklisting,
|
|
2417
|
+
enableDomainBlacklisting = _ref$enableDomainBlac === void 0 ? true : _ref$enableDomainBlac,
|
|
2418
|
+
_ref$enableDomainWhit = _ref.enableDomainWhitelisting,
|
|
2419
|
+
enableDomainWhitelisting = _ref$enableDomainWhit === void 0 ? true : _ref$enableDomainWhit,
|
|
2348
2420
|
helpDocUrls = _ref.helpDocUrls,
|
|
2349
2421
|
className = _ref.className;
|
|
2350
2422
|
var queryClient = reactQuery.useQueryClient();
|
|
@@ -2428,7 +2500,8 @@ var BuildForm = function BuildForm(_ref) {
|
|
|
2428
2500
|
buildRequestArgs: buildRequestArgs,
|
|
2429
2501
|
cancelButtonProps: cancelButtonProps,
|
|
2430
2502
|
disabledAddButtonTooltipProps: disabledAddButtonTooltipProps,
|
|
2431
|
-
|
|
2503
|
+
enableDomainBlacklisting: enableDomainBlacklisting,
|
|
2504
|
+
enableDomainWhitelisting: enableDomainWhitelisting,
|
|
2432
2505
|
enableFieldCode: enableFieldCode,
|
|
2433
2506
|
formDescription: formDescription,
|
|
2434
2507
|
formTitle: formTitle,
|