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