@itilite/iui-user-management 1.5.13 → 1.5.14-beta.2

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 { Tooltip, IconButton, Menu, MenuItem, Popper, Grow, Paper, ClickAwayListener, MenuList, Typography, Box } from '@material-ui/core';
@@ -182,7 +182,7 @@ function _finallyRethrows(body, finalizer) {
182
182
  return finalizer(false, result);
183
183
  }
184
184
 
185
- var styles = {"UUIUserManagementAddEdit":"_3n-WG","pageHeader":"_3qWcA","buttonWrapper":"_1IP9P","scrolled":"_m8f96","headingButtonWrapper":"_w9z7b","headingButtonWrapperProfile":"_12Wd9","hintText":"_ySdbZ","heading":"_2Y1Aw","headingLarge":"_2K1NF","headingMedium":"_RUuAz","headingSmall":"_23Dye","additionalInfoContainer":"_1Suhw","additionalInfoTitle":"_56iJF","titleContainer":"_H5nfl","expandIconAlign":"_3F4i0","detailsContainer":"_2G0LW","formWrapper":"_2fPRc","sectionWrapper":"_37Gqp","margin":"_2Sdl7","minGridWidth":"_2D7iu","firstRowMargin":"_1BozG","firstChildMargin":"_2C3Mb","paddingTop":"_DBPjV","backGrdColorOnHover":"_5oE6H","fieldMargin":"_RCWjq","productContainerGap":"_tuCbi","containerWidth":"_1oWos","productItemBroder":"_T0Hcd","headingPadding":"_2MFfQ","emptyFieldContainer":"_3VWtw","emptyFieldDescription":"_2jC5u","rowGap":"_1NJFY","formTitle":"_GAKk2","formDescription":"_3TZ6Z","themeLink":"_eJ_1B","dashedLine":"_3ZOs1","dividerColor":"_2pxEJ","errorTextCls":"_27eth","backdrop":"_Pm0Au","inputWidth":"_ajB82","buttonRight":"_1lEyQ","containedDropdownBtn":"_3ymE1"};
185
+ var styles = {"UUIUserManagementAddEdit":"_3n-WG","pageHeader":"_3qWcA","buttonWrapper":"_1IP9P","scrolled":"_m8f96","pageHeaderIframe":"_1D2-R","headingButtonWrapper":"_w9z7b","headingButtonWrapperProfile":"_12Wd9","hintText":"_ySdbZ","heading":"_2Y1Aw","headingLarge":"_2K1NF","headingMedium":"_RUuAz","headingSmall":"_23Dye","additionalInfoContainer":"_1Suhw","additionalInfoTitle":"_56iJF","titleContainer":"_H5nfl","expandIconAlign":"_3F4i0","detailsContainer":"_2G0LW","formWrapper":"_2fPRc","sectionWrapper":"_37Gqp","margin":"_2Sdl7","minGridWidth":"_2D7iu","firstRowMargin":"_1BozG","firstChildMargin":"_2C3Mb","paddingTop":"_DBPjV","backGrdColorOnHover":"_5oE6H","fieldMargin":"_RCWjq","productContainerGap":"_tuCbi","containerWidth":"_1oWos","productItemBroder":"_T0Hcd","headingPadding":"_2MFfQ","emptyFieldContainer":"_3VWtw","emptyFieldDescription":"_2jC5u","rowGap":"_1NJFY","formTitle":"_GAKk2","formDescription":"_3TZ6Z","themeLink":"_eJ_1B","dashedLine":"_3ZOs1","dividerColor":"_2pxEJ","errorTextCls":"_27eth","backdrop":"_Pm0Au","inputWidth":"_ajB82","buttonRight":"_1lEyQ","containedDropdownBtn":"_3ymE1"};
186
186
 
187
187
  function r(e) {
188
188
  var t,
@@ -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
  },
@@ -2667,7 +2670,8 @@ var CARDS_DISABLED = {
2667
2670
  };
2668
2671
 
2669
2672
  var IUILocalStorageService$3 = services.IUILocalStorageService;
2670
- var env$3 = configs.env;
2673
+ var env$3 = configs.env,
2674
+ paymentApi$1 = configs.paymentApi;
2671
2675
  var CardsManagement = function CardsManagement(_ref) {
2672
2676
  var _selectedCard$metadat, _pg$gateway;
2673
2677
  var _ref$paymentDetails = _ref.paymentDetails,
@@ -2688,6 +2692,23 @@ var CardsManagement = function CardsManagement(_ref) {
2688
2692
  var _useState2 = useState(null),
2689
2693
  selectedCard = _useState2[0],
2690
2694
  setSelectedCard = _useState2[1];
2695
+ var _useState3 = useState(false),
2696
+ allowPersonalCardAdd = _useState3[0],
2697
+ setAllowPersonalCardAdd = _useState3[1];
2698
+ useEffect(function () {
2699
+ var isActive = true;
2700
+ paymentApi$1.get(userAddEditUrl.personalCardEligibility()).then(function (res) {
2701
+ if (isActive) {
2702
+ var _res$data;
2703
+ setAllowPersonalCardAdd((res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.allow_personal_card_add) === true);
2704
+ }
2705
+ })["catch"](function () {
2706
+ if (isActive) setAllowPersonalCardAdd(false);
2707
+ });
2708
+ return function () {
2709
+ isActive = false;
2710
+ };
2711
+ }, []);
2691
2712
  var handleMenuClick = function handleMenuClick(event, card) {
2692
2713
  setAnchorEl(event.currentTarget);
2693
2714
  setSelectedCard(card);
@@ -2913,7 +2934,7 @@ var CardsManagement = function CardsManagement(_ref) {
2913
2934
  return renderCard(card);
2914
2935
  }) : null, corporateCards.length !== 0 ? corporateCards === null || corporateCards === void 0 ? void 0 : corporateCards.map(function (card) {
2915
2936
  return renderCard(card);
2916
- }) : 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", {
2937
+ }) : 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", {
2917
2938
  className: classes.addCardButton,
2918
2939
  onClick: function onClick() {
2919
2940
  sendLog({
@@ -2962,7 +2983,7 @@ var CardsManagement = function CardsManagement(_ref) {
2962
2983
  vertical: 'top',
2963
2984
  horizontal: 'right'
2964
2985
  }
2965
- }, selectedCard && selectedCard.metadata.is_enabled !== CARDS_DISABLED.EXPIRED && selectedCard.metadata.is_enabled !== CARDS_DISABLED.INVALID && !+selectedCard.metadata.default_card && /*#__PURE__*/React.createElement(MenuItem, {
2986
+ }, selectedCard && selectedCard.metadata.is_enabled !== CARDS_DISABLED.DISABLED && selectedCard.metadata.is_enabled !== CARDS_DISABLED.EXPIRED && selectedCard.metadata.is_enabled !== CARDS_DISABLED.INVALID && !+selectedCard.metadata.default_card && /*#__PURE__*/React.createElement(MenuItem, {
2966
2987
  onClick: handleMarkAsDefault
2967
2988
  }, "Mark as default"), showMenuButton && /*#__PURE__*/React.createElement(MenuItem, {
2968
2989
  onClick: handleDeleteCard,
@@ -6859,6 +6880,13 @@ var UserAddEdit = function UserAddEdit(props) {
6859
6880
  var _useState9 = useState(false),
6860
6881
  scroll = _useState9[0],
6861
6882
  setScroll = _useState9[1];
6883
+ var isInsideIframe = function () {
6884
+ try {
6885
+ return window.self !== window.top;
6886
+ } catch (e) {
6887
+ return true;
6888
+ }
6889
+ }();
6862
6890
  var _useState10 = useState({}),
6863
6891
  customFieldsInput = _useState10[0],
6864
6892
  setCustomFieldsInput = _useState10[1];
@@ -8205,7 +8233,7 @@ var UserAddEdit = function UserAddEdit(props) {
8205
8233
  color: "inherit"
8206
8234
  })), /*#__PURE__*/React.createElement(IUIBox, {
8207
8235
  component: "div",
8208
- className: clsx(styles.pageHeader, scroll ? styles.scrolled : '')
8236
+ className: clsx(styles.pageHeader, scroll ? styles.scrolled : '', isInsideIframe ? styles.pageHeaderIframe : '')
8209
8237
  }, !isProfile && /*#__PURE__*/React.createElement(IUIBox, {
8210
8238
  component: "div",
8211
8239
  className: styles.breadcrumb
@@ -10170,7 +10198,6 @@ var DropdownBtn = function DropdownBtn(props) {
10170
10198
  anchorEl: anchorRef.current,
10171
10199
  role: undefined,
10172
10200
  transition: true,
10173
- disablePortal: true,
10174
10201
  style: {
10175
10202
  zIndex: '9'
10176
10203
  },
@@ -10705,9 +10732,11 @@ var UndoButton = function UndoButton(_ref) {
10705
10732
  }, "UNDO"));
10706
10733
  };
10707
10734
  var UserList = function UserList(_ref2) {
10735
+ var _config$features;
10708
10736
  var config = _ref2.config,
10709
10737
  isProfile = _ref2.isProfile;
10710
10738
  env$7.init(config, isProfile);
10739
+ var hideSignupRequestsTab = !!(config !== null && config !== void 0 && (_config$features = config.features) !== null && _config$features !== void 0 && _config$features.hideSignupRequestsTab);
10711
10740
  var history = useHistory();
10712
10741
  var _useSelector = useSelector(function (state) {
10713
10742
  return state.userList;
@@ -11308,6 +11337,10 @@ var UserList = function UserList(_ref2) {
11308
11337
  if (!isSearchingChange && !isSortingChange && !isSignUpSearchingChange && !isSignUpSortingChange) {
11309
11338
  dispatch(showDataFetchingStatus());
11310
11339
  dispatch(fetchUsersList(url)).then(function () {
11340
+ if (hideSignupRequestsTab) {
11341
+ dispatch(stopDataFetchingStatus());
11342
+ return;
11343
+ }
11311
11344
  dispatch(fetchUserSignupRequests({
11312
11345
  ordering: signup_order === 'asc' ? signup_orderBy : "-" + signup_orderBy,
11313
11346
  length: signup_rowsPerPage,
@@ -11361,6 +11394,38 @@ var UserList = function UserList(_ref2) {
11361
11394
  onClick: handleAddPageNavigation
11362
11395
  })));
11363
11396
  };
11397
+ var currentUsersPanel = /*#__PURE__*/React.createElement(IUIBox, {
11398
+ style: {
11399
+ marginLeft: '-17px'
11400
+ }
11401
+ }, /*#__PURE__*/React.createElement(IUIBox, {
11402
+ component: "div",
11403
+ className: styles$6.headingWrapper
11404
+ }, /*#__PURE__*/React.createElement(IUITypography, {
11405
+ variant: "body2",
11406
+ className: clsx(styles$6.description)
11407
+ }, "Create new users, customize user permissions and manage user accounts")), /*#__PURE__*/React.createElement(StickyHeadTable, {
11408
+ data: userListInfo,
11409
+ handleChangeRowsPerPage: handleChangeRowsPerPage,
11410
+ handleChangePage: handleChangePage,
11411
+ page: page,
11412
+ rowsPerPage: rowsPerPage,
11413
+ handleActiveUser: handleActiveUser,
11414
+ handleSelectAllClick: handleSelectAllClick,
11415
+ selected: selected,
11416
+ handleSingleCheckBoxClick: handleSingleCheckBoxClick,
11417
+ orderBy: orderBy,
11418
+ order: order,
11419
+ onRequestSort: onRequestSort,
11420
+ onSearchHandler: onSearchHandler,
11421
+ onEditHandler: handleEditUserClick,
11422
+ disableRowCheckbox: deactivatedUsers,
11423
+ searchValue: searchValue,
11424
+ isILadmin: isILadmin,
11425
+ onPrimaryAdminHandler: onPrimaryAdminHandler,
11426
+ onResetPasswordHandler: onResetPasswordHandler,
11427
+ toggleInviteModal: toggleInviteModal
11428
+ }));
11364
11429
  return /*#__PURE__*/React.createElement(IUIBox, {
11365
11430
  component: "div",
11366
11431
  className: styles$6.UUIUserManagementList
@@ -11435,7 +11500,7 @@ var UserList = function UserList(_ref2) {
11435
11500
  alignItems: "center"
11436
11501
  })), /*#__PURE__*/React.createElement(IUIBox, {
11437
11502
  className: styles$6.tablewrapper
11438
- }, /*#__PURE__*/React.createElement(IUITabs, {
11503
+ }, hideSignupRequestsTab ? currentUsersPanel : /*#__PURE__*/React.createElement(IUITabs, {
11439
11504
  value: tabValue,
11440
11505
  customTabHandler: function customTabHandler(value) {
11441
11506
  return dispatch(updateTabValue(value));
@@ -11445,38 +11510,7 @@ var UserList = function UserList(_ref2) {
11445
11510
  label: /*#__PURE__*/React.createElement(IUIBox, null, "Current users", ' ', /*#__PURE__*/React.createElement(TabLabelCount, {
11446
11511
  count: userListInfo.count
11447
11512
  }), ' '),
11448
- content: /*#__PURE__*/React.createElement(IUIBox, {
11449
- style: {
11450
- marginLeft: '-17px'
11451
- }
11452
- }, /*#__PURE__*/React.createElement(IUIBox, {
11453
- component: "div",
11454
- className: styles$6.headingWrapper
11455
- }, /*#__PURE__*/React.createElement(IUITypography, {
11456
- variant: "body2",
11457
- className: clsx(styles$6.description)
11458
- }, "Create new users, customize user permissions and manage user accounts")), /*#__PURE__*/React.createElement(StickyHeadTable, {
11459
- data: userListInfo,
11460
- handleChangeRowsPerPage: handleChangeRowsPerPage,
11461
- handleChangePage: handleChangePage,
11462
- page: page,
11463
- rowsPerPage: rowsPerPage,
11464
- handleActiveUser: handleActiveUser,
11465
- handleSelectAllClick: handleSelectAllClick,
11466
- selected: selected,
11467
- handleSingleCheckBoxClick: handleSingleCheckBoxClick,
11468
- orderBy: orderBy,
11469
- order: order,
11470
- onRequestSort: onRequestSort,
11471
- onSearchHandler: onSearchHandler,
11472
- onEditHandler: handleEditUserClick,
11473
- disableRowCheckbox: deactivatedUsers,
11474
- searchValue: searchValue,
11475
- isILadmin: isILadmin,
11476
- onPrimaryAdminHandler: onPrimaryAdminHandler,
11477
- onResetPasswordHandler: onResetPasswordHandler,
11478
- toggleInviteModal: toggleInviteModal
11479
- }))
11513
+ content: currentUsersPanel
11480
11514
  }, {
11481
11515
  label: /*#__PURE__*/React.createElement(IUIBox, null, "Sign-up requests", ' ', /*#__PURE__*/React.createElement(TabLabelCount, {
11482
11516
  count: signupRequestListInfo.count