@opencxh/domain 1.141.0 → 1.142.0

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.
@@ -138,6 +138,14 @@ export interface AppManifest<TSDK = any> {
138
138
  * Paths will be automatically prefixed with `/apps/{appName}`.
139
139
  */
140
140
  routes?: RouteDefinition[];
141
+ /**
142
+ * Root path the app's `public: true` routes are mounted under, e.g. `/help`.
143
+ *
144
+ * Only cosmetic: without it a public route keeps the `/apps/{appName}`
145
+ * prefix and works exactly the same. It exists because a help centre or a
146
+ * status page is a URL customers see and link to.
147
+ */
148
+ publicBasePath?: string;
141
149
  /** An array of menu items provided by this application. */
142
150
  menu?: MenuItem[];
143
151
  /** An array of translations provided by this application. */
@@ -8,6 +8,14 @@ export interface RouteDefinition {
8
8
  resource: string;
9
9
  /** If true, the path must match exactly. */
10
10
  exact?: boolean;
11
+ /**
12
+ * Readable without a session. The shell skips its bounce to the login screen
13
+ * for these paths and renders them without any chrome.
14
+ *
15
+ * This says nothing about the data behind the page: every server route is
16
+ * still authenticated unless it opts out with `{ authenticated: false }`.
17
+ */
18
+ public?: boolean;
11
19
  }
12
20
  export interface NamespacedRouteDefinition extends RouteDefinition {
13
21
  appName: string;
@@ -39,3 +47,39 @@ export declare function appNameFromPath(path: string | null | undefined): string
39
47
  * and `WakeRoute` routes onward itself.
40
48
  */
41
49
  export declare function isDeepLink(path: string | null | undefined): boolean;
50
+ /** Turn a route pattern with `:param` segments into an exact-match regex. */
51
+ export declare function pathToRegex(path: string): RegExp;
52
+ /** Read the `:param` values out of a concrete path, given the pattern it matched. */
53
+ export declare function extractParams(pattern: string, actualPath: string): Record<string, string>;
54
+ /** The shape of a manifest this module needs; keeps it free of the manifest module. */
55
+ export interface PublicRouteSource {
56
+ name: string;
57
+ /**
58
+ * Root path the app's public routes hang under, e.g. `/help`. Absent means
59
+ * they keep the normal `/apps/{name}` prefix — public, just not pretty.
60
+ */
61
+ publicBasePath?: string;
62
+ routes?: RouteDefinition[];
63
+ }
64
+ export interface PublicRoutePattern {
65
+ appName: string;
66
+ resource: string;
67
+ /** Absolute pattern, e.g. `/help/:hcSlug/:locale`. */
68
+ pattern: string;
69
+ }
70
+ export interface PublicRouteMatch extends PublicRoutePattern {
71
+ params: Record<string, string>;
72
+ }
73
+ /** Where an app's public routes are mounted. */
74
+ export declare function publicBasePathFor(app: PublicRouteSource): string;
75
+ /** Every public route across the installed apps, as absolute patterns. */
76
+ export declare function publicRoutePatterns(apps: Iterable<PublicRouteSource>): PublicRoutePattern[];
77
+ /**
78
+ * The public route this path lands on, or null.
79
+ *
80
+ * Most specific pattern wins, so registration order never decides which page a
81
+ * URL opens.
82
+ */
83
+ export declare function matchPublicRoute(path: string | null | undefined, patterns: readonly PublicRoutePattern[]): PublicRouteMatch | null;
84
+ /** Does this path resolve to a page that may be read without a session? */
85
+ export declare function isPublicPath(path: string | null | undefined, patterns: readonly PublicRoutePattern[]): boolean;
@@ -22,7 +22,16 @@ export interface InternalSDK<LocalServices extends ServiceMap = {}, TranslationK
22
22
  invoke<R = any>(options: InvokeOptions): Promise<R>;
23
23
  };
24
24
  readonly router: {
25
+ /** Relative to the app's own `/apps/{appName}` prefix. */
25
26
  navigate(path: string, options?: any): void;
27
+ /**
28
+ * Straight to a shell path, no prefix.
29
+ *
30
+ * For the app's `public: true` routes: those hang off the manifest's
31
+ * `publicBasePath` (`/help/…`), so the app prefix would point at a page
32
+ * that does not exist.
33
+ */
34
+ navigateAbsolute(path: string, options?: any): void;
26
35
  currentPath(): string;
27
36
  path$: Observable<string>;
28
37
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencxh/domain",
3
- "version": "1.141.0",
3
+ "version": "1.142.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",