@bigbinary/neeto-access-control-frontend 1.3.2 → 1.3.4

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/index.cjs.js CHANGED
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
6
4
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
7
5
  var react = require('react');
@@ -9,12 +7,12 @@ var classNames = require('classnames');
9
7
  var neetoCist = require('@bigbinary/neeto-cist');
10
8
  var Container = require('@bigbinary/neeto-molecules/Container');
11
9
  var Scrollable = require('@bigbinary/neeto-molecules/Scrollable');
12
- var Label = require('@bigbinary/neetoui/Label');
13
10
  var Spinner = require('@bigbinary/neetoui/Spinner');
14
11
  var ActionBlock = require('@bigbinary/neetoui/formik/ActionBlock');
15
12
  var Form = require('@bigbinary/neetoui/formik/Form');
16
13
  var Input = require('@bigbinary/neetoui/formik/Input');
17
14
  var Radio = require('@bigbinary/neetoui/formik/Radio');
15
+ var ramda = require('ramda');
18
16
  var reactI18next = require('react-i18next');
19
17
  var constants = require('@bigbinary/neeto-commons-frontend/constants');
20
18
  var Delete = require('@bigbinary/neeto-icons/Delete');
@@ -26,7 +24,6 @@ var NoData = require('@bigbinary/neetoui/NoData');
26
24
  var Pane = require('@bigbinary/neetoui/Pane');
27
25
  var Table = require('@bigbinary/neetoui/Table');
28
26
  var Typography = require('@bigbinary/neetoui/Typography');
29
- var ramda = require('ramda');
30
27
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
31
28
  var reactQuery = require('@tanstack/react-query');
32
29
  var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
@@ -39,13 +36,11 @@ var jsxRuntime = require('react/jsx-runtime');
39
36
  var MoreDropdown = require('@bigbinary/neeto-molecules/MoreDropdown');
40
37
  var Tooltip = require('@bigbinary/neetoui/Tooltip');
41
38
  var formik = require('formik');
39
+ var Label = require('@bigbinary/neetoui/Label');
42
40
  var NeetoHeader = require('@bigbinary/neeto-molecules/Header');
43
41
  var HelpPopover = require('@bigbinary/neeto-molecules/HelpPopover');
44
42
 
45
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
46
-
47
- function _interopNamespace(e) {
48
- if (e && e.__esModule) return e;
43
+ function _interopNamespaceDefault(e) {
49
44
  var n = Object.create(null);
50
45
  if (e) {
51
46
  Object.keys(e).forEach(function (k) {
@@ -58,52 +53,24 @@ function _interopNamespace(e) {
58
53
  }
59
54
  });
60
55
  }
61
- n["default"] = e;
56
+ n.default = e;
62
57
  return Object.freeze(n);
63
58
  }
64
59
 
65
- var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
66
- var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
67
- var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
68
- var Container__default = /*#__PURE__*/_interopDefaultLegacy(Container);
69
- var Scrollable__default = /*#__PURE__*/_interopDefaultLegacy(Scrollable);
70
- var Label__default = /*#__PURE__*/_interopDefaultLegacy(Label);
71
- var Spinner__default = /*#__PURE__*/_interopDefaultLegacy(Spinner);
72
- var ActionBlock__default = /*#__PURE__*/_interopDefaultLegacy(ActionBlock);
73
- var Form__default = /*#__PURE__*/_interopDefaultLegacy(Form);
74
- var Input__default = /*#__PURE__*/_interopDefaultLegacy(Input);
75
- var Radio__default = /*#__PURE__*/_interopDefaultLegacy(Radio);
76
- var Delete__default = /*#__PURE__*/_interopDefaultLegacy(Delete);
77
- var SubHeader__default = /*#__PURE__*/_interopDefaultLegacy(SubHeader);
78
- var TableWrapper__default = /*#__PURE__*/_interopDefaultLegacy(TableWrapper);
79
- var Alert__default = /*#__PURE__*/_interopDefaultLegacy(Alert);
80
- var Button__default$1 = /*#__PURE__*/_interopDefaultLegacy(Button$1);
81
- var NoData__default = /*#__PURE__*/_interopDefaultLegacy(NoData);
82
- var Pane__default = /*#__PURE__*/_interopDefaultLegacy(Pane);
83
- var Table__default = /*#__PURE__*/_interopDefaultLegacy(Table);
84
- var Typography__default = /*#__PURE__*/_interopDefaultLegacy(Typography);
85
- var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
86
- var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
87
- var MultiEmailInput__default = /*#__PURE__*/_interopDefaultLegacy(MultiEmailInput);
88
- var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
89
- var yup__namespace = /*#__PURE__*/_interopNamespace(yup);
90
- var MoreDropdown__default = /*#__PURE__*/_interopDefaultLegacy(MoreDropdown);
91
- var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip);
92
- var NeetoHeader__default = /*#__PURE__*/_interopDefaultLegacy(NeetoHeader);
93
- var HelpPopover__default = /*#__PURE__*/_interopDefaultLegacy(HelpPopover);
60
+ var yup__namespace = /*#__PURE__*/_interopNamespaceDefault(yup);
94
61
 
95
62
  var ACCESS_CONTROL_BASE_PATH = "/secure/api/v1";
96
63
 
97
64
  var invitationsPath = "".concat(ACCESS_CONTROL_BASE_PATH, "/configuration/invitations");
98
65
  var list = function list(params) {
99
- return axios__default["default"].get(invitationsPath, {
66
+ return axios.get(invitationsPath, {
100
67
  params: params
101
68
  });
102
69
  };
103
70
  var bulkCreate = function bulkCreate(_ref) {
104
71
  var configurationId = _ref.configurationId,
105
72
  payload = _ref.payload;
106
- return axios__default["default"].post("".concat(invitationsPath, "/bulk_create"), payload, {
73
+ return axios.post("".concat(invitationsPath, "/bulk_create"), payload, {
107
74
  params: {
108
75
  neetoAccessControlConfigurationId: configurationId
109
76
  }
@@ -112,7 +79,7 @@ var bulkCreate = function bulkCreate(_ref) {
112
79
  var bulkDestroy = function bulkDestroy(_ref2) {
113
80
  var configurationId = _ref2.configurationId,
114
81
  payload = _ref2.payload;
115
- return axios__default["default"].post("".concat(invitationsPath, "/bulk_destroy"), payload, {
82
+ return axios.post("".concat(invitationsPath, "/bulk_destroy"), payload, {
116
83
  params: {
117
84
  neetoAccessControlConfigurationId: configurationId
118
85
  }
@@ -130,14 +97,14 @@ var QUERY_KEYS = {
130
97
  };
131
98
 
132
99
  var _excluded = ["ownerId", "ownerType"];
133
- function ownKeys$3(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; }
134
- function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
100
+ function ownKeys$4(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; }
101
+ function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
135
102
  var ACCESS_CONTROL_CONFIGURATION_INVITATIONS$1 = QUERY_KEYS.ACCESS_CONTROL_CONFIGURATION_INVITATIONS;
136
103
  var useListInvitations = function useListInvitations(_ref, options) {
137
104
  var ownerId = _ref.ownerId,
138
105
  ownerType = _ref.ownerType,
139
- otherParams = _objectWithoutProperties__default["default"](_ref, _excluded);
140
- return reactQuery.useQuery(_objectSpread$3({
106
+ otherParams = _objectWithoutProperties(_ref, _excluded);
107
+ return reactQuery.useQuery(_objectSpread$4({
141
108
  queryKey: [ACCESS_CONTROL_CONFIGURATION_INVITATIONS$1, ownerType, ownerId, otherParams],
142
109
  queryFn: function queryFn() {
143
110
  return invitationsApi.list(otherParams);
@@ -154,7 +121,7 @@ var useBulkCreateInvitations = function useBulkCreateInvitations(_ref2, options)
154
121
  configurationId: configurationId,
155
122
  payload: payload
156
123
  });
157
- }, _objectSpread$3({
124
+ }, _objectSpread$4({
158
125
  keysToInvalidate: [[ACCESS_CONTROL_CONFIGURATION_INVITATIONS$1, ownerType, ownerId]]
159
126
  }, options));
160
127
  };
@@ -167,7 +134,7 @@ var useBulkDestroyInvitations = function useBulkDestroyInvitations(_ref3, option
167
134
  configurationId: configurationId,
168
135
  payload: payload
169
136
  });
170
- }, _objectSpread$3({
137
+ }, _objectSpread$4({
171
138
  keysToInvalidate: [[ACCESS_CONTROL_CONFIGURATION_INVITATIONS$1, ownerType, ownerId]]
172
139
  }, options));
173
140
  };
@@ -212,7 +179,7 @@ var AddEmails = function AddEmails(_ref) {
212
179
  }
213
180
  });
214
181
  };
215
- return /*#__PURE__*/jsxRuntime.jsxs(Form__default["default"], {
182
+ return /*#__PURE__*/jsxRuntime.jsxs(Form, {
216
183
  className: "mb-5 flex w-full space-x-5",
217
184
  formikProps: {
218
185
  initialValues: ADD_EMAILS_FORM_INIT_VALUES,
@@ -221,14 +188,14 @@ var AddEmails = function AddEmails(_ref) {
221
188
  },
222
189
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
223
190
  className: "flex-grow",
224
- children: /*#__PURE__*/jsxRuntime.jsx(MultiEmailInput__default["default"], {
191
+ children: /*#__PURE__*/jsxRuntime.jsx(MultiEmailInput, {
225
192
  helpText: t("neetoAccessControl.addEmails.helpText"),
226
193
  label: t("neetoAccessControl.titles.emails"),
227
194
  name: "emails",
228
195
  placeholder: t("neetoAccessControl.addEmails.placeholder"),
229
196
  ref: emailsInputRef
230
197
  })
231
- }), /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
198
+ }), /*#__PURE__*/jsxRuntime.jsx(Button, {
232
199
  className: "flex-shrink-0 self-center whitespace-nowrap",
233
200
  label: t("neetoAccessControl.buttons.invite"),
234
201
  type: "submit"
@@ -246,14 +213,14 @@ var defaultColumnData = function defaultColumnData(_ref) {
246
213
  render: function render(email, inviteData) {
247
214
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
248
215
  className: "flex items-center justify-between gap-x-3",
249
- children: [/*#__PURE__*/jsxRuntime.jsx(Tooltip__default["default"], {
216
+ children: [/*#__PURE__*/jsxRuntime.jsx(Tooltip, {
250
217
  content: email,
251
218
  disabled: email.length < TRUNCATE_LENGTH,
252
- children: /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
219
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
253
220
  style: "body2",
254
221
  children: neetoCist.truncate(email, TRUNCATE_LENGTH)
255
222
  })
256
- }), /*#__PURE__*/jsxRuntime.jsx(MoreDropdown__default["default"], {
223
+ }), /*#__PURE__*/jsxRuntime.jsx(MoreDropdown, {
257
224
  dropdownProps: {
258
225
  strategy: "fixed"
259
226
  },
@@ -290,6 +257,8 @@ var renderColumnData = function renderColumnData(_ref2) {
290
257
  }), extraColumnsData);
291
258
  };
292
259
 
260
+ function ownKeys$3(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; }
261
+ function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
293
262
  var Invitations$1 = function Invitations(_ref) {
294
263
  var _selectedEmails$;
295
264
  var _ref$extraColumnsData = _ref.extraColumnsData,
@@ -303,18 +272,20 @@ var Invitations$1 = function Invitations(_ref) {
303
272
  onClose = _ref.onClose,
304
273
  _ref$hideAddEmailsFor = _ref.hideAddEmailsForm,
305
274
  hideAddEmailsForm = _ref$hideAddEmailsFor === void 0 ? false : _ref$hideAddEmailsFor,
275
+ _ref$inviteButtonProp = _ref.inviteButtonProps,
276
+ inviteButtonProps = _ref$inviteButtonProp === void 0 ? {} : _ref$inviteButtonProp,
306
277
  _ref$onDestroyInvitat = _ref.onDestroyInvitationsSuccess,
307
278
  onDestroyInvitationsSuccess = _ref$onDestroyInvitat === void 0 ? neetoCist.noop : _ref$onDestroyInvitat;
308
279
  var _useState = react.useState([]),
309
- _useState2 = _slicedToArray__default["default"](_useState, 2),
280
+ _useState2 = _slicedToArray(_useState, 2),
310
281
  selectedEmails = _useState2[0],
311
282
  setSelectedEmails = _useState2[1];
312
283
  var _useState3 = react.useState(false),
313
- _useState4 = _slicedToArray__default["default"](_useState3, 2),
284
+ _useState4 = _slicedToArray(_useState3, 2),
314
285
  showDeleteAlert = _useState4[0],
315
286
  setShowDeleteAlert = _useState4[1];
316
287
  var _useState5 = react.useState(constants.DEFAULT_PAGE_INDEX),
317
- _useState6 = _slicedToArray__default["default"](_useState5, 2),
288
+ _useState6 = _slicedToArray(_useState5, 2),
318
289
  page = _useState6[0],
319
290
  setPage = _useState6[1];
320
291
  var _useTranslation = reactI18next.useTranslation(),
@@ -364,25 +335,28 @@ var Invitations$1 = function Invitations(_ref) {
364
335
  setShowDeleteAlert(true);
365
336
  };
366
337
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
367
- children: [/*#__PURE__*/jsxRuntime.jsxs(Pane__default["default"], {
338
+ children: [/*#__PURE__*/jsxRuntime.jsxs(Pane, {
368
339
  isOpen: isOpen,
369
340
  size: "large",
370
341
  onClose: handleOnClose,
371
- children: [/*#__PURE__*/jsxRuntime.jsx(Pane__default["default"].Header, {
372
- children: /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
342
+ children: [/*#__PURE__*/jsxRuntime.jsx(Pane.Header, {
343
+ children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
373
344
  style: "h2",
374
345
  weight: "semibold",
375
346
  children: t("neetoAccessControl.titles.invitations")
376
347
  })
377
- }), /*#__PURE__*/jsxRuntime.jsxs(Pane__default["default"].Body, {
378
- className: "pt-2",
379
- children: [!hideAddEmailsForm && /*#__PURE__*/jsxRuntime.jsx(AddEmails, {
348
+ }), /*#__PURE__*/jsxRuntime.jsxs(Pane.Body, {
349
+ className: "space-y-4 pt-2",
350
+ children: [neetoCist.isNotEmpty(inviteButtonProps) && /*#__PURE__*/jsxRuntime.jsx("div", {
351
+ className: "flex w-full justify-end",
352
+ children: /*#__PURE__*/jsxRuntime.jsx(Button$1, _objectSpread$3({}, inviteButtonProps))
353
+ }), !hideAddEmailsForm && /*#__PURE__*/jsxRuntime.jsx(AddEmails, {
380
354
  configurationId: configurationId,
381
355
  ownerId: ownerId,
382
356
  ownerType: ownerType
383
357
  }), neetoCist.isNotEmpty(invitations) ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
384
- children: [/*#__PURE__*/jsxRuntime.jsx(SubHeader__default["default"], {
385
- leftActionBlock: ramda.isEmpty(selectedEmails) ? /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
358
+ children: [/*#__PURE__*/jsxRuntime.jsx(SubHeader, {
359
+ leftActionBlock: ramda.isEmpty(selectedEmails) ? /*#__PURE__*/jsxRuntime.jsx(Typography, {
386
360
  className: "min-h-8",
387
361
  component: "h4",
388
362
  style: "h4",
@@ -391,14 +365,14 @@ var Invitations$1 = function Invitations(_ref) {
391
365
  })
392
366
  }) : /*#__PURE__*/jsxRuntime.jsxs("div", {
393
367
  className: "flex items-center gap-x-4",
394
- children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
368
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
395
369
  style: "h4",
396
370
  children: t("neetoAccessControl.titles.selectedEmailsWithCount", {
397
371
  count: selectedEmails.length,
398
372
  totalCount: totalCount
399
373
  })
400
- }), /*#__PURE__*/jsxRuntime.jsx(Button__default$1["default"], {
401
- icon: Delete__default["default"],
374
+ }), /*#__PURE__*/jsxRuntime.jsx(Button$1, {
375
+ icon: Delete,
402
376
  style: "secondary",
403
377
  tooltipProps: {
404
378
  content: t("neetoAccessControl.labels.delete")
@@ -408,9 +382,9 @@ var Invitations$1 = function Invitations(_ref) {
408
382
  }
409
383
  })]
410
384
  })
411
- }), /*#__PURE__*/jsxRuntime.jsx(TableWrapper__default["default"], {
385
+ }), /*#__PURE__*/jsxRuntime.jsx(TableWrapper, {
412
386
  hasPagination: totalCount > constants.DEFAULT_PAGE_SIZE,
413
- children: /*#__PURE__*/jsxRuntime.jsx(Table__default["default"], {
387
+ children: /*#__PURE__*/jsxRuntime.jsx(Table, {
414
388
  totalCount: totalCount,
415
389
  fixedHeight: true,
416
390
  rowSelection: true,
@@ -430,15 +404,15 @@ var Invitations$1 = function Invitations(_ref) {
430
404
  })]
431
405
  }) : /*#__PURE__*/jsxRuntime.jsxs("div", {
432
406
  className: "flex h-full w-full justify-center",
433
- children: [!isLoading && /*#__PURE__*/jsxRuntime.jsx(NoData__default["default"], {
407
+ children: [!isLoading && /*#__PURE__*/jsxRuntime.jsx(NoData, {
434
408
  title: t("neetoAccessControl.labels.noInvitations")
435
409
  }), isLoading && /*#__PURE__*/jsxRuntime.jsx("div", {
436
410
  className: "flex h-full w-full items-center justify-center",
437
- children: /*#__PURE__*/jsxRuntime.jsx(Spinner__default["default"], {})
411
+ children: /*#__PURE__*/jsxRuntime.jsx(Spinner, {})
438
412
  })]
439
413
  })]
440
414
  })]
441
- }), /*#__PURE__*/jsxRuntime.jsx(Alert__default["default"], {
415
+ }), /*#__PURE__*/jsxRuntime.jsx(Alert, {
442
416
  isOpen: showDeleteAlert,
443
417
  isSubmitting: isPending,
444
418
  submitButtonLabel: t("neetoAccessControl.labels.delete"),
@@ -465,7 +439,7 @@ var Invitations$1 = function Invitations(_ref) {
465
439
 
466
440
  var configurationPath = "".concat(ACCESS_CONTROL_BASE_PATH, "/configuration");
467
441
  var show = function show(params) {
468
- return axios__default["default"].get(configurationPath, {
442
+ return axios.get(configurationPath, {
469
443
  params: params
470
444
  });
471
445
  };
@@ -473,7 +447,7 @@ var update = function update(_ref) {
473
447
  var ownerId = _ref.ownerId,
474
448
  ownerType = _ref.ownerType,
475
449
  payload = _ref.payload;
476
- return axios__default["default"].put(configurationPath, {
450
+ return axios.put(configurationPath, {
477
451
  configuration: payload
478
452
  }, {
479
453
  params: {
@@ -488,7 +462,7 @@ var configurationsApi = {
488
462
  };
489
463
 
490
464
  function ownKeys$2(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; }
491
- function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
465
+ function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
492
466
  var ACCESS_CONTROL_CONFIGURATION = QUERY_KEYS.ACCESS_CONTROL_CONFIGURATION,
493
467
  ACCESS_CONTROL_CONFIGURATION_INVITATIONS = QUERY_KEYS.ACCESS_CONTROL_CONFIGURATION_INVITATIONS;
494
468
  var useShowConfiguration = function useShowConfiguration(_ref) {
@@ -527,26 +501,6 @@ var AUTH = {
527
501
  SESSION: "session",
528
502
  INVITED: "invited"
529
503
  };
530
- var AUTH_OPTIONS = [{
531
- label: i18next.t("neetoAccessControl.auth.no"),
532
- value: AUTH.NO,
533
- "data-cy": neetoCist.hyphenate(i18next.t("neetoAccessControl.auth.no"))
534
- }, {
535
- label: i18next.t("neetoAccessControl.auth.basic"),
536
- value: AUTH.BASIC,
537
- "data-cy": neetoCist.hyphenate(i18next.t("neetoAccessControl.auth.basic"))
538
- }, {
539
- label: i18next.t("neetoAccessControl.auth.invited"),
540
- value: AUTH.INVITED
541
- }, {
542
- label: i18next.t("neetoAccessControl.auth.email"),
543
- value: AUTH.EMAIL,
544
- "data-cy": neetoCist.hyphenate(i18next.t("neetoAccessControl.auth.email"))
545
- }, {
546
- label: i18next.t("neetoAccessControl.auth.session"),
547
- value: AUTH.SESSION,
548
- "data-cy": neetoCist.hyphenate(i18next.t("neetoAccessControl.auth.session"))
549
- }];
550
504
  var CONFIGURATION_VALIDATION_SCHEMA = yup__namespace.object({
551
505
  auth: yup__namespace.string().required(i18next.t("neetoAccessControl.inputs.validation.authRequired")),
552
506
  password: yup__namespace.string().nullable().when("auth", {
@@ -602,7 +556,7 @@ var renderLabelWithViewInvitation = function renderLabelWithViewInvitation(_ref2
602
556
  return /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
603
557
  i18nKey: "neetoAccessControl.auth.invitedWithViewButton",
604
558
  components: {
605
- button: /*#__PURE__*/jsxRuntime.jsx(Button__default$1["default"], {
559
+ button: /*#__PURE__*/jsxRuntime.jsx(Button$1, {
606
560
  className: "mt-1",
607
561
  size: "small",
608
562
  style: "link",
@@ -611,6 +565,41 @@ var renderLabelWithViewInvitation = function renderLabelWithViewInvitation(_ref2
611
565
  }
612
566
  });
613
567
  };
568
+ var getAuthOptions = function getAuthOptions(_ref3) {
569
+ var translationContext = _ref3.translationContext,
570
+ t = _ref3.t;
571
+ return [{
572
+ label: t("neetoAccessControl.auth.no", {
573
+ context: translationContext
574
+ }),
575
+ value: AUTH.NO,
576
+ "data-cy": "access-control-public-access-radio-input"
577
+ }, {
578
+ label: t("neetoAccessControl.auth.basic", {
579
+ context: translationContext
580
+ }),
581
+ value: AUTH.BASIC,
582
+ "data-cy": "access-control-password-protected-radio-input"
583
+ }, {
584
+ label: t("neetoAccessControl.auth.invited", {
585
+ context: translationContext
586
+ }),
587
+ value: AUTH.INVITED,
588
+ "data-cy": "access-control-only-invited-people-radio-input"
589
+ }, {
590
+ label: t("neetoAccessControl.auth.email", {
591
+ context: translationContext
592
+ }),
593
+ value: AUTH.EMAIL,
594
+ "data-cy": "access-control-secure-by-email-patterns-radio-input"
595
+ }, {
596
+ label: t("neetoAccessControl.auth.session", {
597
+ context: translationContext
598
+ }),
599
+ value: AUTH.SESSION,
600
+ "data-cy": "access-control-logged-in-members-only-radio-input"
601
+ }];
602
+ };
614
603
 
615
604
  var AllowedKeywords = reactUtils.withT(function (_ref) {
616
605
  var t = _ref.t,
@@ -624,18 +613,18 @@ var AllowedKeywords = reactUtils.withT(function (_ref) {
624
613
  var showDeleteButton = allowedKeywords.length > 1 || neetoCist.isNotEmpty(allowedKeywords[0]);
625
614
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
626
615
  className: "space-y-4",
627
- children: [/*#__PURE__*/jsxRuntime.jsx(Label__default["default"], {
616
+ children: [/*#__PURE__*/jsxRuntime.jsx(Label, {
628
617
  children: label
629
618
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
630
619
  className: "neeto-ui-bg-pastel-blue neeto-ui-rounded-sm space-y-4 p-6",
631
620
  children: [allowedKeywords.map(function (_, index) {
632
- return /*#__PURE__*/jsxRuntime.jsx(Input__default["default"], {
621
+ return /*#__PURE__*/jsxRuntime.jsx(Input, {
633
622
  className: "w-full",
634
623
  name: "".concat(name, ".").concat(index),
635
624
  placeholder: t("neetoAccessControl.inputs.placeholders.enterKeyword"),
636
- suffix: showDeleteButton && /*#__PURE__*/jsxRuntime.jsx(Button__default$1["default"], {
625
+ suffix: showDeleteButton && /*#__PURE__*/jsxRuntime.jsx(Button$1, {
637
626
  "data-cy": "allowed-keyword-delete-button",
638
- icon: Delete__default["default"],
627
+ icon: Delete,
639
628
  size: "small",
640
629
  style: "text",
641
630
  onClick: function onClick() {
@@ -647,7 +636,7 @@ var AllowedKeywords = reactUtils.withT(function (_ref) {
647
636
  }
648
637
  })
649
638
  }, index);
650
- }), /*#__PURE__*/jsxRuntime.jsx(Button__default$1["default"], {
639
+ }), /*#__PURE__*/jsxRuntime.jsx(Button$1, {
651
640
  className: "pt-2",
652
641
  "data-cy": "add-allowed-keyword-button",
653
642
  label: t("neetoAccessControl.actions.addKeyword"),
@@ -663,16 +652,16 @@ var AllowedKeywords = reactUtils.withT(function (_ref) {
663
652
  });
664
653
 
665
654
  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; }
666
- 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; }
655
+ 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; }
667
656
  var Header = function Header(_ref) {
668
657
  var headerProps = _ref.headerProps;
669
658
  var title = headerProps.title,
670
659
  helpLink = headerProps.helpLink,
671
660
  description = headerProps.description;
672
- return /*#__PURE__*/jsxRuntime.jsx(NeetoHeader__default["default"], _objectSpread$1(_objectSpread$1({}, headerProps), {}, {
661
+ return /*#__PURE__*/jsxRuntime.jsx(NeetoHeader, _objectSpread$1(_objectSpread$1({}, headerProps), {}, {
673
662
  title: /*#__PURE__*/jsxRuntime.jsxs("span", {
674
663
  className: "flex",
675
- children: [title, /*#__PURE__*/jsxRuntime.jsx(HelpPopover__default["default"], {
664
+ children: [title, /*#__PURE__*/jsxRuntime.jsx(HelpPopover, {
676
665
  description: description,
677
666
  title: title,
678
667
  className: "ml-2 self-center",
@@ -685,7 +674,7 @@ var Header = function Header(_ref) {
685
674
  };
686
675
 
687
676
  function ownKeys(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; }
688
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
677
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
689
678
  var Configuration = function Configuration(_ref) {
690
679
  var ownerId = _ref.ownerId,
691
680
  ownerType = _ref.ownerType,
@@ -703,11 +692,18 @@ var Configuration = function Configuration(_ref) {
703
692
  hideAddEmailsFromInvitationPane = _ref$hideAddEmailsFro === void 0 ? false : _ref$hideAddEmailsFro,
704
693
  _ref$onDestroyInvitat = _ref.onDestroyInvitationsSuccess,
705
694
  onDestroyInvitationsSuccess = _ref$onDestroyInvitat === void 0 ? neetoCist.noop : _ref$onDestroyInvitat,
706
- children = _ref.children;
695
+ _ref$inviteButtonProp = _ref.inviteButtonProps,
696
+ inviteButtonProps = _ref$inviteButtonProp === void 0 ? {} : _ref$inviteButtonProp,
697
+ _ref$additionalFields = _ref.additionalFieldsInitialValues,
698
+ additionalFieldsInitialValues = _ref$additionalFields === void 0 ? {} : _ref$additionalFields,
699
+ children = _ref.children,
700
+ fieldsWrapper = _ref.fieldsWrapper,
701
+ translationContext = _ref.translationContext;
707
702
  var _useState = react.useState(false),
708
- _useState2 = _slicedToArray__default["default"](_useState, 2),
709
- showInviationsPane = _useState2[0],
710
- setShowInviationsPane = _useState2[1];
703
+ _useState2 = _slicedToArray(_useState, 2),
704
+ showInvitationsPane = _useState2[0],
705
+ setShowInvitationsPane = _useState2[1];
706
+ var FieldsWrapper = fieldsWrapper || react.Fragment;
711
707
  var _useTranslation = reactI18next.useTranslation(),
712
708
  t = _useTranslation.t;
713
709
  var _useShowConfiguration = useShowConfiguration({
@@ -718,7 +714,7 @@ var Configuration = function Configuration(_ref) {
718
714
  configuration = _useShowConfiguration2 === void 0 ? {} : _useShowConfiguration2,
719
715
  isLoading = _useShowConfiguration.isLoading,
720
716
  isFetching = _useShowConfiguration.isFetching;
721
- var configurationInitialValues = buildConfigurationInitialValues(configuration);
717
+ var configurationInitialValues = ramda.mergeLeft(buildConfigurationInitialValues(configuration), additionalFieldsInitialValues);
722
718
  var _useUpdateConfigurati = useUpdateConfiguration({
723
719
  ownerId: ownerId,
724
720
  ownerType: ownerType
@@ -736,7 +732,7 @@ var Configuration = function Configuration(_ref) {
736
732
  updateConfiguration = _useUpdateConfigurati.mutate;
737
733
  var handleSubmit = function handleSubmit(values, _ref2) {
738
734
  var setSubmitting = _ref2.setSubmitting;
739
- var payload = buildPayload(values);
735
+ var payload = ramda.mergeLeft(buildPayload(values), ramda.pick(ramda.keys(additionalFieldsInitialValues), values));
740
736
  updateConfiguration(payload, {
741
737
  onSettled: function onSettled() {
742
738
  return setSubmitting(false);
@@ -744,18 +740,18 @@ var Configuration = function Configuration(_ref) {
744
740
  });
745
741
  };
746
742
  var handleShowInvitations = onConfigurationChangedToInviteOnly === neetoCist.noop ? function () {
747
- return setShowInviationsPane(true);
743
+ return setShowInvitationsPane(true);
748
744
  } : onConfigurationChangedToInviteOnly;
749
- return /*#__PURE__*/jsxRuntime.jsxs(Container__default["default"], {
745
+ return /*#__PURE__*/jsxRuntime.jsxs(Container, {
750
746
  children: [/*#__PURE__*/jsxRuntime.jsx(Header, {
751
747
  headerProps: headerProps
752
748
  }), isLoading ? /*#__PURE__*/jsxRuntime.jsx("div", {
753
749
  className: "flex h-full w-full items-center justify-center",
754
- children: /*#__PURE__*/jsxRuntime.jsx(Spinner__default["default"], {})
755
- }) : /*#__PURE__*/jsxRuntime.jsxs(Scrollable__default["default"], {
750
+ children: /*#__PURE__*/jsxRuntime.jsx(Spinner, {})
751
+ }) : /*#__PURE__*/jsxRuntime.jsxs(Scrollable, {
756
752
  className: "w-full",
757
- children: [/*#__PURE__*/jsxRuntime.jsx(Form__default["default"], {
758
- className: classNames__default["default"]("space-y-6", className),
753
+ children: [/*#__PURE__*/jsxRuntime.jsx(Form, {
754
+ className: classNames("space-y-6", className),
759
755
  formikProps: {
760
756
  initialValues: configurationInitialValues,
761
757
  validationSchema: CONFIGURATION_VALIDATION_SCHEMA,
@@ -766,45 +762,47 @@ var Configuration = function Configuration(_ref) {
766
762
  children: function children(_ref3) {
767
763
  var values = _ref3.values;
768
764
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
769
- children: [/*#__PURE__*/jsxRuntime.jsx(Label__default["default"], {
770
- className: "neeto-ui-text-base",
771
- children: t("neetoAccessControl.inputs.labels.visibility")
772
- }), /*#__PURE__*/jsxRuntime.jsx(Radio__default["default"], {
773
- stacked: true,
774
- name: "auth",
775
- children: AUTH_OPTIONS.map(function (props) {
776
- return /*#__PURE__*/react.createElement(Radio__default["default"].Item, _objectSpread(_objectSpread({}, props), {}, {
777
- key: props.value,
778
- className: classNames__default["default"]({
779
- "items-start": (configuration === null || configuration === void 0 ? void 0 : configuration.auth) === props.value && (configuration === null || configuration === void 0 ? void 0 : configuration.auth) === AUTH.INVITED
780
- }),
781
- label: (configuration === null || configuration === void 0 ? void 0 : configuration.auth) === props.value && (configuration === null || configuration === void 0 ? void 0 : configuration.auth) === AUTH.INVITED ? renderLabelWithViewInvitation({
782
- onViewInvites: function onViewInvites() {
783
- return setShowInviationsPane(true);
765
+ children: [/*#__PURE__*/jsxRuntime.jsxs(FieldsWrapper, {
766
+ children: [/*#__PURE__*/jsxRuntime.jsx(Radio, {
767
+ stacked: true,
768
+ name: "auth",
769
+ children: getAuthOptions({
770
+ translationContext: translationContext,
771
+ t: t
772
+ }).map(function (props) {
773
+ return /*#__PURE__*/react.createElement(Radio.Item, _objectSpread(_objectSpread({}, props), {}, {
774
+ key: props.value,
775
+ className: classNames({
776
+ "items-start": (configuration === null || configuration === void 0 ? void 0 : configuration.auth) === props.value && (configuration === null || configuration === void 0 ? void 0 : configuration.auth) === AUTH.INVITED
777
+ }),
778
+ label: (configuration === null || configuration === void 0 ? void 0 : configuration.auth) === props.value && (configuration === null || configuration === void 0 ? void 0 : configuration.auth) === AUTH.INVITED ? renderLabelWithViewInvitation({
779
+ onViewInvites: function onViewInvites() {
780
+ return setShowInvitationsPane(true);
781
+ }
782
+ }) : props.label,
783
+ labelProps: {
784
+ className: classNames({
785
+ "flex flex-col items-start justify-start": (configuration === null || configuration === void 0 ? void 0 : configuration.auth) === props.value && (configuration === null || configuration === void 0 ? void 0 : configuration.auth) === AUTH.INVITED
786
+ })
784
787
  }
785
- }) : props.label,
786
- labelProps: {
787
- className: classNames__default["default"]({
788
- "flex flex-col items-start justify-start": (configuration === null || configuration === void 0 ? void 0 : configuration.auth) === props.value && (configuration === null || configuration === void 0 ? void 0 : configuration.auth) === AUTH.INVITED
789
- })
790
- }
791
- }));
792
- })
793
- }), values.auth === AUTH.BASIC && /*#__PURE__*/jsxRuntime.jsx("div", {
794
- className: "space-y-4 pb-2",
795
- children: /*#__PURE__*/jsxRuntime.jsx(Input__default["default"], {
796
- autoFocus: true,
797
- required: true,
798
- unlimitedChars: true,
799
- className: "w-7/12",
800
- label: t("neetoAccessControl.inputs.labels.password"),
801
- name: "password",
802
- placeholder: t("neetoAccessControl.inputs.placeholders.enterPassword")
803
- })
804
- }), values.auth === AUTH.EMAIL && /*#__PURE__*/jsxRuntime.jsx(AllowedKeywords, {
805
- label: t("neetoAccessControl.inputs.labels.keywords"),
806
- name: "allowedKeywords"
807
- }), /*#__PURE__*/jsxRuntime.jsx(ActionBlock__default["default"], {
788
+ }));
789
+ })
790
+ }), values.auth === AUTH.BASIC && /*#__PURE__*/jsxRuntime.jsx("div", {
791
+ className: "space-y-4 pb-2",
792
+ children: /*#__PURE__*/jsxRuntime.jsx(Input, {
793
+ autoFocus: true,
794
+ required: true,
795
+ unlimitedChars: true,
796
+ className: "w-7/12",
797
+ label: t("neetoAccessControl.inputs.labels.password"),
798
+ name: "password",
799
+ placeholder: t("neetoAccessControl.inputs.placeholders.enterPassword")
800
+ })
801
+ }), values.auth === AUTH.EMAIL && /*#__PURE__*/jsxRuntime.jsx(AllowedKeywords, {
802
+ label: t("neetoAccessControl.inputs.labels.keywords"),
803
+ name: "allowedKeywords"
804
+ })]
805
+ }), /*#__PURE__*/jsxRuntime.jsx(ActionBlock, {
808
806
  cancelButtonProps: {
809
807
  onClick: handleCancel
810
808
  },
@@ -815,15 +813,16 @@ var Configuration = function Configuration(_ref) {
815
813
  });
816
814
  }
817
815
  }), /*#__PURE__*/jsxRuntime.jsx(Invitations$1, {
816
+ inviteButtonProps: inviteButtonProps,
818
817
  onDestroyInvitationsSuccess: onDestroyInvitationsSuccess,
819
818
  ownerId: ownerId,
820
819
  ownerType: ownerType,
821
820
  configurationId: configuration.id,
822
821
  extraColumnsData: invitationsTableExtraColumnsData,
823
822
  hideAddEmailsForm: hideAddEmailsFromInvitationPane,
824
- isOpen: showInviationsPane && !isFetching,
823
+ isOpen: showInvitationsPane && !isFetching,
825
824
  onClose: function onClose() {
826
- return setShowInviationsPane(false);
825
+ return setShowInvitationsPane(false);
827
826
  }
828
827
  }), children]
829
828
  })]