@itilite/iui-user-management 1.4.894 → 1.4.941

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.
@@ -410,6 +410,9 @@ var userAddEditUrl = {
410
410
  setDefaultCard: function setDefaultCard(pmId, vendorId) {
411
411
  return env.getPaymentUrl() + "/api/v1/card/default";
412
412
  },
413
+ disablePaymentCard: function disablePaymentCard() {
414
+ return env.getPaymentUrl() + "/api/v1/card/status";
415
+ },
413
416
  verifyUserInfo: function verifyUserInfo(userId) {
414
417
  return "api/v1/onboarding/user-sign-up-info/" + userId + "?company_id=" + IUILocalStorageService.getCompanyId();
415
418
  },
@@ -826,7 +829,7 @@ var UserRole = function UserRole(_ref) {
826
829
 
827
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"};
828
831
 
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"};
832
+ var classes = {"disabledCard":"_3MVKj","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
833
 
831
834
  var SHOW_LOADER = 'SHOW_LOADER';
832
835
  var STOP_LOADER = 'STOP_LOADER';
@@ -1835,13 +1838,13 @@ var setDefaultPaymentCard = function setDefaultPaymentCard(payload) {
1835
1838
  });
1836
1839
  dispatch(setPaymentDetails(_paymentDetails));
1837
1840
  } else {
1838
- var _res$data3;
1839
- IUIToastMessageService$1.warningNotify((res === null || res === void 0 ? void 0 : (_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : _res$data3.message) || 'Opps, Something went wrong.');
1841
+ var _res$data4;
1842
+ IUIToastMessageService$1.warningNotify((res === null || res === void 0 ? void 0 : (_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : _res$data4.message) || 'Opps, Something went wrong.');
1840
1843
  reject(res);
1841
1844
  }
1842
1845
  })["catch"](function (err) {
1843
- var _err$response15, _err$response15$data;
1844
- IUIToastMessageService$1.warningNotify((err === null || err === void 0 ? void 0 : (_err$response15 = err.response) === null || _err$response15 === void 0 ? void 0 : (_err$response15$data = _err$response15.data) === null || _err$response15$data === void 0 ? void 0 : _err$response15$data.message) || 'Opps, Something went wrong.');
1846
+ var _err$response16, _err$response16$data;
1847
+ IUIToastMessageService$1.warningNotify((err === null || err === void 0 ? void 0 : (_err$response16 = err.response) === null || _err$response16 === void 0 ? void 0 : (_err$response16$data = _err$response16.data) === null || _err$response16$data === void 0 ? void 0 : _err$response16$data.message) || 'Opps, Something went wrong.');
1845
1848
  reject(err);
1846
1849
  })["finally"](function () {
1847
1850
  dispatch(stopLoader());
@@ -1856,16 +1859,16 @@ var verifyUserInfo = function verifyUserInfo(userId) {
1856
1859
  if (res.data.status === 200) {
1857
1860
  resolve(res.data.result);
1858
1861
  } else {
1859
- var _res$data4;
1860
- IUIToastMessageService$1.warningNotify((res === null || res === void 0 ? void 0 : (_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : _res$data4.message) || 'Opps, Unable to fetch user info.');
1862
+ var _res$data5;
1863
+ IUIToastMessageService$1.warningNotify((res === null || res === void 0 ? void 0 : (_res$data5 = res.data) === null || _res$data5 === void 0 ? void 0 : _res$data5.message) || 'Opps, Unable to fetch user info.');
1861
1864
  setTimeout(function () {
1862
1865
  window.history.back();
1863
1866
  }, 1000);
1864
1867
  reject(res);
1865
1868
  }
1866
1869
  })["catch"](function (err) {
1867
- var _err$response16, _err$response16$data;
1868
- IUIToastMessageService$1.warningNotify((err === null || err === void 0 ? void 0 : (_err$response16 = err.response) === null || _err$response16 === void 0 ? void 0 : (_err$response16$data = _err$response16.data) === null || _err$response16$data === void 0 ? void 0 : _err$response16$data.message) || 'Opps, Unable to fetch user info.');
1870
+ var _err$response17, _err$response17$data;
1871
+ IUIToastMessageService$1.warningNotify((err === null || err === void 0 ? void 0 : (_err$response17 = err.response) === null || _err$response17 === void 0 ? void 0 : (_err$response17$data = _err$response17.data) === null || _err$response17$data === void 0 ? void 0 : _err$response17$data.message) || 'Opps, Unable to fetch user info.');
1869
1872
  setTimeout(function () {
1870
1873
  window.history.back();
1871
1874
  }, 1000);
@@ -1880,8 +1883,8 @@ var submitAddModalData = function submitAddModalData(tableName, data) {
1880
1883
  api$2.post(tableName === 'department' ? departmentUrl.departmentUrl() : userAddEditUrl.dropdownList() + ("?action=add&table=" + tableName), data).then(function (res) {
1881
1884
  resolve(res);
1882
1885
  })["catch"](function (err) {
1883
- var _err$response17, _err$response17$data;
1884
- IUIToastMessageService$1.warningNotify((err === null || err === void 0 ? void 0 : (_err$response17 = err.response) === null || _err$response17 === void 0 ? void 0 : (_err$response17$data = _err$response17.data) === null || _err$response17$data === void 0 ? void 0 : _err$response17$data.message) || 'Opps, Something went wrong.');
1886
+ var _err$response18, _err$response18$data;
1887
+ IUIToastMessageService$1.warningNotify((err === null || err === void 0 ? void 0 : (_err$response18 = err.response) === null || _err$response18 === void 0 ? void 0 : (_err$response18$data = _err$response18.data) === null || _err$response18$data === void 0 ? void 0 : _err$response18$data.message) || 'Opps, Something went wrong.');
1885
1888
  dispatch(stopLoader());
1886
1889
  });
1887
1890
  });
@@ -1894,13 +1897,13 @@ var rejectUserVerification = function rejectUserVerification(userId) {
1894
1897
  if (res.data.status === true) {
1895
1898
  resolve(res.data);
1896
1899
  } else {
1897
- var _res$data5;
1898
- IUIToastMessageService$1.warningNotify((res === null || res === void 0 ? void 0 : (_res$data5 = res.data) === null || _res$data5 === void 0 ? void 0 : _res$data5.message) || 'Opps, Unable to reject user.');
1900
+ var _res$data6;
1901
+ IUIToastMessageService$1.warningNotify((res === null || res === void 0 ? void 0 : (_res$data6 = res.data) === null || _res$data6 === void 0 ? void 0 : _res$data6.message) || 'Opps, Unable to reject user.');
1899
1902
  reject(res);
1900
1903
  }
1901
1904
  })["catch"](function (err) {
1902
- var _err$response18, _err$response18$data;
1903
- IUIToastMessageService$1.warningNotify((err === null || err === void 0 ? void 0 : (_err$response18 = err.response) === null || _err$response18 === void 0 ? void 0 : (_err$response18$data = _err$response18.data) === null || _err$response18$data === void 0 ? void 0 : _err$response18$data.message) || 'Opps, Unable to reject user.');
1905
+ var _err$response19, _err$response19$data;
1906
+ IUIToastMessageService$1.warningNotify((err === null || err === void 0 ? void 0 : (_err$response19 = err.response) === null || _err$response19 === void 0 ? void 0 : (_err$response19$data = _err$response19.data) === null || _err$response19$data === void 0 ? void 0 : _err$response19$data.message) || 'Opps, Unable to reject user.');
1904
1907
  reject(err);
1905
1908
  });
1906
1909
  });
@@ -2775,14 +2778,27 @@ var CardsManagement = function CardsManagement(_ref) {
2775
2778
  fill: "#2EA363"
2776
2779
  }));
2777
2780
  };
2781
+ var personalCards = cards === null || cards === void 0 ? void 0 : cards.filter(function (card) {
2782
+ return (card === null || card === void 0 ? void 0 : card.category) === 'Personal';
2783
+ });
2784
+ var corporateCards = cards === null || cards === void 0 ? void 0 : cards.filter(function (card) {
2785
+ return (card === null || card === void 0 ? void 0 : card.category) === 'Corporate';
2786
+ });
2787
+ var companyCards = cards === null || cards === void 0 ? void 0 : cards.filter(function (card) {
2788
+ return (card === null || card === void 0 ? void 0 : card.category) === 'Company';
2789
+ });
2790
+ var cardsCount = (personalCards === null || personalCards === void 0 ? void 0 : personalCards.length) + (corporateCards === null || corporateCards === void 0 ? void 0 : corporateCards.length);
2778
2791
  var renderCard = function renderCard(card) {
2779
- var _card$metadata, _card$card, _card$card2, _card$card3, _card$card4;
2792
+ var _card$metadata, _card$metadata2, _clsx, _card$card, _card$card2, _card$card3, _card$card4;
2793
+ console.log('_paymentDetails2', card, cards);
2780
2794
  var isCompanyCard = (card === null || card === void 0 ? void 0 : card.category) === 'Company';
2781
2795
  var cardClass = getCardTypeClass(card === null || card === void 0 ? void 0 : card.category);
2782
2796
  var isDefaultCard = !!+(card === null || card === void 0 ? void 0 : (_card$metadata = card.metadata) === null || _card$metadata === void 0 ? void 0 : _card$metadata.default_card);
2797
+ var isDisabled = (card === null || card === void 0 ? void 0 : (_card$metadata2 = card.metadata) === null || _card$metadata2 === void 0 ? void 0 : _card$metadata2.is_enabled) === '0';
2798
+ var showMenuButton = cardsCount === 1 || cardsCount > 1 && !isDefaultCard;
2783
2799
  return /*#__PURE__*/React.createElement("div", {
2784
2800
  key: card.id,
2785
- className: clsx(classes.card, classes[cardClass])
2801
+ className: clsx(classes.card, classes[cardClass], (_clsx = {}, _clsx[classes.disabledCard] = isDisabled, _clsx))
2786
2802
  }, /*#__PURE__*/React.createElement("div", {
2787
2803
  className: classes.cardHeader
2788
2804
  }, /*#__PURE__*/React.createElement("div", {
@@ -2816,16 +2832,6 @@ var CardsManagement = function CardsManagement(_ref) {
2816
2832
  className: classes.cardFooter
2817
2833
  }, /*#__PURE__*/React.createElement("div", null), getBrandLogo(card === null || card === void 0 ? void 0 : (_card$card4 = card.card) === null || _card$card4 === void 0 ? void 0 : _card$card4.brand)));
2818
2834
  };
2819
- var personalCards = cards === null || cards === void 0 ? void 0 : cards.filter(function (card) {
2820
- return (card === null || card === void 0 ? void 0 : card.category) === 'Personal';
2821
- });
2822
- var corporateCards = cards === null || cards === void 0 ? void 0 : cards.filter(function (card) {
2823
- return (card === null || card === void 0 ? void 0 : card.category) === 'Corporate';
2824
- });
2825
- var companyCards = cards === null || cards === void 0 ? void 0 : cards.filter(function (card) {
2826
- return (card === null || card === void 0 ? void 0 : card.category) === 'Company';
2827
- });
2828
- var cardsCount = (personalCards === null || personalCards === void 0 ? void 0 : personalCards.length) + (corporateCards === null || corporateCards === void 0 ? void 0 : corporateCards.length);
2829
2835
  var _url = env$3.getPaymentUrl() + ("/api/v1/auth/" + IUILocalStorageService$4.getAccessToken() + "/1/" + pg.entity_id + "/0/" + pg.vendor_id + "/1");
2830
2836
  var showMenuButton = cardsCount === 1 || cardsCount > 1 && !+(selectedCard === null || selectedCard === void 0 ? void 0 : (_selectedCard$metadat = selectedCard.metadata) === null || _selectedCard$metadat === void 0 ? void 0 : _selectedCard$metadat.default_card);
2831
2837
  return /*#__PURE__*/React.createElement("div", {