@luigi-project/core-modular 0.0.7-dev.20260590104 → 0.0.7-dev.20260610120

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/package.json CHANGED
@@ -18,5 +18,5 @@
18
18
  "micro-frontends",
19
19
  "microfrontends"
20
20
  ],
21
- "version": "0.0.7-dev.20260590104"
21
+ "version": "0.0.7-dev.20260610120"
22
22
  }
@@ -1,4 +1,3 @@
1
- import { LuigiContainer, LuigiCompoundContainer } from '@luigi-project/container';
2
1
  import { Luigi } from '../core-api/luigi';
3
2
  /**
4
3
  * Localization-related functions
@@ -21,7 +20,7 @@ export declare class i18nService {
21
20
  * Sets current locale to the specified one.
22
21
  * @param {string} locale locale to be set as the current locale
23
22
  */
24
- setCurrentLocale(locale: string, containerElement?: LuigiContainer | LuigiCompoundContainer): void;
23
+ setCurrentLocale(locale: string): void;
25
24
  /**
26
25
  * Registers a listener for locale changes.
27
26
  * @param {Function} listener function called on every locale change with the new locale as argument
@@ -125,4 +125,14 @@ export declare class RoutingService {
125
125
  * @returns {Promise<void>} A promise that resolves when error handling is complete.
126
126
  */
127
127
  showPageNotFoundError(pathToRedirect: string, notFoundPath: string, isAnyPathMatched?: boolean): Promise<void>;
128
+ /**
129
+ * Handles viewUrl misconfiguration scenario. If a node has no viewUrl, no children,
130
+ * and is not a compound node, it redirects to the root default child node.
131
+ * @param node - active node data
132
+ * @param viewUrl - the url of the current mf view
133
+ * @param previousPathData - previous path data
134
+ * @param pathUrlRaw - path url without hash
135
+ * @returns true if misconfiguration was detected and handled
136
+ */
137
+ handleViewUrlMisconfigured(node: Node, viewUrl: string, previousPathData: PathData, pathUrlRaw: string): Promise<boolean>;
128
138
  }
@@ -29,5 +29,6 @@ export interface LuigiConnector {
29
29
  getLuigiContainer(): HTMLElement | null;
30
30
  getNavFooterContainer(): HTMLElement | null;
31
31
  };
32
+ unload(): void;
32
33
  }
33
34
  export type { Node };
@@ -33,8 +33,13 @@ export interface ProfileSettings {
33
33
  items?: ProfileItem[];
34
34
  staticUserInfoFn?: () => Promise<UserInfo>;
35
35
  onUserInfoUpdate: (fn: (uInfo: UserInfo) => void) => void;
36
+ settings: UserSettingsProfileMenuEntry;
36
37
  itemClick: (item: ProfileItem) => void;
37
38
  }
39
+ export interface UserSettingsProfileMenuEntry {
40
+ label?: string;
41
+ link?: string;
42
+ }
38
43
  export interface ProfileLogout {
39
44
  label?: string;
40
45
  icon?: string;
@@ -98,9 +103,11 @@ export interface Node {
98
103
  hideFromNav?: boolean;
99
104
  hideSideNav?: boolean;
100
105
  icon?: string;
106
+ intendToHaveEmptyViewUrl?: boolean;
101
107
  isRootNode?: boolean;
102
108
  keepSelectedForChildren?: boolean;
103
109
  label?: string;
110
+ link?: string;
104
111
  loadingIndicator?: {
105
112
  enabled: boolean;
106
113
  };
@@ -128,6 +135,7 @@ export interface Node {
128
135
  _virtualTree?: Node;
129
136
  _virtualPathIndex?: number;
130
137
  _virtualViewUrl?: string;
138
+ _rawContext?: Record<string, any>;
131
139
  }
132
140
  export interface PageErrorHandler {
133
141
  timeout: number;
@@ -158,6 +166,7 @@ export interface BreadcrumbItem {
158
166
  export interface NavItem {
159
167
  altText?: string;
160
168
  category?: Category;
169
+ href?: string;
161
170
  icon?: string;
162
171
  node?: Node;
163
172
  label?: string;
@@ -229,6 +238,7 @@ export interface NavigationRequestBase {
229
238
  }
230
239
  export interface NavigationRequestParams extends NavigationRequestBase {
231
240
  drawerSettings?: any;
241
+ intent?: boolean;
232
242
  modalSettings?: any;
233
243
  newTab?: boolean;
234
244
  path: string;
@@ -124,7 +124,7 @@ export declare const GenericHelpers: {
124
124
  * @param parenthesis
125
125
  * @returns
126
126
  */
127
- replaceVars(inputString: string, params: Record<string, any>, prefix: string, parenthesis?: boolean): string;
127
+ replaceVars(inputString: string, params: Record<string, any>, prefix: string, parenthesis?: boolean, slashStop?: boolean): string;
128
128
  /**
129
129
  * Escapes special characters in a string for use in a regular expression.
130
130
  * @param string
@@ -0,0 +1,3 @@
1
+ export declare class I18nHelpers {
2
+ static hasLocaleChangePermission(containerElement: any): boolean;
3
+ }
@@ -8,10 +8,9 @@ export declare const NavigationHelpers: {
8
8
  checkVisibleForFeatureToggles: (nodeToCheckPermission: any, featureToggles: FeatureToggles) => boolean;
9
9
  generateTooltipText: (node: Node, translation: string, luigi: Luigi) => string;
10
10
  isNodeAccessPermitted: (nodeToCheckPermissionFor: Node, parentNode: Node | undefined, currentContext: Record<string, any>, luigi: Luigi) => boolean;
11
- applyContext: (context: Record<string, any>, addition: Record<string, any>, navigationContext: any) => Record<string, any>;
12
11
  updateHeaderTitle: (appSwitcherData: AppSwitcher, pathData: PathData) => string | undefined;
13
12
  buildPath(pathToLeftNavParent: Node[], pathData?: PathData): string;
14
- mergeContext(...objs: Record<string, any>[]): Record<string, any>;
13
+ mergeContext(base: Record<string, any>, addition?: Record<string, any>, navigationContext?: string): Record<string, any>;
15
14
  prepareForTests(...parts: string[]): string;
16
15
  /**
17
16
  * Finds the virtual tree root node for a given node by traversing up the node hierarchy until it finds a node with the virtualTree property set to true. If no such node is found, it returns undefined.
@@ -80,19 +80,100 @@ export declare const RoutingHelpers: {
80
80
  * @returns An object containing only the permitted search parameters for the client.
81
81
  */
82
82
  prepareSearchParamsForClient(currentNode: Node, luigi: Luigi): {};
83
+ /**
84
+ * Checks if given path contains intent navigation special syntax
85
+ * @param {string} path - path to be checked
86
+ */
87
+ hasIntent(path: string): boolean;
88
+ /**
89
+ * This function takes an intentLink and parses it conforming certain limitations in characters usage.
90
+ * Limitations include:
91
+ * - `semanticObject` allows only alphanumeric characters
92
+ * - `action` allows alphanumeric characters and the '_' sign
93
+ *
94
+ * Example of resulting output:
95
+ * ```
96
+ * {
97
+ * semanticObject: "Sales",
98
+ * action: "order",
99
+ * params: {param1: "value1",param2: "value2"}
100
+ * };
101
+ * ```
102
+ * @param {string} intentLink - the intent link represents the semantic intent defined by the user, i.e.: #?intent=semanticObject-action?param=value
103
+ */
104
+ getIntentObject(intentLink: string): Record<string, any> | undefined;
105
+ /**
106
+ * This function compares the intentLink parameter with the configuration intentMapping
107
+ * and returns the path segment that is matched together with the parameters, if any
108
+ *
109
+ * Example:
110
+ *
111
+ * For intentLink = `#?intent=Sales-order?foo=bar`
112
+ * and Luigi configuration:
113
+ * ```
114
+ * intentMapping: [{
115
+ * semanticObject: 'Sales',
116
+ * action: 'order',
117
+ * pathSegment: '/projects/pr2/order'
118
+ * }]
119
+ *
120
+ * ```
121
+ * the given intentLink is matched with the configuration's same semanticObject and action,
122
+ * resulting in pathSegment `/projects/pr2/order` being returned. The parameter is also added in
123
+ * this case resulting in: `/projects/pr2/order?~foo=bar`
124
+ *
125
+ * Or for external intent links: intentLink = `#?intent=External-view`
126
+ * and Luigi configuration:
127
+ * ```
128
+ * intentMapping: [{
129
+ * semanticObject: 'External',
130
+ * action: 'view',
131
+ * externalLink: { url: 'https://www.sap.com', openInNewTab: true }
132
+ * }]
133
+ * ```
134
+ * The resulting will be returned from this function:
135
+ * ```
136
+ * {
137
+ * url: 'https://www.sap.com',
138
+ * openInNewTab: true,
139
+ * external: true
140
+ * }
141
+ * ```
142
+ * @param {string} intentLink - the intentLink represents the semantic intent defined by the user, i.e.: #?intent=semanticObject-action?param=value
143
+ * @param luigi - Luigi instance used to access configuration values
144
+ */
145
+ getIntentPath(intentLink: string, luigi: Luigi): boolean | string | Record<string, any>;
146
+ /**
147
+ * This function takes a path which contains dynamic parameters and a list parameters and replaces the dynamic parameters
148
+ * with the given parameters if any. The input path remains unchanged if the parameters list
149
+ * does not contain the respective dynamic parameter name.
150
+ * e.g.:
151
+ * Assume either of these two calls are made:
152
+ * 1. `LuigiClient.linkManager().navigateToIntent('Sales-settings', {project: 'pr2', user: 'john'})`
153
+ * 2. `LuigiClient.linkManager().navigate('/#?intent=Sales-settings?project=pr2&user=john')`
154
+ * For both 1. and 2., the following dynamic input path: `/projects/:project/details/:user`
155
+ * is resolved through this method to `/projects/pr2/details/john`
156
+ *
157
+ * @param {string} path - the path containing the potential dynamic parameter
158
+ * @param {Object} parameters - a list of objects consisting of passed parameters
159
+ */
160
+ resolveDynamicIntentPath(path: string, parameters: object): string;
83
161
  /**
84
162
  * Retrieves the current path and query string from the browser's location hash.
85
163
  *
164
+ * @param hashRouting - true if hash routing is active, false if path routing is active
165
+ * @param luigi - Luigi instance used to access configuration values
86
166
  * @returns An object containing the normalized path and the query string.
87
167
  * @remarks
88
168
  * - The path is normalized using `NavigationHelpers.normalizePath`.
89
169
  * - The query string is extracted from the portion after the '?' in the hash.
90
170
  * - If there is no query string, `query` will be `undefined`.
91
171
  */
92
- getCurrentPath(hashRouting?: boolean): {
172
+ getCurrentPath(luigi: Luigi, hashRouting?: boolean, checkIntent?: boolean): {
93
173
  path: string;
94
174
  query: string;
95
175
  };
176
+ handleExternalIntentPath(intentPath: Record<string, any>): void;
96
177
  /**
97
178
  * Retrieves the modal path from the current URL's query parameters based on the provided Luigi instance.
98
179
  *
@@ -163,7 +244,7 @@ export declare const RoutingHelpers: {
163
244
  getModalParamsFromPath(luigi: Luigi): any;
164
245
  /**
165
246
  * Get the query param separator which is used with hashRouting
166
- * Default: :
247
+ * Default:
167
248
  * @example /home?modal=(urlencoded)/some-modal?modalParams=(urlencoded){...}&otherParam=hmhm
168
249
  * @returns the first query param separator (like ? for path routing)
169
250
  */
@@ -323,7 +404,31 @@ export declare const RoutingHelpers: {
323
404
  * @returns a string representing the full route from the root to the given node, including query parameters if provided.
324
405
  */
325
406
  buildRoute(node: Node, path: string, params?: string): string;
326
- substituteViewUrl(node: Node, pathParams: Record<string, string>, luigi: Luigi): string;
407
+ /**
408
+ * Resolves the final view URL for a given node by substituting dynamic placeholders with actual values.
409
+ *
410
+ * Performs the following substitutions in order:
411
+ * 1. Removes `{virtualTreePath}` if the node is a virtual tree.
412
+ * 2. Replaces path parameters (e.g. `:id`) with their concrete values from `pathParams`.
413
+ * 3. Replaces context variables (e.g. `{context.myVar}`) with values from `node.context`.
414
+ * 4. Replaces node parameter variables (e.g. `{nodeParams.myParam}`) with values from `nodeParams`.
415
+ * 5. Replaces `{i18n.currentLocale}` with the current locale.
416
+ * 6. Replaces `{routing.queryParams.<key>}` with the corresponding search parameter value,
417
+ * or removes the query parameter from the URL if the value is not present.
418
+ *
419
+ * @param node - The navigation node containing the `viewUrl` template and optional `context`/`virtualTree` properties.
420
+ * @param pathParams - A map of path parameter names to their resolved values (e.g. `{ id: '42' }`).
421
+ * @param nodeParams - A map of node-specific parameters passed to the micro frontend.
422
+ * @param luigi - The Luigi instance used to access i18n, routing, and configuration.
423
+ * @returns The fully resolved view URL string, or an empty string if `node.viewUrl` is not defined.
424
+ */
425
+ substituteViewUrl(node: Node, pathParams: Record<string, string>, nodeParams: Record<string, any>, luigi: Luigi): string;
426
+ /**
427
+ * Returns the viewUrl with current locale, e.g. luigi/{i18n.currentLocale}/ -> luigi/en
428
+ * if viewUrl contains {i18n.currentLocale} term, it will be replaced by current locale
429
+ * @param viewUrl
430
+ */
431
+ getI18nViewUrl(viewUrl: string, luigi: Luigi): string;
327
432
  /**
328
433
  * Generates a sub-path for a given node by replacing dynamic parameters in the node's path with actual values from pathParams.
329
434
  * @param node - The node for which to generate the sub-path. It is expected to have a `pathSegment` property and optionally a `parent` property pointing to its parent node.
@@ -343,4 +448,31 @@ export declare const RoutingHelpers: {
343
448
  * @returns A string representing the concatenated path, with exactly one '/' character between the base and relative paths.
344
449
  */
345
450
  concatenatePath(basePath: any, relativePath?: any): string;
451
+ /**
452
+ * Returns the resolved route link for a navigation node. If the node has an external link, its URL is returned directly.
453
+ * If the node has an internal link, the prefix is prepended. Otherwise, the full route is built from the node's path
454
+ * segments and path parameters are substituted.
455
+ * @param node - The navigation node to resolve the link for
456
+ * @param pathParams - Dynamic path parameters to substitute in the route
457
+ * @param relativePathPrefix - Prefix to prepend to relative paths (e.g. '#' for hash routing)
458
+ * @returns The resolved route link as a string
459
+ */
460
+ getRouteLink(node: Node, pathParams: Record<string, any>, relativePathPrefix: string): string;
461
+ /**
462
+ * Calculates the full href for a navigation node, taking hash routing and i18n view URLs into account.
463
+ * @param node - The navigation node to calculate the href for
464
+ * @param pathParams - Dynamic path parameters to substitute in the route
465
+ * @param luigi - The Luigi instance used to read routing configuration
466
+ * @returns The fully resolved href string for the node
467
+ */
468
+ calculateNodeHref(node: Node, pathParams: Record<string, any>, luigi: Luigi): string;
469
+ /**
470
+ * Returns the href for a navigation node if the `navigation.addNavHrefs` configuration is enabled.
471
+ * This is used to populate anchor `href` attributes for accessibility and native browser behavior.
472
+ * @param node - The navigation node to get the href for
473
+ * @param pathParams - Dynamic path parameters to substitute in the route
474
+ * @param luigi - The Luigi instance used to read configuration
475
+ * @returns The node href string if `addNavHrefs` is enabled, otherwise `undefined`
476
+ */
477
+ getNodeHref(node: Node, pathParams: Record<string, any>, luigi: Luigi): string | undefined;
346
478
  };