@undp/carbon-library 1.0.33 → 1.0.35

Sign up to get free protection for your applications and to get access to all the features.
package/dist/esm/index.js CHANGED
@@ -4569,7 +4569,7 @@ Select.Option;
4569
4569
  var AddNewUserComponent = function (props) {
4570
4570
  var _a, _b, _c, _d, _e, _f;
4571
4571
  var t = props.t, onNavigateToUserManagement = props.onNavigateToUserManagement, onNavigateLogin = props.onNavigateLogin, useConnection = props.useConnection, useUserContext = props.useUserContext, useLocation = props.useLocation, useAbilityContext = props.useAbilityContext;
4572
- var _g = useConnection(), post = _g.post, put = _g.put, del = _g.delete;
4572
+ var _g = useConnection(), post = _g.post, put = _g.put, del = _g.delete, get = _g.get;
4573
4573
  var formOne = Form.useForm()[0];
4574
4574
  var state = useLocation().state;
4575
4575
  var updateToken = useConnection().updateToken;
@@ -4583,6 +4583,24 @@ var AddNewUserComponent = function (props) {
4583
4583
  var _p = useState(""), errorMsg = _p[0], setErrorMsg = _p[1];
4584
4584
  var userInfoState = useUserContext().userInfoState;
4585
4585
  var ability = useAbilityContext();
4586
+ var _q = useState([]), countries = _q[0], setCountries = _q[1];
4587
+ var getCountryList = function () { return __awaiter(void 0, void 0, void 0, function () {
4588
+ var response, alpha2Names;
4589
+ return __generator(this, function (_a) {
4590
+ switch (_a.label) {
4591
+ case 0: return [4 /*yield*/, get("national/organisation/countries")];
4592
+ case 1:
4593
+ response = _a.sent();
4594
+ if (response.data) {
4595
+ alpha2Names = response.data.map(function (item) {
4596
+ return item.alpha2;
4597
+ });
4598
+ setCountries(alpha2Names);
4599
+ }
4600
+ return [2 /*return*/];
4601
+ }
4602
+ });
4603
+ }); };
4586
4604
  var onAddUser = function (values) { return __awaiter(void 0, void 0, void 0, function () {
4587
4605
  var response, error_1;
4588
4606
  return __generator(this, function (_a) {
@@ -4794,6 +4812,7 @@ var AddNewUserComponent = function (props) {
4794
4812
  }); };
4795
4813
  useEffect(function () {
4796
4814
  console.log("state -- val --- ", __assign({}, state));
4815
+ getCountryList();
4797
4816
  setIsUpdate((state === null || state === void 0 ? void 0 : state.record) ? true : false);
4798
4817
  }, []);
4799
4818
  return (React.createElement("div", { className: "add-user-main-container" },
@@ -4894,7 +4913,7 @@ var AddNewUserComponent = function (props) {
4894
4913
  ] },
4895
4914
  React.createElement(PhoneInput, { placeholder: t("addUser:phoneNo"), international: true,
4896
4915
  // value={contactNoInput}
4897
- defaultCountry: "LK", countryCallingCodeEditable: false, onChange: function (v) { } }))))),
4916
+ defaultCountry: "LK", countryCallingCodeEditable: false, onChange: function (v) { }, countries: countries }))))),
4898
4917
  React.createElement("div", { className: "actions" },
4899
4918
  React.createElement(Form.Item, null,
4900
4919
  React.createElement("div", { className: "create-user-btn-container" },
@@ -4999,8 +5018,8 @@ var UserProfileComponent = function (props) {
4999
5018
  onNavigateUpdateUser(organisationDetails, userDetails);
5000
5019
  } }, t("userProfile:edit"))),
5001
5020
  React.createElement(LanguageSelection, { i18n: i18n })))),
5002
- !userDetails ||
5003
- (!organisationDetails && (React.createElement("div", { className: "content-body" },
5021
+ (!userDetails ||
5022
+ (!organisationDetails) && (React.createElement("div", { className: "content-body" },
5004
5023
  React.createElement(Skeleton, { active: true, loading: true })))),
5005
5024
  userDetails && organisationDetails && (React.createElement("div", { className: "content-body" },
5006
5025
  React.createElement(Row, { gutter: 16 },