@luigi-project/core-modular 0.0.4-dev.20260490045 → 0.0.5-dev.202604160059

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.
@@ -7,10 +7,12 @@ export declare const UIModule: {
7
7
  navService: NavigationService;
8
8
  routingService: RoutingService;
9
9
  luigi: Luigi;
10
+ modalContainer: any;
11
+ drawerContainer: any;
10
12
  init: (luigi: Luigi) => void;
11
13
  update: (scopes?: string[]) => Promise<void>;
12
14
  updateMainContent: (currentNode: Node, luigi: Luigi, luigiParams?: LuigiParams, withoutSync?: boolean, preventContextUpdate?: boolean) => Promise<void>;
13
15
  openModal: (luigi: Luigi, node: Node, modalSettings: ModalSettings, onCloseCallback?: () => void) => Promise<void>;
14
16
  updateModalSettings: (modalSettings: ModalSettings, addHistoryEntry: boolean, luigi: Luigi) => void;
15
- openDrawer: (luigi: Luigi, node: Node, modalSettings: ModalSettings, onCloseCallback?: () => void) => Promise<void>;
17
+ openDrawer: (luigi: Luigi, node: Node, drawerSettings: ModalSettings, onCloseCallback?: () => void) => Promise<void>;
16
18
  };
@@ -1,11 +1,12 @@
1
1
  import { LuigiCompoundContainer, LuigiContainer } from '@luigi-project/container';
2
2
  import { Luigi } from '../core-api/luigi';
3
3
  export interface AlertSettings {
4
- text?: string;
5
- type?: string;
6
- links?: Record<string, Link>;
7
4
  closeAfter?: number;
8
5
  id?: string;
6
+ links?: Record<string, Link>;
7
+ text?: string;
8
+ ttl?: number;
9
+ type?: string;
9
10
  }
10
11
  export interface AlertHandler {
11
12
  openFromClient: boolean;
package/package.json CHANGED
@@ -18,5 +18,5 @@
18
18
  "micro-frontends",
19
19
  "microfrontends"
20
20
  ],
21
- "version": "0.0.4-dev.20260490045"
21
+ "version": "0.0.5-dev.202604160059"
22
22
  }
@@ -12,8 +12,7 @@ export declare class NavigationService {
12
12
  getPathData(path: string): Promise<PathData>;
13
13
  findMatchingNode(urlPathElement: string, nodes: Node[]): Node | undefined;
14
14
  buildNavItems(nodes: Node[], selectedNode: Node | undefined, pathData: PathData): NavItem[];
15
- shouldRedirect(path: string, pData?: PathData): Promise<string | undefined>;
16
- getCurrentNode(path: string): Promise<any>;
15
+ getCurrentNode(path: string): Promise<Node | undefined>;
17
16
  getPathParams(path: string): Promise<Record<string, any>>;
18
17
  /**
19
18
  * getTruncatedChildren
@@ -103,7 +102,7 @@ export declare class NavigationService {
103
102
  * Builds a path string by concatenating path segments from the virtual tree root or the incoming path.
104
103
  *
105
104
  * @param incomingPath - The incoming path segment to be appended.
106
- * @param fromVirtualTreeRoot - A boolean indicating whether to build the path from the virtual tree root.
105
+ * @param options - The set of params related to navigation.
107
106
  * @returns The constructed path string.
108
107
  */
109
108
  buildPath(incomingPath: string, options: NavigationOptions): Promise<string>;
@@ -105,4 +105,22 @@ export declare class RoutingService {
105
105
  */
106
106
  updateModalDataInUrl(modalPath: string, modalParams: ModalSettings, addHistoryEntry: boolean): void;
107
107
  checkInvalidateCache(previousPathData: PathData | undefined, newPath: string): void;
108
+ /**
109
+ * Deal with page not found scenario.
110
+ * @param {Object} nodeObject - the data of node
111
+ * @param {string} viewUrl - the url of the current mf view
112
+ * @param {Object} pathData - the information of current path
113
+ * @param {string} path - the path of the view to open
114
+ * @param {string} pathUrlRaw - path url without hash
115
+ * @returns {Promise<boolean>} A promise that resolves when page not found handling is complete.
116
+ */
117
+ handlePageNotFound(nodeObject: any, viewUrl: string, pathData: PathData, path: string, pathUrlRaw: string): Promise<boolean>;
118
+ /**
119
+ * Handle error for page not found scenario.
120
+ * @param {string} pathToRedirect - fallback path for redirection
121
+ * @param {string} notFoundPath - the path which cannot be found
122
+ * @param {boolean} isAnyPathMatched - is any path matched or not
123
+ * @returns {Promise<void>} A promise that resolves when error handling is complete.
124
+ */
125
+ showPageNotFoundError(pathToRedirect: string, notFoundPath: string, isAnyPathMatched?: boolean): Promise<void>;
108
126
  }
@@ -66,11 +66,13 @@ export interface LeftNavData {
66
66
  navClick?: (item: NavItem) => void;
67
67
  }
68
68
  export interface PathData {
69
+ context?: Record<string, any>;
69
70
  selectedNode?: Node;
70
71
  selectedNodeChildren?: Node[];
71
72
  nodesInPath?: Node[];
72
73
  rootNodes: Node[];
73
74
  pathParams: Record<string, any>;
75
+ matchedPath: string;
74
76
  }
75
77
  export interface RootNode {
76
78
  node: Node;
@@ -204,6 +206,7 @@ export interface NavigationRequestBase {
204
206
  options?: NavigationOptions;
205
207
  }
206
208
  export interface NavigationRequestParams extends NavigationRequestBase {
209
+ drawerSettings?: any;
207
210
  modalSettings?: any;
208
211
  newTab?: boolean;
209
212
  path: string;
@@ -35,15 +35,39 @@ export declare const GenericHelpers: {
35
35
  * @returns {boolean}
36
36
  */
37
37
  isObject: (objectToCheck: object | any) => boolean;
38
+ /**
39
+ * Checks if a given input string begins a hash with slash
40
+ * @param {string} path
41
+ * @returns {boolean}
42
+ */
43
+ hasHash: (path: string) => boolean;
44
+ /**
45
+ * Removes leading hash of a string
46
+ * @param {string} path
47
+ * @returns {string}
48
+ */
49
+ getPathWithoutHash: (path: string) => string;
50
+ /**
51
+ * Removes any trailing slash of a string
52
+ * @param {string} path
53
+ * @returns {string}
54
+ */
55
+ getTrimmedUrl: (path: string) => string;
56
+ /**
57
+ * Adds a leading slash to a string if it has none
58
+ * @param {string} str string to be checked
59
+ * @returns {string} string with a leading slash
60
+ */
61
+ addLeadingSlash: (str: string) => string;
38
62
  /**
39
63
  * Removes leading slash of a string
40
- * @param {str} string
64
+ * @param {string} str string to be checked
41
65
  * @returns {string} string without leading slash
42
66
  */
43
67
  trimLeadingSlash: (str: string) => string;
44
68
  /**
45
69
  * Prepend current url to redirect_uri, if it is a relative path
46
- * @param {str} string from which any number of trailing slashes should be removed
70
+ * @param {string} str string from which any number of trailing slashes should be removed
47
71
  * @returns {string} string without any trailing slash
48
72
  */
49
73
  trimTrailingSlash: (str: string) => string;
@@ -0,0 +1,18 @@
1
+ import { Luigi } from '../../core-api/luigi';
2
+ export type MicrofrontendEntry = {
3
+ iframe: HTMLElement;
4
+ id: string;
5
+ active: boolean;
6
+ };
7
+ export type MicrofrontendInDom = {
8
+ container: HTMLElement;
9
+ active: boolean;
10
+ type: 'main' | 'modal' | 'drawer';
11
+ id: string;
12
+ };
13
+ export declare const LuigiContainerHelpers: {
14
+ getMicrofrontendsInDom(luigi: Luigi): MicrofrontendInDom[];
15
+ getMainMicrofrontends(luigi: Luigi): MicrofrontendEntry[];
16
+ getModalMicrofrontends(): MicrofrontendEntry[];
17
+ getDrawerMicrofrontends(): MicrofrontendEntry;
18
+ };
@@ -8,6 +8,7 @@ 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>;
11
12
  updateHeaderTitle: (appSwitcherData: AppSwitcher, pathData: PathData) => string | undefined;
12
13
  buildPath(pathToLeftNavParent: Node[], pathData?: PathData): string;
13
14
  mergeContext(...objs: Record<string, any>[]): Record<string, any>;
@@ -18,4 +19,12 @@ export declare const NavigationHelpers: {
18
19
  * @returns The virtual tree root node if found, otherwise undefined.
19
20
  */
20
21
  findVirtualTreeRootNode(node: Node): Node | undefined;
22
+ /**
23
+ * Validates if a path exists and handles page not found cases.
24
+ * Returns the redirect path if valid, or undefined if the path should not be followed.
25
+ * @param path The path to validate
26
+ * @param luigi The Luigi instance
27
+ * @returns The redirect path if valid, undefined otherwise
28
+ */
29
+ validatePathAndGetRedirect: (path: string, luigi: Luigi) => Promise<string | undefined>;
21
30
  };
@@ -262,6 +262,41 @@ export declare const RoutingHelpers: {
262
262
  * @param {*} pathParams
263
263
  */
264
264
  getDynamicNodeValue(node: Node, pathParams: Record<string, string>): string | undefined;
265
+ /**
266
+ * Checks if given path is an existing route or not
267
+ * @param {string} activePath - path to be checked
268
+ * @param {PathData} pathData - related path data
269
+ * @returns {boolean} the result of path checking as boolean value
270
+ */
271
+ isExistingRoute(activePath: string, pathData: PathData): boolean;
272
+ /**
273
+ * Handles case if path exists or not.
274
+ * @param {string} path - the path to be checked
275
+ * @param {Luigi} luigi - the Luigi instance used to access configuration values
276
+ * @returns {Promise<boolean>} the result of path checking as async boolean value
277
+ */
278
+ pathExists(path: string, luigi: Luigi): Promise<boolean>;
279
+ showRouteNotFoundAlert(path: string, isAnyPathMatched: boolean | undefined, luigi: Luigi): void;
280
+ /**
281
+ * Queries the pageNotFoundHandler configuration and returns redirect path if it exists
282
+ * If the there is no `pageNotFoundHandler` defined we return undefined.
283
+ * @param {string} notFoundPath - the path to be checked
284
+ * @param {boolean} isAnyPathMatched - is any path matched or not
285
+ * @param {Luigi} luigi - the Luigi instance used to access config value
286
+ * @returns {Object} an object optionally containing the path to redirect, the keepURL option or an empty object if handler is undefined
287
+ */
288
+ getPageNotFoundRedirectResult(notFoundPath: string, isAnyPathMatched: boolean | undefined, luigi: Luigi): object;
289
+ /**
290
+ * Handles pageNotFound situation depending if path exists or not.
291
+ * If path exists simply return the given path, else fetch the pageNotFound redirect path and return it.
292
+ * In case there was no pageNotFound handler defined it shows an alert and returns undefined.
293
+ * @param {string} path - the path to check for
294
+ * @param {boolean} pathExists - defines if path exists or not
295
+ * @param {Luigi} luigi - the Luigi instance used to access configuration values
296
+ * @returns {} the path to redirect to or undefined if path doesn't exist and no redirect path is defined
297
+ */
298
+ handlePageNotFoundAndRetrieveRedirectPath(path: string, pathExists: boolean, luigi: Luigi): Promise<string | undefined>;
299
+ getDefaultChildNode(pathData: PathData, childrenResolverFn?: (lastElement: object, pathContext: object) => any): Promise<string>;
265
300
  /**
266
301
  * Recursively constructs the full path for a given node by concatenating its path segment with those of its ancestors.
267
302
  * If `params` are provided, they are appended as query parameters to the final path.