@anthusai/papyrus 1.0.0-next.12 → 1.0.0-next.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/page.tsx +8 -3
- package/lib/root-route-redirect.ts +16 -0
- package/package.json +2 -1
- package/routes.manifest.json +1 -1
package/app/page.tsx
CHANGED
|
@@ -15,7 +15,8 @@ import {
|
|
|
15
15
|
} from "../lib/public-placeholder-config";
|
|
16
16
|
import type { PublicationItem } from "../lib/publication-items";
|
|
17
17
|
import { SITE_BRAND, rootRoute } from "../lib/site-brand";
|
|
18
|
-
import { redirect } from "next/navigation";
|
|
18
|
+
import { notFound, redirect } from "next/navigation";
|
|
19
|
+
import { buildRootRedirectTarget } from "../lib/root-route-redirect";
|
|
19
20
|
import NewsDeskRootPage, { type NewsDeskRootSearchParams } from "./newsroom/page";
|
|
20
21
|
|
|
21
22
|
export const dynamic = "force-dynamic";
|
|
@@ -41,8 +42,12 @@ export default async function Home({ searchParams }: HomePageProps) {
|
|
|
41
42
|
return <NewsDeskRootPage searchParams={searchParams} />;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
if (rootRoute.kind === "redirect"
|
|
45
|
-
redirect(rootRoute.destination);
|
|
45
|
+
if (rootRoute.kind === "redirect") {
|
|
46
|
+
redirect(buildRootRedirectTarget(rootRoute.destination, resolvedSearchParams));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (SITE_BRAND.renderer.kind === "markus") {
|
|
50
|
+
notFound();
|
|
46
51
|
}
|
|
47
52
|
|
|
48
53
|
// Resolved only on the reader path: Markus brands (renderer "markus") have
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type RootSearchParams = Record<string, string | string[] | undefined>;
|
|
2
|
+
|
|
3
|
+
export function buildRootRedirectTarget(destination: string, searchParams: RootSearchParams | undefined): string {
|
|
4
|
+
const query = new URLSearchParams();
|
|
5
|
+
for (const [name, value] of Object.entries(searchParams ?? {})) {
|
|
6
|
+
if (Array.isArray(value)) {
|
|
7
|
+
for (const entry of value) query.append(name, entry);
|
|
8
|
+
} else if (value !== undefined) {
|
|
9
|
+
query.append(name, value);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const serialized = query.toString();
|
|
13
|
+
if (!serialized) return destination;
|
|
14
|
+
const separator = destination.includes("?") ? "&" : "?";
|
|
15
|
+
return `${destination}${separator}${serialized}`;
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -189,6 +189,7 @@
|
|
|
189
189
|
"./lib/renderer-config": "./lib/renderer-config.ts",
|
|
190
190
|
"./lib/renderer": "./lib/renderer.ts",
|
|
191
191
|
"./lib/reporting-story-budget": "./lib/reporting-story-budget.ts",
|
|
192
|
+
"./lib/root-route-redirect": "./lib/root-route-redirect.ts",
|
|
192
193
|
"./lib/semantic-graph": "./lib/semantic-graph.ts",
|
|
193
194
|
"./lib/site-brand-tenant": "./lib/site-brand-tenant.ts",
|
|
194
195
|
"./lib/site-brand": "./lib/site-brand.ts",
|
|
@@ -276,7 +277,7 @@
|
|
|
276
277
|
"optional": true
|
|
277
278
|
}
|
|
278
279
|
},
|
|
279
|
-
"version": "1.0.0-next.
|
|
280
|
+
"version": "1.0.0-next.14",
|
|
280
281
|
"dependencies": {
|
|
281
282
|
"@aws-amplify/adapter-nextjs": "^1.7.3",
|
|
282
283
|
"@aws-sdk/client-cognito-identity-provider": "3.1045.0",
|
package/routes.manifest.json
CHANGED