@opencxh/domain 1.141.0 → 1.144.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.
- package/dist/entities/communication/message-template.d.ts +17 -2
- package/dist/entities/kb/help-center.d.ts +106 -0
- package/dist/entities/kb/index.d.ts +1 -0
- package/dist/entities/kb/types.d.ts +66 -3
- package/dist/entities/kb/types.test.d.ts +1 -0
- package/dist/index.cjs +6 -6
- package/dist/index.js +418 -328
- package/dist/platform/manifest.d.ts +8 -0
- package/dist/platform/routing.d.ts +71 -0
- package/dist/platform/sdk.d.ts +9 -0
- package/package.json +1 -1
|
@@ -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,26 @@ export interface RouteDefinition {
|
|
|
8
8
|
resource: string;
|
|
9
9
|
/** If true, the path must match exactly. */
|
|
10
10
|
exact?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Fixed props handed to the resource on top of the path parameters.
|
|
13
|
+
*
|
|
14
|
+
* Lets one component serve several routes without the viewport having to
|
|
15
|
+
* remount a different resource per URL — which is what makes navigating
|
|
16
|
+
* between them flash. Two paths that produce the same parameters (a list and
|
|
17
|
+
* its `/search` sibling, say) stay distinguishable because the route says
|
|
18
|
+
* which one it is.
|
|
19
|
+
*
|
|
20
|
+
* Path parameters win on a name collision: those come from the URL.
|
|
21
|
+
*/
|
|
22
|
+
props?: Record<string, string>;
|
|
23
|
+
/**
|
|
24
|
+
* Readable without a session. The shell skips its bounce to the login screen
|
|
25
|
+
* for these paths and renders them without any chrome.
|
|
26
|
+
*
|
|
27
|
+
* This says nothing about the data behind the page: every server route is
|
|
28
|
+
* still authenticated unless it opts out with `{ authenticated: false }`.
|
|
29
|
+
*/
|
|
30
|
+
public?: boolean;
|
|
11
31
|
}
|
|
12
32
|
export interface NamespacedRouteDefinition extends RouteDefinition {
|
|
13
33
|
appName: string;
|
|
@@ -39,3 +59,54 @@ export declare function appNameFromPath(path: string | null | undefined): string
|
|
|
39
59
|
* and `WakeRoute` routes onward itself.
|
|
40
60
|
*/
|
|
41
61
|
export declare function isDeepLink(path: string | null | undefined): boolean;
|
|
62
|
+
/** Turn a route pattern with `:param` segments into an exact-match regex. */
|
|
63
|
+
export declare function pathToRegex(path: string): RegExp;
|
|
64
|
+
/** Read the `:param` values out of a concrete path, given the pattern it matched. */
|
|
65
|
+
export declare function extractParams(pattern: string, actualPath: string): Record<string, string>;
|
|
66
|
+
/** The shape of a manifest this module needs; keeps it free of the manifest module. */
|
|
67
|
+
export interface PublicRouteSource {
|
|
68
|
+
name: string;
|
|
69
|
+
/**
|
|
70
|
+
* Root path the app's public routes hang under, e.g. `/help`. Absent means
|
|
71
|
+
* they keep the normal `/apps/{name}` prefix — public, just not pretty.
|
|
72
|
+
*/
|
|
73
|
+
publicBasePath?: string;
|
|
74
|
+
routes?: RouteDefinition[];
|
|
75
|
+
}
|
|
76
|
+
export interface PublicRoutePattern {
|
|
77
|
+
appName: string;
|
|
78
|
+
resource: string;
|
|
79
|
+
/** Absolute pattern, e.g. `/help/:hcSlug/:locale`. */
|
|
80
|
+
pattern: string;
|
|
81
|
+
/** See {@link RouteDefinition.props}. */
|
|
82
|
+
props?: Record<string, string>;
|
|
83
|
+
}
|
|
84
|
+
export interface PublicRouteMatch extends PublicRoutePattern {
|
|
85
|
+
params: Record<string, string>;
|
|
86
|
+
}
|
|
87
|
+
/** Where an app's public routes are mounted. */
|
|
88
|
+
export declare function publicBasePathFor(app: PublicRouteSource): string;
|
|
89
|
+
/** Every public route across the installed apps, as absolute patterns. */
|
|
90
|
+
export declare function publicRoutePatterns(apps: Iterable<PublicRouteSource>): PublicRoutePattern[];
|
|
91
|
+
/**
|
|
92
|
+
* Is `a` a more specific pattern than `b`?
|
|
93
|
+
*
|
|
94
|
+
* Segment by segment, a literal beats a parameter: `/help/:hc/:locale/search`
|
|
95
|
+
* has to win over `/help/:hc/:locale/:collection`, or a help centre can never
|
|
96
|
+
* have a search page. Comparing string lengths would get exactly that case
|
|
97
|
+
* backwards, since `:collection` is the longer text.
|
|
98
|
+
*
|
|
99
|
+
* Exported because the shell asks the same question about `/apps/{name}` routes.
|
|
100
|
+
* It used to answer it with "whichever matched last", so a declared `/create`
|
|
101
|
+
* lost to the `/:id` below it — the opposite of what the author wrote down.
|
|
102
|
+
*/
|
|
103
|
+
export declare function isMoreSpecificPattern(a: string, b: string): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* The public route this path lands on, or null.
|
|
106
|
+
*
|
|
107
|
+
* Most specific pattern wins, so registration order never decides which page a
|
|
108
|
+
* URL opens.
|
|
109
|
+
*/
|
|
110
|
+
export declare function matchPublicRoute(path: string | null | undefined, patterns: readonly PublicRoutePattern[]): PublicRouteMatch | null;
|
|
111
|
+
/** Does this path resolve to a page that may be read without a session? */
|
|
112
|
+
export declare function isPublicPath(path: string | null | undefined, patterns: readonly PublicRoutePattern[]): boolean;
|
package/dist/platform/sdk.d.ts
CHANGED
|
@@ -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
|
};
|