akanjs 3.3.0-rc.80 → 3.3.0-rc.82

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.
@@ -71,6 +71,13 @@ export interface PageConfig {
71
71
  * page under it), for a page whose output follows parameter order or a tracking parameter it reads without declaring
72
72
  * it with `.search()`. By default the key sorts the query and leaves out `AKAN_ROUTE_CACHE_TRACKING_PARAMS`. */
73
73
  canonicalQuery?: boolean;
74
+ /**
75
+ * The screen a native app's deep link lays under the page when it opens the app on it with nothing behind, so Back
76
+ * and the edge swipe go where a person who walked there would: a route pattern whose params come from the link
77
+ * (`"/org/:orgId"`), and its own `stackOn` chains on. On a layout it holds for every page below it, the route it
78
+ * names included, where it ends the chain. Left out, the link's leading segments that are routes stack under it.
79
+ */
80
+ stackOn?: string;
74
81
  topSafeAreaColor?: string;
75
82
  bottomSafeAreaColor?: string;
76
83
  /** Keeps the route (on a `_layout`, its whole directory) out of `akan build` while `akan start` serves it. Write a
@@ -0,0 +1,97 @@
1
+ interface RouteMatch {
2
+ path: string;
3
+ route: string;
4
+ params: { [param: string]: string };
5
+ }
6
+
7
+ /** The route patterns a deep link resolves against, and the screen each one names to lay under it (`stackOn`). */
8
+ export class DeepLinkStack {
9
+
10
+ static readonly #depthLimit = 8;
11
+ readonly #routes: string[][];
12
+ readonly #stackOn: Map<string, string>;
13
+
14
+ constructor(routes: string[], stackOn: [route: string, under: string][] = []) {
15
+ this.#routes = [...new Set(routes)].map(DeepLinkStack.#segmentsOf).sort(DeepLinkStack.#bySpecificity);
16
+ this.#stackOn = new Map(stackOn);
17
+ }
18
+
19
+ get size() {
20
+ return this.#routes.length;
21
+ }
22
+
23
+ has(path: string) {
24
+ return this.#match(path) !== null;
25
+ }
26
+
27
+ /** The concrete paths of `path`'s leading segments that are routes themselves, `path` last; with no routes, `path`. */
28
+ prefixesOf(path: string) {
29
+ if (this.#routes.length === 0) return [path];
30
+ const segments = DeepLinkStack.#segmentsOf(path);
31
+ if (segments.length === 0) return this.has("/") ? ["/"] : [];
32
+ return segments
33
+ .map((_, idx) => `/${segments.slice(0, idx + 1).join("/")}`)
34
+ .filter((candidate) => this.has(candidate));
35
+ }
36
+
37
+ /** The screens `path`'s route names under it through `stackOn`, bottom first; a route naming itself ends the chain. */
38
+ underOf(path: string) {
39
+ const under: string[] = [];
40
+ let current = this.#match(path);
41
+ while (current && under.length < DeepLinkStack.#depthLimit) {
42
+ const pattern = this.#stackOn.get(current.route);
43
+ const parentPath = pattern ? DeepLinkStack.#fill(pattern, current.params) : null;
44
+ if (!parentPath || parentPath === current.path || under.includes(parentPath)) break;
45
+ const parent = this.#match(parentPath);
46
+ if (!parent) break;
47
+ under.unshift(parentPath);
48
+ current = parent;
49
+ }
50
+ return under;
51
+ }
52
+
53
+ /** The part of `path`'s `stackOn` chain above `currentPath`, the screen on view: all of it when that is not in it. */
54
+ missingUnder(path: string, currentPath: string) {
55
+ if (currentPath === path) return [];
56
+ const under = this.underOf(path);
57
+ return under.slice(under.indexOf(currentPath) + 1);
58
+ }
59
+
60
+ #match(path: string): RouteMatch | null {
61
+ const segments = DeepLinkStack.#segmentsOf(path);
62
+ for (const route of this.#routes) {
63
+ if (route.length !== segments.length) continue;
64
+ const params: { [param: string]: string } = {};
65
+ const isMatch = route.every((part, idx) => {
66
+ const value = segments[idx] ?? "";
67
+ if (!part.startsWith(":")) return part === value;
68
+ params[part.slice(1)] = value;
69
+ return true;
70
+ });
71
+ if (isMatch) return { path, route: `/${route.join("/")}`, params };
72
+ }
73
+ return null;
74
+ }
75
+
76
+ static #segmentsOf(path: string) {
77
+ return path.split("/").filter(Boolean);
78
+ }
79
+
80
+ static #bySpecificity(a: string[], b: string[]) {
81
+ for (let idx = 0; idx < Math.min(a.length, b.length); idx++) {
82
+ const isParamA = (a[idx] ?? "").startsWith(":");
83
+ if (isParamA !== (b[idx] ?? "").startsWith(":")) return isParamA ? 1 : -1;
84
+ }
85
+ return 0;
86
+ }
87
+
88
+ static #fill(pattern: string, params: { [param: string]: string }) {
89
+ const segments: string[] = [];
90
+ for (const segment of DeepLinkStack.#segmentsOf(pattern)) {
91
+ const value = segment.startsWith(":") ? params[segment.slice(1)] : segment;
92
+ if (value === undefined) return null;
93
+ segments.push(value);
94
+ }
95
+ return `/${segments.join("/")}`;
96
+ }
97
+ }
@@ -54,6 +54,7 @@ const pageConfigKeys = new Set<keyof PageConfig>([
54
54
  "rscPatchHeadSafe",
55
55
  "prefetch",
56
56
  "canonicalQuery",
57
+ "stackOn",
57
58
  "topSafeAreaColor",
58
59
  "bottomSafeAreaColor",
59
60
  ]);
@@ -95,6 +96,11 @@ export const validatePageConfig = (routeKey: string, config?: PageConfig) => {
95
96
  `[route-convention] pageConfig.${key} in ${routeKey} must be a boolean, a non-negative px number, or { base, sm?, md?, lg?, xl?, "2xl"? } of them.`,
96
97
  );
97
98
  }
99
+ if (
100
+ pageConfig.stackOn !== undefined &&
101
+ (typeof pageConfig.stackOn !== "string" || !pageConfig.stackOn.startsWith("/"))
102
+ )
103
+ throw new Error(`[route-convention] pageConfig.stackOn in ${routeKey} must be a route path starting with "/".`);
98
104
  const { overlay } = pageConfig;
99
105
  if (overlay !== undefined && typeof overlay !== "boolean" && overlay !== "top" && overlay !== "bottom")
100
106
  throw new Error(`[route-convention] pageConfig.overlay in ${routeKey} must be a boolean, "top" or "bottom".`);
package/client/router.ts CHANGED
@@ -12,6 +12,7 @@ import {
12
12
  import { closeAppOpenedTab } from "./appOpenedTab";
13
13
  import { CsrLocation, csrLocation } from "./csrLocation";
14
14
  import { CsrRuntimeParams } from "./csrRuntimeParams";
15
+ import { DeepLinkStack } from "./deepLinkStack";
15
16
  import { Href } from "./href";
16
17
  import { isMcpView } from "./mcpView";
17
18
  import { type NavigationAttempt, type NavigationGuard, NavigationGuards, NavigationRefused } from "./navigationGuards";
@@ -32,6 +33,8 @@ export interface RouteOptions {
32
33
  }
33
34
  export interface RouteManifest {
34
35
  routes: string[];
36
+ /** Per route, the route a deep link lays under it when the app opens on it with nothing behind (`PageConfig.stackOn`). */
37
+ stackOn?: { [route: string]: string };
35
38
  }
36
39
  export interface DeepLinkOptions extends RouteOptions {
37
40
  resetStack?: boolean;
@@ -222,7 +225,7 @@ class Router {
222
225
  #isCsr: boolean = false;
223
226
  #prefix = "";
224
227
  #lang = parseAkanI18nEnv().defaultLocale;
225
- #routePaths = new Set<string>();
228
+ #deepLinks = new DeepLinkStack([]);
226
229
  #indexPath = "/";
227
230
  #navigation: Promise<void> = Promise.resolve();
228
231
  #historyIdx = 0;
@@ -258,13 +261,14 @@ class Router {
258
261
  this.#isCsr = options.type === "csr";
259
262
  this.#prefix = options.prefix ?? "";
260
263
  this.#lang = options.lang ?? parseAkanI18nEnv().defaultLocale;
261
- this.#routePaths = new Set(
262
- (Array.isArray(options.routeManifest) ? options.routeManifest : (options.routeManifest?.routes ?? []))
263
- .map((path) => normalizeRouteManifestPath(path, this.#prefix))
264
- .filter(Boolean),
264
+ const manifest = Array.isArray(options.routeManifest) ? { routes: options.routeManifest } : options.routeManifest;
265
+ const routePathOf = (path: string) => normalizeRouteManifestPath(path, this.#prefix);
266
+ this.#deepLinks = new DeepLinkStack(
267
+ (manifest?.routes ?? []).map(routePathOf),
268
+ Object.entries(manifest?.stackOn ?? {}).map(([route, under]) => [routePathOf(route), routePathOf(under)]),
265
269
  );
266
270
  this.#indexPath = splitHref(options.indexPath ?? "/").path;
267
- if (this.#routePaths.size > 0 && !this.#routePaths.has(this.#indexPath)) {
271
+ if (this.#deepLinks.size > 0 && !this.#deepLinks.has(this.#indexPath)) {
268
272
  Logger.info(`[router] indexPath '${this.#indexPath}' was not found in route manifest. Falling back to '/'.`);
269
273
  this.#indexPath = "/";
270
274
  }
@@ -481,13 +485,6 @@ class Router {
481
485
  const { path, search, hash } = this.#getPathInfo(href);
482
486
  globalThis.__AKAN_DEV_SYNC_NAVIGATION__?.(`${path}${search ? `?${search}` : ""}${hash ? `#${hash}` : ""}`, kind);
483
487
  }
484
- #getExistingSegmentStack(path: string) {
485
- const segments = path.split("/").filter(Boolean);
486
- if (segments.length === 0) return this.#routePaths.has("/") ? ["/"] : [];
487
- return segments
488
- .map((_, index) => `/${segments.slice(0, index + 1).join("/")}`)
489
- .filter((candidate) => this.#routePaths.has(candidate));
490
- }
491
488
 
492
489
  #routePathOfLink(path: string) {
493
490
  const segments = path.split("/").filter(Boolean);
@@ -500,13 +497,14 @@ class Router {
500
497
  const normalizedHref = normalizeDeepLinkHref(href);
501
498
  const { path: linkPath, search, hash } = splitHref(normalizedHref);
502
499
  const path = this.#routePathOfLink(linkPath);
503
- if (this.#routePaths.size > 0 && !this.#routePaths.has(path)) {
500
+ if (this.#deepLinks.size > 0 && !this.#deepLinks.has(path)) {
504
501
  Logger.info(`[router] deep link target '${path}' was not found in route manifest.`);
505
502
  return [];
506
503
  }
507
- const stack = this.#routePaths.size > 0 ? this.#getExistingSegmentStack(path) : [path];
504
+ const under = this.#deepLinks.underOf(path);
505
+ const stack = under.length ? [...under, path] : this.#deepLinks.prefixesOf(path);
508
506
  const baseStack =
509
- stack.length > 1 || this.#indexPath === path || stack.includes(this.#indexPath)
507
+ under.length || stack.length > 1 || this.#indexPath === path || stack.includes(this.#indexPath)
510
508
  ? stack
511
509
  : [this.#indexPath, ...stack];
512
510
  const dedupedStack = baseStack.filter((candidate, index) => baseStack.indexOf(candidate) === index);
@@ -517,16 +515,20 @@ class Router {
517
515
  enterDeepLink(href: string, options: DeepLinkOptions = {}) {
518
516
  if (this.#deferredUntilInit(() => this.enterDeepLink(href, options))) return true;
519
517
  this.#checkInitialized();
520
- if (!options.resetStack) {
521
- this.push(normalizeDeepLinkHref(href), options);
522
- return true;
523
- }
524
- const stack = this.resolveDeepLinkStack(href);
518
+ const { resetStack, ...routeOptions } = options;
519
+ const linkHref = normalizeDeepLinkHref(href);
520
+ const [linkPath, currentPath] = [splitHref(linkHref).path, csrLocation.pathname].map((path) =>
521
+ this.#routePathOfLink(path),
522
+ );
523
+
524
+ const stack = resetStack
525
+ ? this.resolveDeepLinkStack(href)
526
+ : [...this.#deepLinks.missingUnder(linkPath, currentPath), linkHref];
525
527
  if (stack.length === 0) return false;
526
- const { resetStack: _resetStack, ...routeOptions } = options;
528
+ const kind = resetStack ? "replace" : "push";
527
529
 
528
- this.#guarded("replace", normalizeDeepLinkHref(href), () => {
529
- const moved = this.#move("replace", stack[0], routeOptions);
530
+ this.#guarded(kind, linkHref, () => {
531
+ const moved = this.#move(kind, stack[0], routeOptions);
530
532
  stack.slice(1).forEach((target, index) => {
531
533
  setTimeout(
532
534
  () => this.#track(this.#move("push", target, routeOptions)),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akanjs",
3
- "version": "3.3.0-rc.80",
3
+ "version": "3.3.0-rc.82",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -0,0 +1,44 @@
1
+ import { csrLocation, router } from "akanjs/client";
2
+ import { PendingNavigation } from "../../client/pendingNavigation";
3
+
4
+ const routeAt = (pathname: () => string): string | null => {
5
+ try {
6
+ const route = router.routeOf(pathname());
7
+ return route.length > 1 ? route.replace(/\/+$/, "") : route;
8
+ } catch {
9
+ return null;
10
+ }
11
+ };
12
+
13
+ /** What one `navigate` saw on its way: the page it started from, and each move a redirect began. */
14
+ export class NavigateMove {
15
+ readonly #from = routeAt(() => csrLocation.pathname);
16
+ readonly #redirectsBefore = router.redirectCount();
17
+ readonly #begun = new Set<string>();
18
+ readonly #stop: () => void;
19
+
20
+ constructor() {
21
+ this.#stop = PendingNavigation.subscribe(() => {
22
+ const target = PendingNavigation.target();
23
+ const route = target ? routeAt(() => new URL(target).pathname) : null;
24
+ if (route) this.#begun.add(route);
25
+ });
26
+ }
27
+
28
+ stop() {
29
+ this.#stop();
30
+ }
31
+
32
+ arrival(path: string): string {
33
+ const landed = routeAt(() => csrLocation.pathname);
34
+ const wanted = routeAt(() => new URL(path, "http://route.invalid").pathname);
35
+ if (!landed || !wanted || landed === wanted) return `Now on ${path}.`;
36
+ if (landed !== this.#from) return `Asked for ${path}, but the app sent the page to ${landed} instead.`;
37
+
38
+ const redirected =
39
+ router.redirectCount() !== this.#redirectsBefore || [...this.#begun].some((route) => route !== wanted);
40
+ return redirected
41
+ ? `Asked for ${path}, but the app sent the page back to ${landed}, the page it was on.`
42
+ : `Asked for ${path}, but the page stayed on ${landed}: the move did not land.`;
43
+ }
44
+ }
@@ -31,6 +31,12 @@ export class ScreenSettle {
31
31
  });
32
32
  }
33
33
 
34
+ /** Whether a load on a page in view is still pending, as `loaded()` reads it. */
35
+ static isLoading(): boolean {
36
+ const body = typeof document === "undefined" ? null : (document.body ?? document.documentElement);
37
+ return !!body && ScreenSettle.#loading(body);
38
+ }
39
+
34
40
  /** Resolves once no load on a page in view is pending, each `Load.*` fallback marking itself; `false` when none was. */
35
41
  static loaded({ timeoutMs = 5000 }: { timeoutMs?: number } = {}): Promise<boolean> {
36
42
  const body = typeof document === "undefined" ? null : (document.body ?? document.documentElement);
@@ -1,8 +1,9 @@
1
- import { csrLocation, isNotFoundView, router } from "akanjs/client";
1
+ import { isNotFoundView, router } from "akanjs/client";
2
2
  import { AgenticSurface, type SurfaceSource, type ToolEntry, ToolReturn } from "../../vendor/use-agentic";
3
3
  import { InlineToken } from "../../common/inlineToken";
4
4
  import { AgentNavigate } from "../agentic/AgentNavigate";
5
5
  import { AgentBridge } from "./AgentBridge";
6
+ import { NavigateMove } from "./NavigateMove";
6
7
  import { ScreenFlash } from "./ScreenFlash";
7
8
  import { ScreenImage } from "./ScreenImage";
8
9
  import { ScreenReader } from "./ScreenReader";
@@ -66,25 +67,29 @@ export class StoreSurfaceSource implements SurfaceSource {
66
67
  const path = String(args.path);
67
68
 
68
69
  const linkedBefore = ScreenTarget.linkedRoutes();
70
+ const move = new NavigateMove();
69
71
  try {
70
- router.push(path);
71
- await router.navigation();
72
- } catch (error) {
73
- if (StoreSurfaceSource.#isKept(error)) throw new Error(StoreSurfaceSource.#kept);
74
- throw new Error(
75
- `There is no route at ${path}, so the page did not move. ${StoreSurfaceSource.#linked(linkedBefore)}`,
76
- );
77
- }
78
-
79
- await StoreSurfaceSource.#settled();
80
- if (isNotFoundView()) {
81
- const left = await StoreSurfaceSource.#leaveNotFound();
82
- throw new Error(
83
- `There is no route at ${path}, so ${left ? "the page went back" : "the page shows the app's not-found page"}. ${StoreSurfaceSource.#linked(left ? linkedBefore : [])}`,
84
- );
72
+ try {
73
+ router.push(path);
74
+ await router.navigation();
75
+ } catch (error) {
76
+ if (StoreSurfaceSource.#isKept(error)) throw new Error(StoreSurfaceSource.#kept);
77
+ throw new Error(
78
+ `There is no route at ${path}, so the page did not move. ${StoreSurfaceSource.#linked(linkedBefore)}`,
79
+ );
80
+ }
81
+
82
+ await StoreSurfaceSource.#settled();
83
+ if (isNotFoundView()) {
84
+ const left = await StoreSurfaceSource.#leaveNotFound();
85
+ throw new Error(
86
+ `There is no route at ${path}, so ${left ? "the page went back" : "the page shows the app's not-found page"}. ${StoreSurfaceSource.#linked(left ? linkedBefore : [])}`,
87
+ );
88
+ }
89
+ return `${move.arrival(path)} ${StoreSurfaceSource.#arrived()}`;
90
+ } finally {
91
+ move.stop();
85
92
  }
86
- const landed = StoreSurfaceSource.#redirected(path);
87
- return `${landed ? `Asked for ${path}, but the app sent the page to ${landed} instead.` : `Now on ${path}.`} ${StoreSurfaceSource.#arrived}`;
88
93
  },
89
94
  };
90
95
  }
@@ -109,8 +114,13 @@ export class StoreSurfaceSource implements SurfaceSource {
109
114
  return left;
110
115
  }
111
116
 
112
- static readonly #arrived =
113
- "This screen's own tools and state replace the previous screen's and are listed on your next turn — call them then, by the names listed. Call readScreen to see the page.";
117
+ static #arrived() {
118
+ const listed =
119
+ "This screen's own tools and state replace the previous screen's and are listed on your next turn — call them then, by the names listed. Call readScreen to see the page.";
120
+ return ScreenSettle.isLoading()
121
+ ? `Part of this page is still loading, so what it shows and the tools it mounts may arrive after your next turn's list. ${listed}`
122
+ : listed;
123
+ }
114
124
 
115
125
  static readonly #kept =
116
126
  "The app asked before leaving this page and kept it, so the page did not move. Tell the user why you could not move, and do not try again unless they ask.";
@@ -126,18 +136,6 @@ export class StoreSurfaceSource implements SurfaceSource {
126
136
  : "Call readScreen — it prints each link on this screen with its own path — and navigate to one of those.";
127
137
  }
128
138
 
129
- /** A redirect moves the page somewhere other than the path it was sent to. */
130
- static #redirected(path: string): string | null {
131
- const trimmed = (route: string) => (route.length > 1 ? route.replace(/\/+$/, "") : route);
132
- try {
133
- const landed = router.routeOf(csrLocation.pathname);
134
- const wanted = router.routeOf(new URL(path, "http://route.invalid").pathname);
135
- return trimmed(landed) === trimmed(wanted) ? null : landed;
136
- } catch {
137
- return null;
138
- }
139
- }
140
-
141
139
  static #goBack(): ToolEntry {
142
140
  return {
143
141
  name: "goBack",
@@ -152,7 +150,7 @@ export class StoreSurfaceSource implements SurfaceSource {
152
150
  if (StoreSurfaceSource.#isKept(error)) throw new Error(StoreSurfaceSource.#kept);
153
151
  });
154
152
  await StoreSurfaceSource.#settled();
155
- return `Back on ${router.getPath()}. ${StoreSurfaceSource.#arrived}`;
153
+ return `Back on ${router.getPath()}. ${StoreSurfaceSource.#arrived()}`;
156
154
  },
157
155
  };
158
156
  }
@@ -64,6 +64,13 @@ export interface PageConfig {
64
64
  * page under it), for a page whose output follows parameter order or a tracking parameter it reads without declaring
65
65
  * it with `.search()`. By default the key sorts the query and leaves out `AKAN_ROUTE_CACHE_TRACKING_PARAMS`. */
66
66
  canonicalQuery?: boolean;
67
+ /**
68
+ * The screen a native app's deep link lays under the page when it opens the app on it with nothing behind, so Back
69
+ * and the edge swipe go where a person who walked there would: a route pattern whose params come from the link
70
+ * (`"/org/:orgId"`), and its own `stackOn` chains on. On a layout it holds for every page below it, the route it
71
+ * names included, where it ends the chain. Left out, the link's leading segments that are routes stack under it.
72
+ */
73
+ stackOn?: string;
67
74
  topSafeAreaColor?: string;
68
75
  bottomSafeAreaColor?: string;
69
76
  /** Keeps the route (on a `_layout`, its whole directory) out of `akan build` while `akan start` serves it. Write a
@@ -0,0 +1,13 @@
1
+ /** The route patterns a deep link resolves against, and the screen each one names to lay under it (`stackOn`). */
2
+ export declare class DeepLinkStack {
3
+ #private;
4
+ constructor(routes: string[], stackOn?: [route: string, under: string][]);
5
+ get size(): number;
6
+ has(path: string): boolean;
7
+ /** The concrete paths of `path`'s leading segments that are routes themselves, `path` last; with no routes, `path`. */
8
+ prefixesOf(path: string): string[];
9
+ /** The screens `path`'s route names under it through `stackOn`, bottom first; a route naming itself ends the chain. */
10
+ underOf(path: string): string[];
11
+ /** The part of `path`'s `stackOn` chain above `currentPath`, the screen on view: all of it when that is not in it. */
12
+ missingUnder(path: string, currentPath: string): string[];
13
+ }
@@ -15,6 +15,10 @@ export interface RouteOptions {
15
15
  }
16
16
  export interface RouteManifest {
17
17
  routes: string[];
18
+ /** Per route, the route a deep link lays under it when the app opens on it with nothing behind (`PageConfig.stackOn`). */
19
+ stackOn?: {
20
+ [route: string]: string;
21
+ };
18
22
  }
19
23
  export interface DeepLinkOptions extends RouteOptions {
20
24
  resetStack?: boolean;
@@ -0,0 +1,7 @@
1
+ /** What one `navigate` saw on its way: the page it started from, and each move a redirect began. */
2
+ export declare class NavigateMove {
3
+ #private;
4
+ constructor();
5
+ stop(): void;
6
+ arrival(path: string): string;
7
+ }
@@ -9,6 +9,8 @@ export interface ScreenSettleOptions {
9
9
  export declare class ScreenSettle {
10
10
  #private;
11
11
  static wait({ quietMs, appearMs, timeoutMs }?: ScreenSettleOptions): Promise<void>;
12
+ /** Whether a load on a page in view is still pending, as `loaded()` reads it. */
13
+ static isLoading(): boolean;
12
14
  /** Resolves once no load on a page in view is pending, each `Load.*` fallback marking itself; `false` when none was. */
13
15
  static loaded({ timeoutMs }?: {
14
16
  timeoutMs?: number;
package/ui/System/CSR.tsx CHANGED
@@ -7,6 +7,7 @@ import {
7
7
  Device,
8
8
  debugFrame,
9
9
  getPathInfo,
10
+ mergePageConfigs,
10
11
  type PageActivity,
11
12
  type PageState,
12
13
  type ReactFont,
@@ -171,7 +172,15 @@ const CSRWrapper = ({
171
172
  lang,
172
173
  prefix,
173
174
  router: { ...reactRouter, canGoBack: () => history.current.idx > 0 },
174
- routeManifest: pathRoutes.map((pathRoute) => pathRoute.path),
175
+ routeManifest: {
176
+ routes: pathRoutes.map((pathRoute) => pathRoute.path),
177
+ stackOn: Object.fromEntries(
178
+ pathRoutes.flatMap(({ path, pageConfigChain }) => {
179
+ const { stackOn } = mergePageConfigs(pageConfigChain);
180
+ return stackOn ? [[path, stackOn]] : [];
181
+ }),
182
+ ),
183
+ },
175
184
  indexPath: window.__AKAN_MOBILE_TARGET__?.indexPath,
176
185
  });
177
186
  globalThis.__AKAN_NOT_FOUND_VIEW__ = () => !!history.current.locations[history.current.idx]?.pathRoute.notFound;