diff --git a/client/src/helpers.js b/client/src/helpers.js index c941027311..0cca4fb3eb 100644 --- a/client/src/helpers.js +++ b/client/src/helpers.js @@ -67,9 +67,7 @@ class Helpers { * @param {string} id listenerId */ removeEventListener(id) { - const listenerExists = Boolean( - this.listeners.find(l => l.listenerId === id) - ); + const listenerExists = Boolean(this.listeners.find(l => l.listenerId === id)); if (listenerExists) { this.listeners = this.listeners.filter(l => l.listenerId !== id); return true; @@ -83,9 +81,7 @@ class Helpers { */ getRandomId() { // window.msCrypto for IE 11 - return (window.crypto || window.msCrypto).getRandomValues( - new Uint32Array(1) - )[0]; + return (window.crypto || window.msCrypto).getRandomValues(new Uint32Array(1))[0]; } /** diff --git a/client/src/lifecycleManager.js b/client/src/lifecycleManager.js index 8aa3e1d3a3..ae3a26ecb0 100644 --- a/client/src/lifecycleManager.js +++ b/client/src/lifecycleManager.js @@ -10,12 +10,7 @@ class LifecycleManager extends LuigiClientBase { constructor() { super(); this.luigiInitialized = false; - this.defaultContextKeys = [ - 'context', - 'internal', - 'nodeParams', - 'pathParams' - ]; + this.defaultContextKeys = ['context', 'internal', 'nodeParams', 'pathParams']; this.setCurrentContext( this.defaultContextKeys.reduce(function(acc, key) { acc[key] = {}; @@ -50,12 +45,12 @@ class LifecycleManager extends LuigiClientBase { * @example * const init = LuigiClient.isLuigiClientInitialized() */ - isLuigiClientInitialized(){ + isLuigiClientInitialized() { return this.luigiInitialized; } /** - * Starts the handshake with Luigi Core and thereafter resulting in initialization of Luigi Client. It is always ran by default when importing luigi-client package in your micro frontend. Note that when using 'defer-luigi-init' to defer default initialization you will need to initialize the handshake using this function manually wherever needed. + * Starts the handshake with Luigi Core and thereafter resulting in initialization of Luigi Client. It is always ran by default when importing luigi-client package in your micro frontend. Note that when using 'defer-luigi-init' to defer default initialization you will need to initialize the handshake using this function manually wherever needed. * @since 1.12.0 * @memberof Lifecycle * @example @@ -63,7 +58,7 @@ class LifecycleManager extends LuigiClientBase { */ luigiClientInit() { if (this.luigiInitialized) { - console.warn("Luigi Client has been already initialized") + console.warn('Luigi Client has been already initialized'); return; } /** @@ -78,12 +73,7 @@ class LifecycleManager extends LuigiClientBase { rawData[key] = JSON.parse(rawData[key]); } } catch (e) { - console.info( - 'unable to parse luigi context data for', - key, - rawData[key], - e - ); + console.info('unable to parse luigi context data for', key, rawData[key], e); } } this.setCurrentContext(rawData); @@ -116,9 +106,7 @@ class LifecycleManager extends LuigiClientBase { setContext(e.data); if (!this.currentContext.internal.isNavigateBack) { history.replaceState({ luigiInduced: true }, '', e.data.viewUrl); - window.dispatchEvent( - new PopStateEvent('popstate', { state: 'luiginavigation' }) - ); + window.dispatchEvent(new PopStateEvent('popstate', { state: 'luiginavigation' })); } // execute the context change listener if set by the micro frontend this._notifyUpdate(); @@ -137,8 +125,7 @@ class LifecycleManager extends LuigiClientBase { '*' ); this._tpcCheck(); - }; - + } _tpcCheck() { let tpc = 'enabled'; @@ -335,12 +322,9 @@ class LifecycleManager extends LuigiClientBase { * const customMsgId = LuigiClient.addCustomMessageListener('myapp.project-updated', (data) => doSomething(data)) */ addCustomMessageListener(customMessageId, customMessageListener) { - return helpers.addEventListener( - customMessageId, - (customMessage, listenerId) => { - return customMessageListener(customMessage, listenerId); - } - ); + return helpers.addEventListener(customMessageId, (customMessage, listenerId) => { + return customMessageListener(customMessage, listenerId); + }); } /** @@ -467,9 +451,7 @@ class LifecycleManager extends LuigiClientBase { * @since 0.6.2 */ sendCustomMessage(message) { - const customMessageInternal = helpers.convertCustomMessageUserToInternal( - message - ); + const customMessageInternal = helpers.convertCustomMessageUserToInternal(message); helpers.sendPostMessageToLuigiCore(customMessageInternal); } diff --git a/client/src/linkManager.js b/client/src/linkManager.js index 55f3dfb237..9b9d638b61 100644 --- a/client/src/linkManager.js +++ b/client/src/linkManager.js @@ -53,14 +53,7 @@ export class linkManager extends LuigiClientBase { * LuigiClient.linkManager().navigate('/settings', null, true) // preserve view * LuigiClient.linkManager().navigate('#?Intent=Sales-order?id=13') // intent navigation */ - navigate( - path, - sessionId, - preserveView, - modalSettings, - splitViewSettings, - drawerSettings - ) { + navigate(path, sessionId, preserveView, modalSettings, splitViewSettings, drawerSettings) { if (this.options.errorSkipNavigation) { this.options.errorSkipNavigation = false; return; @@ -150,18 +143,12 @@ export class linkManager extends LuigiClientBase { fromContext(navigationContext) { const navigationContextInParent = this.currentContext.context.parentNavigationContexts && - this.currentContext.context.parentNavigationContexts.indexOf( - navigationContext - ) !== -1; + this.currentContext.context.parentNavigationContexts.indexOf(navigationContext) !== -1; if (navigationContextInParent) { this.options.fromContext = navigationContext; } else { this.options.errorSkipNavigation = true; - console.error( - 'Navigation not possible, navigationContext ' + - navigationContext + - ' not found.' - ); + console.error('Navigation not possible, navigationContext ' + navigationContext + ' not found.'); } return this; } @@ -175,15 +162,12 @@ export class linkManager extends LuigiClientBase { */ fromClosestContext() { const hasParentNavigationContext = - this.currentContext && - this.currentContext.context.parentNavigationContexts.length > 0; + this.currentContext && this.currentContext.context.parentNavigationContexts.length > 0; if (hasParentNavigationContext) { this.options.fromContext = null; this.options.fromClosestContext = true; } else { - console.error( - 'Navigation not possible, no parent navigationContext found.' - ); + console.error('Navigation not possible, no parent navigationContext found.'); } return this; } @@ -292,10 +276,7 @@ export class linkManager extends LuigiClientBase { * @returns {boolean} indicating if there is a preserved view you can return to */ hasBack() { - return ( - !!this.currentContext.internal.modal || - this.currentContext.internal.viewStackSize !== 0 - ); + return !!this.currentContext.internal.modal || this.currentContext.internal.viewStackSize !== 0; } /** diff --git a/client/src/luigi-client.js b/client/src/luigi-client.js index 152f79a3a8..c1e459305a 100644 --- a/client/src/luigi-client.js +++ b/client/src/luigi-client.js @@ -9,11 +9,7 @@ import { storageManager } from './storageManager'; */ class LuigiClient { constructor() { - if ( - window !== window.top && - window.document.head.getAttribute('disable-luigi-history-handling') != - 'true' - ) { + if (window !== window.top && window.document.head.getAttribute('disable-luigi-history-handling') != 'true') { history.pushState = history.replaceState.bind(history); } } diff --git a/client/src/luigi-element.js b/client/src/luigi-element.js index c3c093609c..591eb82e5c 100644 --- a/client/src/luigi-element.js +++ b/client/src/luigi-element.js @@ -36,11 +36,7 @@ export class LuigiElement extends HTMLElement { this.afterInit(ctx); this.__initialized = true; }; - if ( - this.luigiConfig && - this.luigiConfig.styleSources && - this.luigiConfig.styleSources.length > 0 - ) { + if (this.luigiConfig && this.luigiConfig.styleSources && this.luigiConfig.styleSources.length > 0) { let nr_styles = this.luigiConfig.styleSources.length; const loadStylesSync = this.luigiConfig.loadStylesSync; const afterLoadOrError = () => { @@ -150,11 +146,7 @@ export function html(literal, ...keys) { let html = ''; literal.forEach((el, index) => { html += el; - if ( - index < keys.length && - keys[index] !== undefined && - keys[index] !== null - ) { + if (index < keys.length && keys[index] !== undefined && keys[index] !== null) { html += keys[index]; } }); diff --git a/client/src/splitViewHandle.js b/client/src/splitViewHandle.js index a2d7c0eed0..f549b0e798 100644 --- a/client/src/splitViewHandle.js +++ b/client/src/splitViewHandle.js @@ -111,10 +111,7 @@ export class splitViewHandle extends LuigiClientBase { console.warn(name + ' is not a valid split view event'); return false; } - const id = helpers.addEventListener( - `luigi.navigation.splitview.${name}.ok`, - e => callback(e.data.data) - ); + const id = helpers.addEventListener(`luigi.navigation.splitview.${name}.ok`, e => callback(e.data.data)); this.splitView.listeners.push(id); return id; } diff --git a/client/src/storageManager.js b/client/src/storageManager.js index 007b7576fa..f8651e60d4 100644 --- a/client/src/storageManager.js +++ b/client/src/storageManager.js @@ -14,9 +14,7 @@ class StorageManager extends LuigiClientBase { constructor() { super(); this.storageEventProcessor = new StorageEventProcessor(); - helpers.addEventListener('storage', (evt, listenerId) => - this.storageEventProcessor.processEvent(evt, listenerId) - ); + helpers.addEventListener('storage', (evt, listenerId) => this.storageEventProcessor.processEvent(evt, listenerId)); } /** diff --git a/client/src/uxManager.js b/client/src/uxManager.js index 66b8785f1b..1973afac27 100644 --- a/client/src/uxManager.js +++ b/client/src/uxManager.js @@ -12,8 +12,7 @@ class UxManager extends LuigiClientBase { super(); helpers.addEventListener('luigi.current-locale-changed', e => { if (e.data.currentLocale && lifecycleManager.currentContext?.internal) { - lifecycleManager.currentContext.internal.currentLocale = - e.data.currentLocale; + lifecycleManager.currentContext.internal.currentLocale = e.data.currentLocale; lifecycleManager._notifyUpdate(); } }); @@ -95,13 +94,10 @@ class UxManager extends LuigiClientBase { * }); */ showConfirmationModal(settings) { - helpers.addEventListener( - 'luigi.ux.confirmationModal.hide', - (e, listenerId) => { - this.hideConfirmationModal(e.data.data); - helpers.removeEventListener(listenerId); - } - ); + helpers.addEventListener('luigi.ux.confirmationModal.hide', (e, listenerId) => { + this.hideConfirmationModal(e.data.data); + helpers.removeEventListener(listenerId); + }); helpers.sendPostMessageToLuigiCore({ msg: 'luigi.ux.confirmationModal.show', data: { settings } @@ -169,9 +165,7 @@ class UxManager extends LuigiClientBase { //generate random ID settings.id = helpers.getRandomId(); if (settings?.closeAfter < 100) { - console.warn( - `Message with id='${settings.id}' has too small 'closeAfter' value. It needs to be at least 100ms.` - ); + console.warn(`Message with id='${settings.id}' has too small 'closeAfter' value. It needs to be at least 100ms.`); settings.closeAfter = undefined; } helpers.sendPostMessageToLuigiCore({ diff --git a/core/package.json b/core/package.json index b2eaa39a02..7896060ba7 100644 --- a/core/package.json +++ b/core/package.json @@ -77,7 +77,7 @@ }, { "path": "./public/luigi.css", - "maxSize": "460 kB", + "maxSize": "461 kB", "compression": "none" }, { diff --git a/core/src/Alerts.html b/core/src/Alerts.html index 8c1a2b6e01..0ba5ddbfc8 100644 --- a/core/src/Alerts.html +++ b/core/src/Alerts.html @@ -6,9 +6,9 @@ id="j2ALl423" data-testid="luigi-alert" > -
+