From 27df8b16e80b2db42dd982b998bc8ac44aa5db6e Mon Sep 17 00:00:00 2001 From: estifanos Date: Thu, 6 Aug 2026 07:04:48 +0000 Subject: [PATCH] feat(ApplicationRedirectPage): add page to resolve deep links for applications fix(LicenseQueuePage): correct sorting logic for "mine" view --- .../pages/ApplicationRedirectPage.tsx | 32 +++++++++++++++++++ apps/portal/src/app/router.tsx | 4 +++ 2 files changed, 36 insertions(+) create mode 100644 apps/portal/src/app/features/licensing/pages/ApplicationRedirectPage.tsx diff --git a/apps/portal/src/app/features/licensing/pages/ApplicationRedirectPage.tsx b/apps/portal/src/app/features/licensing/pages/ApplicationRedirectPage.tsx new file mode 100644 index 000000000..2c7589fcb --- /dev/null +++ b/apps/portal/src/app/features/licensing/pages/ApplicationRedirectPage.tsx @@ -0,0 +1,32 @@ +import { Center, Loader } from '@mantine/core'; +import { Navigate, useParams } from 'react-router-dom'; +import { useGetApplicationQuery } from '@ema-platform/api'; + +/** + * Resolves `/applications/:applicationId` deep links (notification + * callbackUrl, emails) to the canonical `/licensing/:typeCode/applications/:id` + * route, which needs the licence type key to load its config. + */ +export function ApplicationRedirectPage() { + const { applicationId } = useParams(); + const { data, isLoading, isError } = useGetApplicationQuery(applicationId!, { + skip: !applicationId, + }); + + if (!applicationId || isError) { + return ; + } + + if (isLoading) { + return ( +
+ +
+ ); + } + + const typeCode = data?.application.licenseType?.key ?? 'FREIGHT_FORWARDER'; + return ; +} + +export default ApplicationRedirectPage; diff --git a/apps/portal/src/app/router.tsx b/apps/portal/src/app/router.tsx index 8bdaa519f..7de646e6f 100644 --- a/apps/portal/src/app/router.tsx +++ b/apps/portal/src/app/router.tsx @@ -42,6 +42,7 @@ import { PaymentCheckPage } from './features/payments/pages/PaymentCheckPage'; import { PaymentSuccessPage } from './features/payments/pages/PaymentSuccessPage'; import { PaymentFailurePage } from './features/payments/pages/PaymentFailurePage'; import { LicenseApplicationPage } from './features/licensing/pages/LicenseApplicationPage'; +import { ApplicationRedirectPage } from './features/licensing/pages/ApplicationRedirectPage'; import { WaiverPage } from './features/waiver/pages/WaiverPage'; @@ -98,6 +99,9 @@ export const router = createBrowserRouter([ path: '/licensing/:typeCode/applications/:applicationId', element: , }, + // Notification / email deep links arrive as /applications/; resolve the + // licence type and forward to the canonical route. + { path: '/applications/:applicationId', element: }, // Seafarer { path: '/seafarer-registration', element: },