@undp/carbon-library 1.0.35 → 1.0.36
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/cjs/index.js +33 -13
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +33 -13
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
@@ -4604,12 +4604,18 @@ var AddNewUserComponent = function (props) {
|
|
4604
4604
|
var userInfoState = useUserContext().userInfoState;
|
4605
4605
|
var ability = useAbilityContext();
|
4606
4606
|
var _q = React.useState([]), countries = _q[0], setCountries = _q[1];
|
4607
|
+
var _r = React.useState(false), isCountryListLoading = _r[0], setIsCountryListLoading = _r[1];
|
4607
4608
|
var getCountryList = function () { return __awaiter(void 0, void 0, void 0, function () {
|
4608
|
-
var response, alpha2Names;
|
4609
|
+
var response, alpha2Names, error_1;
|
4609
4610
|
return __generator(this, function (_a) {
|
4610
4611
|
switch (_a.label) {
|
4611
|
-
case 0:
|
4612
|
+
case 0:
|
4613
|
+
setIsCountryListLoading(true);
|
4614
|
+
_a.label = 1;
|
4612
4615
|
case 1:
|
4616
|
+
_a.trys.push([1, 3, 4, 5]);
|
4617
|
+
return [4 /*yield*/, get("national/organisation/countries")];
|
4618
|
+
case 2:
|
4613
4619
|
response = _a.sent();
|
4614
4620
|
if (response.data) {
|
4615
4621
|
alpha2Names = response.data.map(function (item) {
|
@@ -4617,12 +4623,26 @@ var AddNewUserComponent = function (props) {
|
|
4617
4623
|
});
|
4618
4624
|
setCountries(alpha2Names);
|
4619
4625
|
}
|
4620
|
-
return [
|
4626
|
+
return [3 /*break*/, 5];
|
4627
|
+
case 3:
|
4628
|
+
error_1 = _a.sent();
|
4629
|
+
console.log("Error in getCountryList", error_1);
|
4630
|
+
antd.message.open({
|
4631
|
+
type: "error",
|
4632
|
+
content: "".concat(error_1.message),
|
4633
|
+
duration: 3,
|
4634
|
+
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
4635
|
+
});
|
4636
|
+
return [3 /*break*/, 5];
|
4637
|
+
case 4:
|
4638
|
+
setIsCountryListLoading(false);
|
4639
|
+
return [7 /*endfinally*/];
|
4640
|
+
case 5: return [2 /*return*/];
|
4621
4641
|
}
|
4622
4642
|
});
|
4623
4643
|
}); };
|
4624
4644
|
var onAddUser = function (values) { return __awaiter(void 0, void 0, void 0, function () {
|
4625
|
-
var response,
|
4645
|
+
var response, error_2;
|
4626
4646
|
return __generator(this, function (_a) {
|
4627
4647
|
switch (_a.label) {
|
4628
4648
|
case 0:
|
@@ -4651,11 +4671,11 @@ var AddNewUserComponent = function (props) {
|
|
4651
4671
|
}
|
4652
4672
|
return [3 /*break*/, 5];
|
4653
4673
|
case 3:
|
4654
|
-
|
4655
|
-
console.log("Error in user creation",
|
4674
|
+
error_2 = _a.sent();
|
4675
|
+
console.log("Error in user creation", error_2);
|
4656
4676
|
antd.message.open({
|
4657
4677
|
type: "error",
|
4658
|
-
content: "".concat(
|
4678
|
+
content: "".concat(error_2.message),
|
4659
4679
|
duration: 3,
|
4660
4680
|
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
4661
4681
|
});
|
@@ -4668,7 +4688,7 @@ var AddNewUserComponent = function (props) {
|
|
4668
4688
|
});
|
4669
4689
|
}); };
|
4670
4690
|
var onUpdateUser = function () { return __awaiter(void 0, void 0, void 0, function () {
|
4671
|
-
var formOneValues, values, response,
|
4691
|
+
var formOneValues, values, response, error_3;
|
4672
4692
|
var _a;
|
4673
4693
|
return __generator(this, function (_b) {
|
4674
4694
|
switch (_b.label) {
|
@@ -4705,11 +4725,11 @@ var AddNewUserComponent = function (props) {
|
|
4705
4725
|
}
|
4706
4726
|
return [3 /*break*/, 4];
|
4707
4727
|
case 3:
|
4708
|
-
|
4709
|
-
console.log("Error in user update",
|
4728
|
+
error_3 = _b.sent();
|
4729
|
+
console.log("Error in user update", error_3);
|
4710
4730
|
antd.message.open({
|
4711
4731
|
type: "error",
|
4712
|
-
content: "".concat(t("updateUserError"), " ").concat(
|
4732
|
+
content: "".concat(t("updateUserError"), " ").concat(error_3.message),
|
4713
4733
|
duration: 3,
|
4714
4734
|
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
4715
4735
|
});
|
@@ -4926,14 +4946,14 @@ var AddNewUserComponent = function (props) {
|
|
4926
4946
|
React.createElement(antd.Radio.Button, { className: "view-only", value: "ViewOnly" },
|
4927
4947
|
React.createElement(icons.EyeOutlined, { className: "role-icons" }),
|
4928
4948
|
t("addUser:viewer")))))),
|
4929
|
-
React.createElement(antd.Form.Item, { name: "phoneNo", label: t("addUser:phoneNo"), initialValue: (_f = state === null || state === void 0 ? void 0 : state.record) === null || _f === void 0 ? void 0 : _f.phoneNo, rules: [
|
4949
|
+
React.createElement(antd.Skeleton, { loading: isCountryListLoading, active: true }, countries.length > 0 && (React.createElement(antd.Form.Item, { name: "phoneNo", label: t("addUser:phoneNo"), initialValue: (_f = state === null || state === void 0 ? void 0 : state.record) === null || _f === void 0 ? void 0 : _f.phoneNo, rules: [
|
4930
4950
|
{
|
4931
4951
|
required: false,
|
4932
4952
|
},
|
4933
4953
|
] },
|
4934
4954
|
React.createElement(PhoneInput, { placeholder: t("addUser:phoneNo"), international: true,
|
4935
4955
|
// value={contactNoInput}
|
4936
|
-
defaultCountry: "LK", countryCallingCodeEditable: false, onChange: function (v) { }, countries: countries }))))),
|
4956
|
+
defaultCountry: "LK", countryCallingCodeEditable: false, onChange: function (v) { }, countries: countries }))))))),
|
4937
4957
|
React.createElement("div", { className: "actions" },
|
4938
4958
|
React.createElement(antd.Form.Item, null,
|
4939
4959
|
React.createElement("div", { className: "create-user-btn-container" },
|