@influenzanet/case-web-app-core 2.7.4-staging.6 → 2.7.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.7.4 - 2023-11-20
4
+
5
+ ### Changed
6
+
7
+ - on logout, the local storage is emptied and the persistState flag is set to false, preventing the app to save
8
+ an empty state. This fixed an incorrect behavior during the sign up process for users that previously unsubscribed
9
+ from the platform
10
+
11
+ ## 2.7.3 - 2023-10-25
12
+
13
+ ### Changed
14
+
15
+ - `immediate` surveys are only opened if they are active now (check both for validUntil and validFrom (new))
16
+
3
17
  ## 2.7.2 - 2023-04-17
4
18
 
5
19
  ### Changed
@@ -223,7 +237,7 @@
223
237
  ### Changed
224
238
 
225
239
  - [BREAKING-CHANGE]: updated dependencies - react markdown renderer needs new format. See documentation here:
226
- <https://github.com/coneno/case-web-ui/blob/master/CHANGELOG.md#breaking-changes>
240
+ <https://github.com/coneno/case-web-ui/blob/master/CHANGELOG.md#breaking-changes>
227
241
 
228
242
  ## [1.0.19]
229
243
 
@@ -247,7 +261,7 @@
247
261
 
248
262
  ### Changed
249
263
 
250
- - *BREAKING*: at signup request sent to the backend, it will send the instanceID as http header. This requires a participant-api (api-gateway) with v0.13.0 or later. This header field was included for providing the instanceID for reCaptcha validation.
264
+ - _BREAKING_: at signup request sent to the backend, it will send the instanceID as http header. This requires a participant-api (api-gateway) with v0.13.0 or later. This header field was included for providing the instanceID for reCaptcha validation.
251
265
  - Updating project dependencies (case-web-ui), with minor improvements.
252
266
 
253
267
  ## [1.0.16]
package/build/index.es.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
2
  import * as React$1 from 'react';
3
- import React__default$1, { Component, useEffect, useCallback, useRef, useState, useContext as useContext$1, useMemo, useLayoutEffect, useReducer, createContext, forwardRef as forwardRef$2, useImperativeHandle, createElement, Suspense } from 'react';
4
- import { LoadingPlaceholder, SimpleHeader, Footer, Avatar, containerClassName, ChevronUp, ChevronDown, Dialog, defaultDialogPaddingXClass, Checkbox, AlertBox, TextField, DialogBtn, useFetchTextFile, TextLink, ConsentDialog, ConfirmDialog, SelectField, MarkdownRenderer, AvatarSelector, EditBtn, SurveyList as SurveyList$1, getExternalOrLocalContentURL, ReportList as ReportList$1, TitleBar, ComposedLineAndScatterChartLoader, MapWithTimeSliderLoader, LinkList, handleOpenExternalPage, LogoCredits, SimpleCard, AccordionList, LoginCard, VideoPlayer, ImageContainer, ActionCard, ImageCard, TeaserImage, MarkdownLoader, getLocalizedString, SurveyView } from 'case-web-ui';
3
+ import React__default$1, { Component, useEffect, useCallback, useRef, useState, useContext as useContext$1, useMemo, useLayoutEffect, useReducer, createContext, forwardRef as forwardRef$2, useImperativeHandle, createElement } from 'react';
4
+ import { LoadingPlaceholder, SimpleHeader, Footer, Avatar, containerClassName, ChevronUp, ChevronDown, Dialog, defaultDialogPaddingXClass, Checkbox, AlertBox, TextField, DialogBtn, useFetchTextFile, TextLink, ConsentDialog, ConfirmDialog, SelectField, AvatarSelector, EditBtn, SurveyList as SurveyList$1, getExternalOrLocalContentURL, ReportList as ReportList$1, TitleBar, ComposedLineAndScatterChartLoader, MapWithTimeSliderLoader, LinkList, handleOpenExternalPage, LogoCredits, SimpleCard, AccordionList, LoginCard, VideoPlayer, ImageContainer, ActionCard, MarkdownRenderer, ImageCard, TeaserImage, MarkdownLoader, getLocalizedString, SurveyView } from 'case-web-ui';
5
5
  import { useTranslation, Trans, initReactI18next } from 'react-i18next';
6
6
  import { useSelector, useDispatch } from 'react-redux';
7
7
  import { createStore, combineReducers, applyMiddleware, compose } from 'redux';
@@ -10948,11 +10948,13 @@ var resetApiAuth = function () {
10948
10948
 
10949
10949
  var useLogout = function () {
10950
10950
  var history = useHistory();
10951
+ var dispatch = useDispatch();
10951
10952
  return function (withoutRedirect) {
10953
+ dispatch(setPersistState(false));
10952
10954
  resetApiAuth();
10953
10955
  localStorageManager.remove();
10954
10956
  if (history && !withoutRedirect) {
10955
- history.push('/');
10957
+ history.push("/");
10956
10958
  }
10957
10959
  };
10958
10960
  };
@@ -19025,7 +19027,6 @@ var EditProfile = function (props) {
19025
19027
  props.onClose();
19026
19028
  };
19027
19029
  var isNewProfile = profile.id.length < 1;
19028
- var consentText = t('dialogs:editProfile.consentCheckboxText');
19029
19030
  return (jsx(Dialog, __assign({ open: props.open, onClose: close, title: isNewProfile ?
19030
19031
  t('dialogs:editProfile.new.title') : t('dialogs:editProfile.edit.title'), ariaLabelledBy: "editProfileDialogTitle" }, { children: jsxs("div", __assign({ className: clsx(defaultDialogPaddingXClass, 'py-3', 'bg-grey-1') }, { children: [jsx("label", __assign({ className: "mb-1 form-label", htmlFor: "consent" }, { children: t('dialogs:editProfile.consentCheckboxLabel') }), void 0), jsx(Checkbox, __assign({ id: "consent", name: "consent", checked: profile.consentConfirmedAt > 0, onChange: function (value) {
19031
19032
  if (value) {
@@ -19038,7 +19039,7 @@ var EditProfile = function (props) {
19038
19039
  return __assign(__assign({}, prev), { consentConfirmedAt: 0 });
19039
19040
  });
19040
19041
  }
19041
- } }, { children: jsx(MarkdownRenderer, { className: "p-0 flex-grow-1", markdown: consentText }, void 0) }), void 0), jsx(TextField, { className: "my-2", id: "nickname", name: "nickname", maxLength: 35, required: true, label: t('dialogs:editProfile.aliasInputLabel'), placeholder: t('dialogs:editProfile.aliasInputPlaceholder'), value: profile.alias, autoComplete: "off", onChange: function (event) {
19042
+ } }, { children: t('dialogs:editProfile.consentCheckboxText') }), void 0), jsx(TextField, { className: "my-2", id: "nickname", name: "nickname", maxLength: 35, required: true, label: t('dialogs:editProfile.aliasInputLabel'), placeholder: t('dialogs:editProfile.aliasInputPlaceholder'), value: profile.alias, autoComplete: "off", onChange: function (event) {
19042
19043
  var value = event.target.value;
19043
19044
  setProfile(function (prev) { return __assign(__assign({}, prev), { alias: value }); });
19044
19045
  } }, void 0), jsx(AvatarSelector, { avatars: avatars, className: "", title: t('dialogs:editProfile.avatarSelectorLabel'), selectedAvatarId: profile.avatarId, onSelectAvatar: function (avatar) {
@@ -24983,9 +24984,6 @@ var ContentRenderer = function (props) {
24983
24984
  else if (action_1.type === 'navigate') {
24984
24985
  history.push(action_1.value);
24985
24986
  }
24986
- else if (action_1.type === 'navigateExternal') {
24987
- window.open(action_1.value, '_blank');
24988
- }
24989
24987
  } }, item.itemKey);
24990
24988
  case 'actionCard':
24991
24989
  var actionCardAction_1 = item.config.action;
@@ -26212,7 +26210,8 @@ var SurveyPage = function (props) {
26212
26210
  var survey = _a[_i];
26213
26211
  if (survey.category === 'immediate' && survey.surveyKey !== currentSurveyKey) {
26214
26212
  var now = Math.round(new Date().getTime() / 1000);
26215
- if (!survey.validUntil || parseFloat(survey.validUntil) > now) {
26213
+ var currentlyValid = (!survey.validUntil || parseFloat(survey.validUntil) > now) && (!survey.validFrom || parseFloat(survey.validFrom) < now);
26214
+ if (currentlyValid) {
26216
26215
  setCurrentSurveyKey(survey.surveyKey);
26217
26216
  shouldOpenSurvey = true;
26218
26217
  break;
@@ -26365,18 +26364,17 @@ var SurveyPage = function (props) {
26365
26364
 
26366
26365
  var Pages = function (props) {
26367
26366
  var isAuth = useIsAuthenticated();
26368
- // Loading page:
26369
- var loadingDiv = jsx("div", __assign({ className: clsx(containerClassName, 'my-3') }, { children: jsx(LoadingPlaceholder, { className: 'loading-page', color: 'secondary', minHeight: '60vh' }, void 0) }), void 0);
26370
26367
  if (!props.config) {
26371
- return loadingDiv;
26368
+ // Loading page:
26369
+ return jsx("div", __assign({ className: clsx(containerClassName, 'my-3') }, { children: jsx(LoadingPlaceholder, { color: 'secondary', minHeight: '60vh' }, void 0) }), void 0);
26372
26370
  }
26373
26371
  var notFoundRoute = props.defaultRoutes.notFound ? props.defaultRoutes.notFound : (isAuth ? props.defaultRoutes.auth : props.defaultRoutes.unauth);
26374
- return (jsx(Suspense, __assign({ fallback: loadingDiv }, { children: jsx("div", { children: jsxs(Switch, { children: [jsx(Redirect, { from: "/", exact: true, to: isAuth ? props.defaultRoutes.auth : props.defaultRoutes.unauth }, void 0), props.config.pages.map(function (pageConfig) {
26375
- return jsx(RouteToLayout, { path: pageConfig.path, pageConfig: pageConfig, defaultRoutes: props.defaultRoutes, extensions: props.extensions, dateLocales: props.dateLocales }, pageConfig.path);
26376
- }), jsx(Route, { path: props.defaultRoutes.surveyPage + '/:studyKey', render: function () { return jsx(SurveyPage, { customResponseComponents: props.customResponseComponents, dateLocales: props.dateLocales, urls: {
26377
- finishedFlowWithLogin: props.defaultRoutes.auth,
26378
- finishedFlowWithoutLogin: props.defaultRoutes.unauth
26379
- } }, void 0); } }, void 0), jsx(Route, { path: linkResolverRootUrl, render: function () { return jsx(LinkResolver, { defaultRoutes: props.defaultRoutes }, void 0); } }, void 0), jsx(Redirect, { to: notFoundRoute }, void 0)] }, void 0) }, void 0) }), void 0));
26372
+ return (jsx("div", { children: jsxs(Switch, { children: [jsx(Redirect, { from: "/", exact: true, to: isAuth ? props.defaultRoutes.auth : props.defaultRoutes.unauth }, void 0), props.config.pages.map(function (pageConfig) {
26373
+ return jsx(RouteToLayout, { path: pageConfig.path, pageConfig: pageConfig, defaultRoutes: props.defaultRoutes, extensions: props.extensions, dateLocales: props.dateLocales }, pageConfig.path);
26374
+ }), jsx(Route, { path: props.defaultRoutes.surveyPage + '/:studyKey', render: function () { return jsx(SurveyPage, { customResponseComponents: props.customResponseComponents, dateLocales: props.dateLocales, urls: {
26375
+ finishedFlowWithLogin: props.defaultRoutes.auth,
26376
+ finishedFlowWithoutLogin: props.defaultRoutes.unauth
26377
+ } }, void 0); } }, void 0), jsx(Route, { path: linkResolverRootUrl, render: function () { return jsx(LinkResolver, { defaultRoutes: props.defaultRoutes }, void 0); } }, void 0), jsx(Redirect, { to: notFoundRoute }, void 0)] }, void 0) }, void 0));
26380
26378
  };
26381
26379
 
26382
26380
  function _typeof$3(obj) {