>(
WrappedComponent: RouteComponent
) {
return function withDomainRequiredWrapper(props: P) {
const {params} = props;
const {features, customerDomain} = window.__initialData;
const {sentryUrl} = window.__initialData.links;
const hasCustomerDomain = (features as unknown as string[]).includes(
'organizations:customer-domains'
);
if (!customerDomain || !hasCustomerDomain) {
// This route should only be accessed if a customer domain is used.
// We redirect the user to the sentryUrl.
const redirectPath = `${window.location.pathname}${window.location.search}${window.location.hash}`;
const redirectURL = `${trimEnd(sentryUrl, '/')}/${trimStart(redirectPath, '/')}`;
window.location.replace(redirectURL);
return null;
}
const newParams = {
...params,
orgId: customerDomain.subdomain,
};
return