@influenzanet/case-web-app-core 2.7.4-staging.7 → 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
  };
@@ -16013,6 +16015,8 @@ class ModalManager {
16013
16015
 
16014
16016
  }
16015
16017
 
16018
+ var ModalManager$1 = ModalManager;
16019
+
16016
16020
  const resolveContainerRef = (ref, document) => {
16017
16021
  if (!canUseDOM) return null;
16018
16022
  if (ref == null) return (document || ownerDocument()).body;
@@ -16051,7 +16055,7 @@ function _objectWithoutPropertiesLoose$4(source, excluded) { if (source == null)
16051
16055
  let manager;
16052
16056
 
16053
16057
  function getManager(window) {
16054
- if (!manager) manager = new ModalManager({
16058
+ if (!manager) manager = new ModalManager$1({
16055
16059
  ownerDocument: window == null ? void 0 : window.document
16056
16060
  });
16057
16061
  return manager;
@@ -16284,7 +16288,7 @@ const Modal = /*#__PURE__*/forwardRef$2((_ref, ref) => {
16284
16288
  });
16285
16289
  Modal.displayName = 'Modal';
16286
16290
  var BaseModal = Object.assign(Modal, {
16287
- Manager: ModalManager
16291
+ Manager: ModalManager$1
16288
16292
  });
16289
16293
 
16290
16294
  /**
@@ -16335,7 +16339,7 @@ const Selector = {
16335
16339
  STICKY_CONTENT: '.sticky-top',
16336
16340
  NAVBAR_TOGGLER: '.navbar-toggler'
16337
16341
  };
16338
- class BootstrapModalManager extends ModalManager {
16342
+ class BootstrapModalManager extends ModalManager$1 {
16339
16343
  adjustAndStore(prop, element, adjust) {
16340
16344
  const actual = element.style[prop];
16341
16345
  // TODO: DOMStringMap and CSSStyleDeclaration aren't strictly compatible
@@ -19023,7 +19027,6 @@ var EditProfile = function (props) {
19023
19027
  props.onClose();
19024
19028
  };
19025
19029
  var isNewProfile = profile.id.length < 1;
19026
- var consentText = t('dialogs:editProfile.consentCheckboxText');
19027
19030
  return (jsx(Dialog, __assign({ open: props.open, onClose: close, title: isNewProfile ?
19028
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) {
19029
19032
  if (value) {
@@ -19036,7 +19039,7 @@ var EditProfile = function (props) {
19036
19039
  return __assign(__assign({}, prev), { consentConfirmedAt: 0 });
19037
19040
  });
19038
19041
  }
19039
- } }, { 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) {
19040
19043
  var value = event.target.value;
19041
19044
  setProfile(function (prev) { return __assign(__assign({}, prev), { alias: value }); });
19042
19045
  } }, void 0), jsx(AvatarSelector, { avatars: avatars, className: "", title: t('dialogs:editProfile.avatarSelectorLabel'), selectedAvatarId: profile.avatarId, onSelectAvatar: function (avatar) {
@@ -24981,9 +24984,6 @@ var ContentRenderer = function (props) {
24981
24984
  else if (action_1.type === 'navigate') {
24982
24985
  history.push(action_1.value);
24983
24986
  }
24984
- else if (action_1.type === 'navigateExternal') {
24985
- window.open(action_1.value, '_blank');
24986
- }
24987
24987
  } }, item.itemKey);
24988
24988
  case 'actionCard':
24989
24989
  var actionCardAction_1 = item.config.action;
@@ -26210,7 +26210,8 @@ var SurveyPage = function (props) {
26210
26210
  var survey = _a[_i];
26211
26211
  if (survey.category === 'immediate' && survey.surveyKey !== currentSurveyKey) {
26212
26212
  var now = Math.round(new Date().getTime() / 1000);
26213
- 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) {
26214
26215
  setCurrentSurveyKey(survey.surveyKey);
26215
26216
  shouldOpenSurvey = true;
26216
26217
  break;
@@ -26333,7 +26334,7 @@ var SurveyPage = function (props) {
26333
26334
  manageProfiles: t('surveyPage:profileSelectionDialog.manageProfilesBtn'),
26334
26335
  }, avatars: avatars, profiles: currentUser.profiles, onSelectProfile: function (p) {
26335
26336
  setSelectedProfileID(p.id);
26336
- setDialogOpen(undefined);
26337
+ dialogActions.closeDialog();
26337
26338
  }, onOpenProfileManager: function () {
26338
26339
  dispatch(dialogActions.openDialogWithoutPayload({ type: 'manageProfiles', origin: 'surveyFlow' }));
26339
26340
  } }, void 0), jsx(SuccessDialog, { open: dialogOpen === 'SubmitSuccessDialog', texts: {
@@ -26363,18 +26364,17 @@ var SurveyPage = function (props) {
26363
26364
 
26364
26365
  var Pages = function (props) {
26365
26366
  var isAuth = useIsAuthenticated();
26366
- // Loading page:
26367
- var loadingDiv = jsx("div", __assign({ className: clsx(containerClassName, 'my-3') }, { children: jsx(LoadingPlaceholder, { className: 'loading-page', color: 'secondary', minHeight: '60vh' }, void 0) }), void 0);
26368
26367
  if (!props.config) {
26369
- 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);
26370
26370
  }
26371
26371
  var notFoundRoute = props.defaultRoutes.notFound ? props.defaultRoutes.notFound : (isAuth ? props.defaultRoutes.auth : props.defaultRoutes.unauth);
26372
- 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) {
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) }), 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));
26378
26378
  };
26379
26379
 
26380
26380
  function _typeof$3(obj) {