@itilite/iui-user-management 0.4.56 → 0.4.58

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
@@ -5076,8 +5076,6 @@ var UserAddEdit = function UserAddEdit(props) {
5076
5076
  isCardsDetailsRendered = _useSelector.isCardsDetailsRendered,
5077
5077
  isCardsAdmin = _useSelector.isCardsAdmin,
5078
5078
  cardsDetails = _useSelector.cardsDetails;
5079
- console.log("isCardsAdmin", isCardsAdmin);
5080
- console.log("cardsDetails", cardsDetails);
5081
5079
  var _useSelector2 = reactRedux.useSelector(function (state) {
5082
5080
  return state.common;
5083
5081
  }),
@@ -5086,7 +5084,6 @@ var UserAddEdit = function UserAddEdit(props) {
5086
5084
  hasVerificationError = _useSelector2.hasVerificationError,
5087
5085
  isILadmin = _useSelector2.isILadmin,
5088
5086
  companyName = _useSelector2.companyName;
5089
- console.log("id", id);
5090
5087
  var history = reactRouterDom.useHistory();
5091
5088
  var location = reactRouterDom.useLocation();
5092
5089
  var _useState = React.useState({
@@ -6005,11 +6002,15 @@ var UserAddEdit = function UserAddEdit(props) {
6005
6002
  React.useEffect(function () {
6006
6003
  if (isTokenVerified === true) {
6007
6004
  dispatch(fetchRenderFileds());
6008
- editUserId ? fetchEditUserCardsDetails(editUserId) : fetchLoggedUserCardsDetails();
6009
6005
  }
6010
6006
  }, [isTokenVerified]);
6011
6007
  React.useEffect(function () {
6012
6008
  if (isRendered === true) {
6009
+ renderFields === null || renderFields === void 0 ? void 0 : renderFields.products.forEach(function (prod) {
6010
+ if ((prod === null || prod === void 0 ? void 0 : prod.name) === 'cards') {
6011
+ editUserId ? fetchEditUserCardsDetails(editUserId) : fetchLoggedUserCardsDetails();
6012
+ }
6013
+ });
6013
6014
  setPersonalInfoInput(_extends({}, personalInfoInput, {
6014
6015
  country_code: countryCode
6015
6016
  }));
@@ -6558,21 +6559,66 @@ var UserAddEdit = function UserAddEdit(props) {
6558
6559
  } else {
6559
6560
  dispatch(showLoader());
6560
6561
  if (cardApiflag === true) {
6561
- fetch(userAddEditUrl.cardsEditUserDetails(isEditMode ? editUserId : id), {
6562
- method: 'POST',
6563
- body: JSON.stringify(cardsPayload),
6564
- headers: {
6565
- 'Content-Type': 'application/json',
6566
- 'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
6562
+ dispatch(createUser(payload)).then(function (res) {
6563
+ var _config$routes4, _config$routes4$users, _config$routes4$users2;
6564
+ if (res !== null && res !== void 0 && res.user_id) {
6565
+ fetch(userAddEditUrl.cardsEditUserDetails(res === null || res === void 0 ? void 0 : res.user_id), {
6566
+ method: 'POST',
6567
+ body: JSON.stringify(cardsPayload),
6568
+ headers: {
6569
+ 'Content-Type': 'application/json',
6570
+ 'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
6571
+ }
6572
+ }).then(function (response) {
6573
+ if (response.status !== 200) {
6574
+ IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
6575
+ }
6576
+ })["catch"](function (error) {
6577
+ console.log("errorrr", error);
6578
+ });
6567
6579
  }
6568
- }).then(function (response) {
6569
- if (response.status === 200) {
6570
- createUserApiCall(payload);
6580
+ (config === null || config === void 0 ? void 0 : (_config$routes4 = config.routes) === null || _config$routes4 === void 0 ? void 0 : (_config$routes4$users = _config$routes4.users) === null || _config$routes4$users === void 0 ? void 0 : (_config$routes4$users2 = _config$routes4$users.list) === null || _config$routes4$users2 === void 0 ? void 0 : _config$routes4$users2.path) && history.push(config.routes.users.list.path);
6581
+ })["catch"](function (err) {
6582
+ if (typeof err === 'object') {
6583
+ if (err.country_code) {
6584
+ err.contact_number = err.country_code;
6585
+ }
6586
+ if (err.contact_country_code) {
6587
+ err.contact_number = err.contact_country_code;
6588
+ }
6589
+ if (err.passport) {
6590
+ err.passport_photo = _extends({}, err.passport);
6591
+ delete err.passport;
6592
+ }
6593
+ setErrorArray(Object.keys(err));
6594
+ setErrorMsgs(err);
6595
+ var _loop4 = function _loop4() {
6596
+ if (Object.hasOwnProperty.call(err, _key4)) {
6597
+ if (err[_key4]) {
6598
+ if (_key4 in passportInfoInput || _key4 in travelPreferenceInfo || _key4 in secureTravelInputInfo) {
6599
+ setAdditionalInfoFlag('open');
6600
+ }
6601
+ var el = document.getElementById(_key4 === 'country_code' || _key4 === 'contact_country_code' ? 'contact_number' : _key4);
6602
+ if (el) {
6603
+ setTimeout(function () {
6604
+ el.scrollIntoView({
6605
+ behavior: 'smooth',
6606
+ block: 'center'
6607
+ });
6608
+ }, 500);
6609
+ return 1;
6610
+ }
6611
+ }
6612
+ }
6613
+ };
6614
+ for (var _key4 in err) {
6615
+ if (_loop4()) break;
6616
+ }
6617
+ } else if (typeof err === 'string') {
6618
+ IUIToastMessageService$4.warningNotify(err);
6571
6619
  } else {
6572
6620
  IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
6573
6621
  }
6574
- })["catch"](function (error) {
6575
- console.log("errorrr", error);
6576
6622
  })["finally"](function () {
6577
6623
  dispatch(stopLoader());
6578
6624
  });
@@ -6596,8 +6642,8 @@ var UserAddEdit = function UserAddEdit(props) {
6596
6642
  }
6597
6643
  }
6598
6644
  } else {
6599
- var _config$routes4, _config$routes4$users, _config$routes4$users2;
6600
- (config === null || config === void 0 ? void 0 : (_config$routes4 = config.routes) === null || _config$routes4 === void 0 ? void 0 : (_config$routes4$users = _config$routes4.users) === null || _config$routes4$users === void 0 ? void 0 : (_config$routes4$users2 = _config$routes4$users.list) === null || _config$routes4$users2 === void 0 ? void 0 : _config$routes4$users2.path) && history.push(config.routes.users.list.path);
6645
+ var _config$routes5, _config$routes5$users, _config$routes5$users2;
6646
+ (config === null || config === void 0 ? void 0 : (_config$routes5 = config.routes) === null || _config$routes5 === void 0 ? void 0 : (_config$routes5$users = _config$routes5.users) === null || _config$routes5$users === void 0 ? void 0 : (_config$routes5$users2 = _config$routes5$users.list) === null || _config$routes5$users2 === void 0 ? void 0 : _config$routes5$users2.path) && history.push(config.routes.users.list.path);
6601
6647
  }
6602
6648
  };
6603
6649
  var handleCustomFieldsNavigation = function handleCustomFieldsNavigation() {