@itilite/iui-user-management 1.4.7611 → 1.4.7681

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.
@@ -826,7 +826,7 @@ var UserRole = function UserRole(_ref) {
826
826
 
827
827
  var styles$1 = {"defaultLabel":"_smjc4","card":"_3_S9J","cardNumber":"_36E9M","cardDigit":"_2pm-T","expiryDate":"_2tBnF","cardImage":"_3QvZh","visa":"_1IpBm","mastercard":"_2x6IX","amex":"_2a38S","discover":"_2vksl","diners":"_2kQRs","jcb":"_2bO1f","unionpay":"_2_jfu","is_nothing":"_1Lrzs","addCard":"_3711U","cardDeleteBtn":"_7Da2t","cardLabel":"_PQTex","defaultBtn":"_1_ArA","cursonPointer":"_1L115","sectionWrapper":"_VpUCK","margin":"_1Fs_D","minGridWidth":"_1hl-Z","firstRowMargin":"_1WZZj","firstChildMargin":"_IT_O_","paddingTop":"_Mhnl7","dividerColor":"_3ltFd"};
828
828
 
829
- var classes = {"sectionHeader":"_2d_OH","myCardsSection":"_3MNHj","companyCardsSection":"_34lN6","cardsGrid":"_1oHGu","card":"_3ZTQc","moreIcon":"_3utA0","personal":"_duePd","corporate":"_3O33a","company":"_180_L","cardHeader":"_1eF61","cardTitleSection":"_2c40W","cardMaskedNumber":"_2Vlhq","cardName":"_bp-Mt","cardType":"_3l4HZ","menuButton":"_3TTEn","lockIcon":"_1S27X","cardDetails":"_IP2rg","cardNumber":"_7FOPe","cardExpiry":"_CI_p2","cardCvv":"_3Gzqu","cardUnhide":"_ivgBf","cardFooter":"_1WgPL","brandLogo":"_EV0l8","addCardButton":"_1oaCc","plusIcon":"_w9L5L"};
829
+ var classes = {"sectionHeader":"_2d_OH","myCardsSection":"_3MNHj","companyCardsSection":"_34lN6","disabledNotice":"_1yV0j","cardsGrid":"_1oHGu","card":"_3ZTQc","moreIcon":"_3utA0","personal":"_duePd","corporate":"_3O33a","company":"_180_L","cardHeader":"_1eF61","cardTitleSection":"_2c40W","cardMaskedNumber":"_2Vlhq","cardName":"_bp-Mt","cardType":"_3l4HZ","menuButton":"_3TTEn","lockIcon":"_1S27X","cardDetails":"_IP2rg","cardNumber":"_7FOPe","cardExpiry":"_CI_p2","cardCvv":"_3Gzqu","cardUnhide":"_ivgBf","cardFooter":"_1WgPL","brandLogo":"_EV0l8","addCardButton":"_1oaCc","plusIcon":"_w9L5L"};
830
830
 
831
831
  var SHOW_LOADER = 'SHOW_LOADER';
832
832
  var STOP_LOADER = 'STOP_LOADER';
@@ -2237,12 +2237,13 @@ var env$3 = configs.env;
2237
2237
  var CardsManagement = function CardsManagement(_ref) {
2238
2238
  var _pg$gateway;
2239
2239
  var _ref$paymentDetails = _ref.paymentDetails,
2240
- paymentDetails = _ref$paymentDetails === void 0 ? {} : _ref$paymentDetails;
2240
+ paymentDetails = _ref$paymentDetails === void 0 ? {} : _ref$paymentDetails,
2241
+ _ref$paymentMethod = _ref.paymentMethod,
2242
+ paymentMethod = _ref$paymentMethod === void 0 ? null : _ref$paymentMethod;
2241
2243
  var dispatch = useDispatch();
2242
2244
  var pg = paymentDetails.pg,
2243
2245
  _paymentDetails$cards = paymentDetails.cards,
2244
2246
  cards = _paymentDetails$cards === void 0 ? null : _paymentDetails$cards;
2245
- console.log(paymentDetails, 'paymentDetails3');
2246
2247
  var _useState = useState(null),
2247
2248
  anchorEl = _useState[0],
2248
2249
  setAnchorEl = _useState[1];
@@ -2341,9 +2342,9 @@ var CardsManagement = function CardsManagement(_ref) {
2341
2342
  className: classes.cardTitleSection
2342
2343
  }, /*#__PURE__*/React.createElement("h3", {
2343
2344
  className: classes.cardName
2344
- }, card.name), /*#__PURE__*/React.createElement("span", {
2345
+ }, card.alias), /*#__PURE__*/React.createElement("span", {
2345
2346
  className: classes.cardType
2346
- }, getCardTypeLabel(card.category))), isCompanyCard ? /*#__PURE__*/React.createElement(LockIcon, {
2347
+ }, getCardTypeLabel(card.category), isDefaultCard && /*#__PURE__*/React.createElement("span", null, ' (Default)'))), isCompanyCard ? /*#__PURE__*/React.createElement(LockIcon, {
2347
2348
  className: classes.lockIcon
2348
2349
  }) : /*#__PURE__*/React.createElement(IconButton, {
2349
2350
  size: "small",
@@ -2353,7 +2354,7 @@ var CardsManagement = function CardsManagement(_ref) {
2353
2354
  className: classes.menuButton
2354
2355
  }, /*#__PURE__*/React.createElement(MoreIcon, {
2355
2356
  className: clsx(classes.moreIcon, classes[cardClass]),
2356
- color: isCompanyCard ? '#10B981' : '#3D89FF'
2357
+ color: isCompanyCard ? '#2EA363' : '#3D89FF'
2357
2358
  }))), /*#__PURE__*/React.createElement("div", {
2358
2359
  className: classes.cardDetails
2359
2360
  }, /*#__PURE__*/React.createElement("div", {
@@ -2366,9 +2367,7 @@ var CardsManagement = function CardsManagement(_ref) {
2366
2367
  className: classes.cardCvv
2367
2368
  }, "CVV \u2022\u2022\u2022")), /*#__PURE__*/React.createElement("div", {
2368
2369
  className: classes.cardFooter
2369
- }, isDefaultCard ? /*#__PURE__*/React.createElement("div", {
2370
- className: styles$1.defaultLabel
2371
- }, "Default Card") : /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("img", {
2370
+ }, /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("img", {
2372
2371
  src: getBrandLogo(card.card.brand),
2373
2372
  alt: card.card.brand,
2374
2373
  className: classes.brandLogo
@@ -2408,20 +2407,22 @@ var CardsManagement = function CardsManagement(_ref) {
2408
2407
  }, /*#__PURE__*/React.createElement(IUIGrid, {
2409
2408
  container: true,
2410
2409
  className: styles$1.formFieldsWrapper
2411
- }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
2410
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, paymentMethod === 2 && /*#__PURE__*/React.createElement("div", {
2411
+ style: classes.disabledNotice
2412
+ }, "Company has disabled usage of your personal cards, please reach out to your admin"), /*#__PURE__*/React.createElement("div", {
2412
2413
  className: classes.cardsGrid
2413
2414
  }, personalCards.map(function (card) {
2414
2415
  return renderCard(card);
2415
2416
  }), corporateCards.map(function (card) {
2416
2417
  return renderCard(card);
2417
- })), (!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 && /*#__PURE__*/React.createElement("button", {
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", {
2418
2419
  className: classes.addCardButton,
2419
2420
  onClick: function onClick() {
2420
2421
  return window.location.assign(_url);
2421
2422
  }
2422
2423
  }, /*#__PURE__*/React.createElement("span", {
2423
2424
  className: classes.plusIcon
2424
- }, "+"), " Add card test")))))), (companyCards === null || companyCards === void 0 ? void 0 : companyCards.length) !== 0 && /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(IUIDivider, {
2425
+ }, "+"), " Add card")))))), (companyCards === null || companyCards === void 0 ? void 0 : companyCards.length) !== 0 && /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(IUIDivider, {
2425
2426
  className: styles$1.dividerColor
2426
2427
  }), /*#__PURE__*/React.createElement(IUIGrid, {
2427
2428
  container: true,
@@ -2459,7 +2460,7 @@ var CardsManagement = function CardsManagement(_ref) {
2459
2460
  vertical: 'top',
2460
2461
  horizontal: 'right'
2461
2462
  }
2462
- }, /*#__PURE__*/React.createElement(MenuItem, {
2463
+ }, selectedCard && !+selectedCard.metadata.default_card && /*#__PURE__*/React.createElement(MenuItem, {
2463
2464
  onClick: handleMarkAsDefault
2464
2465
  }, "Mark as default"), /*#__PURE__*/React.createElement(MenuItem, {
2465
2466
  onClick: handleDeleteCard,
@@ -2475,7 +2476,6 @@ var PaymentCards = function PaymentCards(_ref) {
2475
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
2477
  return /*#__PURE__*/React.createElement(React.Fragment, null);
2477
2478
  }
2478
- console.log('paymentDetails2', paymentDetails);
2479
2479
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIDivider, {
2480
2480
  className: styles$1.dividerColor
2481
2481
  }), /*#__PURE__*/React.createElement(CardsManagement, {
@@ -2553,7 +2553,9 @@ var TravelExpenseFields = function TravelExpenseFields(props) {
2553
2553
  _props$editUserId = props.editUserId,
2554
2554
  editUserId = _props$editUserId === void 0 ? null : _props$editUserId,
2555
2555
  _props$roles = props.roles,
2556
- roles = _props$roles === void 0 ? [] : _props$roles;
2556
+ roles = _props$roles === void 0 ? [] : _props$roles,
2557
+ _props$paymentMethod = props.paymentMethod,
2558
+ paymentMethod = _props$paymentMethod === void 0 ? null : _props$paymentMethod;
2557
2559
  var _useState = useState({
2558
2560
  product: '',
2559
2561
  approvers: []
@@ -2850,7 +2852,8 @@ var TravelExpenseFields = function TravelExpenseFields(props) {
2850
2852
  placeholder: "Example label - \u201CManager\u201D"
2851
2853
  }));
2852
2854
  })))), type === 'travel' && paymentDetails && /*#__PURE__*/React.createElement(PaymentCards, {
2853
- paymentDetails: paymentDetails
2855
+ paymentDetails: paymentDetails,
2856
+ paymentMethod: paymentMethod
2854
2857
  }));
2855
2858
  };
2856
2859
 
@@ -3605,6 +3608,17 @@ var cardsConstants = {
3605
3608
  fullWidth: false,
3606
3609
  visibility: true,
3607
3610
  disableText: 'Please get in touch with your administrator to change this value.'
3611
+ }, {
3612
+ id: 3,
3613
+ label: 'Bookkeeper',
3614
+ description: 'This role is capable of reading all the action for own and other card employees',
3615
+ value: '',
3616
+ name: '',
3617
+ type: 'radio',
3618
+ isAssigned: false,
3619
+ fullWidth: false,
3620
+ visibility: true,
3621
+ disableText: 'Please get in touch with your administrator to change this value.'
3608
3622
  }]
3609
3623
  };
3610
3624
  var passportInfo = [{
@@ -4012,6 +4026,7 @@ var reducer = function reducer(state, action) {
4012
4026
  {
4013
4027
  var _action$payload8, _action$payload8$role, _action$payload9;
4014
4028
  var cardsDetails = _extends({}, state.cardsDetails);
4029
+ console.log(action === null || action === void 0 ? void 0 : action.payload, 'cardsDetails22');
4015
4030
  if (action !== null && action !== void 0 && (_action$payload8 = action.payload) !== null && _action$payload8 !== void 0 && (_action$payload8$role = _action$payload8.roles) !== null && _action$payload8$role !== void 0 && _action$payload8$role.length) {
4016
4031
  cardsDetails.cardsRoles = action.payload.roles.map(function (role) {
4017
4032
  return {
@@ -4028,6 +4043,7 @@ var reducer = function reducer(state, action) {
4028
4043
  };
4029
4044
  });
4030
4045
  }
4046
+ console.log(cardsDetails, 'cardsDetails2');
4031
4047
  return _extends({}, state, {
4032
4048
  cardsDetails: cardsDetails,
4033
4049
  isCardsDetailsRendered: true,
@@ -5971,7 +5987,9 @@ var UserAddEdit = function UserAddEdit(props) {
5971
5987
  editUserId = props.editUserId,
5972
5988
  config = props.config,
5973
5989
  _props$isProfile = props.isProfile,
5974
- isProfile = _props$isProfile === void 0 ? false : _props$isProfile;
5990
+ isProfile = _props$isProfile === void 0 ? false : _props$isProfile,
5991
+ _props$paymentMethod = props.paymentMethod,
5992
+ paymentMethod = _props$paymentMethod === void 0 ? null : _props$paymentMethod;
5975
5993
  env$4.init(config, isProfile);
5976
5994
  var queryParams = new URLSearchParams(window.location.search);
5977
5995
  var verifyUserId = Number(queryParams.get(config.routes.users.add.queryParamKeys.verifyUserId));
@@ -6187,26 +6205,7 @@ var UserAddEdit = function UserAddEdit(props) {
6187
6205
  }).then(function (res) {
6188
6206
  var _res$roles;
6189
6207
  if (res !== null && res !== void 0 && (_res$roles = res.roles) !== null && _res$roles !== void 0 && _res$roles.length) {
6190
- dispatch(setCardsDetails(res));
6191
- } else {
6192
- IUIToastMessageService$6.warningNotify('Opps, Something went wrong.');
6193
- }
6194
- })["catch"](function (error) {
6195
- console.log("errorrr", error);
6196
- });
6197
- };
6198
- var fetchLoggedUserCardsDetails = function fetchLoggedUserCardsDetails() {
6199
- fetch(userAddEditUrl.cardsAddUsersDetails(), {
6200
- method: 'GET',
6201
- headers: {
6202
- 'Content-Type': 'application/json',
6203
- 'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
6204
- }
6205
- }).then(function (response) {
6206
- return response.json();
6207
- }).then(function (res) {
6208
- var _res$roles2;
6209
- if (res !== null && res !== void 0 && (_res$roles2 = res.roles) !== null && _res$roles2 !== void 0 && _res$roles2.length) {
6208
+ console.log(res, 'cardsDetails222');
6210
6209
  dispatch(setCardsDetails(res));
6211
6210
  } else {
6212
6211
  IUIToastMessageService$6.warningNotify('Opps, Something went wrong.');
@@ -6906,10 +6905,11 @@ var UserAddEdit = function UserAddEdit(props) {
6906
6905
  }
6907
6906
  }, [isTokenVerified]);
6908
6907
  useEffect(function () {
6908
+ console.log(isProfile, 'isProfile', id, 'id', editUserId, 'editUserId');
6909
6909
  if (isRendered === true) {
6910
6910
  renderFields === null || renderFields === void 0 ? void 0 : renderFields.products.forEach(function (prod) {
6911
6911
  if ((prod === null || prod === void 0 ? void 0 : prod.name) === 'card') {
6912
- editUserId ? fetchEditUserCardsDetails(editUserId) : fetchLoggedUserCardsDetails();
6912
+ fetchEditUserCardsDetails(isProfile ? id : editUserId);
6913
6913
  }
6914
6914
  });
6915
6915
  setPersonalInfoInput(_extends({}, personalInfoInput, {
@@ -6935,7 +6935,6 @@ var UserAddEdit = function UserAddEdit(props) {
6935
6935
  userId: isProfile ? id : editUserId
6936
6936
  })).then(function (res) {
6937
6937
  var _res$user_tags, _res$custom_attribute;
6938
- console.log(res, 'paymentDetails1', res === null || res === void 0 ? void 0 : res.payment_details);
6939
6938
  var profilePic = [];
6940
6939
  if (res && res.profile_pic) {
6941
6940
  profilePic = [{
@@ -7883,7 +7882,8 @@ var UserAddEdit = function UserAddEdit(props) {
7883
7882
  maxApprovers: maxTravelApprovers,
7884
7883
  isProfile: isProfile,
7885
7884
  editUserId: editUserId,
7886
- roles: renderFields.travelRoles
7885
+ roles: renderFields.travelRoles,
7886
+ paymentMethod: paymentMethod
7887
7887
  }), /*#__PURE__*/React.createElement(AdditionalInfo, {
7888
7888
  membershipInfoInput: membershipInfoInput,
7889
7889
  onMemInfoInputChange: onMemInfoInputChange,