diff --git a/site/scripts/search/update-data.ts b/site/scripts/search/update-data.ts index 56bdc7dae..82a096b94 100644 --- a/site/scripts/search/update-data.ts +++ b/site/scripts/search/update-data.ts @@ -42,7 +42,7 @@ const formatRulesToAlgolia = (rules: ParsedRules) => ruleName, namespace, pathDepth: path.length, - acronyme: acronyme, + acronyme, titre: title, icone: icônes, description: description || résumé, diff --git a/site/source/ATInternetTracking/Tracker.ts b/site/source/ATInternetTracking/Tracker.ts index 73139e4cc..ce5b2b80c 100644 --- a/site/source/ATInternetTracking/Tracker.ts +++ b/site/source/ATInternetTracking/Tracker.ts @@ -97,6 +97,7 @@ export class Log implements ATTracker { constructor(options?: Record) { console.debug('ATTracker::new', options) } + setProp(name: string, value: boolean | string, persistent: boolean): void { console.debug('ATTracker::setProp', { name, value, persistent }) } @@ -106,6 +107,7 @@ export class Log implements ATTracker { console.debug('ATTracker::events.send', name, data) }, } + privacy: ATTracker['privacy'] = { setVisitorMode(...args) { console.debug('ATTracker::privacy.setVisitorMode', ...args) @@ -119,6 +121,7 @@ export class Log implements ATTracker { return { name: 'exempt' } }, } + dispatch(): void { console.debug('ATTracker::dispatch') } diff --git a/site/source/components/Distribution.tsx b/site/source/components/Distribution.tsx index ffc3b5739..1accbbb1c 100644 --- a/site/source/components/Distribution.tsx +++ b/site/source/components/Distribution.tsx @@ -6,7 +6,6 @@ import { useSelector } from 'react-redux' import { targetUnitSelector } from '@/selectors/simulationSelectors' import BarChartBranch from './BarChart' import './Distribution.css' -import './PaySlip' import { getCotisationsBySection } from './PaySlip' import RuleLink from './RuleLink' diff --git a/site/source/components/EngineValue.tsx b/site/source/components/EngineValue.tsx index 6d3750e83..5cb87b8bc 100644 --- a/site/source/components/EngineValue.tsx +++ b/site/source/components/EngineValue.tsx @@ -120,7 +120,7 @@ export function WhenNotApplicable({ } export function WhenAlreadyDefined({ - dottedName: dottedName, + dottedName, children, }: { dottedName: DottedName @@ -135,7 +135,7 @@ export function WhenAlreadyDefined({ } export function WhenNotAlreadyDefined({ - dottedName: dottedName, + dottedName, children, }: { dottedName: DottedName diff --git a/site/source/components/MoreInfosOnUs.tsx b/site/source/components/MoreInfosOnUs.tsx index 1a3e77c3c..7c22cdefd 100644 --- a/site/source/components/MoreInfosOnUs.tsx +++ b/site/source/components/MoreInfosOnUs.tsx @@ -66,7 +66,7 @@ export default function MoreInfosOnUs() { }} > - + } diff --git a/site/source/components/Notifications.tsx b/site/source/components/Notifications.tsx index 895770834..6279c82ce 100644 --- a/site/source/components/Notifications.tsx +++ b/site/source/components/Notifications.tsx @@ -28,7 +28,7 @@ export function getNotifications(engine: Engine) { return Object.values(engine.getParsedRules()) .filter( (rule) => - rule.rawNode['type'] === 'notification' && + rule.rawNode.type === 'notification' && !!engine.evaluate(rule.dottedName).nodeValue ) .map(({ dottedName, rawNode: { sévérité, résumé, description } }) => ({ diff --git a/site/source/components/PaySlipSections.tsx b/site/source/components/PaySlipSections.tsx index 1868e4f28..934f06ab7 100644 --- a/site/source/components/PaySlipSections.tsx +++ b/site/source/components/PaySlipSections.tsx @@ -39,7 +39,7 @@ export const SalaireNetSection = () => { - {customEndMessages ? ( - customEndMessages - ) : ( + {customEndMessages || ( Vous avez maintenant accès à l'estimation la plus précise possible. diff --git a/site/source/components/conversation/Explicable.tsx b/site/source/components/conversation/Explicable.tsx index b701fc24b..fe442c2b4 100644 --- a/site/source/components/conversation/Explicable.tsx +++ b/site/source/components/conversation/Explicable.tsx @@ -25,7 +25,7 @@ export function ExplicableRule({ return null } - //TODO montrer les variables de type 'une possibilité' + // TODO montrer les variables de type 'une possibilité' return ( - + {descriptionIRCEC} => { ? child : isIterable(child) ? flatMapChildren(Array.from(child)) - : typeof child == 'object' && 'props' in child + : typeof child === 'object' && 'props' in child ? // eslint-disable-next-line (child.props?.value as string) ?? flatMapChildren(child.props?.children) : '' diff --git a/site/source/components/utils/useNextQuestion.tsx b/site/source/components/utils/useNextQuestion.tsx index c700f3727..255348110 100644 --- a/site/source/components/utils/useNextQuestion.tsx +++ b/site/source/components/utils/useNextQuestion.tsx @@ -48,24 +48,24 @@ export function getNextSteps( missingVariables ) - const innerKeys = flatten(map(keys, missingVariables)), - missingByTargetsAdvanced = Object.fromEntries( - Object.entries(countBy(identity, innerKeys)).map( - // Give higher score to top level questions - ([name, score]) => [ - name, - score + Math.max(0, 4 - name.split('.').length), - ] - ) + const innerKeys = flatten(map(keys, missingVariables)) + const missingByTargetsAdvanced = Object.fromEntries( + Object.entries(countBy(identity, innerKeys)).map( + // Give higher score to top level questions + ([name, score]) => [name, score + Math.max(0, 4 - name.split('.').length)] ) + ) const missingByCompound = mergeWith( - pair, - missingByTargetsAdvanced, - missingByTotalScore - ), - pairs = toPairs(missingByCompound), - sortedPairs = sortWith([descend(byCount), descend(byScore) as any], pairs) + pair, + missingByTargetsAdvanced, + missingByTotalScore + ) + const pairs = toPairs(missingByCompound) + const sortedPairs = sortWith( + [descend(byCount), descend(byScore) as any], + pairs + ) return map(head, sortedPairs) as any } diff --git a/site/source/components/utils/useSearchParamsSimulationSharing.ts b/site/source/components/utils/useSearchParamsSimulationSharing.ts index adc0676b3..72cef7d6a 100644 --- a/site/source/components/utils/useSearchParamsSimulationSharing.ts +++ b/site/source/components/utils/useSearchParamsSimulationSharing.ts @@ -66,8 +66,6 @@ export default function useSearchParamsSimulationSharing() { setUrlSituationIsExtracted(true) } - - return }, [ currentUrl, simulationUrl, diff --git a/site/source/design-system/field/NumberField.tsx b/site/source/design-system/field/NumberField.tsx index 2f54ca7a8..e4cdb0449 100644 --- a/site/source/design-system/field/NumberField.tsx +++ b/site/source/design-system/field/NumberField.tsx @@ -357,12 +357,8 @@ function useSimpleNumberFieldState( commit: () => { rawInputValue && updateInputValue(numberValue) }, - incrementToMax: () => { - return - }, - decrementToMin: () => { - return - }, + incrementToMax: () => null, + decrementToMin: () => null, setInputValue: handleInputValueChange, formatter, } diff --git a/site/source/design-system/layout/index.ts b/site/source/design-system/layout/index.ts index 54861ab7e..ed2df9414 100644 --- a/site/source/design-system/layout/index.ts +++ b/site/source/design-system/layout/index.ts @@ -1,6 +1,7 @@ -export { default as Container } from './Container' import styled from 'styled-components' +export { default as Container } from './Container' + export const Spacing = styled.div< | { xxl: true } | { xl: true } diff --git a/site/source/hexToHSL.ts b/site/source/hexToHSL.ts index 4f69963f7..f831cab7e 100644 --- a/site/source/hexToHSL.ts +++ b/site/source/hexToHSL.ts @@ -6,13 +6,15 @@ export function hexToHSL(hex: string): [number, number, number] { let r = parseInt(result[1], 16) let g = parseInt(result[2], 16) let b = parseInt(result[3], 16) - ;(r /= 255), (g /= 255), (b /= 255) - const max = Math.max(r, g, b), - min = Math.min(r, g, b) - let h = 0, - s = 0 + r /= 255 + g /= 255 + b /= 255 + const max = Math.max(r, g, b) + const min = Math.min(r, g, b) + let h = 0 + let s = 0 const l = (max + min) / 2 - if (max != min) { + if (max !== min) { const d = max - min s = l > 0.5 ? d / (2 - max - min) : d / (max + min) switch (max) { diff --git a/site/source/pages/Creer/CreationChecklist.tsx b/site/source/pages/Creer/CreationChecklist.tsx index a55d5de7c..cd3f354fb 100644 --- a/site/source/pages/Creer/CreationChecklist.tsx +++ b/site/source/pages/Creer/CreationChecklist.tsx @@ -77,7 +77,7 @@ export default function CreateCompany({ statut }: CreateCompanyProps) { 'entreprise.page.description', "La liste complète des démarches à faire pour créer une {{statut}} auprès de l'administration française.", ], - { statut: statut } + { statut } ) } /> diff --git a/site/source/pages/Gerer/Home.tsx b/site/source/pages/Gerer/Home.tsx index eca02b19b..f8292f6ef 100644 --- a/site/source/pages/Gerer/Home.tsx +++ b/site/source/pages/Gerer/Home.tsx @@ -181,12 +181,8 @@ export default function Gérer() { - - + + diff --git a/site/source/pages/Simulateurs/ArtisteAuteur.tsx b/site/source/pages/Simulateurs/ArtisteAuteur.tsx index af1d0582f..9589b2796 100644 --- a/site/source/pages/Simulateurs/ArtisteAuteur.tsx +++ b/site/source/pages/Simulateurs/ArtisteAuteur.tsx @@ -2,9 +2,11 @@ import { DistributionBranch } from '@/components/Distribution' import { Condition } from '@/components/EngineValue' import PeriodSwitch from '@/components/PeriodSwitch' import SimulateurWarning from '@/components/SimulateurWarning' -import Simulation from '@/components/Simulation' +import Simulation, { + SimulationGoal, + SimulationGoals, +} from '@/components/Simulation' import { InstitutionsPartenairesArtisteAuteur } from '@/components/simulationExplanation/InstitutionsPartenaires' -import { SimulationGoal, SimulationGoals } from '@/components/Simulation' import { EngineContext } from '@/components/utils/EngineContext' import useSimulationConfig from '@/components/utils/useSimulationConfig' import { H2 } from '@/design-system/typography/heading' diff --git a/site/source/pages/Simulateurs/AutoEntrepreneur.tsx b/site/source/pages/Simulateurs/AutoEntrepreneur.tsx index ce6449e3a..8c6857ba8 100644 --- a/site/source/pages/Simulateurs/AutoEntrepreneur.tsx +++ b/site/source/pages/Simulateurs/AutoEntrepreneur.tsx @@ -2,9 +2,11 @@ import ChiffreAffairesActivitéMixte from '@/components/ChiffreAffairesActivité import { WhenAlreadyDefined } from '@/components/EngineValue' import PeriodSwitch from '@/components/PeriodSwitch' import SimulateurWarning from '@/components/SimulateurWarning' -import Simulation from '@/components/Simulation' +import Simulation, { + SimulationGoal, + SimulationGoals, +} from '@/components/Simulation' import { InstitutionsPartenairesAutoEntrepreneur } from '@/components/simulationExplanation/InstitutionsPartenaires' -import { SimulationGoal, SimulationGoals } from '@/components/Simulation' import StackedBarChart from '@/components/StackedBarChart' import { H2 } from '@/design-system/typography/heading' import { useContext } from 'react' diff --git a/site/source/pages/Simulateurs/ChômagePartiel.tsx b/site/source/pages/Simulateurs/ChômagePartiel.tsx index 371e0e7dc..a7fa39f2f 100644 --- a/site/source/pages/Simulateurs/ChômagePartiel.tsx +++ b/site/source/pages/Simulateurs/ChômagePartiel.tsx @@ -1,6 +1,8 @@ import RuleLink from '@/components/RuleLink' -import Simulation from '@/components/Simulation' -import { SimulationGoal, SimulationGoals } from '@/components/Simulation' +import Simulation, { + SimulationGoal, + SimulationGoals, +} from '@/components/Simulation' import { FromTop } from '@/components/ui/animate' import Warning from '@/components/ui/WarningBlock' import { useIsEmbedded } from '@/components/utils/embeddedContext' diff --git a/site/source/pages/Simulateurs/Dividendes.tsx b/site/source/pages/Simulateurs/Dividendes.tsx index 3db2ab626..e32f63486 100644 --- a/site/source/pages/Simulateurs/Dividendes.tsx +++ b/site/source/pages/Simulateurs/Dividendes.tsx @@ -2,8 +2,10 @@ import { updateSituation } from '@/actions/actions' import { HiddenOptionContext } from '@/components/conversation/ChoicesInput' import { Condition } from '@/components/EngineValue' import Notifications from '@/components/Notifications' -import Simulation from '@/components/Simulation' -import { SimulationGoal, SimulationGoals } from '@/components/Simulation' +import Simulation, { + SimulationGoal, + SimulationGoals, +} from '@/components/Simulation' import StackedBarChart from '@/components/StackedBarChart' import Warning from '@/components/ui/WarningBlock' import { useEngine } from '@/components/utils/EngineContext' diff --git a/site/source/pages/Simulateurs/ExonerationCovid/Table.tsx b/site/source/pages/Simulateurs/ExonerationCovid/Table.tsx index dc8d4632e..679697156 100644 --- a/site/source/pages/Simulateurs/ExonerationCovid/Table.tsx +++ b/site/source/pages/Simulateurs/ExonerationCovid/Table.tsx @@ -184,7 +184,7 @@ export const Row = ({ .filter((x: T | null): x is T => Boolean(x)) if (items.length > 0) { - items.unshift({ key: 'non', text: choices['non'][0] }) + items.unshift({ key: 'non', text: choices.non[0] }) } return ( diff --git a/site/source/pages/Simulateurs/Home.tsx b/site/source/pages/Simulateurs/Home.tsx index a2aedaf3a..29cf5827f 100644 --- a/site/source/pages/Simulateurs/Home.tsx +++ b/site/source/pages/Simulateurs/Home.tsx @@ -86,8 +86,8 @@ export default function Simulateurs() { - - + + @@ -108,8 +108,8 @@ export default function Simulateurs() { Autres outils - - + + diff --git a/site/source/pages/Simulateurs/Indépendant.tsx b/site/source/pages/Simulateurs/Indépendant.tsx index 1da3250b9..e8f71e925 100644 --- a/site/source/pages/Simulateurs/Indépendant.tsx +++ b/site/source/pages/Simulateurs/Indépendant.tsx @@ -3,9 +3,11 @@ import ChiffreAffairesActivitéMixte from '@/components/ChiffreAffairesActivité import { Condition } from '@/components/EngineValue' import PeriodSwitch from '@/components/PeriodSwitch' import SimulateurWarning from '@/components/SimulateurWarning' -import Simulation from '@/components/Simulation' +import Simulation, { + SimulationGoal, + SimulationGoals, +} from '@/components/Simulation' import IndépendantExplanation from '@/components/simulationExplanation/IndépendantExplanation' -import { SimulationGoal, SimulationGoals } from '@/components/Simulation' import { useEngine } from '@/components/utils/EngineContext' import { Radio, ToggleGroup } from '@/design-system/field' import { DottedName } from 'modele-social' diff --git a/site/source/pages/Simulateurs/SASU.tsx b/site/source/pages/Simulateurs/SASU.tsx index eec5a709d..9a749ccb1 100644 --- a/site/source/pages/Simulateurs/SASU.tsx +++ b/site/source/pages/Simulateurs/SASU.tsx @@ -1,8 +1,10 @@ import PeriodSwitch from '@/components/PeriodSwitch' import SimulateurWarning from '@/components/SimulateurWarning' -import Simulation from '@/components/Simulation' +import Simulation, { + SimulationGoal, + SimulationGoals, +} from '@/components/Simulation' import SalaryExplanation from '@/components/simulationExplanation/SalaryExplanation' -import { SimulationGoal, SimulationGoals } from '@/components/Simulation' export function SASUSimulation() { return ( diff --git a/site/source/pages/Simulateurs/Salarié.tsx b/site/source/pages/Simulateurs/Salarié.tsx index c85d4acf9..e2d9759e1 100644 --- a/site/source/pages/Simulateurs/Salarié.tsx +++ b/site/source/pages/Simulateurs/Salarié.tsx @@ -5,9 +5,11 @@ import Value, { } from '@/components/EngineValue' import PeriodSwitch from '@/components/PeriodSwitch' import RuleLink from '@/components/RuleLink' -import Simulation from '@/components/Simulation' +import Simulation, { + SimulationGoal, + SimulationGoals, +} from '@/components/Simulation' import SalaryExplanation from '@/components/simulationExplanation/SalaryExplanation' -import { SimulationGoal, SimulationGoals } from '@/components/Simulation' import { FromTop } from '@/components/ui/animate' import Emoji from '@/components/utils/Emoji' import { useEngine } from '@/components/utils/EngineContext' diff --git a/site/source/pages/Simulateurs/metadata.tsx b/site/source/pages/Simulateurs/metadata.tsx index 83b717004..14625f7f6 100644 --- a/site/source/pages/Simulateurs/metadata.tsx +++ b/site/source/pages/Simulateurs/metadata.tsx @@ -244,10 +244,10 @@ function getSimulatorsData({ ), }, eirl: { - ...pureSimulatorsData['eirl'], + ...pureSimulatorsData.eirl, config: indépendantConfig as SimulationConfig, meta: { - ...pureSimulatorsData['eirl']?.meta, + ...pureSimulatorsData.eirl?.meta, ogImage: AutoEntrepreneurPreview, }, component: IndépendantSimulation, @@ -255,10 +255,10 @@ function getSimulatorsData({ nextSteps: ['comparaison-statuts'], }, sasu: { - ...pureSimulatorsData['sasu'], + ...pureSimulatorsData.sasu, config: sasuConfig as SimulationConfig, meta: { - ...pureSimulatorsData['sasu']?.meta, + ...pureSimulatorsData.sasu?.meta, ogImage: RémunérationSASUPreview, }, path: sitePaths.simulateurs.sasu, @@ -306,10 +306,10 @@ function getSimulatorsData({ ), }, eurl: { - ...pureSimulatorsData['eurl'], + ...pureSimulatorsData.eurl, config: eurlConfig as SimulationConfig, meta: { - ...pureSimulatorsData['eurl']?.meta, + ...pureSimulatorsData.eurl?.meta, ogImage: RémunérationSASUPreview, }, path: sitePaths.simulateurs.eurl, @@ -510,7 +510,7 @@ function getSimulatorsData({ path: sitePaths.gérer.formulaireMobilité, }, pharmacien: { - ...pureSimulatorsData['pharmacien'], + ...pureSimulatorsData.pharmacien, config: pharmacienConfig, path: sitePaths.simulateurs['profession-libérale'].pharmacien, component: IndépendantPLSimulation, @@ -540,7 +540,7 @@ function getSimulatorsData({ component: IndépendantPLSimulation, }, avocat: { - ...pureSimulatorsData['avocat'], + ...pureSimulatorsData.avocat, config: avocatConfig, path: sitePaths.simulateurs['profession-libérale'].avocat, component: IndépendantPLSimulation, @@ -558,7 +558,7 @@ function getSimulatorsData({ component: IndépendantPLSimulation, }, pamc: { - ...pureSimulatorsData['pamc'], + ...pureSimulatorsData.pamc, path: sitePaths.simulateurs.pamc, config: professionLibéraleConfig as SimulationConfig, component: PAMCHome, @@ -595,7 +595,7 @@ function getSimulatorsData({ component: AidesEmbauche, }, is: { - ...pureSimulatorsData['is'], + ...pureSimulatorsData.is, path: sitePaths.simulateurs.is, component: ISSimulation, seoExplanations: ( @@ -633,7 +633,7 @@ function getSimulatorsData({ ), }, dividendes: { - ...pureSimulatorsData['dividendes'], + ...pureSimulatorsData.dividendes, path: sitePaths.simulateurs.dividendes, component: DividendesSimulation, config: dividendesConfig as SimulationConfig, diff --git a/site/source/pages/Stats/SatisfactionChart.tsx b/site/source/pages/Stats/SatisfactionChart.tsx index 2e0207574..22a0a157c 100644 --- a/site/source/pages/Stats/SatisfactionChart.tsx +++ b/site/source/pages/Stats/SatisfactionChart.tsx @@ -111,16 +111,16 @@ const CustomTooltip = ({ payload, active }: CustomTooltipProps) => {
  • - {Math.round((data['très bien'] ?? 0) + (data['bien'] ?? 0))}% + {Math.round((data['très bien'] ?? 0) + (data.bien ?? 0))}% {' '} satisfaits{' '} ({Math.round(data['très bien'] ?? 0)}% /{' '} - {Math.round(data['bien'] ?? 0)}% ) + {Math.round(data.bien ?? 0)}% )
  • - {Math.round(data['mauvais'] ?? 0)}% négatifs + {Math.round(data.mauvais ?? 0)}% négatifs
diff --git a/site/source/pages/integration/Options.tsx b/site/source/pages/integration/Options.tsx index 7988749dc..49fe72b51 100644 --- a/site/source/pages/integration/Options.tsx +++ b/site/source/pages/integration/Options.tsx @@ -90,7 +90,7 @@ export default function Options() { }} > - + } diff --git a/site/test/regressions/simulations.test.ts b/site/test/regressions/simulations.test.ts index 85679d8fa..0de60a7f6 100644 --- a/site/test/regressions/simulations.test.ts +++ b/site/test/regressions/simulations.test.ts @@ -59,7 +59,7 @@ const runSimulations = ( const evaluatedNotifications = Object.values(engine.getParsedRules()) .filter( (rule) => - rule.rawNode['type'] === 'notification' && + rule.rawNode.type === 'notification' && engine.evaluate(rule.dottedName).nodeValue === true ) .map((node) => node.dottedName) diff --git a/site/vite.config.ts b/site/vite.config.ts index 5da77beed..2dca7d319 100644 --- a/site/vite.config.ts +++ b/site/vite.config.ts @@ -38,7 +38,7 @@ export default defineConfig(({ command }) => ({ return } - const relativePath = filePath.replace(__dirname + '/', '') + const relativePath = filePath.replace(path.join(__dirname, '/'), '') console.log('Transform:', relativePath) const source = JSON.stringify(data) @@ -59,8 +59,6 @@ export default defineConfig(({ command }) => ({ .emit() .then(() => console.log(' Done! :', relativePath + '.d.ts')) .catch((err) => console.error(err)) - - return }, }), toml,