diff --git a/src/components/Splash/SplashRoot.tsx b/src/components/Splash/SplashRoot.tsx index 097a6317e60a81b6a42da6b55005130cc899743a..69e08c6382fcc8cd2e8c7543fd2dfcdbaa29da13 100644 --- a/src/components/Splash/SplashRoot.tsx +++ b/src/components/Splash/SplashRoot.tsx @@ -13,11 +13,14 @@ import { import { DateTime } from 'luxon' import { migrations } from 'migrations/migration.data' import { MigrationService } from 'migrations/migration.service' -import { Profile, TermsStatus, UserChallenge } from 'models' -import { CustomPopup } from 'models/customPopup.model' -import { InitSteps, InitStepsErrors } from 'models/initialisationSteps.model' -import { PartnersInfo } from 'models/partnersInfo.model' -import { ReleaseNotes } from 'models/releaseNotes.model' +import { + CustomPopup, + InitSteps, + InitStepsErrors, + PartnersInfo, + Profile, + UserChallenge, +} from 'models' import React, { Dispatch, ReactNode, @@ -185,9 +188,7 @@ const SplashRoot = ({ fadeTimer = 1000, children }: SplashRootProps) => { const partnersInfoService = new PartnersInfoService(client) const ms = new MigrationService(client, setInitStepErrors) try { - const migrationsResult: ReleaseNotes = await ms.runMigrations( - migrations - ) + const migrationsResult = await ms.runMigrations(migrations) // Init last release notes when they exist dispatch( @@ -199,8 +200,7 @@ const SplashRoot = ({ fadeTimer = 1000, children }: SplashRootProps) => { ) // init Terms - const termsStatus: TermsStatus = - await initializationService.initConsent() + const termsStatus = await initializationService.initConsent() if (subscribed) dispatch(updateTermValidation(termsStatus)) // Init fluidPrices @@ -228,14 +228,17 @@ const SplashRoot = ({ fadeTimer = 1000, children }: SplashRootProps) => { initializationService.initChallengeEntity(profile.explorationHash), initializationService.initAnalysis(profile), ]) - profile.ecogestureHash = ecogestureHash - profile.duelHash = duelHash - profile.quizHash = quizHash - profile.challengeHash = challengeHash - profile.explorationHash = explorationHash - profile.monthlyAnalysisDate = analysisResult.monthlyAnalysisDate - profile.haveSeenLastAnalysis = analysisResult.haveSeenLastAnalysis - dispatch(updateProfile(profile)) + const updatedProfile = { + ...profile, + ecogestureHash, + duelHash, + quizHash, + challengeHash, + explorationHash, + monthlyAnalysisDate: analysisResult.monthlyAnalysisDate, + haveSeenLastAnalysis: analysisResult.haveSeenLastAnalysis, + } + dispatch(updateProfile(updatedProfile)) if (profileType) { dispatch(updateProfileType(profileType)) } @@ -248,7 +251,7 @@ const SplashRoot = ({ fadeTimer = 1000, children }: SplashRootProps) => { const fluidStatus = await initializationService.initFluidStatus() if (subscribed) { dispatch(setFluidStatus(fluidStatus)) - const refDate: DateTime = DateTime.fromISO('0001-01-01') + const refDate = DateTime.fromISO('0001-01-01') let lastDataDate: DateTime | null = DateTime.fromISO('0001-01-01') for (const fluid of fluidStatus) { if (fluid.lastDataDate && fluid.lastDataDate > lastDataDate) { @@ -274,7 +277,7 @@ const SplashRoot = ({ fadeTimer = 1000, children }: SplashRootProps) => { ) { dispatch(toggleChallengeExplorationNotification(true)) } - // Set action to notifcation if action is accomplished + // Set action to notification if action is accomplished if ( filteredCurrentOngoingChallenge[0]?.action.state === UserActionState.ONGOING diff --git a/src/models/index.ts b/src/models/index.ts index 2394d563d1d58e12d150170d19d9e73fc1b1a67b..69e5f3bc14850f2b389b87537395b6042eb90aa9 100644 --- a/src/models/index.ts +++ b/src/models/index.ts @@ -4,6 +4,7 @@ export * from './analysis.model' export * from './challenge.model' export * from './chart.model' export * from './config.model' +export * from './customPopup.model' export * from './datachart.model' export * from './dataload.model' export * from './duel.model' @@ -13,8 +14,10 @@ export * from './fluid.model' export * from './fluidPrice.model' export * from './global.model' export * from './indicator.model' +export * from './initialisationSteps.model' export * from './konnector.model' export * from './modal.model' +export * from './partnersInfo.model' export * from './profile.model' export * from './profileType.model' export * from './quiz.model' diff --git a/src/store/global/global.reducer.ts b/src/store/global/global.reducer.ts index 39beff291511099d4c5da0ab6bdcc18576fed8c2..a8281e5b6b8c48217aad109bf5bb7dbc4a4668ab 100644 --- a/src/store/global/global.reducer.ts +++ b/src/store/global/global.reducer.ts @@ -37,7 +37,7 @@ const initialState: GlobalState = { challengeDuelNotification: false, analysisNotification: false, termsStatus: { - accepted: false, + accepted: true, versionType: 'init', }, fluidStatus: [ diff --git a/src/store/profile/profile.reducer.ts b/src/store/profile/profile.reducer.ts index 498a098cf83fe3e47c0914f67ea51f53f82a60e3..182a0c0bffe4486dd2ad397dcb4412e1e7f28d87 100644 --- a/src/store/profile/profile.reducer.ts +++ b/src/store/profile/profile.reducer.ts @@ -30,7 +30,7 @@ const initialState: Profile = { isProfileTypeCompleted: false, isProfileEcogestureCompleted: false, onboarding: { - isWelcomeSeen: false, + isWelcomeSeen: true, }, haveSeenEcogestureModal: false, activateHalfHourDate: DateTime.fromISO('0000-01-01T00:00:00.000Z'), diff --git a/tests/__mocks__/store.ts b/tests/__mocks__/store.ts index f523b0bfd3a81169cf045e597f636b0413d9c59b..7ef4e9327ce072d9432cbd93db6e41646be51ede 100644 --- a/tests/__mocks__/store.ts +++ b/tests/__mocks__/store.ts @@ -39,7 +39,7 @@ export const mockInitialGlobalState: GlobalState = { challengeDuelNotification: false, analysisNotification: false, termsStatus: { - accepted: false, + accepted: true, versionType: 'init', }, customPopupModal: { @@ -237,7 +237,7 @@ export const mockInitialProfileState: Profile = { monthlyAnalysisDate: DateTime.fromISO('0000-01-01T00:00:00.000Z'), isProfileTypeCompleted: false, onboarding: { - isWelcomeSeen: false, + isWelcomeSeen: true, }, haveSeenEcogestureModal: false, activateHalfHourDate: DateTime.fromISO('0000-01-01T00:00:00.000Z'),