@itilite/iui-user-management 0.4.66 → 0.4.68

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.
@@ -32,6 +32,9 @@ function _extends() {
32
32
  };
33
33
  return _extends.apply(this, arguments);
34
34
  }
35
+ function _readOnlyError(name) {
36
+ throw new TypeError("\"" + name + "\" is read-only");
37
+ }
35
38
  function _unsupportedIterableToArray(o, minLen) {
36
39
  if (!o) return;
37
40
  if (typeof o === "string") return _arrayLikeToArray(o, minLen);
@@ -5004,7 +5007,8 @@ var CardsField = function CardsField(props) {
5004
5007
  roles = _props$roles === void 0 ? [] : _props$roles,
5005
5008
  _props$cardsAdmin = props.cardsAdmin,
5006
5009
  cardsAdmin = _props$cardsAdmin === void 0 ? false : _props$cardsAdmin,
5007
- editUserId = props.editUserId;
5010
+ editUserId = props.editUserId,
5011
+ loggedInUserId = props.loggedInUserId;
5008
5012
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIGrid, {
5009
5013
  container: true,
5010
5014
  className: (styles.headingPadding)
@@ -5033,7 +5037,7 @@ var CardsField = function CardsField(props) {
5033
5037
  }, /*#__PURE__*/React.createElement(IUIGrid, {
5034
5038
  container: true,
5035
5039
  className: styles.formFieldsWrapper
5036
- }, isProfile ? /*#__PURE__*/React.createElement(UserRole, {
5040
+ }, isProfile || loggedInUserId === editUserId ? /*#__PURE__*/React.createElement(UserRole, {
5037
5041
  list: roles,
5038
5042
  value: roleValue
5039
5043
  }) : /*#__PURE__*/React.createElement(IUIRadio, {
@@ -5065,8 +5069,6 @@ var UserAddEdit = function UserAddEdit(props) {
5065
5069
  config = props.config,
5066
5070
  _props$isProfile = props.isProfile,
5067
5071
  isProfile = _props$isProfile === void 0 ? false : _props$isProfile;
5068
- console.log("isProfile", isProfile);
5069
- console.log("isEditMode", isEditMode);
5070
5072
  env$4.init(config, isProfile);
5071
5073
  var queryParams = new URLSearchParams(window.location.search);
5072
5074
  var verifyUserId = Number(queryParams.get(config.routes.users.add.queryParamKeys.verifyUserId));
@@ -5464,7 +5466,6 @@ var UserAddEdit = function UserAddEdit(props) {
5464
5466
  var _useState25 = useState(''),
5465
5467
  cardsRole = _useState25[0],
5466
5468
  setCardsRole = _useState25[1];
5467
- console.log("cardsRole123", cardsRole);
5468
5469
  useEffect(function () {
5469
5470
  if (productAccess.card === false) {
5470
5471
  setCardsRole('');
@@ -5479,7 +5480,7 @@ var UserAddEdit = function UserAddEdit(props) {
5479
5480
  setCardsRole(selectedRole.value);
5480
5481
  } else {
5481
5482
  var defaultRole = cardsDetails.cardsRoles.find(function (role) {
5482
- var splitRoleVal = role.value.split(":");
5483
+ var splitRoleVal = role.value.split(':');
5483
5484
  return splitRoleVal[2] === 'card-holder';
5484
5485
  });
5485
5486
  if (defaultRole) {
@@ -5490,7 +5491,7 @@ var UserAddEdit = function UserAddEdit(props) {
5490
5491
  var targetRole = isCardsAdmin ? 'card-admin' : 'card-holder';
5491
5492
  for (var _iterator = _createForOfIteratorHelperLoose(cardsDetails.cardsRoles), _step; !(_step = _iterator()).done;) {
5492
5493
  var role = _step.value;
5493
- var splitRoleVal = role.value.split(":");
5494
+ var splitRoleVal = role.value.split(':');
5494
5495
  var profileRole = splitRoleVal[2];
5495
5496
  if (profileRole === targetRole) {
5496
5497
  setCardsRole(role.value);
@@ -6521,14 +6522,14 @@ var UserAddEdit = function UserAddEdit(props) {
6521
6522
  }
6522
6523
  var cardApiflag = false;
6523
6524
  if (productAccess.card === false || isCardsAdmin === false) {
6524
- cardApiflag = false;
6525
+ false, _readOnlyError("cardApiflag");
6525
6526
  } else {
6526
- cardApiflag = true;
6527
+ true, _readOnlyError("cardApiflag");
6527
6528
  }
6528
6529
  if (!_isError) {
6529
6530
  if (isEditMode && editUserId || isProfile) {
6530
6531
  dispatch(showLoader());
6531
- if (cardApiflag && !isProfile) {
6532
+ if (cardApiflag && !isProfile && editUserId !== (id === null || id === void 0 ? void 0 : id.toString())) {
6532
6533
  fetch(userAddEditUrl.cardsEditUserDetails(editUserId), {
6533
6534
  method: 'POST',
6534
6535
  body: JSON.stringify(cardsPayload),
@@ -7059,7 +7060,8 @@ var UserAddEdit = function UserAddEdit(props) {
7059
7060
  roleValue: cardsRole,
7060
7061
  roles: cardsDetails.cardsRoles,
7061
7062
  cardsAdmin: isCardsAdmin,
7062
- editUserId: editUserId
7063
+ editUserId: editUserId,
7064
+ loggedInUserId: id === null || id === void 0 ? void 0 : id.toString()
7063
7065
  }))) : /*#__PURE__*/React.createElement(VerificationError, {
7064
7066
  config: config,
7065
7067
  errMsg: hasVerificationError