@bigbinary/neeto-team-members-frontend 2.3.0 → 2.3.3

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.esm.js CHANGED
@@ -8570,6 +8570,7 @@ Dropzone.propTypes = {
8570
8570
  */
8571
8571
  validator: propTypes.exports.func
8572
8572
  };
8573
+ var Dropzone$1 = Dropzone;
8573
8574
  /**
8574
8575
  * A function that is invoked for the `dragenter`,
8575
8576
  * `dragover` and `dragleave` events.
@@ -9259,7 +9260,7 @@ function noop() {}
9259
9260
  const Uploader = _ref => {
9260
9261
  let sampleFileUrl = _ref.sampleFileUrl,
9261
9262
  csvColumns = _ref.csvColumns;
9262
- return /*#__PURE__*/React.createElement(Dropzone, {
9263
+ return /*#__PURE__*/React.createElement(Dropzone$1, {
9263
9264
  onDrop: noop$2
9264
9265
  }, _ref2 => {
9265
9266
  let getRootProps = _ref2.getRootProps,
@@ -9296,6 +9297,7 @@ const Uploader = _ref => {
9296
9297
  });
9297
9298
  };
9298
9299
 
9300
+ /* eslint-disable @bigbinary/neeto/no-dangling-constants */
9299
9301
  const DATETIME_OPTIONS = {
9300
9302
  year: "numeric",
9301
9303
  month: "short",
@@ -9333,7 +9335,7 @@ const COLUMN_DATA = [{
9333
9335
  title: instance.t("helpers.uploaded"),
9334
9336
  dataIndex: "uploaded_by",
9335
9337
  key: "uploaded_by",
9336
- render: (uploaded_by, row) => "".concat(uploaded_by, " at ").concat(new Date(row.created_at).toLocaleString("en-US", DATETIME_OPTIONS))
9338
+ render: (uploaded_by, row) => `${uploaded_by} at ${new Date(row.created_at).toLocaleString("en-US", DATETIME_OPTIONS)}`
9337
9339
  }];
9338
9340
  const SAMPLE_ROW_DATA = [{
9339
9341
  key: "1",
@@ -9413,13 +9415,13 @@ const Csv = _ref => {
9413
9415
  const BASE_URL = "team_members";
9414
9416
  const INVITATIONS_URL = "neeto_invitations";
9415
9417
 
9416
- const fetch$3 = params => axios.get("".concat(INVITATIONS_URL, "/invite_links"), {
9418
+ const fetch$3 = params => axios.get(`${INVITATIONS_URL}/invite_links`, {
9417
9419
  params
9418
9420
  });
9419
9421
 
9420
- const create$2 = payload => axios.post("".concat(INVITATIONS_URL, "/invite_links"), payload);
9422
+ const create$2 = payload => axios.post(`${INVITATIONS_URL}/invite_links`, payload);
9421
9423
 
9422
- const destroy$1 = (id, payload) => axios.delete("".concat(INVITATIONS_URL, "/invite_links/").concat(id), payload);
9424
+ const destroy$1 = (id, payload) => axios.delete(`${INVITATIONS_URL}/invite_links/${id}`, payload);
9423
9425
 
9424
9426
  const inviteLinksApi = {
9425
9427
  fetch: fetch$3,
@@ -9485,8 +9487,8 @@ var dist$1 = {exports: {}};
9485
9487
  } (dist$1));
9486
9488
 
9487
9489
  const renderTime = time => {
9488
- if (time.days) return "".concat(time.days, "d ").concat(time.hours, "h");else if (time.hours) return "".concat(time.hours, "h ").concat(time.minutes, "m");
9489
- return "".concat(time.minutes, "m ").concat(time.seconds, "s");
9490
+ if (time.days) return `${time.days}d ${time.hours}h`;else if (time.hours) return `${time.hours}h ${time.minutes}m`;
9491
+ return `${time.minutes}m ${time.seconds}s`;
9490
9492
  };
9491
9493
 
9492
9494
  const Timer = _ref => {
@@ -9532,7 +9534,7 @@ const InviteLink = _ref => {
9532
9534
  const showInviteLink = inviteLink && new Date(inviteLink.expiresAt) > new Date();
9533
9535
 
9534
9536
  const handleCopyInviteLink = () => {
9535
- navigator.clipboard.writeText("".concat(window.location.host, "/neeto_invitations/").concat(inviteLink.id));
9537
+ navigator.clipboard.writeText(`${window.location.host}/neeto_invitations/${inviteLink.id}`);
9536
9538
  Toastr.info(instance.t("helpers.copiedToClipboard"));
9537
9539
  };
9538
9540
 
@@ -9690,7 +9692,7 @@ const Invitations = _ref => {
9690
9692
 
9691
9693
  var index$2 = withReactQuery(Invitations);
9692
9694
 
9693
- const fetch$2 = () => axios.get("".concat(BASE_URL, "/permissions"));
9695
+ const fetch$2 = () => axios.get(`${BASE_URL}/permissions`);
9694
9696
 
9695
9697
  const permissionsApi = {
9696
9698
  fetch: fetch$2
@@ -9708,13 +9710,13 @@ const useFetchPermissions = function () {
9708
9710
  }, options));
9709
9711
  };
9710
9712
 
9711
- const fetch$1 = () => axios.get("".concat(BASE_URL, "/organization_roles"));
9713
+ const fetch$1 = () => axios.get(`${BASE_URL}/organization_roles`);
9712
9714
 
9713
- const create$1 = payload => axios.post("".concat(BASE_URL, "/organization_roles"), payload);
9715
+ const create$1 = payload => axios.post(`${BASE_URL}/organization_roles`, payload);
9714
9716
 
9715
- const update$1 = (id, payload) => axios.patch("".concat(BASE_URL, "/organization_roles/").concat(id), payload);
9717
+ const update$1 = (id, payload) => axios.patch(`${BASE_URL}/organization_roles/${id}`, payload);
9716
9718
 
9717
- const destroy = (id, payload) => axios.delete("".concat(BASE_URL, "/organization_roles/").concat(id), {
9719
+ const destroy = (id, payload) => axios.delete(`${BASE_URL}/organization_roles/${id}`, {
9718
9720
  data: payload
9719
9721
  });
9720
9722
 
@@ -11532,6 +11534,7 @@ const DEFAULT_MANAGE_ROLE_VALUES = {
11532
11534
  };
11533
11535
 
11534
11536
  const renderRolesTooltipContent = roleName => Object.is(roleName, "Admin") ? instance.t("tooltips.editAdminRoleNotAllowed") : instance.t("tooltips.noPermissionToEditRoles");
11537
+ const removeDuplicates = array => [...new Set(array)];
11535
11538
 
11536
11539
  const Row = _ref => {
11537
11540
  let _ref$allPermissionsOf = _ref.allPermissionsOfCategory,
@@ -11548,7 +11551,7 @@ const Row = _ref => {
11548
11551
 
11549
11552
  const handleSubmit = (role, checked) => {
11550
11553
  const permissionIds = allPermissionIdsOfCategory.length > 0 ? allPermissionIdsOfCategory : [permission.id];
11551
- const modifiedRole = modify("permissionIds", () => checked ? [...role.permissionIds, ...permissionIds] : role.permissionIds.filter(id => !permissionIds.includes(id)), role);
11554
+ const modifiedRole = modify("permissionIds", () => checked ? removeDuplicates([...role.permissionIds, ...permissionIds]) : role.permissionIds.filter(id => !permissionIds.includes(id)), role);
11552
11555
  updateRole({
11553
11556
  id: role.id,
11554
11557
  payload: {
@@ -11618,7 +11621,7 @@ const TableHeader = _ref => {
11618
11621
 
11619
11622
  const hasSystemRole = Object.is(role.kind, "system");
11620
11623
  return /*#__PURE__*/React.createElement("div", {
11621
- key: "ntm-roles-".concat(index),
11624
+ key: `ntm-roles-${index}`,
11622
11625
  className: "ntm-roles-table__cell"
11623
11626
  }, /*#__PURE__*/React.createElement("div", {
11624
11627
  className: "ntm-roles-table-header-cell__container"
@@ -11856,9 +11859,9 @@ const renderDescription = permissions => permissions === null || permissions ===
11856
11859
  });
11857
11860
  const getSearchWrapperStyle = () => {
11858
11861
  const scrollBarWidth = getScrollBarWidth();
11859
- document.documentElement.style.setProperty("--ntm-roles-table-default-scroll", "".concat(scrollBarWidth, "px"));
11862
+ document.documentElement.style.setProperty("--ntm-roles-table-default-scroll", `${scrollBarWidth}px`);
11860
11863
  return {
11861
- marginBottom: "".concat(scrollBarWidth, "px")
11864
+ marginBottom: `${scrollBarWidth}px`
11862
11865
  };
11863
11866
  };
11864
11867
 
@@ -12068,13 +12071,13 @@ Roles.defaultProps = {
12068
12071
  };
12069
12072
  var index$1 = withReactQuery(Roles);
12070
12073
 
12071
- const fetch = params => axios.get("".concat(BASE_URL, "/teams"), {
12074
+ const fetch = params => axios.get(`${BASE_URL}/teams`, {
12072
12075
  params
12073
12076
  });
12074
12077
 
12075
- const create = payload => axios.post("".concat(BASE_URL, "/teams"), payload);
12078
+ const create = payload => axios.post(`${BASE_URL}/teams`, payload);
12076
12079
 
12077
- const update = (id, payload) => axios.put("".concat(BASE_URL, "/teams/").concat(id), payload);
12080
+ const update = (id, payload) => axios.put(`${BASE_URL}/teams/${id}`, payload);
12078
12081
 
12079
12082
  const teamsApi = {
12080
12083
  fetch,
@@ -12353,7 +12356,7 @@ const getColumnData = _ref3 => {
12353
12356
  width: "10%"
12354
12357
  }];
12355
12358
  };
12356
- const renderHeaderTitle = (filterStatus, metaName) => instance.t("common.".concat(toLower(filterStatus), "_"), {
12359
+ const renderHeaderTitle = (filterStatus, metaName) => instance.t(`common.${toLower(filterStatus)}_`, {
12357
12360
  what: instance.t(metaName, PLURAL).toLocaleLowerCase()
12358
12361
  });
12359
12362
  const renderUpdateAlertTitle = (member, metaName, config) => {
@@ -12398,7 +12401,7 @@ const handlePageChange = (setFilters, filter) => (page, results) => {
12398
12401
  page,
12399
12402
  results
12400
12403
  };
12401
- window.history.replaceState({}, "", "?".concat(getSearchParams(pageParams, filter)));
12404
+ window.history.replaceState({}, "", `?${getSearchParams(pageParams, filter)}`);
12402
12405
  setFilters(mergeLeft(pageParams));
12403
12406
  };
12404
12407
  const renderPaginationProps = size => ({
@@ -12442,15 +12445,21 @@ const renderPayload = function (_ref) {
12442
12445
  };
12443
12446
 
12444
12447
  const ManageMember = _ref => {
12445
- let metaName = _ref.metaName,
12448
+ let config = _ref.config,
12446
12449
  isOpen = _ref.isOpen,
12450
+ metaName = _ref.metaName,
12447
12451
  onClose = _ref.onClose,
12448
12452
  _ref$roles = _ref.roles,
12449
12453
  roles = _ref$roles === void 0 ? [] : _ref$roles,
12450
12454
  selectedMember = _ref.selectedMember;
12451
12455
 
12452
12456
  const _useCreateMember = useCreateMember({
12453
- onSuccess: onClose
12457
+ onSuccess: () => {
12458
+ var _config$createMember, _config$createMember$;
12459
+
12460
+ onClose();
12461
+ config === null || config === void 0 ? void 0 : (_config$createMember = config.createMember) === null || _config$createMember === void 0 ? void 0 : (_config$createMember$ = _config$createMember.onSuccess) === null || _config$createMember$ === void 0 ? void 0 : _config$createMember$.callback();
12462
+ }
12454
12463
  }),
12455
12464
  createMember = _useCreateMember.mutate,
12456
12465
  isCreatingMember = _useCreateMember.isLoading;
@@ -12513,7 +12522,7 @@ const ManageMember = _ref => {
12513
12522
  counter: COUNTER_PROPS,
12514
12523
  filterInvalidEmails: FILTER_INVALID_EMAILS,
12515
12524
  disabled: selectedMember,
12516
- label: "".concat(instance.t("common.email", PLURAL), "*"),
12525
+ label: `${instance.t("common.email", PLURAL)}*`,
12517
12526
  placeholder: instance.t("placeholders.email"),
12518
12527
  helpText: instance.t("helpers.enterMultipleEmails")
12519
12528
  }), /*#__PURE__*/React.createElement(Select, {
@@ -12747,8 +12756,9 @@ const TeamMembers = _ref => {
12747
12756
  onClick: () => setIsOpen(assoc("manageMember", true))
12748
12757
  })
12749
12758
  })), /*#__PURE__*/React.createElement(ManageMember, {
12750
- metaName: metaName,
12759
+ config: config,
12751
12760
  isOpen: isOpen.manageMember,
12761
+ metaName: metaName,
12752
12762
  onClose: handleModalClose,
12753
12763
  roles: roles,
12754
12764
  selectedMember: selectedMember