@bigbinary/neeto-team-members-frontend 2.8.1 → 2.8.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.cjs.js CHANGED
@@ -4193,7 +4193,7 @@ var I18n = function (_EventEmitter) {
4193
4193
  this.logger.warn('hasLoadedNamespace: i18n.languages were undefined or empty', this.languages);
4194
4194
  return false;
4195
4195
  }
4196
- var lng = this.resolvedLanguage || this.languages[0];
4196
+ var lng = options.lng || this.resolvedLanguage || this.languages[0];
4197
4197
  var fallbackLng = this.options ? this.options.fallbackLng : false;
4198
4198
  var lastLng = this.languages[this.languages.length - 1];
4199
4199
  if (lng.toLowerCase() === 'cimode') return true;
@@ -4763,8 +4763,9 @@ function warnOnce() {
4763
4763
  if (typeof args[0] === 'string') alreadyWarned[args[0]] = new Date();
4764
4764
  warn.apply(void 0, args);
4765
4765
  }
4766
- function loadNamespaces(i18n, ns, cb) {
4767
- i18n.loadNamespaces(ns, function () {
4766
+
4767
+ var loadedClb = function loadedClb(i18n, cb) {
4768
+ return function () {
4768
4769
  if (i18n.isInitialized) {
4769
4770
  cb();
4770
4771
  } else {
@@ -4777,7 +4778,18 @@ function loadNamespaces(i18n, ns, cb) {
4777
4778
 
4778
4779
  i18n.on('initialized', initialized);
4779
4780
  }
4781
+ };
4782
+ };
4783
+
4784
+ function loadNamespaces(i18n, ns, cb) {
4785
+ i18n.loadNamespaces(ns, loadedClb(i18n, cb));
4786
+ }
4787
+ function loadLanguages(i18n, lng, ns, cb) {
4788
+ if (typeof ns === 'string') ns = [ns];
4789
+ ns.forEach(function (n) {
4790
+ if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n);
4780
4791
  });
4792
+ i18n.loadLanguages(lng, loadedClb(i18n, cb));
4781
4793
  }
4782
4794
 
4783
4795
  function oldI18nextHasLoadedNamespace(ns, i18n) {
@@ -4814,6 +4826,7 @@ function hasLoadedNamespace(ns, i18n) {
4814
4826
  }
4815
4827
 
4816
4828
  return i18n.hasLoadedNamespace(ns, {
4829
+ lng: options.lng,
4817
4830
  precheck: function precheck(i18nInstance, loadNotPending) {
4818
4831
  if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false;
4819
4832
  }
@@ -5310,7 +5323,7 @@ function useTranslation(ns) {
5310
5323
  });
5311
5324
 
5312
5325
  function getT() {
5313
- return i18n.getFixedT(null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix);
5326
+ return i18n.getFixedT(props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix);
5314
5327
  }
5315
5328
 
5316
5329
  var _useState = React.useState(getT),
@@ -5319,6 +5332,7 @@ function useTranslation(ns) {
5319
5332
  setT = _useState2[1];
5320
5333
 
5321
5334
  var joinedNS = namespaces.join();
5335
+ if (props.lng) joinedNS = "".concat(props.lng).concat(joinedNS);
5322
5336
  var previousJoinedNS = usePrevious(joinedNS);
5323
5337
  var isMounted = React.useRef(true);
5324
5338
  React.useEffect(function () {
@@ -5327,9 +5341,15 @@ function useTranslation(ns) {
5327
5341
  isMounted.current = true;
5328
5342
 
5329
5343
  if (!ready && !useSuspense) {
5330
- loadNamespaces(i18n, namespaces, function () {
5331
- if (isMounted.current) setT(getT);
5332
- });
5344
+ if (props.lng) {
5345
+ loadLanguages(i18n, props.lng, namespaces, function () {
5346
+ if (isMounted.current) setT(getT);
5347
+ });
5348
+ } else {
5349
+ loadNamespaces(i18n, namespaces, function () {
5350
+ if (isMounted.current) setT(getT);
5351
+ });
5352
+ }
5333
5353
  }
5334
5354
 
5335
5355
  if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
@@ -5367,9 +5387,15 @@ function useTranslation(ns) {
5367
5387
  if (ready) return ret;
5368
5388
  if (!ready && !useSuspense) return ret;
5369
5389
  throw new Promise(function (resolve) {
5370
- loadNamespaces(i18n, namespaces, function () {
5371
- resolve();
5372
- });
5390
+ if (props.lng) {
5391
+ loadLanguages(i18n, props.lng, namespaces, function () {
5392
+ return resolve();
5393
+ });
5394
+ } else {
5395
+ loadNamespaces(i18n, namespaces, function () {
5396
+ return resolve();
5397
+ });
5398
+ }
5373
5399
  });
5374
5400
  }
5375
5401
 
@@ -12024,7 +12050,7 @@ var RolesDropdown = function RolesDropdown(_ref) {
12024
12050
  searchTerm = _useState4[0],
12025
12051
  setSearchTerm = _useState4[1];
12026
12052
  var filteredRoles = filterBySearchTerm(searchTerm, roles);
12027
- var isUpdationAllowed = hasUpdatePermission && !disabled;
12053
+ var isUpdatingAllowed = hasUpdatePermission && !disabled;
12028
12054
  var handleSearch = function handleSearch(_ref2) {
12029
12055
  var value = _ref2.target.value;
12030
12056
  return setSearchTerm(value);
@@ -12044,17 +12070,17 @@ var RolesDropdown = function RolesDropdown(_ref) {
12044
12070
  };
12045
12071
  return /*#__PURE__*/React__default["default"].createElement(neetoui.Tooltip, {
12046
12072
  content: t("tooltips.activateUserToEdit", PLURAL),
12047
- disabled: isUpdationAllowed,
12073
+ disabled: isUpdatingAllowed,
12048
12074
  position: "top"
12049
12075
  }, /*#__PURE__*/React__default["default"].createElement("span", null, /*#__PURE__*/React__default["default"].createElement(neetoui.Dropdown, {
12050
12076
  buttonStyle: "secondary",
12051
12077
  closeOnSelect: false,
12052
12078
  "data-cy": "ntm-members-roles-update-dropdown-button",
12053
- disabled: !isUpdationAllowed,
12054
- isOpen: isUpdationAllowed && isDropdownOpen,
12079
+ disabled: !isUpdatingAllowed,
12080
+ isOpen: isUpdatingAllowed && isDropdownOpen,
12055
12081
  position: "auto-end",
12056
12082
  customTarget: /*#__PURE__*/React__default["default"].createElement(MenuItem$1.Button, {
12057
- disabled: !isUpdationAllowed,
12083
+ disabled: !isUpdatingAllowed,
12058
12084
  suffix: /*#__PURE__*/React__default["default"].createElement(neetoIcons.Right, {
12059
12085
  size: 16
12060
12086
  })
@@ -12155,10 +12181,6 @@ var Left = function Left(_ref) {
12155
12181
  }
12156
12182
  });
12157
12183
  };
12158
- var handleAlertClose = function handleAlertClose() {
12159
- selectedAlert.onSubmit();
12160
- setAlertType("");
12161
- };
12162
12184
  var alertTypes = [{
12163
12185
  message: "alerts.messages.deactivateMember",
12164
12186
  onSubmit: handleDeactivateMembers,
@@ -12182,6 +12204,10 @@ var Left = function Left(_ref) {
12182
12204
  var selectedAlert = pure.findBy({
12183
12205
  type: alertType
12184
12206
  }, alertTypes);
12207
+ var handleAlertClose = function handleAlertClose() {
12208
+ selectedAlert.onSubmit(bulkUpdateRole);
12209
+ setAlertType("");
12210
+ };
12185
12211
  return /*#__PURE__*/React__default["default"].createElement("div", {
12186
12212
  className: "neeto-ui-flex neeto-ui-items-center neeto-ui-gap-4"
12187
12213
  }, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {