@itilite/iui-user-management 1.4.751 → 1.4.761

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,22 +1,19 @@
1
- import { IUIAsyncSelect, IUIBox, IUILabel, IUIFileUpload, IUICheckboxButton, IUIPhone, IUISelect, IUIDatePicker, IUIInput, IUIDivider, IUIGrid, IUITypography, IUIRadio, IUIButton, IUIModal, IUISearch, IUICircularProgress, IUIAccordion, IUIAccordionSummary, IUIAccordionDetails, IUICard, IUIBackdrop, IUIBreadCrumb, IUIDropzone, IUIStepper, IUIIconButton, IUIFormControlLabel, IUICheckBox, IUIPrimaryRadio, IUITable, IUISkeleton, IUIProfileBox, IUIFormGroup, IUIDropdownButton, IUITabs } from '@itilite/iuistyles';
2
- import React, { useState, useEffect, memo, useRef, Fragment as Fragment$1 } from 'react';
1
+ import { IUIAsyncSelect, IUIBox, IUILabel, IUIFileUpload, IUICheckboxButton, IUIPhone, IUISelect, IUIDatePicker, IUIInput, IUIGrid, IUIDivider, IUITypography, IUIRadio, IUIButton, IUIModal, IUISearch, IUICircularProgress, IUIAccordion, IUIAccordionSummary, IUIAccordionDetails, IUICard, IUIBackdrop, IUIBreadCrumb, IUIDropzone, IUIStepper, IUIIconButton, IUIFormControlLabel, IUICheckBox, IUIPrimaryRadio, IUITable, IUISkeleton, IUIProfileBox, IUIFormGroup, IUIDropdownButton, IUITabs } from '@itilite/iuistyles';
2
+ import React, { useState, Fragment as Fragment$1, useEffect, memo, useRef } from 'react';
3
3
  import { configs, services, utilUrls } from '@itilite/utils';
4
4
  import axios from 'axios';
5
- import AddIcon$1 from '@material-ui/icons/Add';
6
- import DeleteIcon$1 from '@material-ui/icons/Delete';
5
+ import { IconButton, Menu, MenuItem, Popper, Grow, Paper, ClickAwayListener, MenuList, Typography, Box } from '@material-ui/core';
7
6
  import { useDispatch, useSelector, Provider } from 'react-redux';
8
7
  import { combineReducers, createStore, applyMiddleware } from 'redux';
9
8
  import thunk from 'redux-thunk';
10
9
  import moment from 'moment';
11
10
  import { composeWithDevTools } from 'redux-devtools-extension';
12
11
  import { useParams, useHistory, useLocation } from 'react-router-dom';
13
- import { CalendarButton } from '@itilite/third-party-integrations';
14
12
  import { withStyles, makeStyles } from '@material-ui/core/styles';
15
13
  import Tooltip from '@material-ui/core/Tooltip';
16
14
  import Switch from '@material-ui/core/Switch';
17
15
  import MoreHorizIcon from '@material-ui/icons/MoreHoriz';
18
16
  import Button from '@material-ui/core/Button';
19
- import { Popper, Grow, Paper, ClickAwayListener, MenuList, MenuItem, Typography, Box } from '@material-ui/core';
20
17
  import { useScrollPosition } from '@n8tb1t/use-scroll-position';
21
18
 
22
19
  function _arrayLikeToArray(r, a) {
@@ -827,7 +824,9 @@ var UserRole = function UserRole(_ref) {
827
824
  }));
828
825
  };
829
826
 
830
- var styles$1 = {"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","defaultLabel":"_smjc4","defaultBtn":"_1_ArA","cursonPointer":"_1L115","sectionWrapper":"_VpUCK","margin":"_1Fs_D","minGridWidth":"_1hl-Z","firstRowMargin":"_1WZZj","firstChildMargin":"_IT_O_","paddingTop":"_Mhnl7","dividerColor":"_3ltFd"};
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
+
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"};
831
830
 
832
831
  var SHOW_LOADER = 'SHOW_LOADER';
833
832
  var STOP_LOADER = 'STOP_LOADER';
@@ -2235,84 +2234,193 @@ var editCustomFieldLabel = function editCustomFieldLabel(payload) {
2235
2234
 
2236
2235
  var IUILocalStorageService$4 = services.IUILocalStorageService;
2237
2236
  var env$3 = configs.env;
2238
- var CreditCard = function CreditCard(_ref) {
2239
- var cardId = _ref.cardId,
2240
- lastDigit = _ref.lastDigit,
2241
- expMonth = _ref.expMonth,
2242
- expYear = _ref.expYear,
2243
- cardBrand = _ref.cardBrand,
2244
- _ref$isDefaultCard = _ref.isDefaultCard,
2245
- isDefaultCard = _ref$isDefaultCard === void 0 ? false : _ref$isDefaultCard,
2246
- pg = _ref.pg;
2237
+ var CardsManagement = function CardsManagement(_ref) {
2238
+ var _pg$gateway;
2239
+ var _ref$paymentDetails = _ref.paymentDetails,
2240
+ paymentDetails = _ref$paymentDetails === void 0 ? {} : _ref$paymentDetails;
2247
2241
  var dispatch = useDispatch();
2248
- var handleCardDelete = function handleCardDelete() {
2249
- dispatch(deletePaymentCard({
2250
- pmId: cardId,
2251
- vendorId: pg.vendor_id
2252
- }));
2253
- };
2254
- var setDefaultCard = function setDefaultCard() {
2242
+ var pg = paymentDetails.pg,
2243
+ _paymentDetails$cards = paymentDetails.cards,
2244
+ cards = _paymentDetails$cards === void 0 ? null : _paymentDetails$cards;
2245
+ var _useState = useState(null),
2246
+ anchorEl = _useState[0],
2247
+ setAnchorEl = _useState[1];
2248
+ var _useState2 = useState(null),
2249
+ selectedCard = _useState2[0],
2250
+ setSelectedCard = _useState2[1];
2251
+ var handleMenuClick = function handleMenuClick(event, card) {
2252
+ setAnchorEl(event.currentTarget);
2253
+ setSelectedCard(card);
2254
+ };
2255
+ var handleMenuClose = function handleMenuClose() {
2256
+ setAnchorEl(null);
2257
+ setSelectedCard(null);
2258
+ };
2259
+ var handleMarkAsDefault = function handleMarkAsDefault() {
2260
+ console.log('Mark as default:', selectedCard);
2261
+ if (!pg || !selectedCard) return;
2255
2262
  dispatch(setDefaultPaymentCard({
2256
2263
  user_id: +pg.user_id,
2257
- method_id: cardId,
2264
+ method_id: selectedCard.id,
2258
2265
  vendor_id: +pg.vendor_id,
2259
2266
  app_type: 1
2260
2267
  }));
2268
+ handleMenuClose();
2261
2269
  };
2262
- return /*#__PURE__*/React.createElement("div", {
2263
- className: styles$1.card
2264
- }, /*#__PURE__*/React.createElement("div", {
2265
- className: styles$1.cardLabel
2266
- }, isDefaultCard ? /*#__PURE__*/React.createElement("span", {
2267
- className: styles$1.defaultLabel
2268
- }, "Default Card") : /*#__PURE__*/React.createElement("button", {
2269
- type: "button",
2270
- onClick: setDefaultCard,
2271
- className: styles$1.defaultBtn
2272
- }, "Make This Default")), !isDefaultCard && /*#__PURE__*/React.createElement("div", {
2273
- className: styles$1.cardDeleteBtn
2274
- }, /*#__PURE__*/React.createElement("button", {
2275
- type: "button",
2276
- onClick: handleCardDelete
2277
- }, /*#__PURE__*/React.createElement(DeleteIcon$1, {
2278
- width: "10",
2279
- height: "10"
2280
- }))), /*#__PURE__*/React.createElement("div", {
2281
- className: styles$1.cardNumber
2282
- }, /*#__PURE__*/React.createElement("span", {
2283
- className: styles$1.cardDigit
2284
- }, "XXXX"), /*#__PURE__*/React.createElement("span", {
2285
- className: styles$1.cardDigit
2286
- }, "XXXX"), /*#__PURE__*/React.createElement("span", {
2287
- className: styles$1.cardDigit
2288
- }, "XXXX"), /*#__PURE__*/React.createElement("span", {
2289
- className: styles$1.cardDigit
2290
- }, lastDigit)), /*#__PURE__*/React.createElement("div", {
2291
- className: styles$1.expiryDate
2292
- }, expMonth, " / ", expYear), /*#__PURE__*/React.createElement("div", {
2293
- className: clsx(styles$1.cardImage, styles$1[cardBrand])
2294
- }));
2295
- };
2296
- var AddCard = function AddCard(_ref2) {
2297
- var pg = _ref2.pg;
2298
- var _url = env$3.getPaymentUrl() + ("/api/v1/auth/" + IUILocalStorageService$4.getAccessToken() + "/1/" + pg.entity_id + "/0/" + pg.vendor_id + "/1");
2299
- var handleAddCard = function handleAddCard() {
2300
- window.location.assign(_url);
2270
+ var handleDeleteCard = function handleDeleteCard() {
2271
+ dispatch(deletePaymentCard({
2272
+ pmId: selectedCard.id,
2273
+ vendorId: pg.vendor_id
2274
+ }));
2275
+ handleMenuClose();
2276
+ };
2277
+ var getBrandLogo = function getBrandLogo(brand) {
2278
+ var logos = {
2279
+ visa: 'https://upload.wikimedia.org/wikipedia/commons/0/04/Visa.svg',
2280
+ mastercard: 'https://upload.wikimedia.org/wikipedia/commons/2/2a/Mastercard-logo.svg',
2281
+ amex: 'https://upload.wikimedia.org/wikipedia/commons/3/30/American_Express_logo.svg'
2282
+ };
2283
+ return logos[brand.toLowerCase()] || '';
2301
2284
  };
2285
+ var getCardTypeClass = function getCardTypeClass(category) {
2286
+ return category === 'Corporate' ? 'corporate' : category === 'Company' ? 'company' : 'personal';
2287
+ };
2288
+ var getCardTypeLabel = function getCardTypeLabel(category) {
2289
+ return category === 'Corporate' ? 'CORPORATE' : category === 'Company' ? 'COMPANY' : 'PERSONAL';
2290
+ };
2291
+ var MoreIcon = function MoreIcon(_ref2) {
2292
+ var _ref2$color = _ref2.color,
2293
+ color = _ref2$color === void 0 ? '#3D89FF' : _ref2$color,
2294
+ className = _ref2.className;
2295
+ return /*#__PURE__*/React.createElement("svg", {
2296
+ width: "16",
2297
+ height: "16",
2298
+ viewBox: "0 0 16 16",
2299
+ fill: "none",
2300
+ className: className
2301
+ }, /*#__PURE__*/React.createElement("path", {
2302
+ d: "M0.8125 8.00439C0.8125 8.4188 0.97712 8.81622 1.27015 9.10925C1.56317 9.40227 1.9606 9.56689 2.375 9.56689C2.7894 9.56689 3.18683 9.40227 3.47985 9.10925C3.77288 8.81622 3.9375 8.4188 3.9375 8.00439C3.9375 7.58999 3.77288 7.19257 3.47985 6.89954C3.18683 6.60651 2.7894 6.44189 2.375 6.44189C1.9606 6.44189 1.56317 6.60651 1.27015 6.89954C0.97712 7.19257 0.8125 7.58999 0.8125 8.00439Z",
2303
+ stroke: color,
2304
+ strokeLinecap: "round",
2305
+ strokeLinejoin: "round"
2306
+ }), /*#__PURE__*/React.createElement("path", {
2307
+ d: "M6.4375 8.00439C6.4375 8.20958 6.47792 8.41277 6.55644 8.60234C6.63496 8.79191 6.75005 8.96416 6.89515 9.10925C7.04024 9.25434 7.21249 9.36943 7.40206 9.44796C7.59163 9.52648 7.79481 9.56689 8 9.56689C8.20519 9.56689 8.40837 9.52648 8.59794 9.44796C8.78751 9.36943 8.95976 9.25434 9.10485 9.10925C9.24995 8.96416 9.36504 8.79191 9.44356 8.60234C9.52208 8.41277 9.5625 8.20958 9.5625 8.00439C9.5625 7.7992 9.52208 7.59602 9.44356 7.40645C9.36504 7.21688 9.24995 7.04463 9.10485 6.89954C8.95976 6.75445 8.78751 6.63936 8.59794 6.56083C8.40837 6.48231 8.20519 6.44189 8 6.44189C7.79481 6.44189 7.59163 6.48231 7.40206 6.56083C7.21249 6.63936 7.04024 6.75445 6.89515 6.89954C6.75005 7.04463 6.63496 7.21688 6.55644 7.40645C6.47792 7.59602 6.4375 7.7992 6.4375 8.00439Z",
2308
+ stroke: color,
2309
+ strokeLinecap: "round",
2310
+ strokeLinejoin: "round"
2311
+ }), /*#__PURE__*/React.createElement("path", {
2312
+ d: "M12.0625 8.00439C12.0625 8.4188 12.2271 8.81622 12.5201 9.10925C12.8132 9.40227 13.2106 9.56689 13.625 9.56689C14.0394 9.56689 14.4368 9.40227 14.7299 9.10925C15.0229 8.81622 15.1875 8.4188 15.1875 8.00439C15.1875 7.58999 15.0229 7.19257 14.7299 6.89954C14.4368 6.60651 14.0394 6.44189 13.625 6.44189C13.2106 6.44189 12.8132 6.60651 12.5201 6.89954C12.2271 7.19257 12.0625 7.58999 12.0625 8.00439Z",
2313
+ stroke: color,
2314
+ strokeLinecap: "round",
2315
+ strokeLinejoin: "round"
2316
+ }));
2317
+ };
2318
+ var LockIcon = function LockIcon(_ref3) {
2319
+ return /*#__PURE__*/React.createElement("svg", {
2320
+ xmlns: "http://www.w3.org/2000/svg",
2321
+ width: "16",
2322
+ height: "16",
2323
+ viewBox: "0 0 16 16",
2324
+ fill: "none"
2325
+ }, /*#__PURE__*/React.createElement("path", {
2326
+ d: "M7.83562 1.50971L8 1.50439C9.32548 1.50439 10.41 2.53593 10.4947 3.84002L10.5 4.00439V5.00439H11.5C12.3284 5.00439 13 5.67597 13 6.50439V12.5044C13 13.3328 12.3284 14.0044 11.5 14.0044H4.5C3.67157 14.0044 3 13.3328 3 12.5044V6.50439C3 5.67597 3.67157 5.00439 4.5 5.00439H5.5V4.00439C5.5 2.67891 6.53154 1.59436 7.83562 1.50971ZM11.5 6.00439H4.5C4.22386 6.00439 4 6.22825 4 6.50439V12.5044C4 12.7805 4.22386 13.0044 4.5 13.0044H11.5C11.7761 13.0044 12 12.7805 12 12.5044V6.50439C12 6.22825 11.7761 6.00439 11.5 6.00439ZM8 8.50439C8.55228 8.50439 9 8.95211 9 9.50439C9 10.0567 8.55228 10.5044 8 10.5044C7.44772 10.5044 7 10.0567 7 9.50439C7 8.95211 7.44772 8.50439 8 8.50439ZM8.14446 2.51126L8 2.50439C7.2203 2.50439 6.57955 3.09928 6.50687 3.85993L6.5 4.00439V5.00439H9.5V4.00439C9.5 3.2247 8.90511 2.58395 8.14446 2.51126Z",
2327
+ fill: "#2EA363"
2328
+ }));
2329
+ };
2330
+ var renderCard = function renderCard(card) {
2331
+ var isCompanyCard = card.category === 'Company';
2332
+ var cardClass = getCardTypeClass(card.category);
2333
+ var isDefaultCard = !!+card.metadata.default_card;
2334
+ return /*#__PURE__*/React.createElement("div", {
2335
+ key: card.id,
2336
+ className: clsx(classes.card, classes[cardClass])
2337
+ }, /*#__PURE__*/React.createElement("div", {
2338
+ className: classes.cardHeader
2339
+ }, /*#__PURE__*/React.createElement("div", {
2340
+ className: classes.cardTitleSection
2341
+ }, /*#__PURE__*/React.createElement("h3", {
2342
+ className: classes.cardName
2343
+ }, card.name), /*#__PURE__*/React.createElement("span", {
2344
+ className: classes.cardType
2345
+ }, getCardTypeLabel(card.category))), isCompanyCard ? /*#__PURE__*/React.createElement(LockIcon, {
2346
+ className: classes.lockIcon
2347
+ }) : /*#__PURE__*/React.createElement(IconButton, {
2348
+ size: "small",
2349
+ onClick: function onClick(e) {
2350
+ return handleMenuClick(e, card);
2351
+ },
2352
+ className: classes.menuButton
2353
+ }, /*#__PURE__*/React.createElement(MoreIcon, {
2354
+ className: clsx(classes.moreIcon, classes[cardClass]),
2355
+ color: isCompanyCard ? '#10B981' : '#3D89FF'
2356
+ }))), /*#__PURE__*/React.createElement("div", {
2357
+ className: classes.cardDetails
2358
+ }, /*#__PURE__*/React.createElement("div", {
2359
+ className: classes.cardNumber
2360
+ }, /*#__PURE__*/React.createElement("span", {
2361
+ className: classes.cardMaskedNumber
2362
+ }, "\u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022 \u2022\u2022\u2022\u2022"), ' ', card.card.last4), /*#__PURE__*/React.createElement("div", {
2363
+ className: classes.cardExpiry
2364
+ }, "Expiry date ", card.card.exp_month, "/", String(card.card.exp_year).slice(-2)), /*#__PURE__*/React.createElement("div", {
2365
+ className: classes.cardCvv
2366
+ }, "CVV \u2022\u2022\u2022")), /*#__PURE__*/React.createElement("div", {
2367
+ className: classes.cardFooter
2368
+ }, isDefaultCard ? /*#__PURE__*/React.createElement("div", {
2369
+ className: styles$1.defaultLabel
2370
+ }, "Default Card") : /*#__PURE__*/React.createElement("div", null), /*#__PURE__*/React.createElement("img", {
2371
+ src: getBrandLogo(card.card.brand),
2372
+ alt: card.card.brand,
2373
+ className: classes.brandLogo
2374
+ })));
2375
+ };
2376
+ var personalCards = cards.filter(function (card) {
2377
+ return card.category === 'Personal';
2378
+ });
2379
+ var corporateCards = cards.filter(function (card) {
2380
+ return card.category === 'Corporate';
2381
+ });
2382
+ var companyCards = cards.filter(function (card) {
2383
+ return card.category === 'Company';
2384
+ });
2385
+ var _url = env$3.getPaymentUrl() + ("/api/v1/auth/" + IUILocalStorageService$4.getAccessToken() + "/1/" + pg.entity_id + "/0/" + pg.vendor_id + "/1");
2302
2386
  return /*#__PURE__*/React.createElement("div", {
2303
- className: clsx(styles$1.card, styles$1.cursonPointer),
2304
- onClick: handleAddCard
2305
- }, /*#__PURE__*/React.createElement("div", {
2306
- className: styles$1.addCard
2307
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(AddIcon$1, null)), /*#__PURE__*/React.createElement("div", null, "Add New Card")));
2308
- };
2309
- var PaymentCards = function PaymentCards(_ref3) {
2310
- var _paymentDetails$pg, _paymentDetails$pg2;
2311
- var paymentDetails = _ref3.paymentDetails;
2312
- 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)) {
2313
- return /*#__PURE__*/React.createElement(React.Fragment, null);
2314
- }
2315
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIDivider, {
2387
+ style: {
2388
+ marginBottom: -20
2389
+ }
2390
+ }, /*#__PURE__*/React.createElement(IUIGrid, {
2391
+ container: true,
2392
+ className: clsx(styles$1.sectionWrapper)
2393
+ }, /*#__PURE__*/React.createElement(IUIGrid, {
2394
+ item: true,
2395
+ sm: 12,
2396
+ md: 4
2397
+ }, /*#__PURE__*/React.createElement(IUILabel, {
2398
+ label: "My cards",
2399
+ headerType: true,
2400
+ description: "These are personal & company issued cards owned by you."
2401
+ })), /*#__PURE__*/React.createElement(IUIGrid, {
2402
+ item: true,
2403
+ sm: 12,
2404
+ md: 8,
2405
+ lg: 8,
2406
+ xl: 6
2407
+ }, /*#__PURE__*/React.createElement(IUIGrid, {
2408
+ container: true,
2409
+ className: styles$1.formFieldsWrapper
2410
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
2411
+ className: classes.cardsGrid
2412
+ }, personalCards.map(function (card) {
2413
+ return renderCard(card);
2414
+ }), corporateCards.map(function (card) {
2415
+ return renderCard(card);
2416
+ })), (!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", {
2417
+ className: classes.addCardButton,
2418
+ onClick: function onClick() {
2419
+ return window.location.assign(_url);
2420
+ }
2421
+ }, /*#__PURE__*/React.createElement("span", {
2422
+ className: classes.plusIcon
2423
+ }, "+"), " Add card")))))), (companyCards === null || companyCards === void 0 ? void 0 : companyCards.length) !== 0 && /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(IUIDivider, {
2316
2424
  className: styles$1.dividerColor
2317
2425
  }), /*#__PURE__*/React.createElement(IUIGrid, {
2318
2426
  container: true,
@@ -2322,9 +2430,9 @@ var PaymentCards = function PaymentCards(_ref3) {
2322
2430
  sm: 12,
2323
2431
  md: 4
2324
2432
  }, /*#__PURE__*/React.createElement(IUILabel, {
2325
- label: "Card Details",
2326
- headerType: true,
2327
- description: ""
2433
+ label: "Company cards",
2434
+ description: "These are the centralized cards owned by your company.",
2435
+ headerType: true
2328
2436
  })), /*#__PURE__*/React.createElement(IUIGrid, {
2329
2437
  item: true,
2330
2438
  sm: 12,
@@ -2334,20 +2442,43 @@ var PaymentCards = function PaymentCards(_ref3) {
2334
2442
  }, /*#__PURE__*/React.createElement(IUIGrid, {
2335
2443
  container: true,
2336
2444
  className: styles$1.formFieldsWrapper
2337
- }, /*#__PURE__*/React.createElement(React.Fragment, null, paymentDetails.cards && paymentDetails.cards.map(function (card) {
2338
- return /*#__PURE__*/React.createElement(CreditCard, {
2339
- key: card.id,
2340
- cardId: card.id,
2341
- lastDigit: card.card.last4,
2342
- expMonth: card.card.exp_month,
2343
- expYear: card.card.exp_year,
2344
- cardBrand: card.card.brand,
2345
- isDefaultCard: !!+card.metadata.default_card,
2346
- pg: paymentDetails.pg
2347
- });
2348
- }), (!paymentDetails.cards || paymentDetails.cards.length < 10) && paymentDetails.pg.gateway.toLowerCase() === 'stripe' && paymentDetails.pg.save_card_enable === 1 && /*#__PURE__*/React.createElement(AddCard, {
2349
- pg: paymentDetails.pg
2350
- }))))));
2445
+ }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
2446
+ className: classes.cardsGrid
2447
+ }, companyCards.map(function (card) {
2448
+ return renderCard(card);
2449
+ }))))))), /*#__PURE__*/React.createElement(Menu, {
2450
+ anchorEl: anchorEl,
2451
+ open: Boolean(anchorEl),
2452
+ onClose: handleMenuClose,
2453
+ anchorOrigin: {
2454
+ vertical: 'top',
2455
+ horizontal: 'right'
2456
+ },
2457
+ transformOrigin: {
2458
+ vertical: 'top',
2459
+ horizontal: 'right'
2460
+ }
2461
+ }, /*#__PURE__*/React.createElement(MenuItem, {
2462
+ onClick: handleMarkAsDefault
2463
+ }, "Mark as default"), /*#__PURE__*/React.createElement(MenuItem, {
2464
+ onClick: handleDeleteCard,
2465
+ style: {
2466
+ color: '#ff4444'
2467
+ }
2468
+ }, "Delete card")));
2469
+ };
2470
+
2471
+ var PaymentCards = function PaymentCards(_ref) {
2472
+ var _paymentDetails$pg, _paymentDetails$pg2;
2473
+ var paymentDetails = _ref.paymentDetails;
2474
+ 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)) {
2475
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
2476
+ }
2477
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IUIDivider, {
2478
+ className: styles$1.dividerColor
2479
+ }), /*#__PURE__*/React.createElement(CardsManagement, {
2480
+ paymentDetails: paymentDetails
2481
+ }));
2351
2482
  };
2352
2483
 
2353
2484
  function AddIcon(props) {
@@ -2716,7 +2847,7 @@ var TravelExpenseFields = function TravelExpenseFields(props) {
2716
2847
  isError: !!errMsg[i],
2717
2848
  placeholder: "Example label - \u201CManager\u201D"
2718
2849
  }));
2719
- })))), type === 'travel' && isProfile && paymentDetails && /*#__PURE__*/React.createElement(PaymentCards, {
2850
+ })))), type === 'travel' && paymentDetails && /*#__PURE__*/React.createElement(PaymentCards, {
2720
2851
  paymentDetails: paymentDetails
2721
2852
  }));
2722
2853
  };
@@ -7750,8 +7881,6 @@ var UserAddEdit = function UserAddEdit(props) {
7750
7881
  isProfile: isProfile,
7751
7882
  editUserId: editUserId,
7752
7883
  roles: renderFields.travelRoles
7753
- }), /*#__PURE__*/React.createElement(IUIDivider, {
7754
- className: styles.dividerColor
7755
7884
  }), /*#__PURE__*/React.createElement(AdditionalInfo, {
7756
7885
  membershipInfoInput: membershipInfoInput,
7757
7886
  onMemInfoInputChange: onMemInfoInputChange,
@@ -7811,54 +7940,7 @@ var UserAddEdit = function UserAddEdit(props) {
7811
7940
  cardsAdmin: isCardsAdmin,
7812
7941
  editUserId: editUserId,
7813
7942
  loggedInUserId: id === null || id === void 0 ? void 0 : id.toString()
7814
- }), isProfile && !!personalInfoInput.email && /*#__PURE__*/React.createElement(Fragment$1, null, /*#__PURE__*/React.createElement(IUIDivider, {
7815
- className: styles.dividerColor
7816
- }), /*#__PURE__*/React.createElement(IUIGrid, {
7817
- container: true,
7818
- className: (styles.headingPadding)
7819
- }, /*#__PURE__*/React.createElement(IUITypography, {
7820
- variant: "h3",
7821
- className: clsx(styles.heading, styles.headingMedium)
7822
- }, "Google connect")), /*#__PURE__*/React.createElement(IUIDivider, {
7823
- className: styles.dividerColor
7824
- }), /*#__PURE__*/React.createElement(IUIGrid, {
7825
- container: true,
7826
- className: clsx(styles.product_info, styles.sectionWrapper)
7827
- }, /*#__PURE__*/React.createElement(IUIGrid, {
7828
- item: true,
7829
- sm: 12,
7830
- md: 4
7831
- }, /*#__PURE__*/React.createElement(IUILabel, {
7832
- label: "Google calender",
7833
- headerType: true
7834
- })), /*#__PURE__*/React.createElement(IUIGrid, {
7835
- item: true,
7836
- sm: 12,
7837
- md: 8,
7838
- lg: 8,
7839
- xl: 6
7840
- }, /*#__PURE__*/React.createElement(CalendarButton, {
7841
- email: personalInfoInput.email,
7842
- googleClientId: "827564411647-eet721luavtsdj28qdsq37abt7tuorkm.apps.googleusercontent.com",
7843
- outlookClientId: null,
7844
- apiBaseUrl: "https://connect.itilite.net",
7845
- buttonText: "Connect Calendar",
7846
- connectedText: "Calendar Connected",
7847
- disconnectText: "Disconnect Calendar",
7848
- onSuccess: function onSuccess(data) {
7849
- return console.log("Calendar connected:", data);
7850
- },
7851
- onError: function onError(error) {
7852
- return console.error("Calendar error:", error);
7853
- },
7854
- onDisconnect: function onDisconnect(data) {
7855
- return console.log("Calendar disconnected:", data);
7856
- },
7857
- className: "custom-class",
7858
- style: {
7859
- margin: "10px"
7860
- }
7861
- })))))) : /*#__PURE__*/React.createElement(VerificationError, {
7943
+ }))) : /*#__PURE__*/React.createElement(VerificationError, {
7862
7944
  config: config,
7863
7945
  errMsg: hasVerificationError
7864
7946
  }), /*#__PURE__*/React.createElement(AddPanelDialog, {
@@ -9390,7 +9472,7 @@ var BulkDownloadIcon = function BulkDownloadIcon(props) {
9390
9472
  }));
9391
9473
  };
9392
9474
 
9393
- var classes = {"containedBtn":"_2A4_u","customMiniBox":"_QGIKG","muiBtn":"_3iFbO","outlinedBtn":"_3lQYD","menuList":"_1C8bJ","menuListContainer":"_1N83W","menuItemContainer":"_3VtcE","menuItemtext":"_2xqnU","subTxt":"_3CVzX"};
9475
+ var classes$1 = {"containedBtn":"_2A4_u","customMiniBox":"_QGIKG","muiBtn":"_3iFbO","outlinedBtn":"_3lQYD","menuList":"_1C8bJ","menuListContainer":"_1N83W","menuItemContainer":"_3VtcE","menuItemtext":"_2xqnU","subTxt":"_3CVzX"};
9394
9476
 
9395
9477
  var DropdownBtn = function DropdownBtn(props) {
9396
9478
  var _clsx;
@@ -9449,7 +9531,7 @@ var DropdownBtn = function DropdownBtn(props) {
9449
9531
  }, [open]);
9450
9532
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
9451
9533
  endIcon: endIcon,
9452
- className: clsx(classes.muiBtn, className, (_clsx = {}, _clsx[classes.outlinedBtn] = outlinedBtn, _clsx)),
9534
+ className: clsx(classes$1.muiBtn, className, (_clsx = {}, _clsx[classes$1.outlinedBtn] = outlinedBtn, _clsx)),
9453
9535
  disableRipple: disableRipple,
9454
9536
  variant: "outlined",
9455
9537
  ref: anchorRef,
@@ -9475,13 +9557,13 @@ var DropdownBtn = function DropdownBtn(props) {
9475
9557
  transformOrigin: placement === 'bottom' ? 'center top' : 'center bottom'
9476
9558
  }
9477
9559
  }), /*#__PURE__*/React.createElement(Paper, {
9478
- className: classes.menuListContainer,
9560
+ className: classes$1.menuListContainer,
9479
9561
  elevation: 0
9480
9562
  }, /*#__PURE__*/React.createElement(ClickAwayListener, {
9481
9563
  onClickAway: handleClose
9482
9564
  }, /*#__PURE__*/React.createElement(MenuList, {
9483
9565
  autoFocusItem: open,
9484
- className: clsx(classes.menuList, (_clsx2 = {}, _clsx2[classes.outlinedBtn] = outlinedBtn, _clsx2), menuListClass),
9566
+ className: clsx(classes$1.menuList, (_clsx2 = {}, _clsx2[classes$1.outlinedBtn] = outlinedBtn, _clsx2), menuListClass),
9485
9567
  id: "menu-list-grow",
9486
9568
  onKeyDown: function onKeyDown(e) {
9487
9569
  return handleListKeyDown(e);
@@ -9492,13 +9574,13 @@ var DropdownBtn = function DropdownBtn(props) {
9492
9574
  return handleMenuClick(val);
9493
9575
  },
9494
9576
  key: _i,
9495
- className: clsx(classes.menuItemContainer, val.disable && 'iui__cursor-not-allowed'),
9577
+ className: clsx(classes$1.menuItemContainer, val.disable && 'iui__cursor-not-allowed'),
9496
9578
  disableRipple: true
9497
9579
  }, /*#__PURE__*/React.createElement(Typography, {
9498
- className: clsx(classes.menuItemtext, val && val.disable && 'iui__opacity--60')
9580
+ className: clsx(classes$1.menuItemtext, val && val.disable && 'iui__opacity--60')
9499
9581
  }, val.label), val.subText && /*#__PURE__*/React.createElement(IUITypography, {
9500
9582
  variant: "subtitle2",
9501
- className: clsx(classes.menuItemtext, classes.subTxt)
9583
+ className: clsx(classes$1.menuItemtext, classes$1.subTxt)
9502
9584
  }, val.subText));
9503
9585
  })))));
9504
9586
  }));