@influenzanet/case-web-app-core 2.8.8-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.
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const PhoneVerificationBanner: React.FC;
3
+ export default PhoneVerificationBanner;
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;
@@ -22730,7 +22736,7 @@ var VerifyWhatsApp = function () {
22730
22736
  if (!open) {
22731
22737
  return null;
22732
22738
  }
22733
- return (jsxs(Dialog, __assign({ open: open, title: t('verifyWhatsApp.title'), ariaLabelledBy: "verify-whatsapp-title", onClose: close, size: "lg" }, { children: [jsxs("div", __assign({ className: "".concat(defaultDialogPaddingXClass, " py-4") }, { children: [jsx("div", __assign({ className: "mb-4" }, { children: jsx("p", __assign({ className: "mb-3" }, { children: t("verifyWhatsApp.info") }), void 0) }), void 0), error && (jsx(AlertBox, { type: "danger", content: error, className: "mb-4" }, void 0)), jsx("div", __assign({ className: "mb-4" }, { 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-3 p-4 border-top" }, { children: [jsx(DialogBtn, { type: "button", onClick: resendCode, label: t('verifyWhatsApp.resendBtn'), loading: resendLoading, disabled: loading || !phoneNumber }, void 0), jsxs("div", __assign({ className: "d-flex gap-2" }, { children: [jsx(DialogBtn, { type: "button", onClick: close, label: t('verifyWhatsApp.cancelBtn'), disabled: loading || resendLoading }, void 0), jsx(DialogBtn, { type: "button", onClick: verifyCode, color: "primary", label: t('verifyWhatsApp.submitBtn'), loading: loading, disabled: !verificationCode.trim() || resendLoading }, void 0)] }), void 0)] }), void 0)] }), void 0));
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));
22734
22740
  };
22735
22741
 
22736
22742
  var GlobalDialogs = function (props) {
@@ -34547,6 +34553,26 @@ var InternalNavigator = function (props) {
34547
34553
  return null;
34548
34554
  };
34549
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
+
34550
34576
  var coreReduxActions = {
34551
34577
  appActions: appActions,
34552
34578
  dialogActions: dialogActions,
@@ -34558,5 +34584,5 @@ var coreReduxThunks = {
34558
34584
  enterStudiesThunk: enterStudiesThunk,
34559
34585
  };
34560
34586
 
34561
- 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 };
34562
34588
  //# sourceMappingURL=index.es.js.map