@itilite/iui-user-management 1.4.768 → 1.4.771

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.
@@ -2240,6 +2240,7 @@ var CardsManagement = function CardsManagement(_ref) {
2240
2240
  paymentDetails = _ref$paymentDetails === void 0 ? {} : _ref$paymentDetails,
2241
2241
  _ref$paymentMethod = _ref.paymentMethod,
2242
2242
  paymentMethod = _ref$paymentMethod === void 0 ? null : _ref$paymentMethod;
2243
+ console.log(paymentMethod, 'paymentMethod in CardsManagement');
2243
2244
  var dispatch = useDispatch();
2244
2245
  var pg = paymentDetails.pg,
2245
2246
  _paymentDetails$cards = paymentDetails.cards,
@@ -2415,7 +2416,7 @@ var CardsManagement = function CardsManagement(_ref) {
2415
2416
  return renderCard(card);
2416
2417
  }), corporateCards.map(function (card) {
2417
2418
  return renderCard(card);
2418
- })), (!cards || (cards === null || cards === void 0 ? void 0 : cards.length) < 10) && (pg === null || pg === void 0 ? void 0 : (_pg$gateway = pg.gateway) === null || _pg$gateway === void 0 ? void 0 : _pg$gateway.toLowerCase()) === 'stripe' && (pg === null || pg === void 0 ? void 0 : pg.save_card_enable) === 1 && paymentMethod !== 2 && /*#__PURE__*/React.createElement("button", {
2419
+ })), console.log(paymentMethod, 'paymentMethod in card section'), (!cards || (cards === null || cards === void 0 ? void 0 : cards.length) < 10) && (pg === null || pg === void 0 ? void 0 : (_pg$gateway = pg.gateway) === null || _pg$gateway === void 0 ? void 0 : _pg$gateway.toLowerCase()) === 'stripe' && (pg === null || pg === void 0 ? void 0 : pg.save_card_enable) === 1 && paymentMethod === 1 && /*#__PURE__*/React.createElement("button", {
2419
2420
  className: classes.addCardButton,
2420
2421
  onClick: function onClick() {
2421
2422
  return window.location.assign(_url);
@@ -2472,14 +2473,17 @@ var CardsManagement = function CardsManagement(_ref) {
2472
2473
 
2473
2474
  var PaymentCards = function PaymentCards(_ref) {
2474
2475
  var _paymentDetails$pg, _paymentDetails$pg2;
2475
- var paymentDetails = _ref.paymentDetails;
2476
- if (!paymentDetails || Object.keys(paymentDetails).length === 0 || (!paymentDetails.cards || paymentDetails.cards.length === 0) && ((paymentDetails === null || paymentDetails === void 0 ? void 0 : (_paymentDetails$pg = paymentDetails.pg) === null || _paymentDetails$pg === void 0 ? void 0 : _paymentDetails$pg.gateway.toLowerCase()) !== 'stripe' || (paymentDetails === null || paymentDetails === void 0 ? void 0 : (_paymentDetails$pg2 = paymentDetails.pg) === null || _paymentDetails$pg2 === void 0 ? void 0 : _paymentDetails$pg2.save_card_enable) !== 1)) {
2476
+ var paymentDetails = _ref.paymentDetails,
2477
+ paymentMethod = _ref.paymentMethod;
2478
+ if (!paymentDetails || Object.keys(paymentDetails).length === 0 || (!paymentDetails.cards || paymentDetails.cards.length === 0) && ((paymentDetails === null || paymentDetails === void 0 ? void 0 : (_paymentDetails$pg = paymentDetails.pg) === null || _paymentDetails$pg === void 0 ? void 0 : _paymentDetails$pg.gateway.toLowerCase()) !== 'stripe' || (paymentDetails === null || paymentDetails === void 0 ? void 0 : (_paymentDetails$pg2 = paymentDetails.pg) === null || _paymentDetails$pg2 === void 0 ? void 0 : _paymentDetails$pg2.save_card_enable) !== 1 || paymentMethod !== 1)) {
2477
2479
  return /*#__PURE__*/React.createElement(React.Fragment, null);
2478
2480
  }
2481
+ console.log(paymentMethod, 'paymentMethod in payment cards');
2479
2482
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIDivider, {
2480
2483
  className: styles$1.dividerColor
2481
2484
  }), /*#__PURE__*/React.createElement(CardsManagement, {
2482
- paymentDetails: paymentDetails
2485
+ paymentDetails: paymentDetails,
2486
+ paymentMethod: paymentMethod
2483
2487
  }));
2484
2488
  };
2485
2489
 
@@ -6196,7 +6200,7 @@ var UserAddEdit = function UserAddEdit(props) {
6196
6200
  method: 'GET',
6197
6201
  headers: {
6198
6202
  'Content-Type': 'application/json',
6199
- 'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
6203
+ authorization: "Bearer " + IUILocalStorageService$5.getAccessToken()
6200
6204
  }
6201
6205
  }).then(function (response) {
6202
6206
  return response.json();
@@ -6208,7 +6212,7 @@ var UserAddEdit = function UserAddEdit(props) {
6208
6212
  IUIToastMessageService$6.warningNotify('Opps, Something went wrong.');
6209
6213
  }
6210
6214
  })["catch"](function (error) {
6211
- console.log("errorrr", error);
6215
+ console.log('errorrr', error);
6212
6216
  });
6213
6217
  };
6214
6218
  useEffect(function () {
@@ -6388,13 +6392,20 @@ var UserAddEdit = function UserAddEdit(props) {
6388
6392
  }
6389
6393
  } else if (isCardsDetailsRendered && isProfile && productAccess.card) {
6390
6394
  var targetRole = isCardsAdmin ? 'card-admin' : 'card-holder';
6391
- for (var _iterator = _createForOfIteratorHelperLoose(cardsDetails.cardsRoles), _step; !(_step = _iterator()).done;) {
6392
- var role = _step.value;
6393
- var splitRoleVal = role.value.split(':');
6394
- var profileRole = splitRoleVal[2];
6395
- if (profileRole === targetRole) {
6396
- setCardsRole(role.value);
6397
- break;
6395
+ var _selectedRole = cardsDetails.cardsRoles.find(function (role) {
6396
+ return role.isAssigned;
6397
+ });
6398
+ if (_selectedRole) {
6399
+ setCardsRole(_selectedRole.value);
6400
+ } else {
6401
+ for (var _iterator = _createForOfIteratorHelperLoose(cardsDetails.cardsRoles), _step; !(_step = _iterator()).done;) {
6402
+ var role = _step.value;
6403
+ var splitRoleVal = role.value.split(':');
6404
+ var profileRole = splitRoleVal[2];
6405
+ if (profileRole === targetRole) {
6406
+ setCardsRole(role.value);
6407
+ break;
6408
+ }
6398
6409
  }
6399
6410
  }
6400
6411
  }
@@ -6902,7 +6913,6 @@ var UserAddEdit = function UserAddEdit(props) {
6902
6913
  }
6903
6914
  }, [isTokenVerified]);
6904
6915
  useEffect(function () {
6905
- console.log(isProfile, 'isProfile', id, 'id', editUserId, 'editUserId');
6906
6916
  if (isRendered === true) {
6907
6917
  renderFields === null || renderFields === void 0 ? void 0 : renderFields.products.forEach(function (prod) {
6908
6918
  if ((prod === null || prod === void 0 ? void 0 : prod.name) === 'card') {
@@ -7249,7 +7259,7 @@ var UserAddEdit = function UserAddEdit(props) {
7249
7259
  employeeInfoInput.skip_manager_id = employeeInfoInput.skip_manager.value;
7250
7260
  }
7251
7261
  var cardsPayload = {
7252
- "roles": [cardsRole]
7262
+ roles: [cardsRole]
7253
7263
  };
7254
7264
  var payload = {
7255
7265
  personalInfoInput: personalInfoInput,
@@ -7435,7 +7445,7 @@ var UserAddEdit = function UserAddEdit(props) {
7435
7445
  body: JSON.stringify(cardsPayload),
7436
7446
  headers: {
7437
7447
  'Content-Type': 'application/json',
7438
- 'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
7448
+ authorization: "Bearer " + IUILocalStorageService$5.getAccessToken()
7439
7449
  }
7440
7450
  }).then(function (response) {
7441
7451
  if (response.status === 200) {
@@ -7444,7 +7454,7 @@ var UserAddEdit = function UserAddEdit(props) {
7444
7454
  IUIToastMessageService$6.warningNotify('Opps, Something went wrong.');
7445
7455
  }
7446
7456
  })["catch"](function (error) {
7447
- console.log("errorrr", error);
7457
+ console.log('errorrr', error);
7448
7458
  })["finally"](function () {
7449
7459
  dispatch(stopLoader());
7450
7460
  });
@@ -7462,14 +7472,14 @@ var UserAddEdit = function UserAddEdit(props) {
7462
7472
  body: JSON.stringify(cardsPayload),
7463
7473
  headers: {
7464
7474
  'Content-Type': 'application/json',
7465
- 'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
7475
+ authorization: "Bearer " + IUILocalStorageService$5.getAccessToken()
7466
7476
  }
7467
7477
  }).then(function (response) {
7468
7478
  if (response.status !== 200) {
7469
7479
  IUIToastMessageService$6.warningNotify('Opps, Something went wrong.');
7470
7480
  }
7471
7481
  })["catch"](function (error) {
7472
- console.log("errorrr", error);
7482
+ console.log('errorrr', error);
7473
7483
  });
7474
7484
  }
7475
7485
  (config === null || config === void 0 ? void 0 : (_config$routes4 = config.routes) === null || _config$routes4 === void 0 ? void 0 : (_config$routes4$users = _config$routes4.users) === null || _config$routes4$users === void 0 ? void 0 : (_config$routes4$users2 = _config$routes4$users.list) === null || _config$routes4$users2 === void 0 ? void 0 : _config$routes4$users2.path) && history.push(config.routes.users.list.path);
@@ -7924,7 +7934,8 @@ var UserAddEdit = function UserAddEdit(props) {
7924
7934
  maxApprovers: maxExpenseApprovers,
7925
7935
  isProfile: isProfile,
7926
7936
  editUserId: editUserId,
7927
- roles: renderFields.expenseRoles
7937
+ roles: renderFields.expenseRoles,
7938
+ paymentMethod: paymentMethod
7928
7939
  }), /*#__PURE__*/React.createElement(IUIDivider, {
7929
7940
  className: styles.dividerColor
7930
7941
  }), isCardsDetailsRendered && productAccess && productAccess.card && /*#__PURE__*/React.createElement(CardsField, {