@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.
package/dist/index.css CHANGED
@@ -357,6 +357,18 @@
357
357
  margin-bottom: 60px;
358
358
  }
359
359
 
360
+ ._1yV0j {
361
+ display: flex;
362
+ padding: 8px;
363
+ flex-direction: column;
364
+ align-items: flex-start;
365
+ gap: 4px;
366
+ color: #CF2231;
367
+ border-radius: 4px;
368
+ background: #FFF1F0;
369
+ margin-bottom: 32px;
370
+ }
371
+
360
372
  ._1oHGu {
361
373
  display: flex;
362
374
  flex-wrap: wrap;
@@ -380,34 +392,34 @@
380
392
  stroke: #6b7280 !important;
381
393
  }
382
394
  ._3ZTQc ._3utA0._3O33a path {
383
- stroke: #3b82f6 !important;
395
+ stroke: #3D89FF !important;
384
396
  }
385
397
  ._3ZTQc ._3utA0._180_L path {
386
- stroke: #10b981 !important;
398
+ stroke: #2EA363 !important;
387
399
  }
388
400
  ._3ZTQc:hover {
389
401
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
390
402
  }
391
403
  ._3ZTQc._duePd {
392
- border-color: #d1d5db;
404
+ border-color: #D3D8DF;
393
405
  }
394
406
  ._3ZTQc._duePd ._1eF61 {
395
- background: #f1f3f5;
396
- border-bottom: 1px solid #d1d5db;
407
+ background: #F1F3F5;
408
+ border-bottom: 1px solid #D3D8DF;
397
409
  }
398
410
  ._3ZTQc._3O33a {
399
- border-color: #bfdbfe;
411
+ border-color: #86CBFF;
400
412
  }
401
413
  ._3ZTQc._3O33a ._1eF61 {
402
- background: #eff6ff;
403
- border-bottom: 1px solid #bfdbfe;
414
+ background: #EBF8FF;
415
+ border-bottom: 1px solid #86CBFF;
404
416
  }
405
417
  ._3ZTQc._180_L {
406
- border-color: #bbf7d0;
418
+ border-color: #70DC9D;
407
419
  }
408
420
  ._3ZTQc._180_L ._1eF61 {
409
- background: #f0fdf4;
410
- border-bottom: 1px solid #bbf7d0;
421
+ background: #D9FBE5;
422
+ border-bottom: 1px solid #70DC9D;
411
423
  }
412
424
 
413
425
  ._1eF61 {
@@ -431,7 +443,7 @@
431
443
  ._bp-Mt {
432
444
  font-size: 14px;
433
445
  font-weight: 600;
434
- color: #363e4f;
446
+ color: #363E4F;
435
447
  margin: 0 0 4px 0;
436
448
  line-height: 20px;
437
449
  }
@@ -446,10 +458,10 @@
446
458
  color: #6b7280;
447
459
  }
448
460
  ._3O33a ._3l4HZ {
449
- color: #3b82f6;
461
+ color: #3D89FF;
450
462
  }
451
463
  ._180_L ._3l4HZ {
452
- color: #10b981;
464
+ color: #2EA363;
453
465
  }
454
466
 
455
467
  ._3TTEn {
@@ -461,7 +473,7 @@
461
473
  }
462
474
 
463
475
  ._1S27X {
464
- color: #10b981;
476
+ color: #2EA363;
465
477
  font-size: 20px;
466
478
  }
467
479
 
package/dist/index.js CHANGED
@@ -829,7 +829,7 @@ var UserRole = function UserRole(_ref) {
829
829
 
830
830
  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"};
831
831
 
832
- 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"};
832
+ 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"};
833
833
 
834
834
  var SHOW_LOADER = 'SHOW_LOADER';
835
835
  var STOP_LOADER = 'STOP_LOADER';
@@ -2240,12 +2240,13 @@ var env$3 = utils.configs.env;
2240
2240
  var CardsManagement = function CardsManagement(_ref) {
2241
2241
  var _pg$gateway;
2242
2242
  var _ref$paymentDetails = _ref.paymentDetails,
2243
- paymentDetails = _ref$paymentDetails === void 0 ? {} : _ref$paymentDetails;
2243
+ paymentDetails = _ref$paymentDetails === void 0 ? {} : _ref$paymentDetails,
2244
+ _ref$paymentMethod = _ref.paymentMethod,
2245
+ paymentMethod = _ref$paymentMethod === void 0 ? null : _ref$paymentMethod;
2244
2246
  var dispatch = reactRedux.useDispatch();
2245
2247
  var pg = paymentDetails.pg,
2246
2248
  _paymentDetails$cards = paymentDetails.cards,
2247
2249
  cards = _paymentDetails$cards === void 0 ? null : _paymentDetails$cards;
2248
- console.log(paymentDetails, 'paymentDetails3');
2249
2250
  var _useState = React.useState(null),
2250
2251
  anchorEl = _useState[0],
2251
2252
  setAnchorEl = _useState[1];
@@ -2344,9 +2345,9 @@ var CardsManagement = function CardsManagement(_ref) {
2344
2345
  className: classes.cardTitleSection
2345
2346
  }, /*#__PURE__*/React__default.createElement("h3", {
2346
2347
  className: classes.cardName
2347
- }, card.name), /*#__PURE__*/React__default.createElement("span", {
2348
+ }, card.alias), /*#__PURE__*/React__default.createElement("span", {
2348
2349
  className: classes.cardType
2349
- }, getCardTypeLabel(card.category))), isCompanyCard ? /*#__PURE__*/React__default.createElement(LockIcon, {
2350
+ }, getCardTypeLabel(card.category), isDefaultCard && /*#__PURE__*/React__default.createElement("span", null, ' (Default)'))), isCompanyCard ? /*#__PURE__*/React__default.createElement(LockIcon, {
2350
2351
  className: classes.lockIcon
2351
2352
  }) : /*#__PURE__*/React__default.createElement(core.IconButton, {
2352
2353
  size: "small",
@@ -2356,7 +2357,7 @@ var CardsManagement = function CardsManagement(_ref) {
2356
2357
  className: classes.menuButton
2357
2358
  }, /*#__PURE__*/React__default.createElement(MoreIcon, {
2358
2359
  className: clsx(classes.moreIcon, classes[cardClass]),
2359
- color: isCompanyCard ? '#10B981' : '#3D89FF'
2360
+ color: isCompanyCard ? '#2EA363' : '#3D89FF'
2360
2361
  }))), /*#__PURE__*/React__default.createElement("div", {
2361
2362
  className: classes.cardDetails
2362
2363
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -2369,9 +2370,7 @@ var CardsManagement = function CardsManagement(_ref) {
2369
2370
  className: classes.cardCvv
2370
2371
  }, "CVV \u2022\u2022\u2022")), /*#__PURE__*/React__default.createElement("div", {
2371
2372
  className: classes.cardFooter
2372
- }, isDefaultCard ? /*#__PURE__*/React__default.createElement("div", {
2373
- className: styles$1.defaultLabel
2374
- }, "Default Card") : /*#__PURE__*/React__default.createElement("div", null), /*#__PURE__*/React__default.createElement("img", {
2373
+ }, /*#__PURE__*/React__default.createElement("div", null), /*#__PURE__*/React__default.createElement("img", {
2375
2374
  src: getBrandLogo(card.card.brand),
2376
2375
  alt: card.card.brand,
2377
2376
  className: classes.brandLogo
@@ -2411,20 +2410,22 @@ var CardsManagement = function CardsManagement(_ref) {
2411
2410
  }, /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
2412
2411
  container: true,
2413
2412
  className: styles$1.formFieldsWrapper
2414
- }, /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("div", {
2413
+ }, /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", null, paymentMethod === 2 && /*#__PURE__*/React__default.createElement("div", {
2414
+ style: classes.disabledNotice
2415
+ }, "Company has disabled usage of your personal cards, please reach out to your admin"), /*#__PURE__*/React__default.createElement("div", {
2415
2416
  className: classes.cardsGrid
2416
2417
  }, personalCards.map(function (card) {
2417
2418
  return renderCard(card);
2418
2419
  }), corporateCards.map(function (card) {
2419
2420
  return renderCard(card);
2420
- })), (!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__default.createElement("button", {
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", {
2421
2422
  className: classes.addCardButton,
2422
2423
  onClick: function onClick() {
2423
2424
  return window.location.assign(_url);
2424
2425
  }
2425
2426
  }, /*#__PURE__*/React__default.createElement("span", {
2426
2427
  className: classes.plusIcon
2427
- }, "+"), " Add card test")))))), (companyCards === null || companyCards === void 0 ? void 0 : companyCards.length) !== 0 && /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIDivider, {
2428
+ }, "+"), " Add card")))))), (companyCards === null || companyCards === void 0 ? void 0 : companyCards.length) !== 0 && /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIDivider, {
2428
2429
  className: styles$1.dividerColor
2429
2430
  }), /*#__PURE__*/React__default.createElement(iuistyles.IUIGrid, {
2430
2431
  container: true,
@@ -2462,7 +2463,7 @@ var CardsManagement = function CardsManagement(_ref) {
2462
2463
  vertical: 'top',
2463
2464
  horizontal: 'right'
2464
2465
  }
2465
- }, /*#__PURE__*/React__default.createElement(core.MenuItem, {
2466
+ }, selectedCard && !+selectedCard.metadata.default_card && /*#__PURE__*/React__default.createElement(core.MenuItem, {
2466
2467
  onClick: handleMarkAsDefault
2467
2468
  }, "Mark as default"), /*#__PURE__*/React__default.createElement(core.MenuItem, {
2468
2469
  onClick: handleDeleteCard,
@@ -2478,7 +2479,6 @@ var PaymentCards = function PaymentCards(_ref) {
2478
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
2480
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
2480
2481
  }
2481
- console.log('paymentDetails2', paymentDetails);
2482
2482
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(iuistyles.IUIDivider, {
2483
2483
  className: styles$1.dividerColor
2484
2484
  }), /*#__PURE__*/React__default.createElement(CardsManagement, {
@@ -2556,7 +2556,9 @@ var TravelExpenseFields = function TravelExpenseFields(props) {
2556
2556
  _props$editUserId = props.editUserId,
2557
2557
  editUserId = _props$editUserId === void 0 ? null : _props$editUserId,
2558
2558
  _props$roles = props.roles,
2559
- roles = _props$roles === void 0 ? [] : _props$roles;
2559
+ roles = _props$roles === void 0 ? [] : _props$roles,
2560
+ _props$paymentMethod = props.paymentMethod,
2561
+ paymentMethod = _props$paymentMethod === void 0 ? null : _props$paymentMethod;
2560
2562
  var _useState = React.useState({
2561
2563
  product: '',
2562
2564
  approvers: []
@@ -2853,7 +2855,8 @@ var TravelExpenseFields = function TravelExpenseFields(props) {
2853
2855
  placeholder: "Example label - \u201CManager\u201D"
2854
2856
  }));
2855
2857
  })))), type === 'travel' && paymentDetails && /*#__PURE__*/React__default.createElement(PaymentCards, {
2856
- paymentDetails: paymentDetails
2858
+ paymentDetails: paymentDetails,
2859
+ paymentMethod: paymentMethod
2857
2860
  }));
2858
2861
  };
2859
2862
 
@@ -3608,6 +3611,17 @@ var cardsConstants = {
3608
3611
  fullWidth: false,
3609
3612
  visibility: true,
3610
3613
  disableText: 'Please get in touch with your administrator to change this value.'
3614
+ }, {
3615
+ id: 3,
3616
+ label: 'Bookkeeper',
3617
+ description: 'This role is capable of reading all the action for own and other card employees',
3618
+ value: '',
3619
+ name: '',
3620
+ type: 'radio',
3621
+ isAssigned: false,
3622
+ fullWidth: false,
3623
+ visibility: true,
3624
+ disableText: 'Please get in touch with your administrator to change this value.'
3611
3625
  }]
3612
3626
  };
3613
3627
  var passportInfo = [{
@@ -4015,6 +4029,7 @@ var reducer = function reducer(state, action) {
4015
4029
  {
4016
4030
  var _action$payload8, _action$payload8$role, _action$payload9;
4017
4031
  var cardsDetails = _extends({}, state.cardsDetails);
4032
+ console.log(action === null || action === void 0 ? void 0 : action.payload, 'cardsDetails22');
4018
4033
  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) {
4019
4034
  cardsDetails.cardsRoles = action.payload.roles.map(function (role) {
4020
4035
  return {
@@ -4031,6 +4046,7 @@ var reducer = function reducer(state, action) {
4031
4046
  };
4032
4047
  });
4033
4048
  }
4049
+ console.log(cardsDetails, 'cardsDetails2');
4034
4050
  return _extends({}, state, {
4035
4051
  cardsDetails: cardsDetails,
4036
4052
  isCardsDetailsRendered: true,
@@ -5974,7 +5990,9 @@ var UserAddEdit = function UserAddEdit(props) {
5974
5990
  editUserId = props.editUserId,
5975
5991
  config = props.config,
5976
5992
  _props$isProfile = props.isProfile,
5977
- isProfile = _props$isProfile === void 0 ? false : _props$isProfile;
5993
+ isProfile = _props$isProfile === void 0 ? false : _props$isProfile,
5994
+ _props$paymentMethod = props.paymentMethod,
5995
+ paymentMethod = _props$paymentMethod === void 0 ? null : _props$paymentMethod;
5978
5996
  env$4.init(config, isProfile);
5979
5997
  var queryParams = new URLSearchParams(window.location.search);
5980
5998
  var verifyUserId = Number(queryParams.get(config.routes.users.add.queryParamKeys.verifyUserId));
@@ -6190,26 +6208,7 @@ var UserAddEdit = function UserAddEdit(props) {
6190
6208
  }).then(function (res) {
6191
6209
  var _res$roles;
6192
6210
  if (res !== null && res !== void 0 && (_res$roles = res.roles) !== null && _res$roles !== void 0 && _res$roles.length) {
6193
- dispatch(setCardsDetails(res));
6194
- } else {
6195
- IUIToastMessageService$6.warningNotify('Opps, Something went wrong.');
6196
- }
6197
- })["catch"](function (error) {
6198
- console.log("errorrr", error);
6199
- });
6200
- };
6201
- var fetchLoggedUserCardsDetails = function fetchLoggedUserCardsDetails() {
6202
- fetch(userAddEditUrl.cardsAddUsersDetails(), {
6203
- method: 'GET',
6204
- headers: {
6205
- 'Content-Type': 'application/json',
6206
- 'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
6207
- }
6208
- }).then(function (response) {
6209
- return response.json();
6210
- }).then(function (res) {
6211
- var _res$roles2;
6212
- if (res !== null && res !== void 0 && (_res$roles2 = res.roles) !== null && _res$roles2 !== void 0 && _res$roles2.length) {
6211
+ console.log(res, 'cardsDetails222');
6213
6212
  dispatch(setCardsDetails(res));
6214
6213
  } else {
6215
6214
  IUIToastMessageService$6.warningNotify('Opps, Something went wrong.');
@@ -6909,10 +6908,11 @@ var UserAddEdit = function UserAddEdit(props) {
6909
6908
  }
6910
6909
  }, [isTokenVerified]);
6911
6910
  React.useEffect(function () {
6911
+ console.log(isProfile, 'isProfile', id, 'id', editUserId, 'editUserId');
6912
6912
  if (isRendered === true) {
6913
6913
  renderFields === null || renderFields === void 0 ? void 0 : renderFields.products.forEach(function (prod) {
6914
6914
  if ((prod === null || prod === void 0 ? void 0 : prod.name) === 'card') {
6915
- editUserId ? fetchEditUserCardsDetails(editUserId) : fetchLoggedUserCardsDetails();
6915
+ fetchEditUserCardsDetails(isProfile ? id : editUserId);
6916
6916
  }
6917
6917
  });
6918
6918
  setPersonalInfoInput(_extends({}, personalInfoInput, {
@@ -6938,7 +6938,6 @@ var UserAddEdit = function UserAddEdit(props) {
6938
6938
  userId: isProfile ? id : editUserId
6939
6939
  })).then(function (res) {
6940
6940
  var _res$user_tags, _res$custom_attribute;
6941
- console.log(res, 'paymentDetails1', res === null || res === void 0 ? void 0 : res.payment_details);
6942
6941
  var profilePic = [];
6943
6942
  if (res && res.profile_pic) {
6944
6943
  profilePic = [{
@@ -7886,7 +7885,8 @@ var UserAddEdit = function UserAddEdit(props) {
7886
7885
  maxApprovers: maxTravelApprovers,
7887
7886
  isProfile: isProfile,
7888
7887
  editUserId: editUserId,
7889
- roles: renderFields.travelRoles
7888
+ roles: renderFields.travelRoles,
7889
+ paymentMethod: paymentMethod
7890
7890
  }), /*#__PURE__*/React__default.createElement(AdditionalInfo, {
7891
7891
  membershipInfoInput: membershipInfoInput,
7892
7892
  onMemInfoInputChange: onMemInfoInputChange,