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

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +26 -1
  2. package/build/AppCore.d.ts +7 -7
  3. package/build/api/authAPI.d.ts +1 -1
  4. package/build/api/instances/authenticatedApi.d.ts +3 -0
  5. package/build/api/types/user.d.ts +15 -0
  6. package/build/api/userAPI.d.ts +3 -3
  7. package/build/components/dialogs/GlobalDialogs/EditProfile.d.ts +2 -2
  8. package/build/components/dialogs/GlobalDialogs/Login.d.ts +2 -2
  9. package/build/components/dialogs/GlobalDialogs/ManageProfiles.d.ts +2 -4
  10. package/build/components/navbar/NavbarComponents/NormalNavbar.d.ts +2 -2
  11. package/build/components/pages/Pages.d.ts +5 -5
  12. package/build/components/pages/components/LinkResolver/LinkResolver.d.ts +2 -9
  13. package/build/components/pages/components/LinkResolver/Resolvers/ContactVerification.d.ts +2 -2
  14. package/build/components/pages/components/LinkResolver/Resolvers/Invitation.d.ts +2 -2
  15. package/build/components/pages/components/LinkResolver/Resolvers/LinkResolverConst.d.ts +7 -0
  16. package/build/components/pages/components/LinkResolver/Resolvers/PasswordReset.d.ts +2 -2
  17. package/build/components/pages/components/LinkResolver/Resolvers/StudyLogin.d.ts +2 -2
  18. package/build/components/pages/components/SurveyPage/Dialogs/ProfileSelectionDialog.d.ts +2 -2
  19. package/build/components/pages/components/SurveyPage/SurveyPage.d.ts +2 -2
  20. package/build/components/study/DefaultStudiesManager.d.ts +3 -0
  21. package/build/components/study/SurveyList.d.ts +2 -2
  22. package/build/index.d.ts +19 -10
  23. package/build/index.es.js +6022 -2979
  24. package/build/index.es.js.map +1 -1
  25. package/build/index.js +6089 -3052
  26. package/build/index.js.map +1 -1
  27. package/build/store/actions/studiesActions.d.ts +8 -0
  28. package/build/store/actions/userActions.d.ts +9 -0
  29. package/build/store/rootReducer.d.ts +3 -2
  30. package/build/store/studiesSlice.d.ts +9 -0
  31. package/build/store/thunks/studiesThunks.d.ts +18 -0
  32. package/build/store/thunks/userThunks.d.ts +3 -0
  33. package/build/store/userSlice.d.ts +6 -5
  34. package/package.json +14 -14
package/CHANGELOG.md CHANGED
@@ -1,12 +1,37 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.7.5 - staging
4
+
5
+ ## Bugfix
6
+
7
+ - corrected multiple instances of circular reference
8
+
9
+ ## Added
10
+
11
+ - Thunks available to be used in your application
12
+ - `enterStudiesThunk` : used to simplify the assignment of a profile to new studies.
13
+ It also make sure to fetch new surveys associated to the newly assigned studies.
14
+
15
+ ## Changed
16
+
17
+ - SurveyList component rework
18
+
19
+ - profiles are no longer subscribed to default studies inside this component
20
+ - active surveys are now saved in the redux store so it's easy to re render the component
21
+ from your application in case the user is assigned new surveys or studies
22
+
23
+ - DefaultStudiesManager component
24
+
25
+ - initialize store state related to studies and surveys
26
+ - make sure default studies are assigned to all profiles (backward compatibility)
27
+
3
28
  ## 2.7.4 - 2023-11-20
4
29
 
5
30
  ### Changed
6
31
 
7
32
  - on logout, the local storage is emptied and the persistState flag is set to false, preventing the app to save
8
33
  an empty state. This fixed an incorrect behavior during the sign up process for users that previously unsubscribed
9
- from the platform
34
+ from the platform and then subscribed again
10
35
 
11
36
  ## 2.7.3 - 2023-10-25
12
37
 
@@ -1,10 +1,10 @@
1
- import React from 'react';
2
- import { FooterConfig } from './types/footerConfig';
3
- import { AppConfig } from './types/appConfig';
4
- import { HeaderConfig } from './types/headerConfig';
5
- import { NavbarConfig } from './types/navbarConfig';
6
- import { PagesConfig } from './types/pagesConfig';
7
- import { CustomSurveyResponseComponent } from 'case-web-ui/build/components/survey/SurveySingleItemView/ResponseComponent/ResponseComponent';
1
+ import React from "react";
2
+ import { FooterConfig } from "./types/footerConfig";
3
+ import { AppConfig } from "./types/appConfig";
4
+ import { HeaderConfig } from "./types/headerConfig";
5
+ import { NavbarConfig } from "./types/navbarConfig";
6
+ import { PagesConfig } from "./types/pagesConfig";
7
+ import { CustomSurveyResponseComponent } from "@influenzanet/case-web-ui/build/components/survey/SurveySingleItemView/ResponseComponent/ResponseComponent";
8
8
  export interface Extension {
9
9
  name: string;
10
10
  component: React.FunctionComponent<any>;
@@ -1,4 +1,4 @@
1
- import { SignupMsg, LoginMsg, TokenResponse, LoginResponse, AutoTokenValidationResponse } from './types/authAPI';
1
+ import { SignupMsg, LoginMsg, TokenResponse, LoginResponse, AutoTokenValidationResponse } from "./types/authAPI";
2
2
  export declare const signupWithEmailRequest: (creds: SignupMsg, recaptchaToken?: string | undefined) => Promise<import("axios").AxiosResponse<TokenResponse, any>>;
3
3
  export declare const loginWithEmailRequest: (creds: LoginMsg) => Promise<import("axios").AxiosResponse<LoginResponse, any>>;
4
4
  export declare const resend2FAVerificationCodeRequest: (creds: LoginMsg) => Promise<import("axios").AxiosResponse<any, any>>;
@@ -1,4 +1,7 @@
1
+ import { TokenResponse } from "../types/authAPI";
1
2
  declare const authApiInstance: import("axios").AxiosInstance;
3
+ export declare const renewTokenURL = "/v1/auth/renew-token";
4
+ export declare const renewTokenReq: (refreshToken: string) => Promise<import("axios").AxiosResponse<TokenResponse, any>>;
2
5
  export declare const renewToken: () => Promise<string>;
3
6
  export declare const setDefaultAccessTokenHeader: (token: string) => void;
4
7
  export declare const resetApiAuth: () => void;
@@ -1,3 +1,4 @@
1
+ import { AssignedSurvey } from "./studyAPI";
1
2
  export interface User {
2
3
  id: string;
3
4
  account: {
@@ -24,6 +25,20 @@ export interface Profile {
24
25
  avatarId: string;
25
26
  createdAt: number;
26
27
  mainProfile: boolean;
28
+ /**
29
+ * The following fields were added here for convenience since
30
+ * the types defined in this file are also used as type for
31
+ * the redux store object. This practice of using the same type
32
+ * for different domains only because they superficially share a set
33
+ * of common properties is huge mistake that we
34
+ * cannot correct right now because it would involve a large
35
+ * refactoring
36
+ *
37
+ * When adding properties here make sure you remove them
38
+ * when posting the profile in ../userAPI.ts
39
+ */
40
+ studies: string[];
41
+ activeSurveys: AssignedSurvey[];
27
42
  }
28
43
  export interface ContactPreferences {
29
44
  subscribedToNewsletter: boolean;
@@ -1,6 +1,6 @@
1
- import { PasswordResetInfos } from './types/authAPI';
2
- import { ServiceStatus } from './types/general';
3
- import { User, Profile, ContactPreferences, ContactInfo } from './types/user';
1
+ import { PasswordResetInfos } from "./types/authAPI";
2
+ import { ServiceStatus } from "./types/general";
3
+ import { User, Profile, ContactPreferences, ContactInfo } from "./types/user";
4
4
  export declare const initiatePasswordResetReq: (instanceId: string, accountId: string) => Promise<import("axios").AxiosResponse<ServiceStatus, any>>;
5
5
  export declare const getInfosForPasswordResetReq: (token: string) => Promise<import("axios").AxiosResponse<PasswordResetInfos, any>>;
6
6
  export declare const resetPasswordReq: (token: string, newPassword: string) => Promise<import("axios").AxiosResponse<ServiceStatus, any>>;
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { Profile } from '../../../api/types/user';
1
+ import React from "react";
2
+ import { Profile } from "../../../api/types/user";
3
3
  interface EditProfileProps {
4
4
  open: boolean;
5
5
  selectedProfile: Profile;
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { DefaultRoutes } from '../../../types/routing';
1
+ import React from "react";
2
+ import { DefaultRoutes } from "../../../types/routing";
3
3
  interface LoginProps {
4
4
  defaultRoutes: DefaultRoutes;
5
5
  }
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
- interface ManageProfilesProps {
3
- }
4
- declare const ManageProfiles: React.FC<ManageProfilesProps>;
1
+ import React from "react";
2
+ declare const ManageProfiles: React.FC;
5
3
  export default ManageProfiles;
@@ -1,5 +1,5 @@
1
- import { AvatarConfig } from 'case-web-ui/build/types/avatars';
2
- import { Profile } from 'case-web-ui/build/types/profile';
1
+ import { AvatarConfig } from '@influenzanet/case-web-ui/build/types/avatars';
2
+ import { Profile } from '@influenzanet/case-web-ui/build/types/profile';
3
3
  import React from 'react';
4
4
  import { NavbarConfig } from '../../../types/navbarConfig';
5
5
  export declare type NavbarBreakpoints = "md" | "sm" | "lg" | "xl" | "xxl";
@@ -1,8 +1,8 @@
1
- import React from 'react';
2
- import { PagesConfig } from '../../types/pagesConfig';
3
- import { DefaultRoutes } from '../../types/routing';
4
- import { Extension } from '../../AppCore';
5
- import { CustomSurveyResponseComponent } from 'case-web-ui/build/components/survey/SurveySingleItemView/ResponseComponent/ResponseComponent';
1
+ import React from "react";
2
+ import { PagesConfig } from "../../types/pagesConfig";
3
+ import { DefaultRoutes } from "../../types/routing";
4
+ import { Extension } from "../../AppCore";
5
+ import { CustomSurveyResponseComponent } from "@influenzanet/case-web-ui/build/components/survey/SurveySingleItemView/ResponseComponent/ResponseComponent";
6
6
  interface PagesProps {
7
7
  config?: PagesConfig;
8
8
  extensions?: Extension[];
@@ -1,12 +1,5 @@
1
- import React from 'react';
2
- import { DefaultRoutes } from '../../../../types/routing';
3
- export declare const linkResolverRootUrl = "/link";
4
- export declare const LinkResolverPaths: {
5
- ContactVerification: string;
6
- PasswordReset: string;
7
- StudyLogin: string;
8
- Invitation: string;
9
- };
1
+ import React from "react";
2
+ import { DefaultRoutes } from "../../../../types/routing";
10
3
  interface LinkResolverProps {
11
4
  defaultRoutes: DefaultRoutes;
12
5
  }
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { DefaultRoutes } from '../../../../../types/routing';
1
+ import React from "react";
2
+ import { DefaultRoutes } from "../../../../../types/routing";
3
3
  interface ContactVerificationProps {
4
4
  defaultRoutes: DefaultRoutes;
5
5
  }
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { DefaultRoutes } from '../../../../../types/routing';
1
+ import React from "react";
2
+ import { DefaultRoutes } from "../../../../../types/routing";
3
3
  interface InvitationProps {
4
4
  defaultRoutes: DefaultRoutes;
5
5
  }
@@ -0,0 +1,7 @@
1
+ export declare const linkResolverRootUrl = "/link";
2
+ export declare const LinkResolverPaths: {
3
+ ContactVerification: string;
4
+ PasswordReset: string;
5
+ StudyLogin: string;
6
+ Invitation: string;
7
+ };
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { DefaultRoutes } from '../../../../../types/routing';
1
+ import React from "react";
2
+ import { DefaultRoutes } from "../../../../../types/routing";
3
3
  interface PasswordResetProps {
4
4
  defaultRoutes: DefaultRoutes;
5
5
  }
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { DefaultRoutes } from '../../../../../types/routing';
1
+ import React from "react";
2
+ import { DefaultRoutes } from "../../../../../types/routing";
3
3
  interface StudyLoginProps {
4
4
  defaultRoutes: DefaultRoutes;
5
5
  }
@@ -1,5 +1,5 @@
1
- import { AvatarConfig } from 'case-web-ui/build/types/avatars';
2
- import { Profile } from 'case-web-ui/build/types/profile';
1
+ import { AvatarConfig } from '@influenzanet/case-web-ui/build/types/avatars';
2
+ import { Profile } from '@influenzanet/case-web-ui/build/types/profile';
3
3
  import React from 'react';
4
4
  interface ProfileSelectionDialogProps {
5
5
  open: boolean;
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { CustomSurveyResponseComponent } from 'case-web-ui/build/components/survey/SurveySingleItemView/ResponseComponent/ResponseComponent';
1
+ import React from "react";
2
+ import { CustomSurveyResponseComponent } from "@influenzanet/case-web-ui/build/components/survey/SurveySingleItemView/ResponseComponent/ResponseComponent";
3
3
  interface SurveyPageProps {
4
4
  customResponseComponents?: CustomSurveyResponseComponent[];
5
5
  dateLocales?: Array<{
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const DefaultStudiesManager: React.FC;
3
+ export default DefaultStudiesManager;
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
- import { DefaultRoutes } from '../../types/routing';
1
+ import React from "react";
2
+ import { DefaultRoutes } from "../../types/routing";
3
3
  interface SurveyListProps {
4
4
  pageKey: string;
5
5
  itemKey: string;
package/build/index.d.ts CHANGED
@@ -1,11 +1,16 @@
1
- import AppCore from './AppCore';
2
- import { initI18n } from './i18n';
3
- import store, { localStorageManager, reducersManager } from './store/store';
4
- import * as studyAPI from './api/studyAPI';
5
- import * as userAPI from './api/userAPI';
1
+ import AppCore from "./AppCore";
2
+ import { initI18n } from "./i18n";
3
+ import store, { localStorageManager, reducersManager } from "./store/store";
4
+ import * as studyAPI from "./api/studyAPI";
5
+ import * as userAPI from "./api/userAPI";
6
6
  import { useAuthTokenCheck } from "./hooks/useAuthTokenCheck";
7
- import PreventAccidentalNavigationPrompt from './components/misc/PreventAccidentalNavigationPrompt';
8
- import InternalNavigator from './components/misc/InternalNavigator';
7
+ import PreventAccidentalNavigationPrompt from "./components/misc/PreventAccidentalNavigationPrompt";
8
+ import InternalNavigator from "./components/misc/InternalNavigator";
9
+ import { AppConfig } from "./types/appConfig";
10
+ import { HeaderConfig } from './types/headerConfig';
11
+ import { FooterConfig } from './types/footerConfig';
12
+ import { NavbarConfig } from './types/navbarConfig';
13
+ import { PageConfig, PagesConfig } from './types/pagesConfig';
9
14
  declare const coreReduxActions: {
10
15
  appActions: import("@reduxjs/toolkit").CaseReducerActions<{
11
16
  reset: (state: import("immer/dist/internal").WritableDraft<import("./store/appSlice").AppState>) => import("immer/dist/internal").WritableDraft<import("./store/appSlice").AppState>;
@@ -50,11 +55,11 @@ declare const coreReduxActions: {
50
55
  }): void;
51
56
  }>;
52
57
  userActions: import("@reduxjs/toolkit").CaseReducerActions<{
53
- reset: (state: import("immer/dist/internal").WritableDraft<import("./store/userSlice").UserState>) => import("immer/dist/internal").WritableDraft<import("./store/userSlice").UserState>;
58
+ reset: () => import("./store/userSlice").UserState;
54
59
  initializeLanguage: (state: import("immer/dist/internal").WritableDraft<import("./store/userSlice").UserState>, action: {
55
60
  payload: string;
56
61
  type: string;
57
- }) => import("immer/dist/internal").WritableDraft<import("./store/userSlice").UserState>;
62
+ }) => void;
58
63
  setFromTokenResponse: (state: import("immer/dist/internal").WritableDraft<import("./store/userSlice").UserState>, action: {
59
64
  payload: import("./api/types/authAPI").TokenResponse;
60
65
  type: string;
@@ -75,5 +80,9 @@ declare const coreReduxActions: {
75
80
  signupActions: {
76
81
  contactVerified: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
77
82
  };
83
+ studiesActions: import("@reduxjs/toolkit").CaseReducerActions<{}>;
84
+ };
85
+ declare const coreReduxThunks: {
86
+ enterStudiesThunk: import("@reduxjs/toolkit").AsyncThunk<import("./store/actions/studiesActions").EnterStudiesPayload, import("./store/thunks/studiesThunks").EnterStudiesRequest, {}>;
78
87
  };
79
- export { AppCore, initI18n, store, reducersManager, localStorageManager, studyAPI, userAPI, coreReduxActions, useAuthTokenCheck, PreventAccidentalNavigationPrompt, InternalNavigator };
88
+ export { AppCore, initI18n, store, reducersManager, localStorageManager, studyAPI, userAPI, coreReduxActions, coreReduxThunks, useAuthTokenCheck, PreventAccidentalNavigationPrompt, InternalNavigator, type AppConfig, type HeaderConfig, type FooterConfig, type NavbarConfig, type PageConfig, type PagesConfig };