@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.
package/dist/index.js CHANGED
@@ -2243,6 +2243,7 @@ var CardsManagement = function CardsManagement(_ref) {
2243
2243
  paymentDetails = _ref$paymentDetails === void 0 ? {} : _ref$paymentDetails,
2244
2244
  _ref$paymentMethod = _ref.paymentMethod,
2245
2245
  paymentMethod = _ref$paymentMethod === void 0 ? null : _ref$paymentMethod;
2246
+ console.log(paymentMethod, 'paymentMethod in CardsManagement');
2246
2247
  var dispatch = reactRedux.useDispatch();
2247
2248
  var pg = paymentDetails.pg,
2248
2249
  _paymentDetails$cards = paymentDetails.cards,
@@ -2418,7 +2419,7 @@ var CardsManagement = function CardsManagement(_ref) {
2418
2419
  return renderCard(card);
2419
2420
  }), corporateCards.map(function (card) {
2420
2421
  return renderCard(card);
2421
- })), (!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__default.createElement("button", {
2422
+ })), 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__default.createElement("button", {
2422
2423
  className: classes.addCardButton,
2423
2424
  onClick: function onClick() {
2424
2425
  return window.location.assign(_url);
@@ -2475,14 +2476,17 @@ var CardsManagement = function CardsManagement(_ref) {
2475
2476
 
2476
2477
  var PaymentCards = function PaymentCards(_ref) {
2477
2478
  var _paymentDetails$pg, _paymentDetails$pg2;
2478
- var paymentDetails = _ref.paymentDetails;
2479
- 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)) {
2479
+ var paymentDetails = _ref.paymentDetails,
2480
+ paymentMethod = _ref.paymentMethod;
2481
+ 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)) {
2480
2482
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
2481
2483
  }
2484
+ console.log(paymentMethod, 'paymentMethod in payment cards');
2482
2485
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIDivider, {
2483
2486
  className: styles$1.dividerColor
2484
2487
  }), /*#__PURE__*/React__default.createElement(CardsManagement, {
2485
- paymentDetails: paymentDetails
2488
+ paymentDetails: paymentDetails,
2489
+ paymentMethod: paymentMethod
2486
2490
  }));
2487
2491
  };
2488
2492
 
@@ -6199,7 +6203,7 @@ var UserAddEdit = function UserAddEdit(props) {
6199
6203
  method: 'GET',
6200
6204
  headers: {
6201
6205
  'Content-Type': 'application/json',
6202
- 'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
6206
+ authorization: "Bearer " + IUILocalStorageService$5.getAccessToken()
6203
6207
  }
6204
6208
  }).then(function (response) {
6205
6209
  return response.json();
@@ -6211,7 +6215,7 @@ var UserAddEdit = function UserAddEdit(props) {
6211
6215
  IUIToastMessageService$6.warningNotify('Opps, Something went wrong.');
6212
6216
  }
6213
6217
  })["catch"](function (error) {
6214
- console.log("errorrr", error);
6218
+ console.log('errorrr', error);
6215
6219
  });
6216
6220
  };
6217
6221
  React.useEffect(function () {
@@ -6391,13 +6395,20 @@ var UserAddEdit = function UserAddEdit(props) {
6391
6395
  }
6392
6396
  } else if (isCardsDetailsRendered && isProfile && productAccess.card) {
6393
6397
  var targetRole = isCardsAdmin ? 'card-admin' : 'card-holder';
6394
- for (var _iterator = _createForOfIteratorHelperLoose(cardsDetails.cardsRoles), _step; !(_step = _iterator()).done;) {
6395
- var role = _step.value;
6396
- var splitRoleVal = role.value.split(':');
6397
- var profileRole = splitRoleVal[2];
6398
- if (profileRole === targetRole) {
6399
- setCardsRole(role.value);
6400
- break;
6398
+ var _selectedRole = cardsDetails.cardsRoles.find(function (role) {
6399
+ return role.isAssigned;
6400
+ });
6401
+ if (_selectedRole) {
6402
+ setCardsRole(_selectedRole.value);
6403
+ } else {
6404
+ for (var _iterator = _createForOfIteratorHelperLoose(cardsDetails.cardsRoles), _step; !(_step = _iterator()).done;) {
6405
+ var role = _step.value;
6406
+ var splitRoleVal = role.value.split(':');
6407
+ var profileRole = splitRoleVal[2];
6408
+ if (profileRole === targetRole) {
6409
+ setCardsRole(role.value);
6410
+ break;
6411
+ }
6401
6412
  }
6402
6413
  }
6403
6414
  }
@@ -6905,7 +6916,6 @@ var UserAddEdit = function UserAddEdit(props) {
6905
6916
  }
6906
6917
  }, [isTokenVerified]);
6907
6918
  React.useEffect(function () {
6908
- console.log(isProfile, 'isProfile', id, 'id', editUserId, 'editUserId');
6909
6919
  if (isRendered === true) {
6910
6920
  renderFields === null || renderFields === void 0 ? void 0 : renderFields.products.forEach(function (prod) {
6911
6921
  if ((prod === null || prod === void 0 ? void 0 : prod.name) === 'card') {
@@ -7252,7 +7262,7 @@ var UserAddEdit = function UserAddEdit(props) {
7252
7262
  employeeInfoInput.skip_manager_id = employeeInfoInput.skip_manager.value;
7253
7263
  }
7254
7264
  var cardsPayload = {
7255
- "roles": [cardsRole]
7265
+ roles: [cardsRole]
7256
7266
  };
7257
7267
  var payload = {
7258
7268
  personalInfoInput: personalInfoInput,
@@ -7438,7 +7448,7 @@ var UserAddEdit = function UserAddEdit(props) {
7438
7448
  body: JSON.stringify(cardsPayload),
7439
7449
  headers: {
7440
7450
  'Content-Type': 'application/json',
7441
- 'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
7451
+ authorization: "Bearer " + IUILocalStorageService$5.getAccessToken()
7442
7452
  }
7443
7453
  }).then(function (response) {
7444
7454
  if (response.status === 200) {
@@ -7447,7 +7457,7 @@ var UserAddEdit = function UserAddEdit(props) {
7447
7457
  IUIToastMessageService$6.warningNotify('Opps, Something went wrong.');
7448
7458
  }
7449
7459
  })["catch"](function (error) {
7450
- console.log("errorrr", error);
7460
+ console.log('errorrr', error);
7451
7461
  })["finally"](function () {
7452
7462
  dispatch(stopLoader());
7453
7463
  });
@@ -7465,14 +7475,14 @@ var UserAddEdit = function UserAddEdit(props) {
7465
7475
  body: JSON.stringify(cardsPayload),
7466
7476
  headers: {
7467
7477
  'Content-Type': 'application/json',
7468
- 'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
7478
+ authorization: "Bearer " + IUILocalStorageService$5.getAccessToken()
7469
7479
  }
7470
7480
  }).then(function (response) {
7471
7481
  if (response.status !== 200) {
7472
7482
  IUIToastMessageService$6.warningNotify('Opps, Something went wrong.');
7473
7483
  }
7474
7484
  })["catch"](function (error) {
7475
- console.log("errorrr", error);
7485
+ console.log('errorrr', error);
7476
7486
  });
7477
7487
  }
7478
7488
  (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);
@@ -7927,7 +7937,8 @@ var UserAddEdit = function UserAddEdit(props) {
7927
7937
  maxApprovers: maxExpenseApprovers,
7928
7938
  isProfile: isProfile,
7929
7939
  editUserId: editUserId,
7930
- roles: renderFields.expenseRoles
7940
+ roles: renderFields.expenseRoles,
7941
+ paymentMethod: paymentMethod
7931
7942
  }), /*#__PURE__*/React__default.createElement(iuistyles.IUIDivider, {
7932
7943
  className: styles.dividerColor
7933
7944
  }), isCardsDetailsRendered && productAccess && productAccess.card && /*#__PURE__*/React__default.createElement(CardsField, {