Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 27 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@mui/material": "^5.16.14",
"@mui/system": "^5.14.9",
"@mui/x-date-pickers": "^6.13.0",
"@pagopa/interop-fe-commons": "^1.4.6",
"@pagopa/interop-fe-commons": "^1.5.2",
"@pagopa/mui-italia": "^1.8.0",
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The upgraded version of '@pagopa/interop-fe-commons' (1.5.2) requires '@pagopa/mui-italia' version ^1.9.0 as a peer dependency, but package.json specifies ^1.8.0. This peer dependency mismatch could lead to runtime issues or warnings during installation. Update '@pagopa/mui-italia' to at least version 1.9.0 to satisfy the peer dependency requirement.

Suggested change
"@pagopa/mui-italia": "^1.8.0",
"@pagopa/mui-italia": "^1.9.0",

Copilot uses AI. Check for mistakes.
"@tanstack/react-query": "^5.51.4",
"@tanstack/react-query-devtools": "^5.51.4",
Expand All @@ -38,7 +38,7 @@
"react-error-boundary": "^4.0.11",
"react-hook-form": "^7.46.1",
"react-i18next": "^13.2.2",
"react-router-dom": "latest",
"react-router-dom": "^6.16.0",
"ts-pattern": "^5.2.0",
"zod": "^4.0.0",
"zustand": "^4.4.1"
Expand Down
2 changes: 0 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { MaintenanceBanner } from './components/shared/banners/MaintenanceBanner
import { FirstLoadingSpinner } from './components/shared/FirstLoadingSpinner'
import { queryClient } from './config/query-client'
import type { EnvironmentBannerProps } from '@pagopa/mui-italia'

import { AuthQueries } from './api/auth'
import i18n from './config/react-i18next'

Expand All @@ -31,7 +30,6 @@ if (redirectUrl) {
} else {
queryClient.prefetchQuery(AuthQueries.getSessionToken())
}

// end init ---

function App() {
Expand Down
4 changes: 3 additions & 1 deletion src/components/dialogs/DialogDeleteOperator.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { SELFCARE_BASE_URL } from '@/config/env'
import useCurrentLanguage from '@/hooks/useCurrentLanguage'
import { useDialog } from '@/stores'
import type { DialogDeleteOperatorProps } from '@/types/dialog.types'
import {
Expand All @@ -19,10 +20,11 @@ export const DialogDeleteOperator: React.FC<DialogDeleteOperatorProps> = ({
const ariaLabelId = React.useId()
const ariaDescriptionId = React.useId()
const { closeDialog } = useDialog()
const lang = useCurrentLanguage()
const { t: tCommon } = useTranslation('common', { keyPrefix: 'actions' })
const { t } = useTranslation('shared-components', { keyPrefix: 'dialogDeleteOperator' })

const selfcareUserPageUrl = `${SELFCARE_BASE_URL}/dashboard/${selfcareId}/users/${userId}`
const selfcareUserPageUrl = `${SELFCARE_BASE_URL}/dashboard/${selfcareId}/users/${userId}?lang=${lang}`

const handleCancel = () => {
closeDialog()
Expand Down
6 changes: 3 additions & 3 deletions src/components/layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export const Header: React.FC<HeaderProps> = ({ jwt, isSupport }) => {
window.location.assign(
`${SELFCARE_BASE_URL}/token-exchange?institutionId=${
party.id
}&productId=${getCurrentSelfCareProductId()}`
}&productId=${getCurrentSelfCareProductId()}&lang=${lang}`
)
}

Expand All @@ -155,12 +155,12 @@ export const Header: React.FC<HeaderProps> = ({ jwt, isSupport }) => {
if (!selfcareId) return

if (product.id === 'selfcare') {
window.location.assign(`${SELFCARE_BASE_URL}/dashboard/${selfcareId}`)
window.location.assign(`${SELFCARE_BASE_URL}/dashboard/${selfcareId}?lang=${lang}`)
return
}

window.location.assign(
`${SELFCARE_BASE_URL}/token-exchange?institutionId=${selfcareId}&productId=${product.id}`
`${SELFCARE_BASE_URL}/token-exchange?institutionId=${selfcareId}&productId=${product.id}&lang=${lang}`
)
}

Expand Down
6 changes: 3 additions & 3 deletions src/components/layout/__test__/Header.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ describe('Header', () => {
await user.click(selectPartyButton)

expect(mockWindowAssign).toBeCalledWith(
`${SELFCARE_BASE_URL}/token-exchange?institutionId=${'test-party-id'}&productId=prod-interop`
`${SELFCARE_BASE_URL}/token-exchange?institutionId=${'test-party-id'}&productId=prod-interop&lang=it`
)
})

Expand Down Expand Up @@ -451,7 +451,7 @@ describe('Header', () => {

await user.click(selectProductButton)

expect(mockWindowAssign).toBeCalledWith(`${SELFCARE_BASE_URL}/dashboard/${selfcareId}`)
expect(mockWindowAssign).toBeCalledWith(`${SELFCARE_BASE_URL}/dashboard/${selfcareId}?lang=it`)
})

it('Header handleSelectProcuct action should return the correct url if product.id is not "selfcare" and there is a jwt.selcareId', async () => {
Expand Down Expand Up @@ -493,7 +493,7 @@ describe('Header', () => {
await user.click(selectProductButton)

expect(mockWindowAssign).toBeCalledWith(
`${SELFCARE_BASE_URL}/token-exchange?institutionId=${selfcareId}&productId=${productId}`
`${SELFCARE_BASE_URL}/token-exchange?institutionId=${selfcareId}&productId=${productId}&lang=it`
)
})
})
10 changes: 8 additions & 2 deletions src/components/sidebar/InteropSidebarItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { NotificationQueries } from '@/api/notification'
import { match } from 'ts-pattern'
import { routes as routesDefinitions } from '@/router/routes'
import { get } from 'lodash'
import useCurrentLanguage from '@/hooks/useCurrentLanguage'

type InteropSidebarItems = {
routes: SidebarRoutes
Expand All @@ -28,13 +29,18 @@ export const InteropSidebarItems: React.FC<InteropSidebarItems> = ({ routes }) =
const generatePath = useGeneratePath()
const isRouteInCurrentSubtree = useIsRouteInCurrentSubtree()
const { t } = useTranslation('sidebar')
const lang = useCurrentLanguage()

const pathname = useCurrentRoute().routeKey
const { jwt, isAdmin, isSupport } = AuthHooks.useJwt()

const selfcareUsersPageUrl =
jwt && `${SELFCARE_BASE_URL}/dashboard/${jwt.selfcareId}/users#${getCurrentSelfCareProductId()}`
const selfcareGroupsPageUrl = jwt && `${SELFCARE_BASE_URL}/dashboard/${jwt.selfcareId}/groups`
jwt &&
`${SELFCARE_BASE_URL}/dashboard/${
jwt.selfcareId
}/users#${getCurrentSelfCareProductId()}?lang=${lang}`
const selfcareGroupsPageUrl =
jwt && `${SELFCARE_BASE_URL}/dashboard/${jwt.selfcareId}/groups?lang=${lang}`

const [parentExpandedItem, setParentExpandedItem] = useState<string | undefined>(
routes.find(
Expand Down
19 changes: 16 additions & 3 deletions src/router/components/RoutesWrapper/RoutesWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import React, { useEffect } from 'react'
import { Footer, Header } from '@/components/layout'
import { AppLayout } from '@/components/layout/AppLayout'
import { PageContainerSkeleton } from '@/components/layout/containers'
import { Outlet } from 'react-router-dom'
import { Outlet, useSearchParams } from 'react-router-dom'
import useScrollTopOnLocationChange from '../../hooks/useScrollTopOnLocationChange'
import { Box } from '@mui/material'
import { AuthGuard } from './AuthGuard'
Expand All @@ -11,15 +11,28 @@ import TOSAgreement from './TOSAgreement'
import { useTOSAgreement } from '../../hooks/useTOSAgreement'
import { ErrorPage } from '@/pages'
import { Dialog } from '@/components/dialogs'
import { routes, useCurrentRoute } from '@/router'
import { routes, useCurrentRoute, useSwitchPathLang } from '@/router'
import { AuthHooks } from '@/api/auth'
import { Stack } from '@mui/system'
import { AllowedLanguage } from '@/router/routes'

function EmptyWrapper({ children }: { children: React.ReactNode }) {
return <>{children}</>
}

const _RoutesWrapper: React.FC = () => {
const switchLang = useSwitchPathLang()
const [searchParams] = useSearchParams()

useEffect(() => {
const language = AllowedLanguage.safeParse(searchParams.get('lang'))
if (language.success) {
switchLang(language.data)
} else {
console.warn('Language URL params is not valid')
}
Comment on lines +27 to +33
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The warning message will be logged even when the 'lang' query parameter is absent (null). This will cause unnecessary console warnings on every page load when users navigate without the lang parameter. Consider checking if the parameter exists before logging the warning, or only log when an invalid value is explicitly provided.

Copilot uses AI. Check for mistakes.
}, [searchParams, switchLang])

const { isPublic, routeKey } = useCurrentRoute()
const {
jwt,
Expand Down
6 changes: 5 additions & 1 deletion src/router/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,17 @@ import { ConsumerPurposeTemplateDetailsPage } from '@/pages/ConsumerPurposeTempl
import ConsumerPurposeTemplateCatalogDetailsPage from '@/pages/ConsumerPurposeTemplateCatalogDetailsPage/ConsumerPurposeTemplateCatalogDetailsPage'
import { ConsumerPurposeTemplateSummaryPage } from '@/pages/ConsumerPurposeTemplateSummaryPage'
import { ConsumerPurposeTemplateEditPage } from '@/pages/ConsumerPurposeTemplateEditPage'
import z from 'zod'

const languages = ['it', 'en'] as const
export const AllowedLanguage = z.enum(languages)

export const { routes, reactRouterDOMRoutes, hooks, components, utils } = new InteropRouterBuilder<
LangCode,
UserProductRole,
{ hideSideNav: boolean }
>({
languages: ['it', 'en'],
languages,
})
.addRoute({
key: 'LOGOUT',
Expand Down
Loading