From eb8c407a5de0b696ec17f95436f2865045ec5c7f Mon Sep 17 00:00:00 2001 From: Dylan Decrulle <81740200+ddecrulle@users.noreply.github.com> Date: Thu, 18 Apr 2024 11:22:51 +0200 Subject: [PATCH] upgrade lunatic and adjust types --- package.json | 4 +- .../Orchestrator/utils/lunaticType.ts | 22 ++- src/components/Orchestrator/utils/sequence.ts | 4 +- src/model/Page.ts | 4 +- yarn.lock | 126 ++++++++++++++++-- 5 files changed, 126 insertions(+), 34 deletions(-) diff --git a/package.json b/package.json index 7da7f5d..09a53c5 100644 --- a/package.json +++ b/package.json @@ -22,8 +22,8 @@ "@codegouvfr/react-dsfr": "^1.9.8", "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.5", - "@inseefr/lunatic": "3.0.0-rc.24", - "@inseefr/lunatic-dsfr": "2.0.0-rc.10", + "@inseefr/lunatic": "3.0.0-rc.29", + "@inseefr/lunatic-dsfr": "2.0.0-rc.12", "@mui/material": "^5.15.15", "@tanstack/react-query": "^5.29.2", "@tanstack/react-router": "^1.27.0", diff --git a/src/components/Orchestrator/utils/lunaticType.ts b/src/components/Orchestrator/utils/lunaticType.ts index 7a64c1f..1b0ecc8 100644 --- a/src/components/Orchestrator/utils/lunaticType.ts +++ b/src/components/Orchestrator/utils/lunaticType.ts @@ -1,24 +1,18 @@ -import type { useLunatic } from '@inseefr/lunatic' +import type { LunaticOptions, LunaticState } from '@inseefr/lunatic' -export type LunaticGetReferentiel = Parameters< - typeof useLunatic ->[2]['getReferentiel'] +export type LunaticGetReferentiel = LunaticOptions['getReferentiel'] export type Nomenclature = Awaited< ReturnType> > -export type LunaticGoToPage = ReturnType['goToPage'] +export type LunaticGoToPage = LunaticState['goToPage'] -export type LunaticGoPreviousPage = ReturnType< - typeof useLunatic ->['goPreviousPage'] -export type LunaticGoNextPage = ReturnType['goNextPage'] +export type LunaticGoPreviousPage = LunaticState['goPreviousPage'] +export type LunaticGoNextPage = LunaticState['goNextPage'] -export type LunaticOverview = ReturnType['overview'] +export type LunaticOverview = LunaticState['overview'] -export type LunaticPageTag = ReturnType['pageTag'] +export type LunaticPageTag = LunaticState['pageTag'] -export type LunaticComponentProps = ReturnType< - ReturnType['getComponents'] -> +export type LunaticComponentsProps = ReturnType diff --git a/src/components/Orchestrator/utils/sequence.ts b/src/components/Orchestrator/utils/sequence.ts index 5745a98..5a3090b 100644 --- a/src/components/Orchestrator/utils/sequence.ts +++ b/src/components/Orchestrator/utils/sequence.ts @@ -1,4 +1,4 @@ -import type { LunaticComponentProps } from './lunaticType' +import type { LunaticComponentsProps } from './lunaticType' -export const isSequencePage = (components: LunaticComponentProps) => +export const isSequencePage = (components: LunaticComponentsProps) => components.some((component) => component.componentType === 'Sequence') diff --git a/src/model/Page.ts b/src/model/Page.ts index 259048b..82e9b33 100644 --- a/src/model/Page.ts +++ b/src/model/Page.ts @@ -1,7 +1,7 @@ -import type { useLunatic } from '@inseefr/lunatic' +import type { LunaticState } from '@inseefr/lunatic' export type StromaePage = 'welcomePage' | 'validationPage' | 'endPage' -export type PageType = StromaePage | ReturnType['pageTag'] +export type PageType = StromaePage | LunaticState['pageTag'] export type InternalPageType = StromaePage | 'lunaticPage' diff --git a/yarn.lock b/yarn.lock index d2a91f6..dce9bf6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -750,17 +750,17 @@ minimatch "^6.2.0" validator "^13.11.0" -"@inseefr/lunatic-dsfr@2.0.0-rc.10": - version "2.0.0-rc.10" - resolved "https://registry.yarnpkg.com/@inseefr/lunatic-dsfr/-/lunatic-dsfr-2.0.0-rc.10.tgz#04789294a5dd0cb3de666097a1eed8f7cdc7ebc4" - integrity sha512-JoRtvMadpim4WWVD91ZShkijiCbfGuY6TkW07gCW1fXPBerbRNau2ZbL7qfbwjx3RHxBTuikieeO5OXr3ZxegA== +"@inseefr/lunatic-dsfr@2.0.0-rc.12": + version "2.0.0-rc.12" + resolved "https://registry.yarnpkg.com/@inseefr/lunatic-dsfr/-/lunatic-dsfr-2.0.0-rc.12.tgz#777523ad573eb5d080b7473371a06c225e062fde" + integrity sha512-BK7PkulrzUsx0weS+CwZbI+FUZs5JzktaxmrfI1nqummOGySJR2Ecv62yFeErJV9LKfWWLtGmvygy6qbUQxmMw== dependencies: react-number-format "^5.3.4" -"@inseefr/lunatic@3.0.0-rc.24": - version "3.0.0-rc.24" - resolved "https://registry.yarnpkg.com/@inseefr/lunatic/-/lunatic-3.0.0-rc.24.tgz#bc973e29fbf2cdb22a77d3199779f85de284edb5" - integrity sha512-7vy8AB6x4FhFQ3Oten7fgzOtLm4wBbiYHzeCoA3WA0lK+PHHMsGObAXfRZTeHX0Gzm61YQCkqrtqZRGd0zpzGg== +"@inseefr/lunatic@3.0.0-rc.29": + version "3.0.0-rc.29" + resolved "https://registry.yarnpkg.com/@inseefr/lunatic/-/lunatic-3.0.0-rc.29.tgz#d41375a5cd116086fc1d1291a8e81d53799f022f" + integrity sha512-LxHFApAcSCFe/flYzc3rEgC/ss8xx2kyGpnaxB4AkG7QZJWTzeSjRjBXAiWyULYR8o3XLclwAaVagP2fRZIHqA== dependencies: "@inseefr/trevas" "^0.1.20" "@inseefr/vtl-2.0-antlr-tools" "^0.1.0" @@ -769,10 +769,10 @@ date-fns "^2.25.0" minisearch "^6.3.0" react-error-boundary "^4.0.12" - react-keyboard-event-handler "^1.5.4" react-markdown "^8.0.3" react-number-format "^5.1.3" react-tooltip "^5.23.0" + remark-breaks "^4.0.0" sass "^1.58.3" "@inseefr/trevas@^0.1.20": @@ -1413,6 +1413,13 @@ dependencies: "@types/unist" "^2" +"@types/mdast@^4.0.0": + version "4.0.3" + resolved "https://registry.yarnpkg.com/@types/mdast/-/mdast-4.0.3.tgz#1e011ff013566e919a4232d1701ad30d70cab333" + integrity sha512-LsjtqsyF+d2/yFOYaN22dHZI1Cpwkrj+g06G8+qtUKlhovPW89YhqSnfKtMbkgmEtYpH2gydRNULd6y8mciAFg== + dependencies: + "@types/unist" "*" + "@types/ms@*": version "0.7.34" resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.34.tgz#10964ba0dee6ac4cd462e2795b6bebd407303433" @@ -1483,6 +1490,11 @@ resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e" integrity sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ== +"@types/unist@*", "@types/unist@^3.0.0": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@types/unist/-/unist-3.0.2.tgz#6dd61e43ef60b34086287f83683a5c1b2dc53d20" + integrity sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ== + "@types/unist@^2", "@types/unist@^2.0.0": version "2.0.10" resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.10.tgz#04ffa7f406ab628f7f7e97ca23e290cd8ab15efc" @@ -2160,6 +2172,13 @@ dequal@^2.0.0, dequal@^2.0.2: resolved "https://registry.yarnpkg.com/dequal/-/dequal-2.0.3.tgz#2644214f1997d39ed0ee0ece72335490a7ac67be" integrity sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA== +devlop@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/devlop/-/devlop-1.1.0.tgz#4db7c2ca4dc6e0e834c30be70c94bbc976dc7018" + integrity sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA== + dependencies: + dequal "^2.0.0" + diff@^5.0.0: version "5.2.0" resolved "https://registry.yarnpkg.com/diff/-/diff-5.2.0.tgz#26ded047cd1179b78b9537d5ef725503ce1ae531" @@ -2484,6 +2503,11 @@ escape-string-regexp@^4.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== +escape-string-regexp@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz#4683126b500b61762f2dbebace1806e8be31b1c8" + integrity sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw== + eslint-plugin-react-hooks@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz#4c3e697ad95b77e93f8646aaa1630c1ba607edd3" @@ -3476,6 +3500,16 @@ mdast-util-definitions@^5.0.0: "@types/unist" "^2.0.0" unist-util-visit "^4.0.0" +mdast-util-find-and-replace@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/mdast-util-find-and-replace/-/mdast-util-find-and-replace-3.0.1.tgz#a6fc7b62f0994e973490e45262e4bc07607b04e0" + integrity sha512-SG21kZHGC3XRTSUhtofZkBzZTJNM5ecCi0SK2IMKmSXR8vO3peL+kb1O0z7Zl83jKtutG4k5Wv/W7V3/YHvzPA== + dependencies: + "@types/mdast" "^4.0.0" + escape-string-regexp "^5.0.0" + unist-util-is "^6.0.0" + unist-util-visit-parents "^6.0.0" + mdast-util-from-markdown@^1.0.0: version "1.3.1" resolved "https://registry.yarnpkg.com/mdast-util-from-markdown/-/mdast-util-from-markdown-1.3.1.tgz#9421a5a247f10d31d2faed2a30df5ec89ceafcf0" @@ -3494,6 +3528,14 @@ mdast-util-from-markdown@^1.0.0: unist-util-stringify-position "^3.0.0" uvu "^0.5.0" +mdast-util-newline-to-break@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/mdast-util-newline-to-break/-/mdast-util-newline-to-break-2.0.0.tgz#4e73ef621b6b1a590240336cfe6c29915e198df0" + integrity sha512-MbgeFca0hLYIEx/2zGsszCSEJJ1JSCdiY5xQxRcLDDGa8EPvlLPupJ4DSajbMPAnC0je8jfb9TiUATnxxrHUog== + dependencies: + "@types/mdast" "^4.0.0" + mdast-util-find-and-replace "^3.0.0" + mdast-util-to-hast@^12.1.0: version "12.3.0" resolved "https://registry.yarnpkg.com/mdast-util-to-hast/-/mdast-util-to-hast-12.3.0.tgz#045d2825fb04374e59970f5b3f279b5700f6fb49" @@ -4222,11 +4264,6 @@ react-is@^18.0.0, react-is@^18.2.0: resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== -react-keyboard-event-handler@^1.5.4: - version "1.5.4" - resolved "https://registry.yarnpkg.com/react-keyboard-event-handler/-/react-keyboard-event-handler-1.5.4.tgz#bd0ccafbf62a96f605ddac78828f22efc54181f0" - integrity sha512-MSOxU/sQ5q9XWNHhXAJxzh4xVLZjKORGNC2Pzvx3qUo24TQeztGB0tq8oSArwX6vfKSIVijiw8wBmkN5pJOB4w== - react-markdown@^8.0.3: version "8.0.7" resolved "https://registry.yarnpkg.com/react-markdown/-/react-markdown-8.0.7.tgz#c8dbd1b9ba5f1c5e7e5f2a44de465a3caafdf89b" @@ -4324,6 +4361,15 @@ regexp.prototype.flags@^1.5.2: es-errors "^1.3.0" set-function-name "^2.0.1" +remark-breaks@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/remark-breaks/-/remark-breaks-4.0.0.tgz#dcc19a2891733906f3b97eaa8acb8621e8da8852" + integrity sha512-IjEjJOkH4FuJvHZVIW0QCDWxcG96kCq7An/KVH2NfJe6rKZU2AsHeB3OEjPNRxi4QC34Xdx7I2KGYn6IpT7gxQ== + dependencies: + "@types/mdast" "^4.0.0" + mdast-util-newline-to-break "^2.0.0" + unified "^11.0.0" + remark-parse@^10.0.0: version "10.0.2" resolved "https://registry.yarnpkg.com/remark-parse/-/remark-parse-10.0.2.tgz#ca241fde8751c2158933f031a4e3efbaeb8bc262" @@ -4899,6 +4945,19 @@ unified@^10.0.0: trough "^2.0.0" vfile "^5.0.0" +unified@^11.0.0: + version "11.0.4" + resolved "https://registry.yarnpkg.com/unified/-/unified-11.0.4.tgz#f4be0ac0fe4c88cb873687c07c64c49ed5969015" + integrity sha512-apMPnyLjAX+ty4OrNap7yumyVAMlKx5IWU2wlzzUdYJO9A8f1p9m/gywF/GM2ZDFcjQPrx59Mc90KwmxsoklxQ== + dependencies: + "@types/unist" "^3.0.0" + bail "^2.0.0" + devlop "^1.0.0" + extend "^3.0.0" + is-plain-obj "^4.0.0" + trough "^2.0.0" + vfile "^6.0.0" + unist-util-generated@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/unist-util-generated/-/unist-util-generated-2.0.1.tgz#e37c50af35d3ed185ac6ceacb6ca0afb28a85cae" @@ -4911,6 +4970,13 @@ unist-util-is@^5.0.0: dependencies: "@types/unist" "^2.0.0" +unist-util-is@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/unist-util-is/-/unist-util-is-6.0.0.tgz#b775956486aff107a9ded971d996c173374be424" + integrity sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw== + dependencies: + "@types/unist" "^3.0.0" + unist-util-position@^4.0.0: version "4.0.4" resolved "https://registry.yarnpkg.com/unist-util-position/-/unist-util-position-4.0.4.tgz#93f6d8c7d6b373d9b825844645877c127455f037" @@ -4925,6 +4991,13 @@ unist-util-stringify-position@^3.0.0: dependencies: "@types/unist" "^2.0.0" +unist-util-stringify-position@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz#449c6e21a880e0855bf5aabadeb3a740314abac2" + integrity sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ== + dependencies: + "@types/unist" "^3.0.0" + unist-util-visit-parents@^5.1.1: version "5.1.3" resolved "https://registry.yarnpkg.com/unist-util-visit-parents/-/unist-util-visit-parents-5.1.3.tgz#b4520811b0ca34285633785045df7a8d6776cfeb" @@ -4933,6 +5006,14 @@ unist-util-visit-parents@^5.1.1: "@types/unist" "^2.0.0" unist-util-is "^5.0.0" +unist-util-visit-parents@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/unist-util-visit-parents/-/unist-util-visit-parents-6.0.1.tgz#4d5f85755c3b8f0dc69e21eca5d6d82d22162815" + integrity sha512-L/PqWzfTP9lzzEa6CKs0k2nARxTdZduw3zyh8d2NVBnsyvHjSX4TWse388YrrQKbvI8w20fGjGlhgT96WwKykw== + dependencies: + "@types/unist" "^3.0.0" + unist-util-is "^6.0.0" + unist-util-visit@^4.0.0: version "4.1.2" resolved "https://registry.yarnpkg.com/unist-util-visit/-/unist-util-visit-4.1.2.tgz#125a42d1eb876283715a3cb5cceaa531828c72e2" @@ -5013,6 +5094,14 @@ vfile-message@^3.0.0: "@types/unist" "^2.0.0" unist-util-stringify-position "^3.0.0" +vfile-message@^4.0.0: + version "4.0.2" + resolved "https://registry.yarnpkg.com/vfile-message/-/vfile-message-4.0.2.tgz#c883c9f677c72c166362fd635f21fc165a7d1181" + integrity sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw== + dependencies: + "@types/unist" "^3.0.0" + unist-util-stringify-position "^4.0.0" + vfile@^5.0.0: version "5.3.7" resolved "https://registry.yarnpkg.com/vfile/-/vfile-5.3.7.tgz#de0677e6683e3380fafc46544cfe603118826ab7" @@ -5023,6 +5112,15 @@ vfile@^5.0.0: unist-util-stringify-position "^3.0.0" vfile-message "^3.0.0" +vfile@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/vfile/-/vfile-6.0.1.tgz#1e8327f41eac91947d4fe9d237a2dd9209762536" + integrity sha512-1bYqc7pt6NIADBJ98UiG0Bn/CHIVOoZ/IyEkqIruLg0mE1BKzkOXY2D6CSqQIcKqgadppE5lrxgWXJmXd7zZJw== + dependencies: + "@types/unist" "^3.0.0" + unist-util-stringify-position "^4.0.0" + vfile-message "^4.0.0" + vite-envs@^4.0.16: version "4.0.16" resolved "https://registry.yarnpkg.com/vite-envs/-/vite-envs-4.0.16.tgz#079f8b6ba2903d20362543810d28c149d955e7e9"