@influenzanet/case-web-app-core 2.8.8-staging → 2.9.0-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) {
@@ -28888,8 +28894,13 @@ var ContentRenderer = function (props) {
28888
28894
  return null;
28889
28895
  }
28890
28896
  var itemConfig = item.config;
28891
- var currentExtensionComponent = props.extensions.filter(function (ext) { return ext.name === itemConfig.config.type; });
28897
+ if (!itemConfig || !itemConfig.componentName) {
28898
+ console.warn("Extension item config is invalid: ".concat(JSON.stringify(item)));
28899
+ return null;
28900
+ }
28901
+ var currentExtensionComponent = props.extensions.filter(function (ext) { return ext.name === itemConfig.componentName; });
28892
28902
  if (!currentExtensionComponent || currentExtensionComponent.length < 1) {
28903
+ console.warn("No extension found with name: ".concat(itemConfig.componentName));
28893
28904
  return null;
28894
28905
  }
28895
28906
  var Component = currentExtensionComponent[0].component;
@@ -34547,6 +34558,31 @@ var InternalNavigator = function (props) {
34547
34558
  return null;
34548
34559
  };
34549
34560
 
34561
+ var PhoneVerificationBanner = function () {
34562
+ var t = useTranslation().t;
34563
+ var isAuth = useIsAuthenticated();
34564
+ var history = useHistory();
34565
+ var currentUser = useSelector(function (state) { return state.user.currentUser; });
34566
+ // Early returns for safety
34567
+ if (!isAuth || !currentUser) {
34568
+ return null;
34569
+ }
34570
+ // Safely check for contactInfos
34571
+ if (!currentUser.contactInfos || !Array.isArray(currentUser.contactInfos)) {
34572
+ return null;
34573
+ }
34574
+ // Check if user has an unverified phone number
34575
+ var phoneInfo = currentUser.contactInfos.find(function (info) { return info.type === 'phone'; });
34576
+ // Don't show banner if no phone or phone is already verified
34577
+ if (!phoneInfo || (phoneInfo.confirmedAt && phoneInfo.confirmedAt > 0)) {
34578
+ return null;
34579
+ }
34580
+ var handleGoToProfile = function () {
34581
+ history.push('/settings');
34582
+ };
34583
+ 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('phoneVerification.title') }, void 0), ' ', t('phoneVerification.message')] }), 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('phoneVerification.button') }), void 0) }), void 0)] }), void 0) }), void 0) }), void 0));
34584
+ };
34585
+
34550
34586
  var coreReduxActions = {
34551
34587
  appActions: appActions,
34552
34588
  dialogActions: dialogActions,
@@ -34558,5 +34594,5 @@ var coreReduxThunks = {
34558
34594
  enterStudiesThunk: enterStudiesThunk,
34559
34595
  };
34560
34596
 
34561
- export { AccountSettings, AppCore, CommunicationSettings, InternalNavigator, PhoneNumberInput, PreventAccidentalNavigationPrompt, coreReduxActions, coreReduxThunks, initI18n, localStorageManager, reducersManager, store, studyAPI, useAuthTokenCheck, userAPI };
34597
+ export { AccountSettings, AppCore, CommunicationSettings, InternalNavigator, PhoneNumberInput, PhoneVerificationBanner, PreventAccidentalNavigationPrompt, coreReduxActions, coreReduxThunks, initI18n, localStorageManager, reducersManager, store, studyAPI, useAuthTokenCheck, userAPI };
34562
34598
  //# sourceMappingURL=index.es.js.map