From efd37ebd2c327ff883da350d23934af90a63f179 Mon Sep 17 00:00:00 2001 From: Alexander Dusenbery Date: Wed, 25 Sep 2024 15:26:29 -0400 Subject: [PATCH] feat: create a route to handle invite keys that includes the customer slug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The existing universal link route does not contain the enterprise slug, so for unauthenticated users, the frontend has no knowledge of which customer’s branded logistration for which to redirect. This is typically relied upon based on the `:enterpriseSlug` route parameter in the URL, which is missing for the existing universal link route. This change adds a new invite key route that includes the enterprise slug. This will enable us to produce slug-aware invite URLs from the admin portal, that receiving learners can use to become linked to the enterprise via the B2B-specific auth flow (which is customer-aware). ENT-9428 --- src/components/app/routes/createAppRouter.test.jsx | 8 ++++++++ src/routes.tsx | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/components/app/routes/createAppRouter.test.jsx b/src/components/app/routes/createAppRouter.test.jsx index baee53fba..80f810af4 100644 --- a/src/components/app/routes/createAppRouter.test.jsx +++ b/src/components/app/routes/createAppRouter.test.jsx @@ -134,6 +134,14 @@ describe('createAppRouter', () => { usesQueryClient: false, }], }, + { + currentRoutePath: '/test-enterprise/invite/enterprise-customer-invite-key', + expectedRouteTestId: 'invite', + expectedRouteLoaders: [{ + loader: makeEnterpriseInviteLoader, + usesQueryClient: false, + }], + }, { currentRoutePath: '/test-enterprise', expectedRouteTestId: 'dashboard', diff --git a/src/routes.tsx b/src/routes.tsx index ae89823b9..01530b362 100644 --- a/src/routes.tsx +++ b/src/routes.tsx @@ -167,6 +167,19 @@ function getEnterpriseSlugRoutes(queryClient?: Types.QueryClient) { }; }, }, + { + path: 'invite/:enterpriseCustomerInviteKey', + lazy: async () => { + const { + default: EnterpriseInviteRoute, + makeEnterpriseInviteLoader, + } = await import('./components/app/routes/EnterpriseInviteRoute'); + return { + Component: EnterpriseInviteRoute, + loader: makeEnterpriseInviteLoader(), + }; + }, + }, { path: '*', element: ,