Skip to content

Commit

Permalink
feat: create a route to handle invite keys that includes the customer…
Browse files Browse the repository at this point in the history
… slug

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
  • Loading branch information
iloveagent57 committed Sep 25, 2024
1 parent 5f5a7c5 commit efd37eb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/components/app/routes/createAppRouter.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
13 changes: 13 additions & 0 deletions src/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: <NotFoundPage />,
Expand Down

0 comments on commit efd37eb

Please sign in to comment.