Skip to content

Commit

Permalink
Make clientAPI label distinguishable (#3920)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndricimrr authored Sep 30, 2024
1 parent 2b62bc2 commit f0956a2
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 120 deletions.
13 changes: 3 additions & 10 deletions client/src/lifecycleManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ class LifecycleManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Returns a list of active feature toggles
* @returns {Array} a list of feature toggle names
* @memberof Lifecycle
Expand All @@ -404,7 +403,6 @@ class LifecycleManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Sets node parameters in Luigi Core. The parameters will be added to the URL.
* @param {Object} params
* @param {boolean} keepBrowserHistory
Expand All @@ -423,7 +421,6 @@ class LifecycleManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Returns the node parameters of the active URL.
* Node parameters are defined like URL query parameters but with a specific prefix allowing Luigi to pass them to the micro frontend view. The default prefix is **~** and you can use it in the following way: `https://my.luigi.app/home/products?~sort=asc&~page=3`.
* <!-- add-attribute:class:warning -->
Expand All @@ -442,7 +439,6 @@ class LifecycleManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Returns the dynamic path parameters of the active URL.
* Path parameters are defined by navigation nodes with a dynamic **pathSegment** value starting with **:**, such as **productId**.
* All path parameters in the current navigation path (as defined by the active URL) are returned.
Expand All @@ -469,7 +465,7 @@ class LifecycleManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* <!-- label-success: Web App API only -->
* Sends search query parameters to Luigi Core. The search parameters will be added to the URL if they are first allowed on a node level using {@link navigation-parameters-reference.md#clientpermissionsurlparameters clientPermissions.urlParameters}.
* @param {Object} searchParams
Expand All @@ -489,7 +485,6 @@ class LifecycleManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Returns the current client permissions as specified in the navigation node or an empty object. For details, see [Node parameters](navigation-parameters-reference.md).
* @returns {Object} client permissions as specified in the navigation node
* @memberof Lifecycle
Expand All @@ -501,6 +496,7 @@ class LifecycleManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web App API only -->
* When the micro frontend is not embedded in the Luigi Core application and there is no init handshake you can set the target origin that is used in postMessage function calls by Luigi Client. Typically used only in custom micro-frontend frameworks that are compatible with LuigiClient API.
* @param {string} origin target origin
* @memberof Lifecycle
Expand All @@ -513,6 +509,7 @@ class LifecycleManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web App API only -->
* Sends a custom message to the Luigi Core application.
* @param {Object} message an object containing data to be sent to the Luigi Core to process it further. This object is set as an input parameter of the custom message listener on the Luigi Core side
* @param {string} message.id a string containing the message id
Expand All @@ -529,7 +526,6 @@ class LifecycleManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Returns the current user settings based on the selected node.
* @returns {Object} current user settings
* @since 1.7.1
Expand All @@ -542,7 +538,6 @@ class LifecycleManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Returns the current anchor based on active URL.
* @memberof Lifecycle
* @since 1.21.0
Expand All @@ -555,7 +550,6 @@ class LifecycleManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Sends anchor to Luigi Core. The anchor will be added to the URL.
* @param {string} anchor
* @since 1.21.0
Expand All @@ -571,7 +565,6 @@ class LifecycleManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* This function allows you to change node labels within the same {@link navigation-advanced.md#view-groups view group}, e.g. in your node config: `label: 'my Node {viewGroupData.vg1}'`.
* @since 2.2.0
* @param {Object} data a data object containing the view group name and desired label
Expand Down
25 changes: 6 additions & 19 deletions client/src/linkManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export class linkManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Navigates to the given path in the application hosted by Luigi. It contains either a full absolute path or a relative path without a leading slash that uses the active route as a base. This is the standard navigation.
* @memberof linkManager
* @param {string} path path to be navigated to
Expand Down Expand Up @@ -97,7 +96,6 @@ export class linkManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Updates path of the modalPathParam when internal navigation occurs.
* @memberof linkManager
* @param {string} path
Expand Down Expand Up @@ -125,7 +123,6 @@ export class linkManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Offers an alternative way of navigating with intents. This involves specifying a semanticSlug and an object containing
* parameters.
* This method internally generates a URL of the form `#?intent=<semantic object>-<action>?<param_name>=<param_value>` through the given
Expand Down Expand Up @@ -158,7 +155,6 @@ export class linkManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Opens a view in a modal. You can specify the modal's title and size. If you don't specify the title, it is the node label. If there is no node label, the title remains empty. The default size of the modal is `l`, which means 80%. You can also use `m` (60%) and `s` (40%) to set the modal size. Optionally, use it in combination with any of the navigation functions.
* @memberof linkManager
* @param {string} path navigation path
Expand Down Expand Up @@ -195,8 +191,8 @@ export class linkManager extends LuigiClientBase {
return modalPromise.promise;
}

/**
* <!-- label-success: Web Component API -->
/**
* <!-- label-success: Web App API only -->
* Updates the current title and size of a modal. If `routing.showModalPathInUrl` is set to `true`, the URL will be updated with the modal settings data.
* In addition, you can specify if a new history entry will be created with the updated URL.
* @memberof linkManager
Expand All @@ -219,7 +215,6 @@ export class linkManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Opens a view in a split view. You can specify the split view's title and size. If you don't specify the title, it is the node label. If there is no node label, the title remains empty. The default size of the split view is `40`, which means 40% height of the split view.
* @memberof linkManager
* @param {string} path navigation path
Expand All @@ -239,7 +234,6 @@ export class linkManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Opens a view in a drawer. You can specify the size of the drawer, whether the drawer has a header, and whether a backdrop is active in the background. By default, the header is shown. The backdrop is not visible and has to be activated. The size of the drawer is set to `s` by default, which means 25% of the micro frontend size. You can also use `l`(75%), `m`(50%) or `xs`(15.5%). Optionally, use it in combination with any of the navigation functions.
* @memberof linkManager
* @param {string} path navigation path
Expand All @@ -258,7 +252,6 @@ export class linkManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Sets the current navigation context to that of a specific parent node which has the {@link navigation-configuration.md navigationContext} field declared in the navigation configuration. This navigation context is then used by the `navigate` function.
* @memberof linkManager
* @param {string} navigationContext
Expand Down Expand Up @@ -298,7 +291,6 @@ export class linkManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Sets the current navigation base to the parent node that is defined as virtualTree. This method works only when the currently active micro frontend is inside a virtualTree.
* @memberof linkManager
* @returns {linkManager} link manager instance
Expand All @@ -314,7 +306,6 @@ export class linkManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Enables navigating to sibling nodes without knowing the absolute path.
* @memberof linkManager
* @returns {linkManager} link manager instance
Expand All @@ -328,7 +319,6 @@ export class linkManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Sends node parameters to the route. The parameters are used by the `navigate` function. Use it optionally in combination with any of the navigation functions and receive it as part of the context object in Luigi Client.
* @memberof linkManager
* @param {Object} nodeParams
Expand All @@ -347,7 +337,7 @@ export class linkManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* <!-- label-success: Web App API only -->
* Sets options to customise route changing behaviour. The parameters are used by the `navigate` function. Use it optionally in combination with any of the navigation functions and receive it as part of the context object in Luigi Client.
* @memberof linkManager
* @param {Object} options navigation options
Expand Down Expand Up @@ -376,7 +366,6 @@ export class linkManager extends LuigiClientBase {

/** @lends linkManager */
/**
* <!-- label-success: Web Component API -->
* Checks if the path you can navigate to exists in the main application. For example, you can use this helper method conditionally to display a DOM element like a button.
* @memberof linkManager
* @param {string} path path which existence you want to check
Expand Down Expand Up @@ -432,7 +421,6 @@ export class linkManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Checks if there is one or more preserved views. You can use it to show a **back** button.
* @memberof linkManager
* @returns {boolean} indicating if there is a preserved view you can return to
Expand All @@ -442,7 +430,6 @@ export class linkManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Discards the active view and navigates back to the last visited view. Works with preserved views, and also acts as the substitute of the browser **back** button. **goBackContext** is only available when using preserved views.
* @memberof linkManager
* @param {any} goBackValue data that is passed in the **goBackContext** field to the last visited view when using preserved views
Expand All @@ -458,7 +445,7 @@ export class linkManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* <!-- label-success: Web App API only -->
* Disables the navigation handling for a single navigation request.
* It prevents Luigi Core from handling the URL change after `navigate()`.
* Used for auto-navigation.
Expand All @@ -473,6 +460,7 @@ export class linkManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web App API only -->
* Enables navigating to a new tab.
* @since 1.16.0
* @example
Expand All @@ -484,7 +472,7 @@ export class linkManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* <!-- label-success: Web App API only -->
* Keeps the URL's query parameters for a navigation request.
* @param {boolean} preserve By default, it is set to `false`. If it is set to `true`, the URL's query parameters will be kept after navigation.
* @since 1.19.0
Expand All @@ -498,7 +486,6 @@ export class linkManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Gets the luigi route associated with the current micro frontend.
* @returns {promise} a promise which resolves to a String value specifying the current luigi route
* @since 1.23.0
Expand Down
1 change: 1 addition & 0 deletions client/src/storageManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { helpers } from './helpers';
const pendingOperation = new Map();

/**
* <!-- label-success: Web App API only -->
* StorageManager allows you to use browser local storage of key/values. Every storage operation is sent to be managed by Luigi Core.
* The idea is that different micro frontends can share or persist items using local storage, as long as they come from the same domain and follow the [same-origin policy](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy).
* Since all storage operations are asynchronous (sending an event to Luigi Core that will reply once operation is finished), all the methods return Promises.
Expand Down
21 changes: 6 additions & 15 deletions client/src/uxManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class UxManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Adds a backdrop with a loading indicator for the micro frontend frame. This overrides the {@link navigation-parameters-reference.md#node-parameters loadingIndicator.enabled} setting.
* @memberof uxManager
*/
Expand All @@ -28,7 +27,6 @@ class UxManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Removes the loading indicator. Use it after calling {@link #showLoadingIndicator showLoadingIndicator()} or to hide the indicator when you use the {@link navigation-parameters-reference.md#node-parameters loadingIndicator.hideAutomatically: false} node configuration.
* @memberof uxManager
*/
Expand All @@ -37,7 +35,6 @@ class UxManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Closes the currently opened micro frontend modal.
* @memberof uxManager
*/
Expand All @@ -46,7 +43,6 @@ class UxManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Adds a backdrop to block the top and side navigation. It is based on the Fundamental UI Modal, which you can use in your micro frontend to achieve the same behavior.
* @memberof uxManager
*/
Expand All @@ -55,7 +51,6 @@ class UxManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Removes the backdrop.
* @memberof uxManager
*/
Expand All @@ -64,7 +59,6 @@ class UxManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* This method informs the main application that there are unsaved changes in the current view in the iframe. It can be used to prevent navigation away from the current view, for example with form fields which were edited but not submitted. However, this functionality is not restricted to forms. If you use `withoutSync()` together with `setDirtyStatus()`, this is a special case in which the dirty state logic needs to be handled by the micro frontend. For example, if the user navigates with an Angular router, which would trigger `withoutSync()`, Angular needs to take care about dirty state, prevent the navigation and ask for permission to navigate away, through `uxManager().showConfirmationModal(settings)`.
* @param {boolean} isDirty indicates if there are any unsaved changes on the current page or in the component
* @memberof uxManager
Expand All @@ -77,7 +71,6 @@ class UxManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Shows a confirmation modal.
* @memberof uxManager
* @param {Object} settings the settings of the confirmation modal. If you don't provide any value for any of the fields, a default value is used
Expand Down Expand Up @@ -136,7 +129,6 @@ class UxManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Shows an alert.
* @memberof uxManager
* @param {Object} settings the settings for the alert
Expand Down Expand Up @@ -215,7 +207,6 @@ class UxManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Gets the current locale.
* @returns {string} current locale
* @memberof uxManager
Expand All @@ -225,7 +216,7 @@ class UxManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* <!-- label-success: Web App API only -->
* Sets current locale to the specified one.
*
* **NOTE:** this must be explicitly allowed on the navigation node level by setting `clientPermissions.changeCurrentLocale` to `true`. (See {@link navigation-parameters-reference.md Node parameters}.)
Expand All @@ -245,7 +236,7 @@ class UxManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* <!-- label-success: Web App API only -->
* Checks if the current micro frontend is displayed inside a split view
* @returns {boolean} indicating if it is loaded inside a split view
* @memberof uxManager
Expand All @@ -256,6 +247,7 @@ class UxManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web App API only -->
* Checks if the current micro frontend is displayed inside a modal
* @returns {boolean} indicating if it is loaded inside a modal
* @memberof uxManager
Expand All @@ -266,7 +258,7 @@ class UxManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* <!-- label-success: Web App API only -->
* Checks if the current micro frontend is displayed inside a drawer
* @returns {boolean} indicating if it is loaded inside a drawer
* @memberof uxManager
Expand All @@ -277,7 +269,6 @@ class UxManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* Gets the current theme.
* @returns {*} current themeObj
* @memberof uxManager
Expand All @@ -287,7 +278,7 @@ class UxManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* <!-- label-success: Web App API only -->
* Gets the CSS variables from Luigi Core with their key and value.
* @returns {Object} CSS variables with their key and value.
* @memberof uxManager
Expand All @@ -299,7 +290,7 @@ class UxManager extends LuigiClientBase {
}

/**
* <!-- label-success: Web Component API -->
* <!-- label-success: Web App API only -->
* Adds the CSS variables from Luigi Core in a <style> tag to the document <head> section.
* @memberof uxManager
* @since 2.3.0
Expand Down
Loading

0 comments on commit f0956a2

Please sign in to comment.