@influenzanet/case-web-app-core 2.8.2-staging → 2.8.3-staging
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/build/index.es.js +38 -2
- package/build/index.es.js.map +1 -1
- package/build/index.js +38 -2
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.es.js
CHANGED
|
@@ -24051,21 +24051,57 @@ var AccountSettings = function (props) {
|
|
|
24051
24051
|
var isAuth = useIsAuthenticated();
|
|
24052
24052
|
var dispatch = useDispatch();
|
|
24053
24053
|
var currentUser = useSelector(function (state) { return state.user.currentUser; });
|
|
24054
|
+
var _a = useState(false), isResending = _a[0], setIsResending = _a[1];
|
|
24055
|
+
var _b = useState(null), resendMessage = _b[0], setResendMessage = _b[1];
|
|
24054
24056
|
if (!isAuth) {
|
|
24055
24057
|
return jsx("div", __assign({ className: "bg-warning-light p-3" }, { children: 'authentication needed' }), void 0);
|
|
24056
24058
|
}
|
|
24057
24059
|
var phoneInfo = currentUser.contactInfos.find(function (info) { return info.type === 'phone'; });
|
|
24058
24060
|
console.log('phoneInfo:', phoneInfo);
|
|
24059
24061
|
console.log('confirmedAt:', phoneInfo === null || phoneInfo === void 0 ? void 0 : phoneInfo.confirmedAt);
|
|
24062
|
+
var handleResendCode = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
24063
|
+
var error_1;
|
|
24064
|
+
return __generator$1(this, function (_a) {
|
|
24065
|
+
switch (_a.label) {
|
|
24066
|
+
case 0:
|
|
24067
|
+
setIsResending(true);
|
|
24068
|
+
setResendMessage(null);
|
|
24069
|
+
_a.label = 1;
|
|
24070
|
+
case 1:
|
|
24071
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
24072
|
+
return [4 /*yield*/, resendWhatsAppCodeReq()];
|
|
24073
|
+
case 2:
|
|
24074
|
+
_a.sent();
|
|
24075
|
+
setResendMessage({
|
|
24076
|
+
type: 'success',
|
|
24077
|
+
text: t("".concat(props.itemKey, ".phone.resendSuccess"), 'Codice inviato con successo!')
|
|
24078
|
+
});
|
|
24079
|
+
return [3 /*break*/, 5];
|
|
24080
|
+
case 3:
|
|
24081
|
+
error_1 = _a.sent();
|
|
24082
|
+
console.error('Error resending WhatsApp code:', error_1);
|
|
24083
|
+
setResendMessage({
|
|
24084
|
+
type: 'error',
|
|
24085
|
+
text: t("".concat(props.itemKey, ".phone.resendError"), 'Errore nell\'invio del codice. Riprova.')
|
|
24086
|
+
});
|
|
24087
|
+
return [3 /*break*/, 5];
|
|
24088
|
+
case 4:
|
|
24089
|
+
setIsResending(false);
|
|
24090
|
+
setTimeout(function () { return setResendMessage(null); }, 5000); // Clear message after 5 seconds
|
|
24091
|
+
return [7 /*endfinally*/];
|
|
24092
|
+
case 5: return [2 /*return*/];
|
|
24093
|
+
}
|
|
24094
|
+
});
|
|
24095
|
+
}); };
|
|
24060
24096
|
var renderProfileSettings = function () {
|
|
24061
24097
|
if (props.hideProfileSettings === true) {
|
|
24062
24098
|
return null;
|
|
24063
24099
|
}
|
|
24064
24100
|
return jsxs(React__default$1.Fragment, { children: [jsx("h4", __assign({ className: "fw-bold mt-2" }, { children: t("".concat(props.itemKey, ".profiles.title")) }), void 0), jsx("p", __assign({ className: "mb-1 text-grey-7" }, { children: t("".concat(props.itemKey, ".profiles.info")) }), void 0), jsx(EditBtn, __assign({ onClick: function () { return dispatch(dialogActions.openDialogWithoutPayload({ type: 'manageProfiles' })); } }, { children: t("".concat(props.itemKey, ".profiles.btn"), { count: currentUser.profiles.length }) }), void 0)] }, void 0);
|
|
24065
24101
|
};
|
|
24066
|
-
return (jsxs("div", __assign({ className: "border-primary border-top-2 pt-2" }, { children: [jsx("h2", { children: t("".concat(props.itemKey, ".title")) }, void 0), jsx("h4", __assign({ className: "fw-bold mt-2" }, { children: t("".concat(props.itemKey, ".email.title")) }), void 0), jsx("p", __assign({ className: "mb-1 text-grey-7" }, { children: t("".concat(props.itemKey, ".email.info")) }), void 0), jsx(EditBtn, __assign({ onClick: function () { return dispatch(dialogActions.openDialogWithoutPayload({ type: 'changeEmail' })); } }, { children: blurEmail(currentUser.account.accountId) }), void 0), jsxs("div", __assign({ className: "d-flex align-items-center mt-2" }, { children: [jsx("h4", __assign({ className: "fw-bold mb-0" }, { children: t("".concat(props.itemKey, ".phone.title")) }), void 0), phoneInfo && (!phoneInfo.confirmedAt || phoneInfo.confirmedAt === 0) && (jsx("span", __assign({ className: "badge bg-warning text-dark ms-2" }, { children: t("".concat(props.itemKey, ".phone.notConfirmed")) }), void 0)), phoneInfo && phoneInfo.confirmedAt && phoneInfo.confirmedAt > 0 && (jsxs("span", __assign({ className: "badge bg-success ms-2" }, { children: [jsx("i", { className: "fas fa-check me-1" }, void 0), t("".concat(props.itemKey, ".phone.confirmed"))] }), void 0))] }), void 0), phoneInfo ? (jsx("p", __assign({ className: "mb-1 text-grey-7" }, { children: t("".concat(props.itemKey, ".phone.info")) }), void 0)) : (jsx("p", __assign({ className: "mb-1 text-grey-7" }, { children: t("".concat(props.itemKey, ".phone.infoAdd")) }), void 0)), jsxs("div", __assign({ className: "m-0 d-flex align-items-center py-2" }, { children: [phoneInfo ? (
|
|
24102
|
+
return (jsxs("div", __assign({ className: "border-primary border-top-2 pt-2" }, { children: [jsx("h2", { children: t("".concat(props.itemKey, ".title")) }, void 0), jsx("h4", __assign({ className: "fw-bold mt-2" }, { children: t("".concat(props.itemKey, ".email.title")) }), void 0), jsx("p", __assign({ className: "mb-1 text-grey-7" }, { children: t("".concat(props.itemKey, ".email.info")) }), void 0), jsx(EditBtn, __assign({ onClick: function () { return dispatch(dialogActions.openDialogWithoutPayload({ type: 'changeEmail' })); } }, { children: blurEmail(currentUser.account.accountId) }), void 0), jsxs("div", __assign({ className: "d-flex align-items-center mt-2" }, { children: [jsx("h4", __assign({ className: "fw-bold mb-0" }, { children: t("".concat(props.itemKey, ".phone.title")) }), void 0), phoneInfo && (!phoneInfo.confirmedAt || phoneInfo.confirmedAt === 0) && (jsx("span", __assign({ className: "badge bg-warning text-dark ms-2" }, { children: t("".concat(props.itemKey, ".phone.notConfirmed")) }), void 0)), phoneInfo && phoneInfo.confirmedAt && phoneInfo.confirmedAt > 0 && (jsxs("span", __assign({ className: "badge bg-success ms-2" }, { children: [jsx("i", { className: "fas fa-check me-1" }, void 0), t("".concat(props.itemKey, ".phone.confirmed"))] }), void 0))] }), void 0), phoneInfo ? (jsx("p", __assign({ className: "mb-1 text-grey-7" }, { children: t("".concat(props.itemKey, ".phone.info")) }), void 0)) : (jsx("p", __assign({ className: "mb-1 text-grey-7" }, { children: t("".concat(props.itemKey, ".phone.infoAdd")) }), void 0)), jsxs("div", __assign({ className: "m-0 d-flex align-items-center py-2" }, { children: [phoneInfo ? (jsxs(Fragment, { children: [jsx(EditBtn, __assign({ onClick: function () { return dispatch(dialogActions.openDialogWithoutPayload({ type: 'changePhone' })); } }, { children: blurPhone(phoneInfo.phone) }), void 0), phoneInfo.confirmedAt === 0 && (jsx("button", __assign({ className: "btn btn-sm btn-primary ms-2", onClick: handleResendCode, disabled: isResending }, { children: isResending ? (jsxs(Fragment, { children: [jsx("span", { className: "spinner-border spinner-border-sm me-2", role: "status", "aria-hidden": "true" }, void 0), t("".concat(props.itemKey, ".phone.resending"), 'Invio...')] }, void 0)) : (jsxs(Fragment, { children: [jsx("i", { className: "fas fa-paper-plane me-2" }, void 0), t("".concat(props.itemKey, ".phone.resendBtn"), 'Invia di nuovo codice')] }, void 0)) }), void 0))] }, void 0)) : (jsx(EditBtn, __assign({ onClick: function () { return dispatch(dialogActions.openDialogWithoutPayload({ type: 'addPhone' })); } }, { children: t("".concat(props.itemKey, ".phone.btn")) }), void 0)), phoneInfo && (jsx("button", __assign({ className: "btn btn-danger-light ms-2", onClick: function () {
|
|
24067
24103
|
dispatch(dialogActions.openDialogWithoutPayload({ type: 'deletePhone' }));
|
|
24068
|
-
} }, { children: jsx("i", { className: "fas fa-trash text-grey-5" }, void 0) }), void 0))] }), void 0), jsx("h4", __assign({ className: "fw-bold mt-2" }, { children: t("".concat(props.itemKey, ".password.title")) }), void 0), jsx("p", __assign({ className: "mb-1 text-grey-7" }, { children: t("".concat(props.itemKey, ".password.info")) }), void 0), jsx(EditBtn, __assign({ onClick: function () { return dispatch(dialogActions.openDialogWithoutPayload({ type: 'changePassword' })); } }, { children: "••••••••••••••" }), void 0), renderProfileSettings()] }), void 0));
|
|
24104
|
+
} }, { children: jsx("i", { className: "fas fa-trash text-grey-5" }, void 0) }), void 0))] }), void 0), resendMessage && (jsx("div", __assign({ className: "alert alert-".concat(resendMessage.type === 'success' ? 'success' : 'danger', " mt-2") }, { children: resendMessage.text }), void 0)), jsx("h4", __assign({ className: "fw-bold mt-2" }, { children: t("".concat(props.itemKey, ".password.title")) }), void 0), jsx("p", __assign({ className: "mb-1 text-grey-7" }, { children: t("".concat(props.itemKey, ".password.info")) }), void 0), jsx(EditBtn, __assign({ onClick: function () { return dispatch(dialogActions.openDialogWithoutPayload({ type: 'changePassword' })); } }, { children: "••••••••••••••" }), void 0), renderProfileSettings()] }), void 0));
|
|
24069
24105
|
};
|
|
24070
24106
|
|
|
24071
24107
|
var CommunicationSettings = function (props) {
|