From b29181f12660903c75d6d50d0dde9ead036fc77b 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 (but not under the root loader). 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 baee53fbaf..80f810af44 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 ae89823b99..807a6a9597 100644 --- a/src/routes.tsx +++ b/src/routes.tsx @@ -214,6 +214,19 @@ function getOtherRoutes() { }; }, }, + { + path: ':enterpriseSlug/invite/:enterpriseCustomerInviteKey', + lazy: async () => { + const { + default: EnterpriseInviteRoute, + makeEnterpriseInviteLoader, + } = await import('./components/app/routes/EnterpriseInviteRoute'); + return { + Component: EnterpriseInviteRoute, + loader: makeEnterpriseInviteLoader(), + }; + }, + }, ]; return otherRoutes; }