@itilite/iui-user-management 0.4.56 → 0.4.57

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.
@@ -6555,21 +6555,66 @@ var UserAddEdit = function UserAddEdit(props) {
6555
6555
  } else {
6556
6556
  dispatch(showLoader());
6557
6557
  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()
6558
+ dispatch(createUser(payload)).then(function (res) {
6559
+ var _config$routes4, _config$routes4$users, _config$routes4$users2;
6560
+ if (res !== null && res !== void 0 && res.user_id) {
6561
+ fetch(userAddEditUrl.cardsEditUserDetails(res === null || res === void 0 ? void 0 : res.user_id), {
6562
+ method: 'POST',
6563
+ body: JSON.stringify(cardsPayload),
6564
+ headers: {
6565
+ 'Content-Type': 'application/json',
6566
+ 'authorization': "Bearer " + IUILocalStorageService$5.getAccessToken()
6567
+ }
6568
+ }).then(function (response) {
6569
+ if (response.status !== 200) {
6570
+ IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
6571
+ }
6572
+ })["catch"](function (error) {
6573
+ console.log("errorrr", error);
6574
+ });
6564
6575
  }
6565
- }).then(function (response) {
6566
- if (response.status === 200) {
6567
- createUserApiCall(payload);
6576
+ (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);
6577
+ })["catch"](function (err) {
6578
+ if (typeof err === 'object') {
6579
+ if (err.country_code) {
6580
+ err.contact_number = err.country_code;
6581
+ }
6582
+ if (err.contact_country_code) {
6583
+ err.contact_number = err.contact_country_code;
6584
+ }
6585
+ if (err.passport) {
6586
+ err.passport_photo = _extends({}, err.passport);
6587
+ delete err.passport;
6588
+ }
6589
+ setErrorArray(Object.keys(err));
6590
+ setErrorMsgs(err);
6591
+ var _loop4 = function _loop4() {
6592
+ if (Object.hasOwnProperty.call(err, _key4)) {
6593
+ if (err[_key4]) {
6594
+ if (_key4 in passportInfoInput || _key4 in travelPreferenceInfo || _key4 in secureTravelInputInfo) {
6595
+ setAdditionalInfoFlag('open');
6596
+ }
6597
+ var el = document.getElementById(_key4 === 'country_code' || _key4 === 'contact_country_code' ? 'contact_number' : _key4);
6598
+ if (el) {
6599
+ setTimeout(function () {
6600
+ el.scrollIntoView({
6601
+ behavior: 'smooth',
6602
+ block: 'center'
6603
+ });
6604
+ }, 500);
6605
+ return 1;
6606
+ }
6607
+ }
6608
+ }
6609
+ };
6610
+ for (var _key4 in err) {
6611
+ if (_loop4()) break;
6612
+ }
6613
+ } else if (typeof err === 'string') {
6614
+ IUIToastMessageService$4.warningNotify(err);
6568
6615
  } else {
6569
6616
  IUIToastMessageService$4.warningNotify('Opps, Something went wrong.');
6570
6617
  }
6571
- })["catch"](function (error) {
6572
- console.log("errorrr", error);
6573
6618
  })["finally"](function () {
6574
6619
  dispatch(stopLoader());
6575
6620
  });
@@ -6593,8 +6638,8 @@ var UserAddEdit = function UserAddEdit(props) {
6593
6638
  }
6594
6639
  }
6595
6640
  } 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);
6641
+ var _config$routes5, _config$routes5$users, _config$routes5$users2;
6642
+ (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
6643
  }
6599
6644
  };
6600
6645
  var handleCustomFieldsNavigation = function handleCustomFieldsNavigation() {