@influenzanet/case-web-app-core 2.8.7-staging → 2.8.9-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.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { PageConfig, PagesConfig } from './types/pagesConfig';
|
|
|
14
14
|
import AccountSettings from './components/settings/AccountSettings';
|
|
15
15
|
import CommunicationSettings from './components/settings/CommunicationSettings';
|
|
16
16
|
import { PhoneNumberInput } from './components/inputs';
|
|
17
|
+
import PhoneVerificationBanner from './components/banners/PhoneVerificationBanner';
|
|
17
18
|
declare const coreReduxActions: {
|
|
18
19
|
appActions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
19
20
|
reset: (state: import("immer/dist/internal").WritableDraft<import("./store/appSlice").AppState>) => import("immer/dist/internal").WritableDraft<import("./store/appSlice").AppState>;
|
|
@@ -92,4 +93,4 @@ declare const coreReduxActions: {
|
|
|
92
93
|
declare const coreReduxThunks: {
|
|
93
94
|
enterStudiesThunk: import("@reduxjs/toolkit").AsyncThunk<import("./store/actions/studiesActions").EnterStudiesPayload, import("./store/thunks/studiesThunks").EnterStudiesRequest, {}>;
|
|
94
95
|
};
|
|
95
|
-
export { AppCore, initI18n, store, reducersManager, localStorageManager, studyAPI, userAPI, coreReduxActions, coreReduxThunks, useAuthTokenCheck, PreventAccidentalNavigationPrompt, InternalNavigator, AccountSettings, CommunicationSettings, PhoneNumberInput, type AppConfig, type HeaderConfig, type FooterConfig, type NavbarConfig, type PageConfig, type PagesConfig };
|
|
96
|
+
export { AppCore, initI18n, store, reducersManager, localStorageManager, studyAPI, userAPI, coreReduxActions, coreReduxThunks, useAuthTokenCheck, PreventAccidentalNavigationPrompt, InternalNavigator, AccountSettings, CommunicationSettings, PhoneNumberInput, PhoneVerificationBanner, type AppConfig, type HeaderConfig, type FooterConfig, type NavbarConfig, type PageConfig, type PagesConfig };
|
package/build/index.es.js
CHANGED
|
@@ -22388,6 +22388,9 @@ var ChangePhone = function () {
|
|
|
22388
22388
|
case 'phone not valid':
|
|
22389
22389
|
setError(t('changePhone.errors.wrongPhoneFormat'));
|
|
22390
22390
|
break;
|
|
22391
|
+
case 'phone number already taken':
|
|
22392
|
+
setError(t('changePhone.errors.phoneAlreadyTaken'));
|
|
22393
|
+
break;
|
|
22391
22394
|
default:
|
|
22392
22395
|
setError(t('changePhone.errors.unknown'));
|
|
22393
22396
|
break;
|
|
@@ -22592,6 +22595,9 @@ var AddPhone = function () {
|
|
|
22592
22595
|
case 'phone not valid':
|
|
22593
22596
|
setError(t('addPhone.errors.wrongPhoneFormat'));
|
|
22594
22597
|
break;
|
|
22598
|
+
case 'phone number already taken':
|
|
22599
|
+
setError(t('addPhone.errors.phoneAlreadyTaken'));
|
|
22600
|
+
break;
|
|
22595
22601
|
default:
|
|
22596
22602
|
setError(t('addPhone.errors.unknown'));
|
|
22597
22603
|
break;
|
|
@@ -22625,6 +22631,13 @@ var VerifyWhatsApp = function () {
|
|
|
22625
22631
|
var _d = useState(''), error = _d[0], setError = _d[1];
|
|
22626
22632
|
var _e = useState(''), verificationCode = _e[0], setVerificationCode = _e[1];
|
|
22627
22633
|
var phoneNumber = (dialogContent === null || dialogContent === void 0 ? void 0 : dialogContent.phoneNumber) || '';
|
|
22634
|
+
// Reset verification code when dialog opens
|
|
22635
|
+
useEffect(function () {
|
|
22636
|
+
if (open) {
|
|
22637
|
+
setVerificationCode('');
|
|
22638
|
+
setError('');
|
|
22639
|
+
}
|
|
22640
|
+
}, [open]);
|
|
22628
22641
|
var close = function () {
|
|
22629
22642
|
dispatch(dialogActions.closeDialog());
|
|
22630
22643
|
setVerificationCode('');
|
|
@@ -22723,7 +22736,7 @@ var VerifyWhatsApp = function () {
|
|
|
22723
22736
|
if (!open) {
|
|
22724
22737
|
return null;
|
|
22725
22738
|
}
|
|
22726
|
-
return (jsxs(Dialog, __assign({ open: open, title: t('verifyWhatsApp.title'), ariaLabelledBy: "verify-whatsapp-title", onClose: close, size: "
|
|
22739
|
+
return (jsxs(Dialog, __assign({ open: open, title: t('verifyWhatsApp.title'), ariaLabelledBy: "verify-whatsapp-title", onClose: close, size: "sm" }, { children: [jsxs("div", __assign({ className: "".concat(defaultDialogPaddingXClass, " py-3") }, { children: [jsx("div", __assign({ className: "mb-3" }, { children: jsx("p", __assign({ className: "mb-2 small" }, { children: t("verifyWhatsApp.info") }), void 0) }), void 0), error && (jsx(AlertBox, { type: "danger", content: error, className: "mb-3" }, void 0)), jsx("div", __assign({ className: "mb-3" }, { children: jsx(TextField, { id: "verification-code", name: "verificationCode", label: t('verifyWhatsApp.codeInputLabel'), placeholder: t('verifyWhatsApp.codeInputPlaceholder'), value: verificationCode, onChange: function (event) { return setVerificationCode(event.target.value); }, maxLength: 6, autoComplete: "off" }, void 0) }), void 0)] }), void 0), jsxs("div", __assign({ className: "d-flex justify-content-between align-items-center gap-2 p-3 border-top" }, { children: [jsx(DialogBtn, { type: "button", onClick: resendCode, label: t('verifyWhatsApp.resendBtn'), loading: resendLoading, disabled: loading || !phoneNumber, className: "btn-sm" }, void 0), jsxs("div", __assign({ className: "d-flex gap-2" }, { children: [jsx(DialogBtn, { type: "button", onClick: close, label: t('verifyWhatsApp.cancelBtn'), disabled: loading || resendLoading, className: "btn-sm" }, void 0), jsx(DialogBtn, { type: "button", onClick: verifyCode, color: "primary", label: t('verifyWhatsApp.submitBtn'), loading: loading, disabled: !verificationCode.trim() || resendLoading, className: "btn-sm" }, void 0)] }), void 0)] }), void 0)] }), void 0));
|
|
22727
22740
|
};
|
|
22728
22741
|
|
|
22729
22742
|
var GlobalDialogs = function (props) {
|
|
@@ -24053,12 +24066,25 @@ var AccountSettings = function (props) {
|
|
|
24053
24066
|
var isAuth = useIsAuthenticated();
|
|
24054
24067
|
var dispatch = useDispatch();
|
|
24055
24068
|
var currentUser = useSelector(function (state) { return state.user.currentUser; });
|
|
24069
|
+
var dialogState = useSelector(function (state) { return state.dialog; });
|
|
24056
24070
|
var _a = useState(false), isResending = _a[0], setIsResending = _a[1];
|
|
24057
24071
|
var _b = useState(null), resendMessage = _b[0], setResendMessage = _b[1];
|
|
24072
|
+
var phoneInfo = currentUser === null || currentUser === void 0 ? void 0 : currentUser.contactInfos.find(function (info) { return info.type === 'phone'; });
|
|
24073
|
+
// Clear success message when phone is verified
|
|
24074
|
+
useEffect(function () {
|
|
24075
|
+
if (phoneInfo && phoneInfo.confirmedAt && phoneInfo.confirmedAt > 0) {
|
|
24076
|
+
setResendMessage(null);
|
|
24077
|
+
}
|
|
24078
|
+
}, [phoneInfo]);
|
|
24079
|
+
// Clear success message when dialog closes
|
|
24080
|
+
useEffect(function () {
|
|
24081
|
+
if (dialogState.config === undefined && (resendMessage === null || resendMessage === void 0 ? void 0 : resendMessage.type) === 'success') {
|
|
24082
|
+
setResendMessage(null);
|
|
24083
|
+
}
|
|
24084
|
+
}, [dialogState.config, resendMessage === null || resendMessage === void 0 ? void 0 : resendMessage.type]);
|
|
24058
24085
|
if (!isAuth) {
|
|
24059
24086
|
return jsx("div", __assign({ className: "bg-warning-light p-3" }, { children: 'authentication needed' }), void 0);
|
|
24060
24087
|
}
|
|
24061
|
-
var phoneInfo = currentUser.contactInfos.find(function (info) { return info.type === 'phone'; });
|
|
24062
24088
|
console.log('phoneInfo:', phoneInfo);
|
|
24063
24089
|
console.log('confirmedAt:', phoneInfo === null || phoneInfo === void 0 ? void 0 : phoneInfo.confirmedAt);
|
|
24064
24090
|
var handleResendCode = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -34527,6 +34553,26 @@ var InternalNavigator = function (props) {
|
|
|
34527
34553
|
return null;
|
|
34528
34554
|
};
|
|
34529
34555
|
|
|
34556
|
+
var PhoneVerificationBanner = function () {
|
|
34557
|
+
var t = useTranslation(['banner']).t;
|
|
34558
|
+
var isAuth = useIsAuthenticated();
|
|
34559
|
+
var history = useHistory();
|
|
34560
|
+
var currentUser = useSelector(function (state) { return state.user.currentUser; });
|
|
34561
|
+
if (!isAuth) {
|
|
34562
|
+
return null;
|
|
34563
|
+
}
|
|
34564
|
+
// Check if user has an unverified phone number
|
|
34565
|
+
var phoneInfo = currentUser.contactInfos.find(function (info) { return info.type === 'phone'; });
|
|
34566
|
+
// Don't show banner if no phone or phone is already verified
|
|
34567
|
+
if (!phoneInfo || (phoneInfo.confirmedAt && phoneInfo.confirmedAt > 0)) {
|
|
34568
|
+
return null;
|
|
34569
|
+
}
|
|
34570
|
+
var handleGoToProfile = function () {
|
|
34571
|
+
history.push('/settings');
|
|
34572
|
+
};
|
|
34573
|
+
return (jsx("div", __assign({ className: "alert alert-warning mb-0", role: "alert", style: { borderRadius: 0 } }, { children: jsx("div", __assign({ className: "container" }, { children: jsxs("div", __assign({ className: "row align-items-center" }, { children: [jsxs("div", __assign({ className: "col-12 col-md-9" }, { children: [jsx("span", __assign({ className: "material-icons align-middle me-2", style: { fontSize: '1.5rem' } }, { children: "warning" }), void 0), jsx("strong", { children: t('banner:phoneVerification.title', 'Attenzione!') }, void 0), ' ', t('banner:phoneVerification.message', 'Il tuo numero di telefono non è ancora stato verificato.')] }), void 0), jsx("div", __assign({ className: "col-12 col-md-3 text-md-end mt-2 mt-md-0" }, { children: jsx("button", __assign({ className: "btn btn-sm btn-dark", onClick: handleGoToProfile }, { children: t('banner:phoneVerification.button', 'Verifica ora') }), void 0) }), void 0)] }), void 0) }), void 0) }), void 0));
|
|
34574
|
+
};
|
|
34575
|
+
|
|
34530
34576
|
var coreReduxActions = {
|
|
34531
34577
|
appActions: appActions,
|
|
34532
34578
|
dialogActions: dialogActions,
|
|
@@ -34538,5 +34584,5 @@ var coreReduxThunks = {
|
|
|
34538
34584
|
enterStudiesThunk: enterStudiesThunk,
|
|
34539
34585
|
};
|
|
34540
34586
|
|
|
34541
|
-
export { AccountSettings, AppCore, CommunicationSettings, InternalNavigator, PhoneNumberInput, PreventAccidentalNavigationPrompt, coreReduxActions, coreReduxThunks, initI18n, localStorageManager, reducersManager, store, studyAPI, useAuthTokenCheck, userAPI };
|
|
34587
|
+
export { AccountSettings, AppCore, CommunicationSettings, InternalNavigator, PhoneNumberInput, PhoneVerificationBanner, PreventAccidentalNavigationPrompt, coreReduxActions, coreReduxThunks, initI18n, localStorageManager, reducersManager, store, studyAPI, useAuthTokenCheck, userAPI };
|
|
34542
34588
|
//# sourceMappingURL=index.es.js.map
|