@luigi-project/core-modular 0.0.1-dev.20260181313
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/App.svelte.d.ts +1 -0
- package/README.md +13 -0
- package/core-api/auth.d.ts +92 -0
- package/core-api/feature-toggles.d.ts +33 -0
- package/core-api/luigi.d.ts +79 -0
- package/core-api/navigation.d.ts +15 -0
- package/core-api/routing.d.ts +43 -0
- package/core-api/theming.d.ts +78 -0
- package/core-api/ux.d.ts +22 -0
- package/luigi-engine.d.ts +40 -0
- package/luigi.js +34 -0
- package/luigi.js.map +1 -0
- package/main.d.ts +1 -0
- package/modules/communicaton-module.d.ts +6 -0
- package/modules/routing-module.d.ts +18 -0
- package/modules/ui-module.d.ts +14 -0
- package/modules/ux-module.d.ts +49 -0
- package/package.json +22 -0
- package/services/auth-layer.service.d.ts +24 -0
- package/services/auth-store.service.d.ts +23 -0
- package/services/dirty-status.service.d.ts +41 -0
- package/services/i18n.service.d.ts +81 -0
- package/services/modal.service.d.ts +52 -0
- package/services/navigation.service.d.ts +213 -0
- package/services/node-data-management.service.d.ts +45 -0
- package/services/routing.service.d.ts +103 -0
- package/services/service-registry.d.ts +42 -0
- package/services/viewurl-decorator.d.ts +7 -0
- package/types/connector.d.ts +26 -0
- package/utilities/defaultLuigiTranslationTable.d.ts +1 -0
- package/utilities/helpers/async-helpers.d.ts +13 -0
- package/utilities/helpers/auth-helpers.d.ts +22 -0
- package/utilities/helpers/config-helpers.d.ts +19 -0
- package/utilities/helpers/escaping-helpers.d.ts +10 -0
- package/utilities/helpers/event-listener-helpers.d.ts +7 -0
- package/utilities/helpers/generic-helpers.d.ts +78 -0
- package/utilities/helpers/navigation-helpers.d.ts +15 -0
- package/utilities/helpers/routing-helpers.d.ts +254 -0
- package/utilities/helpers/storage-helpers.d.ts +25 -0
- package/utilities/helpers/usersetting-dialog-helpers.d.ts +8 -0
- package/utilities/luigi-config-defaults.d.ts +21 -0
- package/utilities/store.d.ts +11 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Luigi } from '../core-api/luigi';
|
|
2
|
+
import { ModalSettings, Node, NavigationService } from './navigation.service';
|
|
3
|
+
export interface Route {
|
|
4
|
+
raw: string;
|
|
5
|
+
node?: Node;
|
|
6
|
+
path: string;
|
|
7
|
+
nodeParams?: Record<string, string>;
|
|
8
|
+
}
|
|
9
|
+
export declare class RoutingService {
|
|
10
|
+
private luigi;
|
|
11
|
+
navigationService?: NavigationService;
|
|
12
|
+
previousNode: Node | undefined;
|
|
13
|
+
currentRoute?: Route;
|
|
14
|
+
modalSettings?: ModalSettings;
|
|
15
|
+
constructor(luigi: Luigi);
|
|
16
|
+
private getNavigationService;
|
|
17
|
+
/**
|
|
18
|
+
* If the current route matches any of the defined patterns, it will be skipped.
|
|
19
|
+
* @returns {boolean} true if the current route matches any of the patterns, false otherwise
|
|
20
|
+
*/
|
|
21
|
+
shouldSkipRoutingForUrlPatterns(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Initializes the route change handler for the application.
|
|
24
|
+
*
|
|
25
|
+
* Depending on the Luigi configuration, this method sets up a listener for hash-based or path-based routing changes.
|
|
26
|
+
* When the URL changes, it:
|
|
27
|
+
* - Parses the current path and query parameters.
|
|
28
|
+
* - Filters node-specific parameters.
|
|
29
|
+
* - Checks if a redirect is necessary and navigates if so.
|
|
30
|
+
* - Retrieves and updates the current navigation node.
|
|
31
|
+
* - Notifies the navigation service of the node change.
|
|
32
|
+
* - Updates the top, left, and tab navigation UIs.
|
|
33
|
+
* - Updates the main content area based on the current node.
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
enableRouting(): void;
|
|
37
|
+
handleRouteChange(routeInfo: {
|
|
38
|
+
path: string;
|
|
39
|
+
query: string;
|
|
40
|
+
}): Promise<void>;
|
|
41
|
+
getCurrentRoute(): Route | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* If `showModalPathInUrl` is provided, bookmarkable modal path will be triggered.
|
|
44
|
+
*/
|
|
45
|
+
shouldShowModalPathInUrl(routeInfo: {
|
|
46
|
+
path: string;
|
|
47
|
+
query: string;
|
|
48
|
+
}): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Handles opening a modal based on the current bookmarkable path.
|
|
51
|
+
*
|
|
52
|
+
* This method checks if there is an additional modal path present in the current Luigi path.
|
|
53
|
+
* If a modal path exists, it retrieves the corresponding modal parameters and node data,
|
|
54
|
+
* then opens the modal using the navigation service.
|
|
55
|
+
*
|
|
56
|
+
* @returns {Promise<void>} A promise that resolves when the modal handling is complete.
|
|
57
|
+
*/
|
|
58
|
+
handleBookmarkableModalPath(routeInfo: {
|
|
59
|
+
path: string;
|
|
60
|
+
query: string;
|
|
61
|
+
}): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Append modal data to url
|
|
64
|
+
* @param {string} modalPath path of the view which is displayed in the modal
|
|
65
|
+
* @param {Object} modalParams query parameter
|
|
66
|
+
*/
|
|
67
|
+
appendModalDataToUrl(modalPath: string, modalParams: ModalSettings): void;
|
|
68
|
+
/**
|
|
69
|
+
* Remove modal data from url
|
|
70
|
+
* @param isClosedInternal flag if the modal is closed via close button or internal back navigation instead of changing browser URL manually or browser back button
|
|
71
|
+
*/
|
|
72
|
+
removeModalDataFromUrl(isClosedInternal: boolean): void;
|
|
73
|
+
/**
|
|
74
|
+
* Set feature toggles if `queryStringParam` is provided at config file
|
|
75
|
+
* @param {string} path used for retrieving and appending the path parameters
|
|
76
|
+
*/
|
|
77
|
+
setFeatureToggle(path: string): void;
|
|
78
|
+
/**
|
|
79
|
+
* Updates the current browser URL with modal-related routing information.
|
|
80
|
+
*
|
|
81
|
+
* Depending on the routing configuration (hash vs. standard), this method
|
|
82
|
+
* injects or updates two query parameters:
|
|
83
|
+
* - <modalParamName>: the modal's path identifier (modalPath)
|
|
84
|
+
* - <modalParamName>Params: a JSON-stringified object of additional modal parameters (modalParams)
|
|
85
|
+
*
|
|
86
|
+
* Behavior:
|
|
87
|
+
* - Determines the parameter base name via RoutingHelpers.getModalViewParamName.
|
|
88
|
+
* - Merges existing query parameters obtained through RoutingHelpers.getQueryParams, overwriting any previous modal values.
|
|
89
|
+
* - If hash routing is enabled (routing.useHashRouting = true):
|
|
90
|
+
* - Strips any existing query segment after the hash before appending the new encoded parameters.
|
|
91
|
+
* - Rebuilds the hash in the form: #<hashBase><separator><encodedParams>.
|
|
92
|
+
* - If hash routing is disabled:
|
|
93
|
+
* - Replaces the entire search string (?...) with the newly encoded parameters.
|
|
94
|
+
* - Serializes modalParams only when it is a non-empty object; otherwise omits the "*Params" companion parameter.
|
|
95
|
+
* - Uses history.pushState when addHistoryEntry is true, otherwise history.replaceState to avoid adding a new history entry.
|
|
96
|
+
*
|
|
97
|
+
* @param modalPath A string identifying the modal view or route segment to encode into the URL.
|
|
98
|
+
* @param modalParams A record of additional parameters for the modal; only included if non-empty. Serialized via JSON.stringify.
|
|
99
|
+
* @param addHistoryEntry If true, a new history entry is pushed (allowing back navigation); if false, the current entry is replaced.
|
|
100
|
+
|
|
101
|
+
*/
|
|
102
|
+
updateModalDataInUrl(modalPath: string, modalParams: ModalSettings, addHistoryEntry: boolean): void;
|
|
103
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
type ServiceFactory<T> = (...args: any[]) => T;
|
|
2
|
+
/**
|
|
3
|
+
* Manages the registration and retrieval of services within the application.
|
|
4
|
+
*
|
|
5
|
+
* The `ServiceRegistry` allows services to be registered with a unique identifier and a factory function.
|
|
6
|
+
* Services can be registered as singletons (default) or as transient instances.
|
|
7
|
+
*
|
|
8
|
+
* - Use `register` to add a service to the registry.
|
|
9
|
+
* - Use `get` to retrieve an instance of a registered service.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* registry.register('myService', () => new MyService(), true);
|
|
14
|
+
* const service = registry.get<T>('myService');
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
declare class ServiceRegistry {
|
|
18
|
+
private services;
|
|
19
|
+
/**
|
|
20
|
+
* Registers a service with the service registry.
|
|
21
|
+
*
|
|
22
|
+
* @template T - The type of the service.
|
|
23
|
+
* @param name - The unique identifier for the service.
|
|
24
|
+
* @param factory - A factory function that creates an instance of the service.
|
|
25
|
+
* @param singleton - If true, the service will be treated as a singleton. Defaults to true.
|
|
26
|
+
*/
|
|
27
|
+
register<T>(param: new (...args: any[]) => T, factory: ServiceFactory<T>, singleton?: boolean): void;
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves an instance of the requested service by its identifier.
|
|
30
|
+
*
|
|
31
|
+
* If the service is registered as a singleton, returns the existing instance or creates one if it doesn't exist.
|
|
32
|
+
* If the service is not a singleton, returns a new instance each time.
|
|
33
|
+
*
|
|
34
|
+
* @typeParam T - The type of the service to retrieve.
|
|
35
|
+
* @param name - The identifier of the service to retrieve.
|
|
36
|
+
* @returns The instance of the requested service.
|
|
37
|
+
* @throws {Error} If the service is not registered.
|
|
38
|
+
*/
|
|
39
|
+
get<T>(param: new (...args: any[]) => T): T;
|
|
40
|
+
}
|
|
41
|
+
export declare const serviceRegistry: ServiceRegistry;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ModalSettings, LeftNavData, Node, TopNavData, TabNavData } from '../services/navigation.service';
|
|
2
|
+
import { AlertHandler, AlertSettings, ConfirmationModalHandler, ConfirmationModalSettings, UserSettings } from '../modules/ux-module';
|
|
3
|
+
export interface LuigiConnector {
|
|
4
|
+
renderMainLayout(): void;
|
|
5
|
+
renderTopNav(data: TopNavData): void;
|
|
6
|
+
renderLeftNav(data: LeftNavData): void;
|
|
7
|
+
getContainerWrapper(): HTMLElement;
|
|
8
|
+
renderModal(content: HTMLElement, modalSettings: ModalSettings, onCloseCallback?: () => void, onCloseRequest?: () => void): any;
|
|
9
|
+
renderDrawer(content: HTMLElement, modalSettings: ModalSettings, onCloseCallback?: () => void): any;
|
|
10
|
+
renderTabNav(data: TabNavData): void;
|
|
11
|
+
renderAlert(alertSettings: AlertSettings, alertHandler: AlertHandler): void;
|
|
12
|
+
renderConfirmationModal(confirmationModalSettings: ConfirmationModalSettings, containerHandler: ConfirmationModalHandler): void;
|
|
13
|
+
setDocumentTitle(documentTitle: string): void;
|
|
14
|
+
getDocumentTitle(): string;
|
|
15
|
+
showLoadingIndicator(container?: HTMLElement): void;
|
|
16
|
+
hideLoadingIndicator(container?: HTMLElement): void;
|
|
17
|
+
addBackdrop(): void;
|
|
18
|
+
removeBackdrop(): void;
|
|
19
|
+
openUserSettings(settings: UserSettings): void;
|
|
20
|
+
closeUserSettings(): void;
|
|
21
|
+
setCurrentLocale(locale: string): void;
|
|
22
|
+
getCurrentLocale(): string;
|
|
23
|
+
updateModalSettings(modalSettings: ModalSettings): void;
|
|
24
|
+
showFatalError(error: string): void;
|
|
25
|
+
}
|
|
26
|
+
export type { Node };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const defaultLuigiTranslationTable: Record<string, any>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const AsyncHelpers: {
|
|
2
|
+
wrapAsPromise: (value: any) => Promise<any>;
|
|
3
|
+
/**
|
|
4
|
+
* Executes a function with a set of parameters
|
|
5
|
+
* and returns its value as promise
|
|
6
|
+
*
|
|
7
|
+
* @param {function} fn a function
|
|
8
|
+
* @param {array} args an array of arguments
|
|
9
|
+
* @returns {promise}
|
|
10
|
+
*/
|
|
11
|
+
applyFunctionPromisified: (fn: any, args: any) => Promise<any>;
|
|
12
|
+
getConfigValueFromObjectAsync: (object: Record<string, any>, property: string, ...parameters: any[]) => Promise<any>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare class AuthHelpersClass {
|
|
2
|
+
getStoredAuthData(): any;
|
|
3
|
+
isLoggedIn(): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if there is a error parameter in the url
|
|
6
|
+
* and returns error and error description
|
|
7
|
+
*/
|
|
8
|
+
parseUrlAuthErrors(): {
|
|
9
|
+
error: string;
|
|
10
|
+
errorDescription: string | null;
|
|
11
|
+
} | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Triggers onAuthError event with the found error
|
|
14
|
+
* and error parameters.
|
|
15
|
+
* @param {object} providerInstanceSettings
|
|
16
|
+
* @param {string} error
|
|
17
|
+
* @param {string} errorDescription
|
|
18
|
+
*/
|
|
19
|
+
handleUrlAuthErrors(providerInstanceSettings: any, error?: string, errorDescription?: string): Promise<any>;
|
|
20
|
+
}
|
|
21
|
+
export declare const AuthHelpers: AuthHelpersClass;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Luigi } from '../../core-api/luigi';
|
|
2
|
+
declare class ConfigHelpersClass {
|
|
3
|
+
setErrorMessage(errorMsg: string): void;
|
|
4
|
+
getLuigi(): Luigi;
|
|
5
|
+
getConfigValue(key: string): any;
|
|
6
|
+
getConfigValueAsync(key: string): any;
|
|
7
|
+
/**
|
|
8
|
+
* Executes the function of the given property on the Luigi config object.
|
|
9
|
+
* Fails if property is not a function.
|
|
10
|
+
*
|
|
11
|
+
* If the value is a Function it is called (with the given parameters) and the result of that call is the value.
|
|
12
|
+
* If the value is not a Promise it is wrapped to a Promise so that the returned value is definitely a Promise.
|
|
13
|
+
* @private
|
|
14
|
+
* @memberof Configuration
|
|
15
|
+
*/
|
|
16
|
+
executeConfigFnAsync(property: string, throwError?: boolean, ...parameters: any): Promise<any>;
|
|
17
|
+
}
|
|
18
|
+
export declare const ConfigHelpers: ConfigHelpersClass;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Link, ProcessedTextAndLinks } from '../../modules/ux-module';
|
|
2
|
+
export declare const EscapingHelpers: {
|
|
3
|
+
sanitizeHtml(text?: string): string;
|
|
4
|
+
restoreSanitizedBrs(text?: string): string;
|
|
5
|
+
restoreSanitizedElements(text?: string): string;
|
|
6
|
+
sanatizeHtmlExceptTextFormatting(text?: string): string;
|
|
7
|
+
sanitizeParam(param?: string): string;
|
|
8
|
+
escapeKeyForRegexp(str?: string): string;
|
|
9
|
+
processTextAndLinks(text: string | undefined, links: Link, uniqueID: any): ProcessedTextAndLinks;
|
|
10
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export declare const GenericHelpers: {
|
|
2
|
+
/**
|
|
3
|
+
* Creates a random Id
|
|
4
|
+
* @returns random numeric value {number}
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
getRandomId: () => number;
|
|
8
|
+
/**
|
|
9
|
+
* Checks if input is a promise.
|
|
10
|
+
* @param promiseToCheck mixed
|
|
11
|
+
* @returns {boolean}
|
|
12
|
+
*/
|
|
13
|
+
isPromise: (promiseToCheck: any) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Checks if input is a function.
|
|
16
|
+
* @param functionToCheck mixed
|
|
17
|
+
* @returns {boolean}
|
|
18
|
+
*/
|
|
19
|
+
isFunction: (functionToCheck: any) => boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Checks if input is a string.
|
|
22
|
+
* @param stringToCheck mixed
|
|
23
|
+
* @returns {boolean}
|
|
24
|
+
*/
|
|
25
|
+
isString: (stringToCheck: string | any) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Checks if input is an object.
|
|
28
|
+
* @param objectToCheck mixed
|
|
29
|
+
* @returns {boolean}
|
|
30
|
+
*/
|
|
31
|
+
isObject: (objectToCheck: object | any) => boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Removes leading slash of a string
|
|
34
|
+
* @param {str} string
|
|
35
|
+
* @returns {string} string without leading slash
|
|
36
|
+
*/
|
|
37
|
+
trimLeadingSlash: (str: string) => string;
|
|
38
|
+
/**
|
|
39
|
+
* Prepend current url to redirect_uri, if it is a relative path
|
|
40
|
+
* @param {str} string from which any number of trailing slashes should be removed
|
|
41
|
+
* @returns {string} string without any trailing slash
|
|
42
|
+
*/
|
|
43
|
+
trimTrailingSlash: (str: string) => string;
|
|
44
|
+
/**
|
|
45
|
+
* Checks if HTML element is visible
|
|
46
|
+
* @param {Element} element to be checked in DOM
|
|
47
|
+
* @returns {boolean} `true` if element is visible - otherwise `false`
|
|
48
|
+
*/
|
|
49
|
+
isElementVisible: (element: Element) => boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Gets collection of HTML elements
|
|
52
|
+
* @param {string} selector to be searched in DOM
|
|
53
|
+
* @param {boolean} onlyVisible elements should be included
|
|
54
|
+
* @returns {Array} collection of HTML elements
|
|
55
|
+
*/
|
|
56
|
+
getNodeList: (selector: string, onlyVisible?: boolean) => Element[];
|
|
57
|
+
/**
|
|
58
|
+
* Prepend current url to redirect_uri, if it is a relative path
|
|
59
|
+
* @param {path} string full url, relative or absolute path
|
|
60
|
+
* @returns {string} window location origin
|
|
61
|
+
*/
|
|
62
|
+
prependOrigin: (path: string) => string;
|
|
63
|
+
/**
|
|
64
|
+
* Gets value of the given property on the given object.
|
|
65
|
+
* @param object mixed
|
|
66
|
+
* @param property name of the given property
|
|
67
|
+
*/
|
|
68
|
+
getConfigValueFromObject: (object: Record<string, any>, property: string) => any;
|
|
69
|
+
/**
|
|
70
|
+
* Gets boolean value of specified property on the given object.
|
|
71
|
+
* Function returns true if the property value is equal true or 'true'. Otherwise the function returns false.
|
|
72
|
+
* @param {Object} object mixed
|
|
73
|
+
* @param {string} property name of the given property
|
|
74
|
+
* @returns {boolean} boolean value
|
|
75
|
+
*/
|
|
76
|
+
getConfigBooleanValue: (object: Record<string, any>, property: string) => boolean;
|
|
77
|
+
getUrlParameter: (key: string) => string | null;
|
|
78
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FeatureToggles } from '../../core-api/feature-toggles';
|
|
2
|
+
import { Luigi } from '../../core-api/luigi';
|
|
3
|
+
import { AppSwitcher, Node, PathData } from '../../services/navigation.service';
|
|
4
|
+
export declare const NavigationHelpers: {
|
|
5
|
+
normalizePath: (raw: string) => string;
|
|
6
|
+
segmentMatches: (linkSegment: string, pathSegment: string, pathParams: Record<string, any>) => boolean;
|
|
7
|
+
checkMatch: (route: string, nodesInPath: Array<any>, pathParams?: Record<string, any>) => boolean;
|
|
8
|
+
checkVisibleForFeatureToggles: (nodeToCheckPermission: any, featureToggles: FeatureToggles) => boolean;
|
|
9
|
+
generateTooltipText: (node: any, translation: string, luigi: Luigi) => string;
|
|
10
|
+
isNodeAccessPermitted: (nodeToCheckPermissionFor: Node, parentNode: Node | undefined, currentContext: Record<string, any>, luigi: Luigi) => boolean;
|
|
11
|
+
updateHeaderTitle: (appSwitcherData: AppSwitcher, pathData: PathData) => string | undefined;
|
|
12
|
+
buildPath(pathToLeftNavParent: Node[], pathData?: PathData): string;
|
|
13
|
+
mergeContext(...objs: Record<string, any>[]): Record<string, any>;
|
|
14
|
+
prepareForTests(...parts: string[]): string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { FeatureToggles } from '../../core-api/feature-toggles';
|
|
2
|
+
import { Luigi } from '../../core-api/luigi';
|
|
3
|
+
import { Node, PathData } from '../../services/navigation.service';
|
|
4
|
+
export declare const RoutingHelpers: {
|
|
5
|
+
defaultContentViewParamPrefix: string;
|
|
6
|
+
defaultQueryParamSeparator: string;
|
|
7
|
+
defaultModalViewParamName: string;
|
|
8
|
+
/**
|
|
9
|
+
* Adds or updates query parameters to a hash-based routing string.
|
|
10
|
+
*
|
|
11
|
+
* @param params - An object representing the parameters to add or update in the hash's query string.
|
|
12
|
+
* @param hash - The hash string (e.g., "#/path?foo=bar") to which the parameters will be added or updated.
|
|
13
|
+
* @param paramPrefix - (Optional) A prefix to apply to each parameter key when adding or updating.
|
|
14
|
+
* @returns The updated hash string with the new or modified query parameters.
|
|
15
|
+
*/
|
|
16
|
+
addParamsOnHashRouting(params: Record<string, any>, hash: string, paramPrefix?: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Modifies the given `URLSearchParams` object by setting or deleting parameters based on the provided `params` object.
|
|
19
|
+
*
|
|
20
|
+
* For each key-value pair in `params`, the function sets the corresponding parameter in `searchParams`.
|
|
21
|
+
* If a `paramPrefix` is provided, it is prepended to each parameter key.
|
|
22
|
+
* If a value in `params` is `undefined`, the corresponding parameter is deleted from `searchParams`.
|
|
23
|
+
*
|
|
24
|
+
* @param params - An object containing key-value pairs to set or delete in the search parameters.
|
|
25
|
+
* @param searchParams - The `URLSearchParams` instance to modify.
|
|
26
|
+
* @param paramPrefix - (Optional) A string to prefix to each parameter key.
|
|
27
|
+
*/
|
|
28
|
+
modifySearchParams(params: Record<string, any>, searchParams: URLSearchParams, paramPrefix?: string): void;
|
|
29
|
+
/**
|
|
30
|
+
* Extracts and sanitizes node-specific parameters from the provided params object.
|
|
31
|
+
*
|
|
32
|
+
* This method filters the input `params` to include only those keys that start with
|
|
33
|
+
* a specific prefix, determined by `getContentViewParamPrefix(luigi)`. The prefix is
|
|
34
|
+
* removed from the key names in the resulting object. The resulting map is then
|
|
35
|
+
* sanitized before being returned.
|
|
36
|
+
*
|
|
37
|
+
* @param params - An object containing key-value pairs of parameters.
|
|
38
|
+
* @param luigi - The Luigi instance used to determine the parameter prefix.
|
|
39
|
+
* @returns A sanitized map of node-specific parameters with the prefix removed from their keys.
|
|
40
|
+
*/
|
|
41
|
+
filterNodeParams(params: Record<string, string>, luigi: Luigi): Record<string, string>;
|
|
42
|
+
/**
|
|
43
|
+
* Retrieves the content view parameter prefix from the Luigi configuration.
|
|
44
|
+
*
|
|
45
|
+
* This method attempts to obtain the prefix value from the Luigi configuration using the key
|
|
46
|
+
* `'routing.nodeParamPrefix'`. If the configuration value is explicitly set to `false`, it returns
|
|
47
|
+
* an empty string. If the value is not set or is falsy, it falls back to the default content view
|
|
48
|
+
* parameter prefix defined in the class.
|
|
49
|
+
*
|
|
50
|
+
* @param luigi - The Luigi instance used to access configuration values.
|
|
51
|
+
* @returns The content view parameter prefix as a string.
|
|
52
|
+
*/
|
|
53
|
+
getContentViewParamPrefix(luigi: Luigi): any;
|
|
54
|
+
/**
|
|
55
|
+
* Sanitizes the keys and values of a parameter map by applying the `EscapingHelpers.sanitizeParam` function
|
|
56
|
+
* to each key-value pair. Returns a new object with sanitized keys and values.
|
|
57
|
+
*
|
|
58
|
+
* @param paramsMap - An object containing string keys and values to be sanitized.
|
|
59
|
+
* @returns A new object with both keys and values sanitized.
|
|
60
|
+
*/
|
|
61
|
+
sanitizeParamsMap(paramsMap: Record<string, string>): Record<string, string>;
|
|
62
|
+
/**
|
|
63
|
+
* Prepares and filters the search parameters from the Luigi routing context
|
|
64
|
+
* based on the current node's client permissions. Only parameters explicitly
|
|
65
|
+
* allowed with `read: true` in the node's `clientPermissions.urlParameters`
|
|
66
|
+
* are included in the returned object.
|
|
67
|
+
*
|
|
68
|
+
* @param currentNode - The current navigation node containing client permissions.
|
|
69
|
+
* @param luigi - The Luigi instance providing access to routing and search parameters.
|
|
70
|
+
* @returns An object containing only the permitted search parameters for the client.
|
|
71
|
+
*/
|
|
72
|
+
prepareSearchParamsForClient(currentNode: Node, luigi: Luigi): {};
|
|
73
|
+
/**
|
|
74
|
+
* Retrieves the current path and query string from the browser's location hash.
|
|
75
|
+
*
|
|
76
|
+
* @returns An object containing the normalized path and the query string.
|
|
77
|
+
* @remarks
|
|
78
|
+
* - The path is normalized using `NavigationHelpers.normalizePath`.
|
|
79
|
+
* - The query string is extracted from the portion after the '?' in the hash.
|
|
80
|
+
* - If there is no query string, `query` will be `undefined`.
|
|
81
|
+
*/
|
|
82
|
+
getCurrentPath(hashRouting?: boolean): {
|
|
83
|
+
path: string;
|
|
84
|
+
query: string;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Retrieves the modal path from the current URL's query parameters based on the provided Luigi instance.
|
|
88
|
+
*
|
|
89
|
+
* @param luigi - The Luigi instance used to determine the query parameter name and value.
|
|
90
|
+
* @returns The modal path as a string if present in the query parameters; otherwise, `undefined`.
|
|
91
|
+
*/
|
|
92
|
+
getModalPathFromPath(luigi: Luigi): string | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* Retrieves the value of a specific query parameter from the current URL.
|
|
95
|
+
*
|
|
96
|
+
* @param paramName - The name of the query parameter to retrieve.
|
|
97
|
+
* @param luigi - The Luigi instance used to access routing information.
|
|
98
|
+
* @returns The value of the specified query parameter if present; otherwise, `undefined`.
|
|
99
|
+
*/
|
|
100
|
+
getQueryParam(paramName: string, luigi: Luigi): string | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* Retrieves the current query parameters from the URL as a key-value record.
|
|
103
|
+
*
|
|
104
|
+
* Depending on the Luigi configuration, this method will extract query parameters
|
|
105
|
+
* either from the URL hash (if hash routing is enabled) or from the standard search
|
|
106
|
+
* portion of the URL.
|
|
107
|
+
*
|
|
108
|
+
* @param luigi - The Luigi instance used to access configuration values.
|
|
109
|
+
* @returns A record containing query parameter names and their corresponding values.
|
|
110
|
+
*/
|
|
111
|
+
getQueryParams(luigi: Luigi): Record<string, string>;
|
|
112
|
+
/**
|
|
113
|
+
* Retrieves the query parameters from the current location's search string as a key-value map.
|
|
114
|
+
*
|
|
115
|
+
* @returns {Record<string, string>} An object containing the query parameters as key-value pairs.
|
|
116
|
+
* If there are no query parameters, returns an empty object.
|
|
117
|
+
*/
|
|
118
|
+
getLocationSearchQueryParams(): Record<string, string>;
|
|
119
|
+
/**
|
|
120
|
+
* Returns the current browser location object.
|
|
121
|
+
*
|
|
122
|
+
* @returns {Location} The current location object representing the URL of the document.
|
|
123
|
+
*/
|
|
124
|
+
getLocation(): Location;
|
|
125
|
+
/**
|
|
126
|
+
* Extracts and parses query parameters from the current location's hash fragment.
|
|
127
|
+
*
|
|
128
|
+
* @returns {Record<string, string>} An object containing key-value pairs of query parameters
|
|
129
|
+
* extracted from the hash, or an empty object if no query parameters are present.
|
|
130
|
+
*/
|
|
131
|
+
getLocationHashQueryParams(): Record<string, string>;
|
|
132
|
+
/**
|
|
133
|
+
* Retrieves the name of the URL parameter used for modal views in routing.
|
|
134
|
+
*
|
|
135
|
+
* This method attempts to obtain the parameter name from the Luigi configuration
|
|
136
|
+
* using the key `'routing.modalPathParam'`. If the configuration value is not set,
|
|
137
|
+
* it falls back to a default parameter name defined by `this.defaultModalViewParamName`.
|
|
138
|
+
*
|
|
139
|
+
* @param luigi - The Luigi instance used to access configuration values.
|
|
140
|
+
* @returns The name of the modal view parameter to be used in routing.
|
|
141
|
+
*/
|
|
142
|
+
getModalViewParamName(luigi: Luigi): string;
|
|
143
|
+
/**
|
|
144
|
+
* Parses a URL query parameter string into an object mapping parameter names to values.
|
|
145
|
+
*
|
|
146
|
+
* Replaces '+' with spaces, splits the string by '&' to get key-value pairs,
|
|
147
|
+
* and decodes each component using `decodeURIComponent`.
|
|
148
|
+
*
|
|
149
|
+
* @param paramsString - The URL query parameter string to parse (e.g., "foo=bar&baz=qux").
|
|
150
|
+
* @returns An object where each key is a parameter name and each value is the corresponding decoded value.
|
|
151
|
+
*/
|
|
152
|
+
parseParams(paramsString: string): Record<string, string>;
|
|
153
|
+
getModalParamsFromPath(luigi: Luigi): any;
|
|
154
|
+
/**
|
|
155
|
+
* Get the query param separator which is used with hashRouting
|
|
156
|
+
* Default: :
|
|
157
|
+
* @example /home?modal=(urlencoded)/some-modal?modalParams=(urlencoded){...}&otherParam=hmhm
|
|
158
|
+
* @returns the first query param separator (like ? for path routing)
|
|
159
|
+
*/
|
|
160
|
+
getHashQueryParamSeparator(): string;
|
|
161
|
+
/**
|
|
162
|
+
* Get an url without modal data. It's necessary on page refresh or loading Luigi with modal data in a new tab
|
|
163
|
+
* @param {String} searchParamsString url search parameter as string
|
|
164
|
+
* @param {String} modalParamName modalPathParam value defined in Luigi routing settings
|
|
165
|
+
* @returns {String} url search parameter as string without modal data
|
|
166
|
+
*/
|
|
167
|
+
getURLWithoutModalData(searchParamsString: string, modalParamName: string): string;
|
|
168
|
+
/**
|
|
169
|
+
* Extending history state object for calculation how much history entries the browser have to go back when modal will be closed.
|
|
170
|
+
* @param {Object} historyState history.state object.
|
|
171
|
+
* @param {Number} historyState.modalHistoryLength will be increased when modals will be openend successively like e.g. stepping through a wizard.
|
|
172
|
+
* @param {Number} historyState.historygap is the history.length at the time when the modal will be opened. It's needed for calculating how much we have to go back in the browser history when the modal will be closed.
|
|
173
|
+
* @param {String} historyState.pathBeforeHistory path before modal will be opened. It's needed for calculating how much we have to go back in the browser history when the modal will be closed.
|
|
174
|
+
* @param {boolean} hashRoutingActive true if hash routing is active, false if path routing is active
|
|
175
|
+
* @param {URL} url url object to read hash value or pathname
|
|
176
|
+
* @returns {Object} history state object
|
|
177
|
+
*/
|
|
178
|
+
handleHistoryState(historyState: any, path: string): any;
|
|
179
|
+
/**
|
|
180
|
+
* Encodes an object of key-value pairs into a URL query string.
|
|
181
|
+
*
|
|
182
|
+
* Each key and value in the input object is URI-encoded and joined with '='.
|
|
183
|
+
* The resulting pairs are concatenated with '&' to form a valid query string.
|
|
184
|
+
*
|
|
185
|
+
* @param dataObj - An object containing key-value pairs to encode.
|
|
186
|
+
* @returns A URL-encoded query string representing the input object.
|
|
187
|
+
*/
|
|
188
|
+
encodeParams(dataObj: Record<string, any>): string;
|
|
189
|
+
/**
|
|
190
|
+
* Retrieves the last node object from the provided `PathData`'s `nodesInPath` array.
|
|
191
|
+
* If `nodesInPath` is empty or undefined, returns an empty object.
|
|
192
|
+
*
|
|
193
|
+
* @param pathData - The `PathData` object containing the `nodesInPath` array.
|
|
194
|
+
* @returns The last node object in the `nodesInPath` array, or an empty object if none exists.
|
|
195
|
+
*/
|
|
196
|
+
getLastNodeObject(pathData: PathData): Node | {};
|
|
197
|
+
/**
|
|
198
|
+
* Checks if given URL is allowed to be included, based on 'navigation.validWebcomponentUrls' in Luigi config.
|
|
199
|
+
*
|
|
200
|
+
* @param {string} url the URL string to be checked
|
|
201
|
+
* @param {Luigi} luigi - the Luigi instance used to determine the parameter prefix
|
|
202
|
+
* @returns {boolean} `true` if allowed - `false` otherwise
|
|
203
|
+
*/
|
|
204
|
+
checkWCUrl(url: string, luigi: Luigi): boolean;
|
|
205
|
+
/**
|
|
206
|
+
* Set feature toggles
|
|
207
|
+
* @param {string} featureToggleProperty used for identifying feature toggles
|
|
208
|
+
* @param {string} path used for retrieving and appending the path parameters
|
|
209
|
+
*/
|
|
210
|
+
/**
|
|
211
|
+
* Set feature toggles
|
|
212
|
+
* @param {string} featureToggleProperty used for identifying feature toggles
|
|
213
|
+
* @param {string} path used for retrieving and appending the path parameters
|
|
214
|
+
*/
|
|
215
|
+
setFeatureToggles(featureToggleProperty: string, path: string, featureToggles: FeatureToggles): void;
|
|
216
|
+
/**
|
|
217
|
+
* Replaces dynamic parameter placeholders in the values of the provided object
|
|
218
|
+
* using a mapping of parameter names to concrete values.
|
|
219
|
+
*
|
|
220
|
+
* A placeholder is defined as the concatenation of `paramPrefix` and a key from `paramMap`
|
|
221
|
+
* (e.g. ":id"). Depending on the `contains` flag, the replacement logic operates in:
|
|
222
|
+
* - Exact match mode (`contains = false`): a value is replaced only if it equals the full placeholder (e.g. value === ":id").
|
|
223
|
+
* - Containment mode (`contains = true`): a value is scanned and any single occurrence of a placeholder substring is replaced
|
|
224
|
+
* (e.g. "/users/:id/details" becomes "/users/123/details"). Only the first matching key is replaced; subsequent occurrences
|
|
225
|
+
* or multiple different placeholders in the same value are not handled by this implementation.
|
|
226
|
+
*
|
|
227
|
+
* The function returns a new plain object; the original `object` argument is not mutated.
|
|
228
|
+
*
|
|
229
|
+
* @param object A record whose string values may contain dynamic parameter placeholders to substitute.
|
|
230
|
+
* @param paramMap A mapping of parameter names (without prefix) to their substitution values.
|
|
231
|
+
* @param paramPrefix The prefix that denotes a placeholder in `object` values. Defaults to ":".
|
|
232
|
+
* @param contains If true, perform substring replacement; if false, only exact value matches are substituted.
|
|
233
|
+
* @returns A new object with substituted values where placeholders matched the provided `paramMap`.
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* const obj = { userId: ':id', path: '/users/:id/details', untouched: 'static' };
|
|
237
|
+
* const paramMap = { id: '123' };
|
|
238
|
+
*
|
|
239
|
+
* // Exact match mode:
|
|
240
|
+
* substituteDynamicParamsInObject(obj, paramMap);
|
|
241
|
+
* // => { userId: '123', path: '/users/:id/details', untouched: 'static' }
|
|
242
|
+
*
|
|
243
|
+
* // Containment mode:
|
|
244
|
+
* substituteDynamicParamsInObject(obj, paramMap, ':', true);
|
|
245
|
+
* // => { userId: '123', path: '/users/123/details', untouched: 'static' }
|
|
246
|
+
*
|
|
247
|
+
* @remarks
|
|
248
|
+
* - Only the first matching parameter key is considered per value when `contains = true`.
|
|
249
|
+
* - Values that are undefined or null are returned as-is.
|
|
250
|
+
* - The return type is a generic object; if stronger typing is desired, consider overloading or
|
|
251
|
+
* constraining `paramMap` and `object` to more specific record types.
|
|
252
|
+
*/
|
|
253
|
+
substituteDynamicParamsInObject(object: Record<string, string>, paramMap: Record<any, any>, paramPrefix?: string, contains?: boolean): {};
|
|
254
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare class StorageHelpersClass {
|
|
2
|
+
init: boolean;
|
|
3
|
+
storage: Storage;
|
|
4
|
+
browseSupported: boolean | undefined;
|
|
5
|
+
constructor();
|
|
6
|
+
checkInit(): void;
|
|
7
|
+
supportLocalStorage(): boolean;
|
|
8
|
+
checkStorageBrowserSupport(): void;
|
|
9
|
+
process(microfrontendId: string, hostname: string, id: string, operation: string, params: object): void;
|
|
10
|
+
cleanHostname(hostname: string): string;
|
|
11
|
+
setItem(hostname: string, params: Record<string, string>): void;
|
|
12
|
+
getItem(hostname: string, params: Record<string, string>): any;
|
|
13
|
+
buildKey(hostname: string, subKey: string): string;
|
|
14
|
+
buildPrefix(hostname: string): string;
|
|
15
|
+
removeItem(hostname: string, params: Record<string, string>): string | undefined;
|
|
16
|
+
clear(hostname: string, params: Record<string, string>): void;
|
|
17
|
+
has(hostname: string, params: Record<string, string>): boolean;
|
|
18
|
+
getAllKeys(hostname: string, params: Record<string, string>): string[];
|
|
19
|
+
checkKey(params: Record<string, string>): void;
|
|
20
|
+
parseJsonIfPossible(text: string): any;
|
|
21
|
+
stringifyValue(value: any): string;
|
|
22
|
+
sendBackOperation(microfrontendId: string, id: string, status: 'OK' | 'ERROR', result: any): any;
|
|
23
|
+
}
|
|
24
|
+
export declare const StorageHelpers: StorageHelpersClass;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare class UserSettingsHelperClass {
|
|
2
|
+
processUserSettingGroups(userSettings: any, storedSettings: any): any[];
|
|
3
|
+
getUserSettingsIframesInDom(): HTMLElement[];
|
|
4
|
+
hideUserSettingsIframe(): void;
|
|
5
|
+
findActiveCustomUserSettingsIframe(eventSource: any): any;
|
|
6
|
+
}
|
|
7
|
+
export declare const UserSettingsHelper: UserSettingsHelperClass;
|
|
8
|
+
export {};
|