@itilite/iui-user-management 1.5.1 → 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.
@@ -1,5 +1,5 @@
1
1
  import { IUIAsyncSelect, IUIBox, IUILabel, IUIFileUpload, IUICheckboxButton, IUIPhone, IUISelect, IUIDatePicker, IUIInput, IUIGrid, IUIDivider, IUITypography, IUITooltip, IUIRadio, IUIButton, IUIModal, IUISearch, IUICircularProgress, IUIAccordion, IUIAccordionSummary, IUIAccordionDetails, IUICard, IUIBackdrop, IUIBreadCrumb, IUIDropdownButton, IUIDropzone, IUIStepper, IUIIconButton, IUIFormControlLabel, IUICheckBox, IUIPrimaryRadio, IUITable, IUISkeleton, IUIProfileBox, IUIFormGroup, IUITabs } from '@itilite/iuistyles';
2
- import React, { useState, Fragment as Fragment$1, useEffect, memo, useRef } from 'react';
2
+ import React, { useState, useEffect, Fragment as Fragment$1, memo, useRef } from 'react';
3
3
  import { configs, services, utilUrls } from '@itilite/utils';
4
4
  import axios from 'axios';
5
5
  import { IconButton, Menu, MenuItem, Popper, Grow, Paper, ClickAwayListener, MenuList, Typography, Box } from '@material-ui/core';
@@ -420,6 +420,9 @@ var userAddEditUrl = {
420
420
  setDefaultCard: function setDefaultCard(pmId, vendorId) {
421
421
  return env.getPaymentUrl() + "/api/v1/card/default";
422
422
  },
423
+ personalCardEligibility: function personalCardEligibility() {
424
+ return env.getPaymentUrl() + "/api/v1/card/clients/" + IUILocalStorageService.getClientId() + "/personal/eligibility?app_type=1";
425
+ },
423
426
  disablePaymentCard: function disablePaymentCard() {
424
427
  return env.getPaymentUrl() + "/api/v1/card/status";
425
428
  },
@@ -2661,7 +2664,8 @@ var Visa = function Visa(props) {
2661
2664
  };
2662
2665
 
2663
2666
  var IUILocalStorageService$3 = services.IUILocalStorageService;
2664
- var env$3 = configs.env;
2667
+ var env$3 = configs.env,
2668
+ paymentApi$1 = configs.paymentApi;
2665
2669
  var CardsManagement = function CardsManagement(_ref) {
2666
2670
  var _selectedCard$metadat, _pg$gateway;
2667
2671
  var _ref$paymentDetails = _ref.paymentDetails,
@@ -2682,6 +2686,23 @@ var CardsManagement = function CardsManagement(_ref) {
2682
2686
  var _useState2 = useState(null),
2683
2687
  selectedCard = _useState2[0],
2684
2688
  setSelectedCard = _useState2[1];
2689
+ var _useState3 = useState(false),
2690
+ allowPersonalCardAdd = _useState3[0],
2691
+ setAllowPersonalCardAdd = _useState3[1];
2692
+ useEffect(function () {
2693
+ var isActive = true;
2694
+ paymentApi$1.get(userAddEditUrl.personalCardEligibility()).then(function (res) {
2695
+ if (isActive) {
2696
+ var _res$data, _res$data$data;
2697
+ 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);
2698
+ }
2699
+ })["catch"](function () {
2700
+ if (isActive) setAllowPersonalCardAdd(false);
2701
+ });
2702
+ return function () {
2703
+ isActive = false;
2704
+ };
2705
+ }, []);
2685
2706
  var handleMenuClick = function handleMenuClick(event, card) {
2686
2707
  setAnchorEl(event.currentTarget);
2687
2708
  setSelectedCard(card);
@@ -2899,7 +2920,7 @@ var CardsManagement = function CardsManagement(_ref) {
2899
2920
  return renderCard(card);
2900
2921
  }) : null, corporateCards.length !== 0 ? corporateCards === null || corporateCards === void 0 ? void 0 : corporateCards.map(function (card) {
2901
2922
  return renderCard(card);
2902
- }) : 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.createElement("button", {
2923
+ }) : 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.createElement("button", {
2903
2924
  className: classes.addCardButton,
2904
2925
  onClick: function onClick() {
2905
2926
  sendLog({