@itilite/iui-user-management 1.5.11 → 1.5.12

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
@@ -423,6 +423,9 @@ var userAddEditUrl = {
423
423
  setDefaultCard: function setDefaultCard(pmId, vendorId) {
424
424
  return env.getPaymentUrl() + "/api/v1/card/default";
425
425
  },
426
+ personalCardEligibility: function personalCardEligibility() {
427
+ return env.getPaymentUrl() + "/api/v1/card/clients/" + IUILocalStorageService.getClientId() + "/personal/eligibility?app_type=1";
428
+ },
426
429
  disablePaymentCard: function disablePaymentCard() {
427
430
  return env.getPaymentUrl() + "/api/v1/card/status";
428
431
  },
@@ -2664,7 +2667,8 @@ var Visa = function Visa(props) {
2664
2667
  };
2665
2668
 
2666
2669
  var IUILocalStorageService$3 = utils.services.IUILocalStorageService;
2667
- var env$3 = utils.configs.env;
2670
+ var env$3 = utils.configs.env,
2671
+ paymentApi$1 = utils.configs.paymentApi;
2668
2672
  var CardsManagement = function CardsManagement(_ref) {
2669
2673
  var _selectedCard$metadat, _pg$gateway;
2670
2674
  var _ref$paymentDetails = _ref.paymentDetails,
@@ -2685,6 +2689,23 @@ var CardsManagement = function CardsManagement(_ref) {
2685
2689
  var _useState2 = React.useState(null),
2686
2690
  selectedCard = _useState2[0],
2687
2691
  setSelectedCard = _useState2[1];
2692
+ var _useState3 = React.useState(false),
2693
+ allowPersonalCardAdd = _useState3[0],
2694
+ setAllowPersonalCardAdd = _useState3[1];
2695
+ React.useEffect(function () {
2696
+ var isActive = true;
2697
+ paymentApi$1.get(userAddEditUrl.personalCardEligibility()).then(function (res) {
2698
+ if (isActive) {
2699
+ var _res$data, _res$data$data;
2700
+ setAllowPersonalCardAdd((res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$data = _res$data.data) === null || _res$data$data === void 0 ? void 0 : _res$data$data.allow_personal_card_add) === true);
2701
+ }
2702
+ })["catch"](function () {
2703
+ if (isActive) setAllowPersonalCardAdd(false);
2704
+ });
2705
+ return function () {
2706
+ isActive = false;
2707
+ };
2708
+ }, []);
2688
2709
  var handleMenuClick = function handleMenuClick(event, card) {
2689
2710
  setAnchorEl(event.currentTarget);
2690
2711
  setSelectedCard(card);
@@ -2902,7 +2923,7 @@ var CardsManagement = function CardsManagement(_ref) {
2902
2923
  return renderCard(card);
2903
2924
  }) : null, corporateCards.length !== 0 ? corporateCards === null || corporateCards === void 0 ? void 0 : corporateCards.map(function (card) {
2904
2925
  return renderCard(card);
2905
- }) : null), console.log('cards', cards, 'cardsCount', cardsCount, pg), (!cards || cardsCount < 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", {
2926
+ }) : null), (!cards || cardsCount < 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 && allowPersonalCardAdd && /*#__PURE__*/React__default.createElement("button", {
2906
2927
  className: classes.addCardButton,
2907
2928
  onClick: function onClick() {
2908
2929
  sendLog({