@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/esm/index.js
CHANGED
@@ -4584,12 +4584,18 @@ var AddNewUserComponent = function (props) {
|
|
4584
4584
|
var userInfoState = useUserContext().userInfoState;
|
4585
4585
|
var ability = useAbilityContext();
|
4586
4586
|
var _q = useState([]), countries = _q[0], setCountries = _q[1];
|
4587
|
+
var _r = useState(false), isCountryListLoading = _r[0], setIsCountryListLoading = _r[1];
|
4587
4588
|
var getCountryList = function () { return __awaiter(void 0, void 0, void 0, function () {
|
4588
|
-
var response, alpha2Names;
|
4589
|
+
var response, alpha2Names, error_1;
|
4589
4590
|
return __generator(this, function (_a) {
|
4590
4591
|
switch (_a.label) {
|
4591
|
-
case 0:
|
4592
|
+
case 0:
|
4593
|
+
setIsCountryListLoading(true);
|
4594
|
+
_a.label = 1;
|
4592
4595
|
case 1:
|
4596
|
+
_a.trys.push([1, 3, 4, 5]);
|
4597
|
+
return [4 /*yield*/, get("national/organisation/countries")];
|
4598
|
+
case 2:
|
4593
4599
|
response = _a.sent();
|
4594
4600
|
if (response.data) {
|
4595
4601
|
alpha2Names = response.data.map(function (item) {
|
@@ -4597,12 +4603,26 @@ var AddNewUserComponent = function (props) {
|
|
4597
4603
|
});
|
4598
4604
|
setCountries(alpha2Names);
|
4599
4605
|
}
|
4600
|
-
return [
|
4606
|
+
return [3 /*break*/, 5];
|
4607
|
+
case 3:
|
4608
|
+
error_1 = _a.sent();
|
4609
|
+
console.log("Error in getCountryList", error_1);
|
4610
|
+
message.open({
|
4611
|
+
type: "error",
|
4612
|
+
content: "".concat(error_1.message),
|
4613
|
+
duration: 3,
|
4614
|
+
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
4615
|
+
});
|
4616
|
+
return [3 /*break*/, 5];
|
4617
|
+
case 4:
|
4618
|
+
setIsCountryListLoading(false);
|
4619
|
+
return [7 /*endfinally*/];
|
4620
|
+
case 5: return [2 /*return*/];
|
4601
4621
|
}
|
4602
4622
|
});
|
4603
4623
|
}); };
|
4604
4624
|
var onAddUser = function (values) { return __awaiter(void 0, void 0, void 0, function () {
|
4605
|
-
var response,
|
4625
|
+
var response, error_2;
|
4606
4626
|
return __generator(this, function (_a) {
|
4607
4627
|
switch (_a.label) {
|
4608
4628
|
case 0:
|
@@ -4631,11 +4651,11 @@ var AddNewUserComponent = function (props) {
|
|
4631
4651
|
}
|
4632
4652
|
return [3 /*break*/, 5];
|
4633
4653
|
case 3:
|
4634
|
-
|
4635
|
-
console.log("Error in user creation",
|
4654
|
+
error_2 = _a.sent();
|
4655
|
+
console.log("Error in user creation", error_2);
|
4636
4656
|
message.open({
|
4637
4657
|
type: "error",
|
4638
|
-
content: "".concat(
|
4658
|
+
content: "".concat(error_2.message),
|
4639
4659
|
duration: 3,
|
4640
4660
|
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
4641
4661
|
});
|
@@ -4648,7 +4668,7 @@ var AddNewUserComponent = function (props) {
|
|
4648
4668
|
});
|
4649
4669
|
}); };
|
4650
4670
|
var onUpdateUser = function () { return __awaiter(void 0, void 0, void 0, function () {
|
4651
|
-
var formOneValues, values, response,
|
4671
|
+
var formOneValues, values, response, error_3;
|
4652
4672
|
var _a;
|
4653
4673
|
return __generator(this, function (_b) {
|
4654
4674
|
switch (_b.label) {
|
@@ -4685,11 +4705,11 @@ var AddNewUserComponent = function (props) {
|
|
4685
4705
|
}
|
4686
4706
|
return [3 /*break*/, 4];
|
4687
4707
|
case 3:
|
4688
|
-
|
4689
|
-
console.log("Error in user update",
|
4708
|
+
error_3 = _b.sent();
|
4709
|
+
console.log("Error in user update", error_3);
|
4690
4710
|
message.open({
|
4691
4711
|
type: "error",
|
4692
|
-
content: "".concat(t("updateUserError"), " ").concat(
|
4712
|
+
content: "".concat(t("updateUserError"), " ").concat(error_3.message),
|
4693
4713
|
duration: 3,
|
4694
4714
|
style: { textAlign: "right", marginRight: 15, marginTop: 10 },
|
4695
4715
|
});
|
@@ -4906,14 +4926,14 @@ var AddNewUserComponent = function (props) {
|
|
4906
4926
|
React.createElement(Radio.Button, { className: "view-only", value: "ViewOnly" },
|
4907
4927
|
React.createElement(EyeOutlined, { className: "role-icons" }),
|
4908
4928
|
t("addUser:viewer")))))),
|
4909
|
-
React.createElement(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: [
|
4929
|
+
React.createElement(Skeleton, { loading: isCountryListLoading, active: true }, countries.length > 0 && (React.createElement(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: [
|
4910
4930
|
{
|
4911
4931
|
required: false,
|
4912
4932
|
},
|
4913
4933
|
] },
|
4914
4934
|
React.createElement(PhoneInput, { placeholder: t("addUser:phoneNo"), international: true,
|
4915
4935
|
// value={contactNoInput}
|
4916
|
-
defaultCountry: "LK", countryCallingCodeEditable: false, onChange: function (v) { }, countries: countries }))))),
|
4936
|
+
defaultCountry: "LK", countryCallingCodeEditable: false, onChange: function (v) { }, countries: countries }))))))),
|
4917
4937
|
React.createElement("div", { className: "actions" },
|
4918
4938
|
React.createElement(Form.Item, null,
|
4919
4939
|
React.createElement("div", { className: "create-user-btn-container" },
|