@itilite/iui-user-management 1.4.85 → 1.4.87

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,4 +1,4 @@
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';
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, IUIDropdownButton, IUIDropzone, IUIStepper, IUIIconButton, IUIFormControlLabel, IUICheckBox, IUIPrimaryRadio, IUITable, IUISkeleton, IUIProfileBox, IUIFormGroup, IUITabs } from '@itilite/iuistyles';
2
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';
@@ -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"};
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"};
186
186
 
187
187
  function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
188
188
 
@@ -886,6 +886,9 @@ var formatCreateUserPayload = function formatCreateUserPayload(payload) {
886
886
  approvers: {},
887
887
  requested_user_is_admin: payload.isCardsAdmin
888
888
  };
889
+ if (payload.send_welcome_email !== undefined) {
890
+ res.send_welcome_email = payload.send_welcome_email;
891
+ }
889
892
  var userTags = [];
890
893
  for (var key in payload.userTagType) {
891
894
  if (Object.hasOwnProperty.call(payload.userTagType, key) && payload.userTagType[key]) {
@@ -5067,6 +5070,7 @@ function withStore(Component) {
5067
5070
  }
5068
5071
 
5069
5072
  var ExpandMoreIcon = function ExpandMoreIcon(props) {
5073
+ var fillColor = props.fillColor || '#6B7280';
5070
5074
  return /*#__PURE__*/React.createElement("svg", {
5071
5075
  xmlns: "http://www.w3.org/2000/svg",
5072
5076
  width: props.width,
@@ -5074,7 +5078,7 @@ var ExpandMoreIcon = function ExpandMoreIcon(props) {
5074
5078
  fill: "none",
5075
5079
  viewBox: "0 0 12 7"
5076
5080
  }, /*#__PURE__*/React.createElement("path", {
5077
- fill: "#6B7280",
5081
+ fill: fillColor,
5078
5082
  d: "M.293.294a1 1 0 011.414 0L6 4.587 10.293.294a1 1 0 111.414 1.414l-5 5a1 1 0 01-1.414 0l-5-5a1 1 0 010-1.414z"
5079
5083
  }));
5080
5084
  };
@@ -7723,7 +7727,10 @@ var UserAddEdit = function UserAddEdit(props) {
7723
7727
  return Promise.reject(e);
7724
7728
  }
7725
7729
  };
7726
- var formSubmitHandler = function formSubmitHandler() {
7730
+ var formSubmitHandler = function formSubmitHandler(send_welcome_email) {
7731
+ if (send_welcome_email === void 0) {
7732
+ send_welcome_email = false;
7733
+ }
7727
7734
  try {
7728
7735
  var checkAnyError = doesFormHasError();
7729
7736
  if (checkAnyError) {
@@ -7761,6 +7768,9 @@ var UserAddEdit = function UserAddEdit(props) {
7761
7768
  cardsRole: cardsRole,
7762
7769
  isCardsAdmin: isCardsAdmin
7763
7770
  };
7771
+ if (!isEditMode && !isProfile) {
7772
+ payload.send_welcome_email = send_welcome_email;
7773
+ }
7764
7774
  if (verifyUserId) {
7765
7775
  payload.verifyUserId = verifyUserId;
7766
7776
  }
@@ -8149,12 +8159,34 @@ var UserAddEdit = function UserAddEdit(props) {
8149
8159
  onClick: handleCancelNavigation
8150
8160
  })), /*#__PURE__*/React.createElement(IUIBox, {
8151
8161
  component: "div",
8152
- className: "pageHeader--button-single button-right"
8153
- }, /*#__PURE__*/React.createElement(IUIButton, {
8162
+ className: clsx('pageHeader--button-single', styles.buttonRight)
8163
+ }, isEditMode || isProfile ? /*#__PURE__*/React.createElement(IUIButton, {
8154
8164
  buttonText: "Save",
8155
8165
  type: "contained",
8156
8166
  onClick: formSubmitHandler,
8157
8167
  disabled: isPageLoading || productAccess.travel === false && productAccess.expense === false || !!doesFormHasError()
8168
+ }) : /*#__PURE__*/React.createElement(IUIDropdownButton, {
8169
+ buttonText: "Create user",
8170
+ outlinedBtn: false,
8171
+ className: styles.containedDropdownBtn,
8172
+ placement: "bottom-end",
8173
+ endIcon: /*#__PURE__*/React.createElement(ExpandMoreIcon, {
8174
+ fillColor: "white",
8175
+ width: "10",
8176
+ height: "10",
8177
+ fill: true
8178
+ }),
8179
+ menuListInfo: [{
8180
+ label: 'Send email invite',
8181
+ handler: function handler() {
8182
+ return formSubmitHandler(true);
8183
+ }
8184
+ }, {
8185
+ label: 'Do not send email',
8186
+ handler: function handler() {
8187
+ return formSubmitHandler(false);
8188
+ }
8189
+ }]
8158
8190
  }))))), /*#__PURE__*/React.createElement(IUIBox, {
8159
8191
  component: "div",
8160
8192
  marginTop: "8rem",
@@ -8666,10 +8698,15 @@ var downloadUploadedRecords = function downloadUploadedRecords(type, jobId) {
8666
8698
  });
8667
8699
  };
8668
8700
  };
8669
- var importUploadedRecords = function importUploadedRecords(jobId, canUpdateExistingUsers) {
8701
+ var importUploadedRecords = function importUploadedRecords(jobId, canUpdateExistingUsers, sendInvite) {
8702
+ if (sendInvite === void 0) {
8703
+ sendInvite = false;
8704
+ }
8670
8705
  return function (dispatch) {
8671
8706
  return new Promise(function (resolve, reject) {
8672
- api$8.post(userBulkImport.importRecords() + "?job_id=" + jobId + "&update=" + canUpdateExistingUsers).then(function (res) {
8707
+ api$8.post(userBulkImport.importRecords() + "?job_id=" + jobId + "&update=" + canUpdateExistingUsers, {
8708
+ send_welcome_email: sendInvite
8709
+ }).then(function (res) {
8673
8710
  resolve(res);
8674
8711
  })["catch"](function (err) {
8675
8712
  reject(err);
@@ -8931,8 +8968,11 @@ var UserBulkUpload = function UserBulkUpload(_ref) {
8931
8968
  canUpdateExistingUsers = _useState5[0],
8932
8969
  setCanUpdateExistingUsers = _useState5[1];
8933
8970
  var _useState6 = useState(false),
8934
- isFileDownloading = _useState6[0],
8935
- setDownlStatus = _useState6[1];
8971
+ sendInvite = _useState6[0],
8972
+ setSendInvite = _useState6[1];
8973
+ var _useState7 = useState(false),
8974
+ isFileDownloading = _useState7[0],
8975
+ setDownlStatus = _useState7[1];
8936
8976
  var _useSelector = useSelector(function (state) {
8937
8977
  return state.common;
8938
8978
  }),
@@ -9040,7 +9080,7 @@ var UserBulkUpload = function UserBulkUpload(_ref) {
9040
9080
  }
9041
9081
  }
9042
9082
  setImportStatus(1);
9043
- return Promise.resolve(dispatch(importUploadedRecords(jobId, canUpdateExistingUsers ? 1 : 0))).then(function (res) {
9083
+ return Promise.resolve(dispatch(importUploadedRecords(jobId, canUpdateExistingUsers ? 1 : 0, sendInvite))).then(function (res) {
9044
9084
  var _temp = function () {
9045
9085
  if (res.data.status) {
9046
9086
  return Promise.resolve(dispatch(_executionJob(jobId, 'is_job_completed')).then(function (resp) {
@@ -9071,6 +9111,9 @@ var UserBulkUpload = function UserBulkUpload(_ref) {
9071
9111
  var handleExistingUserUpdation = function handleExistingUserUpdation(event) {
9072
9112
  setCanUpdateExistingUsers(!canUpdateExistingUsers);
9073
9113
  };
9114
+ var handleSendInvite = function handleSendInvite() {
9115
+ setSendInvite(!sendInvite);
9116
+ };
9074
9117
  var CustomStepIcon = function CustomStepIcon(step) {
9075
9118
  if ((importStatus === 1 || importStatus === 2 || importStatus === 4) && step === Number(activeStep)) {
9076
9119
  return /*#__PURE__*/React.createElement(IUIPrimaryRadio, {
@@ -9380,6 +9423,18 @@ var UserBulkUpload = function UserBulkUpload(_ref) {
9380
9423
  label: "Update any existing users",
9381
9424
  className: clsx(styles$5.checkboxlabel, (_clsx5 = {}, _clsx5[styles$5.disabledText] = +userBulkImportInfo.exist_users === 0, _clsx5)),
9382
9425
  disabled: +userBulkImportInfo.exist_users === 0
9426
+ })), /*#__PURE__*/React.createElement(IUIBox, {
9427
+ display: "flex",
9428
+ style: {
9429
+ paddingLeft: '28px'
9430
+ }
9431
+ }, /*#__PURE__*/React.createElement(IUIFormControlLabel, {
9432
+ control: /*#__PURE__*/React.createElement(IUICheckBox, {
9433
+ handleCheckBoxHandler: handleSendInvite,
9434
+ checked: sendInvite
9435
+ }),
9436
+ label: "Send invitation emails to new users who have not logged into the platform.",
9437
+ className: clsx(styles$5.checkboxlabel)
9383
9438
  })), /*#__PURE__*/React.createElement(IUIBox, {
9384
9439
  display: "flex",
9385
9440
  style: {