From ec80798243d43782b6dff703f2a92584b9aebd0d Mon Sep 17 00:00:00 2001 From: Bryan Frimin Date: Fri, 10 Jul 2026 15:17:28 +0200 Subject: [PATCH] Update public apps for dedicated host routing Stop relying on the /trust/{id} path prefix in the public trust app and serve it from the host root, reading contact and profile data from the trust center instead of the organization. Mirror the same fragment ownership change in the compliance portal hero. Signed-off-by: Bryan Frimin --- ...actInfo.tsx => TrustCenterContactInfo.tsx} | 34 +++++++++--------- apps/compliance-portal/src/pages/HomePage.tsx | 6 ++-- apps/trust/src/components/AuditRow.tsx | 5 +-- .../components/DocumentPageErrorBoundary.tsx | 4 +-- apps/trust/src/components/DocumentRow.tsx | 5 +-- .../src/components/OrganizationSidebar.tsx | 26 +++++++------- .../src/components/RootErrorBoundary.tsx | 4 +-- .../src/components/TrustCenterFileRow.tsx | 5 +-- .../src/hooks/useRequestAccessCallback.ts | 4 +-- apps/trust/src/hooks/useSafeContinueUrl.ts | 9 ++--- apps/trust/src/pages/DocumentPage.tsx | 4 +-- apps/trust/src/pages/NDAPage.tsx | 9 +++-- apps/trust/src/pages/auth/ConnectPage.tsx | 3 +- apps/trust/src/pages/auth/FullNamePage.tsx | 11 +++--- .../src/pages/auth/VerifyMagicLinkPage.tsx | 8 ++--- apps/trust/src/providers/RelayProviders.tsx | 13 ++----- apps/trust/src/queries/TrustGraph.ts | 10 +++--- apps/trust/src/routes.tsx | 13 +------ apps/trust/src/utils/pathPrefix.ts | 35 ------------------- 19 files changed, 63 insertions(+), 145 deletions(-) rename apps/compliance-portal/src/components/Hero/{OrganizationContactInfo.tsx => TrustCenterContactInfo.tsx} (66%) delete mode 100644 apps/trust/src/utils/pathPrefix.ts diff --git a/apps/compliance-portal/src/components/Hero/OrganizationContactInfo.tsx b/apps/compliance-portal/src/components/Hero/TrustCenterContactInfo.tsx similarity index 66% rename from apps/compliance-portal/src/components/Hero/OrganizationContactInfo.tsx rename to apps/compliance-portal/src/components/Hero/TrustCenterContactInfo.tsx index adcf55b4c..5d91acfb3 100644 --- a/apps/compliance-portal/src/components/Hero/OrganizationContactInfo.tsx +++ b/apps/compliance-portal/src/components/Hero/TrustCenterContactInfo.tsx @@ -24,29 +24,29 @@ import { graphql, useFragment } from "react-relay"; import { externalHref, hostnameOf } from "#/lib/url/hostname"; -import type { OrganizationContactInfo_organization$key } from "./__generated__/OrganizationContactInfo_organization.graphql"; +import type { TrustCenterContactInfo_trustCenter$key } from "./__generated__/TrustCenterContactInfo_trustCenter.graphql"; import { organizationContactInfo } from "./variants"; -const organizationContactInfoFragment = graphql` - fragment OrganizationContactInfo_organization on Organization { +const trustCenterContactInfoFragment = graphql` + fragment TrustCenterContactInfo_trustCenter on TrustCenter { websiteUrl email headquarterAddress } `; -interface OrganizationContactInfoProps { - organizationKey: OrganizationContactInfo_organization$key; +interface TrustCenterContactInfoProps { + trustCenterKey: TrustCenterContactInfo_trustCenter$key; } -// Organization contact details (website, email, HQ) rendered as an icon + label -// row. Owns its fragment so it can be reused wherever the org is in scope. -export function OrganizationContactInfo({ organizationKey }: OrganizationContactInfoProps) { - const organization = useFragment(organizationContactInfoFragment, organizationKey); +// Trust center contact details (website, email, HQ) rendered as an icon + label +// row. Owns its fragment so it can be reused wherever the trust center is in scope. +export function TrustCenterContactInfo({ trustCenterKey }: TrustCenterContactInfoProps) { + const trustCenter = useFragment(trustCenterContactInfoFragment, trustCenterKey); - const hasWebsite = organization.websiteUrl != null && organization.websiteUrl !== ""; - const hasEmail = organization.email != null && organization.email !== ""; - const hasAddress = organization.headquarterAddress != null && organization.headquarterAddress !== ""; + const hasWebsite = trustCenter.websiteUrl != null && trustCenter.websiteUrl !== ""; + const hasEmail = trustCenter.email != null && trustCenter.email !== ""; + const hasAddress = trustCenter.headquarterAddress != null && trustCenter.headquarterAddress !== ""; // Nothing to show — render no row (and therefore no divider) at all. if (!hasWebsite && !hasEmail && !hasAddress) { @@ -60,21 +60,21 @@ export function OrganizationContactInfo({ organizationKey }: OrganizationContact {hasWebsite && ( - {hostnameOf(organization.websiteUrl)} + {hostnameOf(trustCenter.websiteUrl)} )} {hasEmail && ( - + - {organization.email} + {trustCenter.email} )} @@ -82,7 +82,7 @@ export function OrganizationContactInfo({ organizationKey }: OrganizationContact
- {organization.headquarterAddress} + {trustCenter.headquarterAddress}
)} diff --git a/apps/compliance-portal/src/pages/HomePage.tsx b/apps/compliance-portal/src/pages/HomePage.tsx index 3041ac56b..bcbe10a78 100644 --- a/apps/compliance-portal/src/pages/HomePage.tsx +++ b/apps/compliance-portal/src/pages/HomePage.tsx @@ -24,7 +24,7 @@ import { graphql, usePreloadedQuery } from "react-relay"; import { ComplianceFrameworksSection } from "#/components/ComplianceFrameworks/ComplianceFrameworksSection"; import { Hero } from "#/components/Hero/Hero"; -import { OrganizationContactInfo } from "#/components/Hero/OrganizationContactInfo"; +import { TrustCenterContactInfo } from "#/components/Hero/TrustCenterContactInfo"; import { RecentUpdatesSection } from "#/components/RecentUpdates/RecentUpdatesSection"; import { SecurityCommitmentsSection } from "#/components/SecurityCommitments/SecurityCommitmentsSection"; import { TrustedBySection } from "#/components/TrustedBy/TrustedBySection"; @@ -36,8 +36,8 @@ export const homePageQuery = graphql` currentTrustCenter @required(action: THROW) { organization { name - ...OrganizationContactInfo_organization } + ...TrustCenterContactInfo_trustCenter ...ComplianceFrameworksSection_trustCenter ...SecurityCommitmentsSection_trustCenter ...TrustedBySection_trustCenter @@ -62,7 +62,7 @@ export function HomePage({ queryRef }: HomePageProps) { title={t("home.heroTitle", { name: organization.name })} description={t("home.heroDescription")} > - +
diff --git a/apps/trust/src/components/AuditRow.tsx b/apps/trust/src/components/AuditRow.tsx index 967761c46..7ae52cee5 100644 --- a/apps/trust/src/components/AuditRow.tsx +++ b/apps/trust/src/components/AuditRow.tsx @@ -38,8 +38,6 @@ import { useFragment, useMutation } from "react-relay"; import { useLocation, useNavigate, useSearchParams } from "react-router"; import { graphql } from "relay-runtime"; -import { getPathPrefix } from "#/utils/pathPrefix"; - import type { AuditRow_requestAccessMutation } from "./__generated__/AuditRow_requestAccessMutation.graphql"; import type { AuditRowFragment$key } from "./__generated__/AuditRowFragment.graphql"; @@ -121,11 +119,10 @@ export function AuditRow(props: { audit: AuditRowFragment$key }) { }, onError: (error) => { if (error instanceof UnAuthenticatedError) { - const pathPrefix = getPathPrefix(); searchParams.set("request-report-id", audit.reportFile?.id ?? ""); const urlSearchParams = new URLSearchParams([[ "continue", - window.location.origin + pathPrefix + location.pathname + "?" + searchParams.toString(), + window.location.origin + location.pathname + "?" + searchParams.toString(), ]]); void navigate(`/connect?${urlSearchParams.toString()}`); diff --git a/apps/trust/src/components/DocumentPageErrorBoundary.tsx b/apps/trust/src/components/DocumentPageErrorBoundary.tsx index c40d0e30c..8af28bfe5 100644 --- a/apps/trust/src/components/DocumentPageErrorBoundary.tsx +++ b/apps/trust/src/components/DocumentPageErrorBoundary.tsx @@ -27,8 +27,6 @@ import { import { Button, IconChevronLeft, IconPageCross } from "@probo/ui"; import { Link, Navigate, useLocation, useRouteError } from "react-router"; -import { getPathPrefix } from "#/utils/pathPrefix"; - export function DocumentPageErrorBoundary() { const error = useRouteError(); const location = useLocation(); @@ -36,7 +34,7 @@ export function DocumentPageErrorBoundary() { const search = new URLSearchParams(); - if (location.pathname !== (getPathPrefix() || "/") || location.search !== "") { + if (location.pathname !== "/" || location.search !== "") { search.set("continue", window.location.href); } diff --git a/apps/trust/src/components/DocumentRow.tsx b/apps/trust/src/components/DocumentRow.tsx index 8f929d9ce..a0b31a5fb 100644 --- a/apps/trust/src/components/DocumentRow.tsx +++ b/apps/trust/src/components/DocumentRow.tsx @@ -32,8 +32,6 @@ import { useFragment, useMutation } from "react-relay"; import { useLocation, useNavigate, useSearchParams } from "react-router"; import { graphql } from "relay-runtime"; -import { getPathPrefix } from "#/utils/pathPrefix"; - import type { DocumentRow_requestAccessMutation } from "./__generated__/DocumentRow_requestAccessMutation.graphql"; import type { DocumentRowFragment$key } from "./__generated__/DocumentRowFragment.graphql"; @@ -103,11 +101,10 @@ export function DocumentRow(props: { document: DocumentRowFragment$key }) { }, onError: (error) => { if (error instanceof UnAuthenticatedError) { - const pathPrefix = getPathPrefix(); searchParams.set("request-document-id", document.id); const urlSearchParams = new URLSearchParams([[ "continue", - window.location.origin + pathPrefix + location.pathname + "?" + searchParams.toString(), + window.location.origin + location.pathname + "?" + searchParams.toString(), ]]); void navigate(`/connect?${urlSearchParams.toString()}`); diff --git a/apps/trust/src/components/OrganizationSidebar.tsx b/apps/trust/src/components/OrganizationSidebar.tsx index a6c5844db..535ca5559 100644 --- a/apps/trust/src/components/OrganizationSidebar.tsx +++ b/apps/trust/src/components/OrganizationSidebar.tsx @@ -38,7 +38,6 @@ import { useLocation, useNavigate, useSearchParams } from "react-router"; import { graphql } from "relay-runtime"; import type { TrustGraphCurrentQuery$data } from "#/queries/__generated__/TrustGraphCurrentQuery.graphql"; -import { getPathPrefix } from "#/utils/pathPrefix"; import type { OrganizationSidebar_requestAllAccessesMutation } from "./__generated__/OrganizationSidebar_requestAllAccessesMutation.graphql"; import type { OrganizationSidebar_subscribeToMailingListMutation } from "./__generated__/OrganizationSidebar_subscribeToMailingListMutation.graphql"; @@ -132,11 +131,10 @@ export function OrganizationSidebar({ }, onError: (error) => { if (error instanceof UnAuthenticatedError) { - const pathPrefix = getPathPrefix(); searchParams.set("request-all", "true"); const urlSearchParams = new URLSearchParams([[ "continue", - window.location.origin + pathPrefix + location.pathname + "?" + searchParams.toString(), + window.location.origin + location.pathname + "?" + searchParams.toString(), ]]); void navigate(`/connect?${urlSearchParams.toString()}`); @@ -237,7 +235,7 @@ export function OrganizationSidebar({ )}

{trustCenter.organization.name}

- {trustCenter.organization.description} + {trustCenter.description}


@@ -248,32 +246,32 @@ export function OrganizationSidebar({ {__("Business information")} - {trustCenter.organization.websiteUrl && ( + {trustCenter.websiteUrl && ( - + - {new URL(trustCenter.organization.websiteUrl).host} + {new URL(trustCenter.websiteUrl).host} )} - {trustCenter.organization.email && ( + {trustCenter.email && ( - + - {trustCenter.organization.email} + {trustCenter.email} )} - {trustCenter.organization.headquarterAddress && ( + {trustCenter.headquarterAddress && ( - {trustCenter.organization.headquarterAddress} + {trustCenter.headquarterAddress} )} - {trustCenter.externalUrls.edges.length > 0 && ( + {trustCenter.customLinks.edges.length > 0 && (
- {trustCenter.externalUrls.edges.map(({ node }) => ( + {trustCenter.customLinks.edges.map(({ node }) => ( { if (error instanceof UnAuthenticatedError) { - const pathPrefix = getPathPrefix(); searchParams.set("request-file-id", file.id); const urlSearchParams = new URLSearchParams([[ "continue", - window.location.origin + pathPrefix + location.pathname + "?" + searchParams.toString(), + window.location.origin + location.pathname + "?" + searchParams.toString(), ]]); void navigate(`/connect?${urlSearchParams.toString()}`); diff --git a/apps/trust/src/hooks/useRequestAccessCallback.ts b/apps/trust/src/hooks/useRequestAccessCallback.ts index 95bce9b9b..6344286a7 100644 --- a/apps/trust/src/hooks/useRequestAccessCallback.ts +++ b/apps/trust/src/hooks/useRequestAccessCallback.ts @@ -26,8 +26,6 @@ import { useMutation } from "react-relay"; import { useLocation, useSearchParams } from "react-router"; import { graphql } from "relay-runtime"; -import { getPathPrefix } from "#/utils/pathPrefix"; - import type { useRequestAccessCallback_allMutation } from "./__generated__/useRequestAccessCallback_allMutation.graphql"; import type { useRequestAccessCallback_documentMutation } from "./__generated__/useRequestAccessCallback_documentMutation.graphql"; import type { useRequestAccessCallback_fileMutation } from "./__generated__/useRequestAccessCallback_fileMutation.graphql"; @@ -192,7 +190,7 @@ export function useRequestAccessCallback() { } toast(successToastArgs(__)); - window.location.href = window.location.origin + getPathPrefix() + location.pathname; + window.location.href = window.location.origin + location.pathname; }, onError: (error) => { toast(errorToastArgs(__, error)); diff --git a/apps/trust/src/hooks/useSafeContinueUrl.ts b/apps/trust/src/hooks/useSafeContinueUrl.ts index 45b73570a..e42bdc446 100644 --- a/apps/trust/src/hooks/useSafeContinueUrl.ts +++ b/apps/trust/src/hooks/useSafeContinueUrl.ts @@ -21,14 +21,11 @@ import { useMemo } from "react"; import { useSearchParams } from "react-router"; -import { getPathPrefix } from "#/utils/pathPrefix"; - export function useSafeContinueUrl(): URL { const [searchParams] = useSearchParams(); const continueUrlParam = searchParams.get("continue"); - const prefix = getPathPrefix(); - const fallback = window.location.origin + (prefix || "/"); + const fallback = window.location.origin + "/"; const safeContinueUrl = useMemo(() => { if (continueUrlParam) { @@ -40,7 +37,7 @@ export function useSafeContinueUrl(): URL { } if ( continueUrl.origin === window.location.origin - && continueUrl.pathname.startsWith(`${prefix}/`) + && continueUrl.pathname.startsWith("/") ) { return new URL( continueUrl.pathname + continueUrl.search, @@ -50,7 +47,7 @@ export function useSafeContinueUrl(): URL { return new URL(fallback, window.location.origin); } return new URL(fallback, window.location.origin); - }, [continueUrlParam, fallback, prefix]); + }, [continueUrlParam, fallback]); return safeContinueUrl; } diff --git a/apps/trust/src/pages/DocumentPage.tsx b/apps/trust/src/pages/DocumentPage.tsx index 2b7c1a75b..214b41d42 100644 --- a/apps/trust/src/pages/DocumentPage.tsx +++ b/apps/trust/src/pages/DocumentPage.tsx @@ -40,7 +40,6 @@ import { Link, useLocation, useNavigate, useSearchParams } from "react-router"; import { graphql } from "relay-runtime"; import { PDFPreview } from "#/components/PDFPreview"; -import { getPathPrefix } from "#/utils/pathPrefix"; import type { DocumentPageExportDocumentMutation } from "./__generated__/DocumentPageExportDocumentMutation.graphql"; import type { DocumentPageExportReportMutation } from "./__generated__/DocumentPageExportReportMutation.graphql"; @@ -322,10 +321,9 @@ export function DocumentPage({ queryRef }: Props) { const handleRequestAccess = () => { const onError = (error: Error) => { if (error instanceof UnAuthenticatedError) { - const pathPrefix = getPathPrefix(); const urlSearchParams = new URLSearchParams([[ "continue", - window.location.origin + pathPrefix + location.pathname + "?" + searchParams.toString(), + window.location.origin + location.pathname + "?" + searchParams.toString(), ]]); void navigate(`/connect?${urlSearchParams.toString()}`); return; diff --git a/apps/trust/src/pages/NDAPage.tsx b/apps/trust/src/pages/NDAPage.tsx index 37ebeebb7..b2d86dd24 100644 --- a/apps/trust/src/pages/NDAPage.tsx +++ b/apps/trust/src/pages/NDAPage.tsx @@ -33,7 +33,6 @@ import { graphql } from "relay-runtime"; import { useWindowSize } from "usehooks-ts"; import { PDFPreview } from "#/components/PDFPreview"; -import { getPathPrefix } from "#/utils/pathPrefix"; import type { NDAPageAcceptElectronicSignatureMutation } from "./__generated__/NDAPageAcceptElectronicSignatureMutation.graphql"; import type { NDAPageFragment$key } from "./__generated__/NDAPageFragment.graphql"; @@ -125,16 +124,16 @@ export function NDAPage(props: { if (continueUrlParam) { try { const continueUrl = new URL(continueUrlParam, window.location.origin); - if (continueUrl.origin === window.location.origin && continueUrl.pathname.startsWith(`${getPathPrefix()}/`)) { + if (continueUrl.origin === window.location.origin && continueUrl.pathname.startsWith("/")) { safeContinueUrl = window.location.origin + continueUrl.pathname + continueUrl.search; } else { - safeContinueUrl = window.location.origin + getPathPrefix(); + safeContinueUrl = window.location.origin; } } catch { - safeContinueUrl = window.location.origin + getPathPrefix(); + safeContinueUrl = window.location.origin; } } else { - safeContinueUrl = window.location.origin + getPathPrefix(); + safeContinueUrl = window.location.origin; } const [acceptSignature, isAccepting] = useMutation( diff --git a/apps/trust/src/pages/auth/ConnectPage.tsx b/apps/trust/src/pages/auth/ConnectPage.tsx index 98d440d1e..2adf4f15f 100644 --- a/apps/trust/src/pages/auth/ConnectPage.tsx +++ b/apps/trust/src/pages/auth/ConnectPage.tsx @@ -29,7 +29,6 @@ import { z } from "zod"; import { useFormWithSchema } from "#/hooks/useFormWithSchema"; import { useSafeContinueUrl } from "#/hooks/useSafeContinueUrl"; -import { getPathPrefix } from "#/utils/pathPrefix"; import type { ConnectPageMutation, SendMagicLinkInput } from "./__generated__/ConnectPageMutation.graphql"; import type { ConnectPageQuery } from "./__generated__/ConnectPageQuery.graphql"; @@ -131,7 +130,7 @@ export function ConnectPage(props: { if (errors) { for (const err of errors) { if (err.extensions?.code === "ALREADY_AUTHENTICATED") { - window.location.href = getPathPrefix() || "/"; + window.location.href = "/"; return; } } diff --git a/apps/trust/src/pages/auth/FullNamePage.tsx b/apps/trust/src/pages/auth/FullNamePage.tsx index 7e78df9ce..ddc8a849f 100644 --- a/apps/trust/src/pages/auth/FullNamePage.tsx +++ b/apps/trust/src/pages/auth/FullNamePage.tsx @@ -29,7 +29,6 @@ import { graphql } from "relay-runtime"; import { z } from "zod"; import { useFormWithSchema } from "#/hooks/useFormWithSchema"; -import { getPathPrefix } from "#/utils/pathPrefix"; import type { FullNamePageMutation } from "./__generated__/FullNamePageMutation.graphql"; @@ -57,16 +56,16 @@ export default function FullNamePage() { if (continueUrlParam) { try { const continueUrl = new URL(continueUrlParam, window.location.origin); - if (continueUrl.origin === window.location.origin && continueUrl.pathname.startsWith(`${getPathPrefix()}/`)) { + if (continueUrl.origin === window.location.origin && continueUrl.pathname.startsWith("/")) { safeContinueUrl = window.location.origin + continueUrl.pathname + continueUrl.search; } else { - safeContinueUrl = window.location.origin + getPathPrefix(); + safeContinueUrl = window.location.origin; } } catch { - safeContinueUrl = window.location.origin + getPathPrefix(); + safeContinueUrl = window.location.origin; } } else { - safeContinueUrl = window.location.origin + getPathPrefix(); + safeContinueUrl = window.location.origin; } const { @@ -94,7 +93,7 @@ export default function FullNamePage() { if (errors) { for (const err of errors) { if (err.extensions?.code === "ALREADY_AUTHENTICATED") { - window.location.href = getPathPrefix() || "/"; + window.location.href = "/"; return; } } diff --git a/apps/trust/src/pages/auth/VerifyMagicLinkPage.tsx b/apps/trust/src/pages/auth/VerifyMagicLinkPage.tsx index 2f9a0ff39..b44e7113c 100644 --- a/apps/trust/src/pages/auth/VerifyMagicLinkPage.tsx +++ b/apps/trust/src/pages/auth/VerifyMagicLinkPage.tsx @@ -27,8 +27,6 @@ import { useMutation } from "react-relay"; import { Link, useNavigate, useSearchParams } from "react-router"; import { graphql } from "relay-runtime"; -import { getPathPrefix } from "#/utils/pathPrefix"; - import type { VerifyMagicLinkPageMutation } from "./__generated__/VerifyMagicLinkPageMutation.graphql"; const verifyMagicLinkMutation = graphql` @@ -63,7 +61,7 @@ export default function VerifyMagicLinkPagePageMutation() { if (errors) { for (const err of errors) { if (err.extensions?.code === "ALREADY_AUTHENTICATED") { - window.location.href = window.location.origin + getPathPrefix(); + window.location.href = window.location.origin; return; } @@ -99,10 +97,10 @@ export default function VerifyMagicLinkPagePageMutation() { const continueUrl = new URL(verifyMagicLink.continue, window.location.origin); window.location.href = window.location.origin + continueUrl.pathname + continueUrl.search; } catch { - window.location.href = window.location.origin + getPathPrefix(); + window.location.href = window.location.origin; } } else { - window.location.href = window.location.origin + getPathPrefix(); + window.location.href = window.location.origin; } }, onError: (err) => { diff --git a/apps/trust/src/providers/RelayProviders.tsx b/apps/trust/src/providers/RelayProviders.tsx index a10138ae5..d3f281a96 100644 --- a/apps/trust/src/providers/RelayProviders.tsx +++ b/apps/trust/src/providers/RelayProviders.tsx @@ -28,8 +28,6 @@ import { Store, } from "relay-runtime"; -import { getPathPrefix } from "#/utils/pathPrefix"; - export function buildEndpoint(): string { let host = import.meta.env.VITE_API_URL; @@ -44,15 +42,8 @@ export function buildEndpoint(): string { const url = new URL(formattedHost); - const prefix = getPathPrefix(); - let path: string; - if (prefix) { - path = `${prefix}/api/trust/v1/graphql`; - } else { - path = `/api/trust/v1/graphql`; - } - - url.pathname = path; + // Compliance pages are always served at the root of a dedicated host. + url.pathname = `/api/trust/v1/graphql`; return url.toString(); } diff --git a/apps/trust/src/queries/TrustGraph.ts b/apps/trust/src/queries/TrustGraph.ts index c83ea3a83..d058782da 100644 --- a/apps/trust/src/queries/TrustGraph.ts +++ b/apps/trust/src/queries/TrustGraph.ts @@ -31,6 +31,10 @@ export const currentTrustGraphQuery = graphql` currentTrustCenter @required(action: THROW) { id slug + description + websiteUrl + email + headquarterAddress viewerSubscription { id email @@ -52,12 +56,8 @@ export const currentTrustGraphQuery = graphql` } organization { name - description - websiteUrl - email - headquarterAddress } - externalUrls(first: 20) { + customLinks(first: 20) { edges { node { id diff --git a/apps/trust/src/routes.tsx b/apps/trust/src/routes.tsx index 0469c8c51..dc6549e82 100644 --- a/apps/trust/src/routes.tsx +++ b/apps/trust/src/routes.tsx @@ -173,15 +173,4 @@ const routes = [ }, ] satisfies AppRoute[]; -// Detect basename from current URL path -// If URL starts with /trust/{slug}, extract that as the basename -// Otherwise, use "/" for custom domains -function getBasename(): string { - const path = window.location.pathname; - const trustMatch = path.match(/^\/trust\/[^/]+/); - return trustMatch ? trustMatch[0] : "/"; -} - -export const router = createBrowserRouter(routes.map(routeFromAppRoute), { - basename: getBasename(), -}); +export const router = createBrowserRouter(routes.map(routeFromAppRoute), {}); diff --git a/apps/trust/src/utils/pathPrefix.ts b/apps/trust/src/utils/pathPrefix.ts deleted file mode 100644 index b7f8b6fef..000000000 --- a/apps/trust/src/utils/pathPrefix.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2026 Probo Inc . -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. - -import { matchPath } from "react-router"; - -export function getPathPrefix() { - const match = matchPath( - { path: "/trust/:id", caseSensitive: false, end: false }, - window.location.pathname, - ); - - let prefix = ""; - if (match) { - prefix = `/trust/${match.params.id}`; - } - - return prefix; -}