@luigi-project/client 2.19.3-dev.20250290033 → 2.20.0
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/luigi-client.js +1 -1
- package/luigi-element.d.ts +78 -0
- package/package.json +1 -1
package/luigi-client.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.LuigiClient=t():e.LuigiClient=t()}(self,(function(){return function(){"use strict";var e={224:function(e){e.exports={rE:"2.19.2"}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var r={};function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,i=function(e){if("object"!==o(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===o(i)?i:String(i)),r)}var i}n.d(r,{default:function(){return J}});var a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.promises={}}var t,n;return t=e,(n=[{key:"setPromise",value:function(e,t){this.promises[e]=t}},{key:"getPromise",value:function(e){return this.promises[e]}}])&&i(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,o=function(e){if("object"!==u(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==u(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===u(o)?o:String(o)),r)}var o}var l=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.listeners=[],this.origin="";var t=function(e){if(e.data.msg)if("custom"===e.data.msg){var t=this.convertCustomMessageInternalToUser(e.data);this.listeners.filter((function(e){return e.name===t.id})).map((function(e){return e.eventFn(t,e.listenerId)}))}else this.listeners.filter((function(t){return t.name===e.data.msg})).map((function(t){return t.eventFn(e,t.listenerId)}))}.bind(this);window.addEventListener("message",t)}var t,n;return t=e,n=[{key:"convertCustomMessageInternalToUser",value:function(e){return e.data}},{key:"convertCustomMessageUserToInternal",value:function(e){return{msg:"custom",data:e}}},{key:"convertStorageMessageToInternal",value:function(e){return{msg:"storage",data:e}}},{key:"addEventListener",value:function(e,t){var n=this.getRandomId();return this.listeners.push({name:e,eventFn:t,listenerId:n}),n}},{key:"removeEventListener",value:function(e){return!!Boolean(this.listeners.find((function(t){return t.listenerId===e})))&&(this.listeners=this.listeners.filter((function(t){return t.listenerId!==e})),!0)}},{key:"getRandomId",value:function(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}},{key:"isFunction",value:function(e){return"function"==typeof e}},{key:"isObject",value:function(e){return"[object Object]"===Object.prototype.toString.call(e)}},{key:"getLuigiCoreDomain",value:function(){return this.origin}},{key:"setLuigiCoreDomain",value:function(e){e&&"null"!==e&&(this.origin=e)}},{key:"setTargetOrigin",value:function(e){this.setLuigiCoreDomain(e)}},{key:"sendPostMessageToLuigiCore",value:function(e){if(this.origin)try{window.parent.postMessage(e,this.origin)}catch(t){console.warn("Unable to post message "+e+" to Luigi Core from origin "+this.origin+": "+t)}else console.warn('There is no target origin set. You can specify the target origin by calling LuigiClient.setTargetOrigin("targetorigin") in your micro frontend.')}},{key:"hasIntent",value:function(e){return!!e&&e.toLowerCase().includes("#?intent=")}},{key:"deSanitizeParamsMap",value:function(e){var t=this;return Object.entries(e).reduce((function(e,n){return e[t.deSanitizeParam(n[0])]=t.deSanitizeParam(n[1]),e}),{})}},{key:"deSanitizeParam",value:function(){return String(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").replaceAll("<","<").replaceAll(">",">").replaceAll(""",'"').replaceAll("'","'").replaceAll("/","/")}}],n&&s(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),c=new l;function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function v(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,o=function(e){if("object"!==f(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==f(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===f(o)?o:String(o)),r)}var o}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}var p=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(u,e);var t,r,o,i,a=(o=u,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=y(o);if(i){var n=y(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===f(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function u(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),(e=a.call(this)).luigiInitialized=!1,e.defaultContextKeys=["context","internal","nodeParams","pathParams","searchParams"],e.setCurrentContext(e.defaultContextKeys.reduce((function(e,t){return e[t]={},e}),{})),e._onContextUpdatedFns={},e._onInactiveFns={},e._onInitFns={},e.authData={},e._isDeferInitDefined()||e.luigiClientInit(),e}return t=u,r=[{key:"_isDeferInitDefined",value:function(){return window.document.head.hasAttribute("defer-luigi-init")}},{key:"_isTpcCheckDisabled",value:function(){var e,t,n;return window.document.head.hasAttribute("disable-tpc-check")||(null===(e=this.currentContext)||void 0===e||null===(t=e.internal)||void 0===t||null===(n=t.thirdPartyCookieCheck)||void 0===n?void 0:n.disabled)}},{key:"isLuigiClientInitialized",value:function(){return this.luigiInitialized}},{key:"luigiClientInit",value:function(){var e=this;if(this.luigiInitialized)console.warn("Luigi Client has been already initialized");else{var t=function(t){for(var n=0;n<e.defaultContextKeys.length;n++){var r=e.defaultContextKeys[n];try{"string"==typeof t[r]&&(t[r]=JSON.parse(t[r]))}catch(e){console.info("unable to parse luigi context data for",r,t[r],e)}}e.setCurrentContext(t)},r=function(t){t&&(e.authData=t)};c.addEventListener("luigi.init",(function(n){t(n.data),r(n.data.authData),c.setLuigiCoreDomain(n.origin),e.luigiInitialized=!0,e._notifyInit(n.origin),e._tpcCheck(),c.sendPostMessageToLuigiCore({msg:"luigi.init.ok"})})),c.addEventListener("luigi-client.inactive-microfrontend",(function(t){e._notifyInactive(t.origin)})),c.addEventListener("luigi.auth.tokenIssued",(function(e){r(e.data.authData)})),c.addEventListener("luigi.navigate",(function(n){if(t(n.data),!e.currentContext.internal.isNavigateBack&&!e.currentContext.withoutSync){var r=window.location.hash;history.replaceState({luigiInduced:!0},"",n.data.viewUrl),window.dispatchEvent(new PopStateEvent("popstate",{state:"luiginavigation"})),window.location.hash!==r&&window.dispatchEvent(new HashChangeEvent("hashchange"))}e.currentContext.withoutSync&&Object.assign(e.currentContext.context,{viewUrl:n.data.viewUrl?n.data.viewUrl:void 0,pathParams:n.data.pathParams?n.data.pathParams:void 0}),e._notifyUpdate(),c.sendPostMessageToLuigiCore({msg:"luigi.navigate.ok"})})),window.parent.postMessage({msg:"luigi.get-context",clientVersion:n(224).rE},"*")}}},{key:"_tpcCheck",value:function(){if(!this._isTpcCheckDisabled()){var e,t="enabled",n=document.cookie;n&&(e=n.split(";").map((function(e){return e.trim()})).find((function(e){return"luigiCookie=true"===e}))),"luigiCookie=true"===e&&(document.cookie="luigiCookie=; Max-Age=-99999999; SameSite=None; Secure"),document.cookie="luigiCookie=true; SameSite=None; Secure",(n=document.cookie)&&(e=n.split(";").map((function(e){return e.trim()})).find((function(e){return"luigiCookie=true"===e}))),"luigiCookie=true"===e?(document.cookie="luigiCookie=; Max-Age=-99999999; SameSite=None; Secure",window.parent.postMessage({msg:"luigi.third-party-cookie",tpc:t},"*")):(t="disabled",window.parent.postMessage({msg:"luigi.third-party-cookie",tpc:t},"*"),console.warn("Third party cookies are not supported!"))}}},{key:"_callAllFns",value:function(e,t,n){for(var r in e)e.hasOwnProperty(r)&&c.isFunction(e[r])&&e[r](t,n)}},{key:"_notifyInit",value:function(e){this._callAllFns(this._onInitFns,this.currentContext.context,e)}},{key:"_notifyUpdate",value:function(){this._callAllFns(this._onContextUpdatedFns,this.currentContext.context)}},{key:"_notifyInactive",value:function(){this._callAllFns(this._onInactiveFns)}},{key:"setCurrentContext",value:function(e){this.currentContext=e}},{key:"addInitListener",value:function(e,t){var n=c.getRandomId();return this._onInitFns[n]=e,t&&document.head.setAttribute("disable-tpc-check",""),this.luigiInitialized&&c.isFunction(e)&&e(this.currentContext.context,c.getLuigiCoreDomain()),n}},{key:"removeInitListener",value:function(e){return!!this._onInitFns[e]&&(this._onInitFns[e]=void 0,!0)}},{key:"addContextUpdateListener",value:function(e){var t=c.getRandomId();return this._onContextUpdatedFns[t]=e,this.luigiInitialized&&c.isFunction(e)&&e(this.currentContext.context),t}},{key:"removeContextUpdateListener",value:function(e){return!!this._onContextUpdatedFns[e]&&(this._onContextUpdatedFns[e]=void 0,!0)}},{key:"addInactiveListener",value:function(e){var t=c.getRandomId();return this._onInactiveFns[t]=e,t}},{key:"removeInactiveListener",value:function(e){return!!this._onInactiveFns[e]&&(this._onInactiveFns[e]=void 0,!0)}},{key:"addCustomMessageListener",value:function(e,t){return c.addEventListener(e,(function(e,n){return t(e,n)}))}},{key:"removeCustomMessageListener",value:function(e){return c.removeEventListener(e)}},{key:"getToken",value:function(){return this.authData.accessToken}},{key:"getContext",value:function(){return this.getEventData()}},{key:"getEventData",value:function(){return this.currentContext.context}},{key:"getActiveFeatureToggles",value:function(){return this.currentContext.internal.activeFeatureToggleList}},{key:"addNodeParams",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e&&c.sendPostMessageToLuigiCore({msg:"luigi.addNodeParams",data:e,keepBrowserHistory:t})}},{key:"getNodeParams",value:function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?c.deSanitizeParamsMap(this.currentContext.nodeParams):this.currentContext.nodeParams}},{key:"getPathParams",value:function(){return this.currentContext.pathParams}},{key:"getCoreSearchParams",value:function(){return this.currentContext.searchParams||{}}},{key:"addCoreSearchParams",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e&&c.sendPostMessageToLuigiCore({msg:"luigi.addSearchParams",data:e,keepBrowserHistory:t})}},{key:"getClientPermissions",value:function(){return this.currentContext.internal.clientPermissions||{}}},{key:"setTargetOrigin",value:function(e){c.setTargetOrigin(e)}},{key:"sendCustomMessage",value:function(e){var t=c.convertCustomMessageUserToInternal(e);c.sendPostMessageToLuigiCore(t)}},{key:"getUserSettings",value:function(){return this.currentContext.internal.userSettings}},{key:"getAnchor",value:function(){return this.currentContext.internal.anchor||""}},{key:"setAnchor",value:function(e){c.sendPostMessageToLuigiCore({msg:"luigi.setAnchor",anchor:e})}},{key:"setViewGroupData",value:function(e){c.sendPostMessageToLuigiCore({msg:"luigi.setVGData",data:e})}}],r&&v(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),u}(a),g=new p;function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function h(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,o=function(e){if("object"!==m(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==m(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===m(o)?o:String(o)),r)}var o}function b(e,t){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},b(e,t)}function w(e){return w=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},w(e)}var k=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b(e,t)}(a,e);var t,n,r,o,i=(r=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=w(r);if(o){var n=w(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===m(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(t=i.call(this)).validSplitViewEvents=["expand","collapse","resize","close"],t.splitView={exists:!0,size:40,collapsed:!1},Object.assign(t.splitView,e),t.splitView.listeners=[c.addEventListener("luigi.navigation.splitview.internal",(function(e){Object.assign(t.splitView,e.data.data)}))],t.on("resize",(function(e){t.splitView.size=e})),t.on("close",(function(){t.splitView.listeners.forEach((function(e){return c.removeEventListener(e)}))})),t}return t=a,(n=[{key:"sendSplitViewEvent",value:function(e,t){c.sendPostMessageToLuigiCore({msg:"luigi.navigation.splitview.".concat(e),data:t})}},{key:"collapse",value:function(){this.sendSplitViewEvent("collapse")}},{key:"expand",value:function(){this.sendSplitViewEvent("expand")}},{key:"close",value:function(){this.sendSplitViewEvent("close")}},{key:"setSize",value:function(e){this.sendSplitViewEvent("resize",e)}},{key:"on",value:function(e,t){if(!this.validSplitViewEvents.includes(e))return console.warn(e+" is not a valid split view event"),!1;var n=c.addEventListener("luigi.navigation.splitview.".concat(e,".ok"),(function(e){var n="number"==typeof e.data.data?e.data.data:void 0;t(n)}));return this.splitView.listeners.push(n),n}},{key:"removeEventListener",value:function(e){return c.removeEventListener(e)}},{key:"exists",value:function(){return this.splitView.exists}},{key:"getSize",value:function(){return this.splitView.size}},{key:"isCollapsed",value:function(){return this.splitView.collapsed}},{key:"isExpanded",value:function(){return!this.splitView.collapsed}}])&&h(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),a}(a);function P(e){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P(e)}function C(e,t){if(e){if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?S(e,t):void 0}}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function x(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,o=function(e){if("object"!==P(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==P(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===P(o)?o:String(o)),r)}var o}function O(e,t){return O=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},O(e,t)}function j(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}var L=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&O(e,t)}(a,e);var t,n,r,o,i=(r=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=E(r);if(o){var n=E(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===P(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return j(e)}(this,e)});function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),t=i.call(this),Object.assign(j(t),e),t.options={preserveView:!1,nodeParams:{},errorSkipNavigation:!1,fromContext:null,fromClosestContext:!1,fromVirtualTreeRoot:!1,fromParent:!1,relative:!1,link:"",newTab:!1,preserveQueryParams:!1,anchor:"",preventContextUpdate:!1,preventHistoryEntry:!1},t}return t=a,n=[{key:"navigate",value:function(e,t,n,r,o,i){if(this.options.errorSkipNavigation)this.options.errorSkipNavigation=!1;else{r&&o&&i&&console.warn("modalSettings, splitViewSettings and drawerSettings cannot be used together. Only modal setting will be taken into account."),this.options.preserveView=n;var a="/"!==e[0];if("/"===e&&(r||o||i))console.warn("Navigation with an absolute path prevented.");else{var u={msg:"luigi.navigation.open",sessionId:t,params:Object.assign(this.options,{link:e,relative:a,intent:c.hasIntent(e),modal:r,splitView:o,drawer:i})};c.sendPostMessageToLuigiCore(u)}}}},{key:"updateModalPathInternalNavigation",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){var r={msg:"luigi.navigation.updateModalDataPath",params:Object.assign(this.options,{link:e,modal:t,history:n})};c.sendPostMessageToLuigiCore(r)}else console.warn("Updating path of the modal upon internal navigation prevented. No path specified.")}},{key:"navigateToIntent",value:function(e){var t,n,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i="#?intent=";if(i+=e,o&&null!==(t=Object.keys(o))&&void 0!==t&&t.length){var a=Object.entries(o);if(a.length>0){i+="?";var u,s=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=C(e))){t&&(e=t);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(a)throw o}}}}(a);try{for(s.s();!(u=s.n()).done;){var l=(n=u.value,r=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],s=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);s=!0);}catch(e){l=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(n,r)||C(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());i+=l[0]+"="+l[1]+"&"}}catch(e){s.e(e)}finally{s.f()}i=i.slice(0,-1)}}this.navigate(i)}},{key:"openAsModal",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};c.addEventListener("luigi.navigation.modal.close",(function(e,n){var r=t.getPromise("modal");r&&(r.resolveFn(e.data),t.setPromise("modal",void 0)),c.removeEventListener(n)}));var r={};return r.promise=new Promise((function(e,t){r.resolveFn=e,r.rejectFn=t})),this.setPromise("modal",r),this.navigate(e,0,!0,n),r.promise}},{key:"updateModalSettings",value:function(){var e={msg:"luigi.navigation.updateModalSettings",updatedModalSettings:arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},addHistoryEntry:arguments.length>1&&void 0!==arguments[1]&&arguments[1]};c.sendPostMessageToLuigiCore(e)}},{key:"openAsSplitView",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.navigate(e,0,!0,void 0,t),new k(t)}},{key:"openAsDrawer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.navigate(e,0,!0,void 0,void 0,t)}},{key:"fromContext",value:function(e){return this.currentContext.context.parentNavigationContexts&&-1!==this.currentContext.context.parentNavigationContexts.indexOf(e)?this.options.fromContext=e:(this.options.errorSkipNavigation=!0,console.error("Navigation not possible, navigationContext "+e+" not found.")),this}},{key:"fromClosestContext",value:function(){var e;return(null===(e=this.currentContext)||void 0===e?void 0:e.context.parentNavigationContexts.length)>0?(this.options.fromContext=null,this.options.fromClosestContext=!0):console.error("Navigation not possible, no parent navigationContext found."),this}},{key:"fromVirtualTreeRoot",value:function(){return this.options.fromContext=null,this.options.fromClosestContext=!1,this.options.fromVirtualTreeRoot=!0,this}},{key:"fromParent",value:function(){return this.options.fromParent=!0,this}},{key:"withParams",value:function(e){return e&&Object.assign(this.options.nodeParams,e),this}},{key:"withOptions",value:function(e){return c.isObject(e)?(void 0!==e.preventHistoryEntry&&(this.options.preventHistoryEntry=e.preventHistoryEntry),void 0!==e.preventContextUpdate&&(this.options.preventContextUpdate=e.preventContextUpdate),this):this}},{key:"pathExists",value:function(e){var t=c.getRandomId(),n=this.getPromise("pathExistsPromises")||{};n[t]={resolveFn:function(){},then:function(e){this.resolveFn=e}},this.setPromise("pathExistsPromises",n),c.addEventListener("luigi.navigation.pathExists.answer",function(e,n){var r=e.data.data,o=this.getPromise("pathExistsPromises")||{};r.correlationId===t&&(o[r.correlationId]&&(o[r.correlationId].resolveFn(r.pathExists),delete o[r.correlationId],this.setPromise("pathExistsPromises",o)),c.removeEventListener(n))}.bind(this));var r={msg:"luigi.navigation.pathExists",data:Object.assign(this.options,{id:t,link:e,intent:c.hasIntent(e),relative:"/"!==e[0]})};return c.sendPostMessageToLuigiCore(r),n[t]}},{key:"hasBack",value:function(){return!!this.currentContext.internal.modal||0!==this.currentContext.internal.viewStackSize}},{key:"goBack",value:function(e){c.sendPostMessageToLuigiCore({msg:"luigi.navigation.back",goBackContext:e&&JSON.stringify(e)})}},{key:"withoutSync",value:function(){return this.options.withoutSync=!0,this}},{key:"newTab",value:function(){return this.options.newTab=!0,this}},{key:"preserveQueryParams",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.options.preserveQueryParams=e,this}},{key:"getCurrentRoute",value:function(){var e=this,t=c.getRandomId(),n=this.getPromise("getCurrentRoute")||{};return n[t]={resolveFn:function(){},then:function(e){this.resolveFn=e}},this.setPromise("getCurrentRoute",n),c.addEventListener("luigi.navigation.currentRoute.answer",(function(n,r){var o=n.data.data,i=e.getPromise("getCurrentRoute")||{};o.correlationId===t&&(i[o.correlationId]&&(i[o.correlationId].resolveFn(o.route),delete i[o.correlationId],e.setPromise("getCurrentRoute",i)),c.removeEventListener(r)),c.removeEventListener(r)})),c.sendPostMessageToLuigiCore({msg:"luigi.navigation.currentRoute",data:Object.assign(this.options,{id:t})}),n[t]}}],n&&x(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),a}(a);function I(e){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I(e)}function T(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,o=function(e){if("object"!==I(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==I(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===I(o)?o:String(o)),r)}var o}function M(e,t){return M=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},M(e,t)}function _(e){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_(e)}var R=new(function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&M(e,t)}(a,e);var t,n,r,o,i=(r=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=_(r);if(o){var n=_(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===I(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function a(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),e=i.call(this),c.addEventListener("luigi.current-locale-changed",(function(e){var t;e.data.currentLocale&&null!==(t=g.currentContext)&&void 0!==t&&t.internal&&(g.currentContext.internal.currentLocale=e.data.currentLocale,g._notifyUpdate())})),e}return t=a,(n=[{key:"showLoadingIndicator",value:function(){c.sendPostMessageToLuigiCore({msg:"luigi.show-loading-indicator"})}},{key:"hideLoadingIndicator",value:function(){c.sendPostMessageToLuigiCore({msg:"luigi.hide-loading-indicator"})}},{key:"closeCurrentModal",value:function(){c.sendPostMessageToLuigiCore({msg:"luigi.close-modal"})}},{key:"addBackdrop",value:function(){c.sendPostMessageToLuigiCore({msg:"luigi.add-backdrop"})}},{key:"removeBackdrop",value:function(){c.sendPostMessageToLuigiCore({msg:"luigi.remove-backdrop"})}},{key:"setDirtyStatus",value:function(e){c.sendPostMessageToLuigiCore({msg:"luigi.set-page-dirty",dirty:e})}},{key:"showConfirmationModal",value:function(e){var t=this;c.addEventListener("luigi.ux.confirmationModal.hide",(function(e,n){t.hideConfirmationModal(e.data.data),c.removeEventListener(n)})),c.sendPostMessageToLuigiCore({msg:"luigi.ux.confirmationModal.show",data:{settings:e}});var n={};return n.promise=new Promise((function(e,t){n.resolveFn=e,n.rejectFn=t})),this.setPromise("confirmationModal",n),n.promise}},{key:"hideConfirmationModal",value:function(e){var t=this.getPromise("confirmationModal");t&&(e.confirmed?t.resolveFn():t.rejectFn(),this.setPromise("confirmationModal",void 0))}},{key:"showAlert",value:function(e){var t=this;e.id=c.getRandomId(),c.addEventListener("luigi.ux.alert.hide",(function(n,r){n.data.id===e.id&&(t.hideAlert(n.data),c.removeEventListener(r))})),(null==e?void 0:e.closeAfter)<100&&(console.warn("Message with id='".concat(e.id,"' has too small 'closeAfter' value. It needs to be at least 100ms.")),e.closeAfter=void 0),c.sendPostMessageToLuigiCore({msg:"luigi.ux.alert.show",data:{settings:e}});var n=this.getPromise("alerts")||{};return n[e.id]={},n[e.id].promise=new Promise((function(t){n[e.id].resolveFn=t})),this.setPromise("alerts",n),n[e.id].promise}},{key:"hideAlert",value:function(e){var t=e.id,n=e.dismissKey,r=this.getPromise("alerts");t&&r[t]&&(r[t].resolveFn(n||t),delete r[t],this.setPromise("alerts",r))}},{key:"getCurrentLocale",value:function(){var e,t;return null===(e=g.currentContext)||void 0===e||null===(t=e.internal)||void 0===t?void 0:t.currentLocale}},{key:"setCurrentLocale",value:function(e){e&&c.sendPostMessageToLuigiCore({msg:"luigi.ux.set-current-locale",data:{currentLocale:e}})}},{key:"isSplitView",value:function(){var e,t;return null===(e=g.currentContext)||void 0===e||null===(t=e.internal)||void 0===t?void 0:t.splitView}},{key:"isModal",value:function(){var e,t;return null===(e=g.currentContext)||void 0===e||null===(t=e.internal)||void 0===t?void 0:t.modal}},{key:"isDrawer",value:function(){var e,t;return null===(e=g.currentContext)||void 0===e||null===(t=e.internal)||void 0===t?void 0:t.drawer}},{key:"getCurrentTheme",value:function(){var e,t;return null===(e=g.currentContext)||void 0===e||null===(t=e.internal)||void 0===t?void 0:t.currentTheme}},{key:"getCSSVariables",value:function(){var e,t;return(null===(e=g.currentContext)||void 0===e||null===(t=e.internal)||void 0===t?void 0:t.cssVariables)||{}}},{key:"applyCSS",value:function(){var e,t;document.querySelectorAll("head style[luigi-injected]").forEach((function(e){e.remove()}));var n=null===(e=g.currentContext)||void 0===e||null===(t=e.internal)||void 0===t?void 0:t.cssVariables;if(n){var r=":root {\n";Object.keys(n).forEach((function(e){var t=n[e];r+=(e.startsWith("--")?"":"--")+e+":"+t+";\n"})),r+="}";var o=document.createElement("style");o.setAttribute("luigi-injected",!0),o.innerHTML=r,document.head.appendChild(o)}}}])&&T(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),a}(a));function A(e){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A(e)}function F(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function V(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,o=function(e){if("object"!==A(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==A(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===A(o)?o:String(o)),r)}var o}function D(e,t,n){return t&&V(e.prototype,t),n&&V(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function U(e,t){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},U(e,t)}function N(e){return N=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},N(e)}var z=new Map,B=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&U(e,t)}(o,e);var t,n,r=(t=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=N(t);if(n){var o=N(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return function(e,t){if(t&&("object"===A(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function o(){var e;return F(this,o),(e=r.call(this)).storageEventProcessor=new H,c.addEventListener("storage",(function(t,n){return e.storageEventProcessor.processEvent(t,n)})),e}return D(o,[{key:"setItem",value:function(e,t){var n=this;return new Promise((function(r,o){n.storageEventProcessor.execute(r,o,"setItem",{key:e,value:t})}))}},{key:"getItem",value:function(e){var t=this;return new Promise((function(n,r){t.storageEventProcessor.execute(n,r,"getItem",{key:e})}))}},{key:"removeItem",value:function(e){var t=this;return new Promise((function(n,r){t.storageEventProcessor.execute(n,r,"removeItem",{key:e})}))}},{key:"clear",value:function(){var e=this;return new Promise((function(t,n){e.storageEventProcessor.execute(t,n,"clear",{})}))}},{key:"has",value:function(e){var t=this;return new Promise((function(n,r){t.storageEventProcessor.execute(n,r,"has",{key:e})}))}},{key:"getAllKeys",value:function(){var e=this;return new Promise((function(t,n){e.storageEventProcessor.execute(t,n,"getAllKeys",{})}))}}]),o}(a),H=function(){function e(){F(this,e)}return D(e,[{key:"processEvent",value:function(e,t){try{var n=e.data.data;if(!z.has(n.id))return void console.log("Impossible to find Promise method for message "+n.id);var r=z.get(n.id);"ERROR"===n.status?r.reject(n.result):r.resolve(n.result),z.delete(n.id)}catch(e){console.error(e)}}},{key:"waitForSyncResult",value:function(e){for(var t=(new Date).getTime();!syncOperation.has(e);)if((new Date).getTime()-t>1e4)throw"Storage operation is taking more than 1 second...Some problem with Luigi Core communication";var n=syncOperation.get(e);return z.delete(e),n}},{key:"execute",value:function(e,t,n,r){var o=c.getRandomId();this.createPendingOperation(o,e,t),this.sendMessage(o,n,r)}},{key:"createPendingOperation",value:function(e,t,n){z.set(e,{resolve:t,reject:n})}},{key:"sendMessage",value:function(e,t,n){c.sendPostMessageToLuigiCore({msg:"storage",data:{id:e,operation:t,params:n}})}}]),e}(),K=new B;function G(e){return G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},G(e)}function Q(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,o=function(e){if("object"!==G(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==G(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===G(o)?o:String(o)),r)}var o}var q=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),window!==window.top&&("true"!==window.document.head.getAttribute("disable-luigi-history-handling")&&(history.pushState=history.replaceState.bind(history)),"true"!==window.document.head.getAttribute("disable-luigi-runtime-error-handling")&&window.addEventListener("error",(function(e){var t={msg:"luigi-runtime-error-handling",errorObj:{filename:e.filename,message:e.message,lineno:e.lineno,colno:e.colno,error:e.error}};c.sendPostMessageToLuigiCore(t)})))}var t,n;return t=e,(n=[{key:"addInitListener",value:function(e,t){return g.addInitListener(e,t)}},{key:"removeInitListener",value:function(e){return g.removeInitListener(e)}},{key:"addContextUpdateListener",value:function(e){return g.addContextUpdateListener(e)}},{key:"removeContextUpdateListener",value:function(e){return g.removeContextUpdateListener(e)}},{key:"getToken",value:function(){return g.getToken()}},{key:"getEventData",value:function(){return g.getEventData()}},{key:"getContext",value:function(){return g.getContext()}},{key:"addNodeParams",value:function(e,t){return g.addNodeParams(e,t)}},{key:"getNodeParams",value:function(e){return g.getNodeParams(e)}},{key:"getActiveFeatureToggles",value:function(){return g.getActiveFeatureToggles()}},{key:"getPathParams",value:function(){return g.getPathParams()}},{key:"getCoreSearchParams",value:function(){return g.getCoreSearchParams()}},{key:"addCoreSearchParams",value:function(e,t){return g.addCoreSearchParams(e,t)}},{key:"getClientPermissions",value:function(){return g.getClientPermissions()}},{key:"sendCustomMessage",value:function(e){return g.sendCustomMessage(e)}},{key:"addCustomMessageListener",value:function(e,t){return g.addCustomMessageListener(e,t)}},{key:"removeCustomMessageListener",value:function(e){return g.removeCustomMessageListener(e)}},{key:"addInactiveListener",value:function(e,t){return g.addInactiveListener(e,t)}},{key:"removeInactiveListener",value:function(e){return g.removeInactiveListener(e)}},{key:"setTargetOrigin",value:function(e){return g.setTargetOrigin(e)}},{key:"getUserSettings",value:function(){return g.getUserSettings()}},{key:"isLuigiClientInitialized",value:function(){return g.isLuigiClientInitialized()}},{key:"luigiClientInit",value:function(){return g.luigiClientInit()}},{key:"getAnchor",value:function(){return g.getAnchor()}},{key:"setAnchor",value:function(e){return g.setAnchor(e)}},{key:"setViewGroupData",value:function(e){return g.setViewGroupData(e)}},{key:"linkManager",value:function(){return new L({currentContext:g.currentContext})}},{key:"uxManager",value:function(){return R}},{key:"lifecycleManager",value:function(){return g}},{key:"storageManager",value:function(){return K}}])&&Q(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),J=q=new q;return r.default}()}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.LuigiClient=t():e.LuigiClient=t()}(self,(function(){return function(){"use strict";var e={224:function(e){e.exports={rE:"2.20.0"}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var r={};function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,i=function(e){if("object"!==o(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===o(i)?i:String(i)),r)}var i}n.d(r,{default:function(){return J}});var a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.promises={}}var t,n;return t=e,(n=[{key:"setPromise",value:function(e,t){this.promises[e]=t}},{key:"getPromise",value:function(e){return this.promises[e]}}])&&i(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,o=function(e){if("object"!==u(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==u(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===u(o)?o:String(o)),r)}var o}var l=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.listeners=[],this.origin="";var t=function(e){if(e.data.msg)if("custom"===e.data.msg){var t=this.convertCustomMessageInternalToUser(e.data);this.listeners.filter((function(e){return e.name===t.id})).map((function(e){return e.eventFn(t,e.listenerId)}))}else this.listeners.filter((function(t){return t.name===e.data.msg})).map((function(t){return t.eventFn(e,t.listenerId)}))}.bind(this);window.addEventListener("message",t)}var t,n;return t=e,n=[{key:"convertCustomMessageInternalToUser",value:function(e){return e.data}},{key:"convertCustomMessageUserToInternal",value:function(e){return{msg:"custom",data:e}}},{key:"convertStorageMessageToInternal",value:function(e){return{msg:"storage",data:e}}},{key:"addEventListener",value:function(e,t){var n=this.getRandomId();return this.listeners.push({name:e,eventFn:t,listenerId:n}),n}},{key:"removeEventListener",value:function(e){return!!Boolean(this.listeners.find((function(t){return t.listenerId===e})))&&(this.listeners=this.listeners.filter((function(t){return t.listenerId!==e})),!0)}},{key:"getRandomId",value:function(){return window.crypto.getRandomValues(new Uint32Array(1))[0]}},{key:"isFunction",value:function(e){return"function"==typeof e}},{key:"isObject",value:function(e){return"[object Object]"===Object.prototype.toString.call(e)}},{key:"getLuigiCoreDomain",value:function(){return this.origin}},{key:"setLuigiCoreDomain",value:function(e){e&&"null"!==e&&(this.origin=e)}},{key:"setTargetOrigin",value:function(e){this.setLuigiCoreDomain(e)}},{key:"sendPostMessageToLuigiCore",value:function(e){if(this.origin)try{window.parent.postMessage(e,this.origin)}catch(t){console.warn("Unable to post message "+e+" to Luigi Core from origin "+this.origin+": "+t)}else console.warn('There is no target origin set. You can specify the target origin by calling LuigiClient.setTargetOrigin("targetorigin") in your micro frontend.')}},{key:"hasIntent",value:function(e){return!!e&&e.toLowerCase().includes("#?intent=")}},{key:"deSanitizeParamsMap",value:function(e){var t=this;return Object.entries(e).reduce((function(e,n){return e[t.deSanitizeParam(n[0])]=t.deSanitizeParam(n[1]),e}),{})}},{key:"deSanitizeParam",value:function(){return String(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").replaceAll("<","<").replaceAll(">",">").replaceAll(""",'"').replaceAll("'","'").replaceAll("/","/")}}],n&&s(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),c=new l;function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function v(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,o=function(e){if("object"!==f(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==f(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===f(o)?o:String(o)),r)}var o}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}var p=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}(u,e);var t,r,o,i,a=(o=u,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=y(o);if(i){var n=y(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===f(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function u(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),(e=a.call(this)).luigiInitialized=!1,e.defaultContextKeys=["context","internal","nodeParams","pathParams","searchParams"],e.setCurrentContext(e.defaultContextKeys.reduce((function(e,t){return e[t]={},e}),{})),e._onContextUpdatedFns={},e._onInactiveFns={},e._onInitFns={},e.authData={},e._isDeferInitDefined()||e.luigiClientInit(),e}return t=u,r=[{key:"_isDeferInitDefined",value:function(){return window.document.head.hasAttribute("defer-luigi-init")}},{key:"_isTpcCheckDisabled",value:function(){var e,t,n;return window.document.head.hasAttribute("disable-tpc-check")||(null===(e=this.currentContext)||void 0===e||null===(t=e.internal)||void 0===t||null===(n=t.thirdPartyCookieCheck)||void 0===n?void 0:n.disabled)}},{key:"isLuigiClientInitialized",value:function(){return this.luigiInitialized}},{key:"luigiClientInit",value:function(){var e=this;if(this.luigiInitialized)console.warn("Luigi Client has been already initialized");else{var t=function(t){for(var n=0;n<e.defaultContextKeys.length;n++){var r=e.defaultContextKeys[n];try{"string"==typeof t[r]&&(t[r]=JSON.parse(t[r]))}catch(e){console.info("unable to parse luigi context data for",r,t[r],e)}}e.setCurrentContext(t)},r=function(t){t&&(e.authData=t)};c.addEventListener("luigi.init",(function(n){t(n.data),r(n.data.authData),c.setLuigiCoreDomain(n.origin),e.luigiInitialized=!0,e._notifyInit(n.origin),e._tpcCheck(),c.sendPostMessageToLuigiCore({msg:"luigi.init.ok"})})),c.addEventListener("luigi-client.inactive-microfrontend",(function(t){e._notifyInactive(t.origin)})),c.addEventListener("luigi.auth.tokenIssued",(function(e){r(e.data.authData)})),c.addEventListener("luigi.navigate",(function(n){if(t(n.data),!e.currentContext.internal.isNavigateBack&&!e.currentContext.withoutSync){var r=window.location.hash;history.replaceState({luigiInduced:!0},"",n.data.viewUrl),window.dispatchEvent(new PopStateEvent("popstate",{state:"luiginavigation"})),window.location.hash!==r&&window.dispatchEvent(new HashChangeEvent("hashchange"))}e.currentContext.withoutSync&&Object.assign(e.currentContext.context,{viewUrl:n.data.viewUrl?n.data.viewUrl:void 0,pathParams:n.data.pathParams?n.data.pathParams:void 0}),e._notifyUpdate(),c.sendPostMessageToLuigiCore({msg:"luigi.navigate.ok"})})),window.parent.postMessage({msg:"luigi.get-context",clientVersion:n(224).rE},"*")}}},{key:"_tpcCheck",value:function(){if(!this._isTpcCheckDisabled()){var e,t="enabled",n=document.cookie;n&&(e=n.split(";").map((function(e){return e.trim()})).find((function(e){return"luigiCookie=true"===e}))),"luigiCookie=true"===e&&(document.cookie="luigiCookie=; Max-Age=-99999999; SameSite=None; Secure"),document.cookie="luigiCookie=true; SameSite=None; Secure",(n=document.cookie)&&(e=n.split(";").map((function(e){return e.trim()})).find((function(e){return"luigiCookie=true"===e}))),"luigiCookie=true"===e?(document.cookie="luigiCookie=; Max-Age=-99999999; SameSite=None; Secure",window.parent.postMessage({msg:"luigi.third-party-cookie",tpc:t},"*")):(t="disabled",window.parent.postMessage({msg:"luigi.third-party-cookie",tpc:t},"*"),console.warn("Third party cookies are not supported!"))}}},{key:"_callAllFns",value:function(e,t,n){for(var r in e)e.hasOwnProperty(r)&&c.isFunction(e[r])&&e[r](t,n)}},{key:"_notifyInit",value:function(e){this._callAllFns(this._onInitFns,this.currentContext.context,e)}},{key:"_notifyUpdate",value:function(){this._callAllFns(this._onContextUpdatedFns,this.currentContext.context)}},{key:"_notifyInactive",value:function(){this._callAllFns(this._onInactiveFns)}},{key:"setCurrentContext",value:function(e){this.currentContext=e}},{key:"addInitListener",value:function(e,t){var n=c.getRandomId();return this._onInitFns[n]=e,t&&document.head.setAttribute("disable-tpc-check",""),this.luigiInitialized&&c.isFunction(e)&&e(this.currentContext.context,c.getLuigiCoreDomain()),n}},{key:"removeInitListener",value:function(e){return!!this._onInitFns[e]&&(this._onInitFns[e]=void 0,!0)}},{key:"addContextUpdateListener",value:function(e){var t=c.getRandomId();return this._onContextUpdatedFns[t]=e,this.luigiInitialized&&c.isFunction(e)&&e(this.currentContext.context),t}},{key:"removeContextUpdateListener",value:function(e){return!!this._onContextUpdatedFns[e]&&(this._onContextUpdatedFns[e]=void 0,!0)}},{key:"addInactiveListener",value:function(e){var t=c.getRandomId();return this._onInactiveFns[t]=e,t}},{key:"removeInactiveListener",value:function(e){return!!this._onInactiveFns[e]&&(this._onInactiveFns[e]=void 0,!0)}},{key:"addCustomMessageListener",value:function(e,t){return c.addEventListener(e,(function(e,n){return t(e,n)}))}},{key:"removeCustomMessageListener",value:function(e){return c.removeEventListener(e)}},{key:"getToken",value:function(){return this.authData.accessToken}},{key:"getContext",value:function(){return this.getEventData()}},{key:"getEventData",value:function(){return this.currentContext.context}},{key:"getActiveFeatureToggles",value:function(){return this.currentContext.internal.activeFeatureToggleList}},{key:"addNodeParams",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e&&c.sendPostMessageToLuigiCore({msg:"luigi.addNodeParams",data:e,keepBrowserHistory:t})}},{key:"getNodeParams",value:function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?c.deSanitizeParamsMap(this.currentContext.nodeParams):this.currentContext.nodeParams}},{key:"getPathParams",value:function(){return this.currentContext.pathParams}},{key:"getCoreSearchParams",value:function(){return this.currentContext.searchParams||{}}},{key:"addCoreSearchParams",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e&&c.sendPostMessageToLuigiCore({msg:"luigi.addSearchParams",data:e,keepBrowserHistory:t})}},{key:"getClientPermissions",value:function(){return this.currentContext.internal.clientPermissions||{}}},{key:"setTargetOrigin",value:function(e){c.setTargetOrigin(e)}},{key:"sendCustomMessage",value:function(e){var t=c.convertCustomMessageUserToInternal(e);c.sendPostMessageToLuigiCore(t)}},{key:"getUserSettings",value:function(){return this.currentContext.internal.userSettings}},{key:"getAnchor",value:function(){return this.currentContext.internal.anchor||""}},{key:"setAnchor",value:function(e){c.sendPostMessageToLuigiCore({msg:"luigi.setAnchor",anchor:e})}},{key:"setViewGroupData",value:function(e){c.sendPostMessageToLuigiCore({msg:"luigi.setVGData",data:e})}}],r&&v(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),u}(a),g=new p;function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function h(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,o=function(e){if("object"!==m(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==m(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===m(o)?o:String(o)),r)}var o}function b(e,t){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},b(e,t)}function w(e){return w=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},w(e)}var k=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b(e,t)}(a,e);var t,n,r,o,i=(r=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=w(r);if(o){var n=w(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===m(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(t=i.call(this)).validSplitViewEvents=["expand","collapse","resize","close"],t.splitView={exists:!0,size:40,collapsed:!1},Object.assign(t.splitView,e),t.splitView.listeners=[c.addEventListener("luigi.navigation.splitview.internal",(function(e){Object.assign(t.splitView,e.data.data)}))],t.on("resize",(function(e){t.splitView.size=e})),t.on("close",(function(){t.splitView.listeners.forEach((function(e){return c.removeEventListener(e)}))})),t}return t=a,(n=[{key:"sendSplitViewEvent",value:function(e,t){c.sendPostMessageToLuigiCore({msg:"luigi.navigation.splitview.".concat(e),data:t})}},{key:"collapse",value:function(){this.sendSplitViewEvent("collapse")}},{key:"expand",value:function(){this.sendSplitViewEvent("expand")}},{key:"close",value:function(){this.sendSplitViewEvent("close")}},{key:"setSize",value:function(e){this.sendSplitViewEvent("resize",e)}},{key:"on",value:function(e,t){if(!this.validSplitViewEvents.includes(e))return console.warn(e+" is not a valid split view event"),!1;var n=c.addEventListener("luigi.navigation.splitview.".concat(e,".ok"),(function(e){var n="number"==typeof e.data.data?e.data.data:void 0;t(n)}));return this.splitView.listeners.push(n),n}},{key:"removeEventListener",value:function(e){return c.removeEventListener(e)}},{key:"exists",value:function(){return this.splitView.exists}},{key:"getSize",value:function(){return this.splitView.size}},{key:"isCollapsed",value:function(){return this.splitView.collapsed}},{key:"isExpanded",value:function(){return!this.splitView.collapsed}}])&&h(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),a}(a);function P(e){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P(e)}function C(e,t){if(e){if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?S(e,t):void 0}}function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function x(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,o=function(e){if("object"!==P(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==P(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===P(o)?o:String(o)),r)}var o}function O(e,t){return O=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},O(e,t)}function j(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}var L=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&O(e,t)}(a,e);var t,n,r,o,i=(r=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=E(r);if(o){var n=E(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===P(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return j(e)}(this,e)});function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),t=i.call(this),Object.assign(j(t),e),t.options={preserveView:!1,nodeParams:{},errorSkipNavigation:!1,fromContext:null,fromClosestContext:!1,fromVirtualTreeRoot:!1,fromParent:!1,relative:!1,link:"",newTab:!1,preserveQueryParams:!1,anchor:"",preventContextUpdate:!1,preventHistoryEntry:!1},t}return t=a,n=[{key:"navigate",value:function(e,t,n,r,o,i){if(this.options.errorSkipNavigation)this.options.errorSkipNavigation=!1;else{r&&o&&i&&console.warn("modalSettings, splitViewSettings and drawerSettings cannot be used together. Only modal setting will be taken into account."),this.options.preserveView=n;var a="/"!==e[0];if("/"===e&&(r||o||i))console.warn("Navigation with an absolute path prevented.");else{var u={msg:"luigi.navigation.open",sessionId:t,params:Object.assign(this.options,{link:e,relative:a,intent:c.hasIntent(e),modal:r,splitView:o,drawer:i})};c.sendPostMessageToLuigiCore(u)}}}},{key:"updateModalPathInternalNavigation",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e){var r={msg:"luigi.navigation.updateModalDataPath",params:Object.assign(this.options,{link:e,modal:t,history:n})};c.sendPostMessageToLuigiCore(r)}else console.warn("Updating path of the modal upon internal navigation prevented. No path specified.")}},{key:"navigateToIntent",value:function(e){var t,n,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i="#?intent=";if(i+=e,o&&null!==(t=Object.keys(o))&&void 0!==t&&t.length){var a=Object.entries(o);if(a.length>0){i+="?";var u,s=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=C(e))){t&&(e=t);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==t.return||t.return()}finally{if(a)throw o}}}}(a);try{for(s.s();!(u=s.n()).done;){var l=(n=u.value,r=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],s=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);s=!0);}catch(e){l=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(n,r)||C(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());i+=l[0]+"="+l[1]+"&"}}catch(e){s.e(e)}finally{s.f()}i=i.slice(0,-1)}}this.navigate(i)}},{key:"openAsModal",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};c.addEventListener("luigi.navigation.modal.close",(function(e,n){var r=t.getPromise("modal");r&&(r.resolveFn(e.data),t.setPromise("modal",void 0)),c.removeEventListener(n)}));var r={};return r.promise=new Promise((function(e,t){r.resolveFn=e,r.rejectFn=t})),this.setPromise("modal",r),this.navigate(e,0,!0,n),r.promise}},{key:"updateModalSettings",value:function(){var e={msg:"luigi.navigation.updateModalSettings",updatedModalSettings:arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},addHistoryEntry:arguments.length>1&&void 0!==arguments[1]&&arguments[1]};c.sendPostMessageToLuigiCore(e)}},{key:"openAsSplitView",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.navigate(e,0,!0,void 0,t),new k(t)}},{key:"openAsDrawer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.navigate(e,0,!0,void 0,void 0,t)}},{key:"fromContext",value:function(e){return this.currentContext.context.parentNavigationContexts&&-1!==this.currentContext.context.parentNavigationContexts.indexOf(e)?this.options.fromContext=e:(this.options.errorSkipNavigation=!0,console.error("Navigation not possible, navigationContext "+e+" not found.")),this}},{key:"fromClosestContext",value:function(){var e;return(null===(e=this.currentContext)||void 0===e?void 0:e.context.parentNavigationContexts.length)>0?(this.options.fromContext=null,this.options.fromClosestContext=!0):console.error("Navigation not possible, no parent navigationContext found."),this}},{key:"fromVirtualTreeRoot",value:function(){return this.options.fromContext=null,this.options.fromClosestContext=!1,this.options.fromVirtualTreeRoot=!0,this}},{key:"fromParent",value:function(){return this.options.fromParent=!0,this}},{key:"withParams",value:function(e){return e&&Object.assign(this.options.nodeParams,e),this}},{key:"withOptions",value:function(e){return c.isObject(e)?(void 0!==e.preventHistoryEntry&&(this.options.preventHistoryEntry=e.preventHistoryEntry),void 0!==e.preventContextUpdate&&(this.options.preventContextUpdate=e.preventContextUpdate),this):this}},{key:"pathExists",value:function(e){var t=c.getRandomId(),n=this.getPromise("pathExistsPromises")||{};n[t]={resolveFn:function(){},then:function(e){this.resolveFn=e}},this.setPromise("pathExistsPromises",n),c.addEventListener("luigi.navigation.pathExists.answer",function(e,n){var r=e.data.data,o=this.getPromise("pathExistsPromises")||{};r.correlationId===t&&(o[r.correlationId]&&(o[r.correlationId].resolveFn(r.pathExists),delete o[r.correlationId],this.setPromise("pathExistsPromises",o)),c.removeEventListener(n))}.bind(this));var r={msg:"luigi.navigation.pathExists",data:Object.assign(this.options,{id:t,link:e,intent:c.hasIntent(e),relative:"/"!==e[0]})};return c.sendPostMessageToLuigiCore(r),n[t]}},{key:"hasBack",value:function(){return!!this.currentContext.internal.modal||0!==this.currentContext.internal.viewStackSize}},{key:"goBack",value:function(e){c.sendPostMessageToLuigiCore({msg:"luigi.navigation.back",goBackContext:e&&JSON.stringify(e)})}},{key:"withoutSync",value:function(){return this.options.withoutSync=!0,this}},{key:"newTab",value:function(){return this.options.newTab=!0,this}},{key:"preserveQueryParams",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.options.preserveQueryParams=e,this}},{key:"getCurrentRoute",value:function(){var e=this,t=c.getRandomId(),n=this.getPromise("getCurrentRoute")||{};return n[t]={resolveFn:function(){},then:function(e){this.resolveFn=e}},this.setPromise("getCurrentRoute",n),c.addEventListener("luigi.navigation.currentRoute.answer",(function(n,r){var o=n.data.data,i=e.getPromise("getCurrentRoute")||{};o.correlationId===t&&(i[o.correlationId]&&(i[o.correlationId].resolveFn(o.route),delete i[o.correlationId],e.setPromise("getCurrentRoute",i)),c.removeEventListener(r)),c.removeEventListener(r)})),c.sendPostMessageToLuigiCore({msg:"luigi.navigation.currentRoute",data:Object.assign(this.options,{id:t})}),n[t]}}],n&&x(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),a}(a);function I(e){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I(e)}function T(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,o=function(e){if("object"!==I(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==I(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===I(o)?o:String(o)),r)}var o}function M(e,t){return M=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},M(e,t)}function _(e){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_(e)}var R=new(function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&M(e,t)}(a,e);var t,n,r,o,i=(r=a,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=_(r);if(o){var n=_(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return function(e,t){if(t&&("object"===I(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function a(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),e=i.call(this),c.addEventListener("luigi.current-locale-changed",(function(e){var t;e.data.currentLocale&&null!==(t=g.currentContext)&&void 0!==t&&t.internal&&(g.currentContext.internal.currentLocale=e.data.currentLocale,g._notifyUpdate())})),e}return t=a,(n=[{key:"showLoadingIndicator",value:function(){c.sendPostMessageToLuigiCore({msg:"luigi.show-loading-indicator"})}},{key:"hideLoadingIndicator",value:function(){c.sendPostMessageToLuigiCore({msg:"luigi.hide-loading-indicator"})}},{key:"closeCurrentModal",value:function(){c.sendPostMessageToLuigiCore({msg:"luigi.close-modal"})}},{key:"addBackdrop",value:function(){c.sendPostMessageToLuigiCore({msg:"luigi.add-backdrop"})}},{key:"removeBackdrop",value:function(){c.sendPostMessageToLuigiCore({msg:"luigi.remove-backdrop"})}},{key:"setDirtyStatus",value:function(e){c.sendPostMessageToLuigiCore({msg:"luigi.set-page-dirty",dirty:e})}},{key:"showConfirmationModal",value:function(e){var t=this;c.addEventListener("luigi.ux.confirmationModal.hide",(function(e,n){t.hideConfirmationModal(e.data.data),c.removeEventListener(n)})),c.sendPostMessageToLuigiCore({msg:"luigi.ux.confirmationModal.show",data:{settings:e}});var n={};return n.promise=new Promise((function(e,t){n.resolveFn=e,n.rejectFn=t})),this.setPromise("confirmationModal",n),n.promise}},{key:"hideConfirmationModal",value:function(e){var t=this.getPromise("confirmationModal");t&&(e.confirmed?t.resolveFn():t.rejectFn(),this.setPromise("confirmationModal",void 0))}},{key:"showAlert",value:function(e){var t=this;e.id=c.getRandomId(),c.addEventListener("luigi.ux.alert.hide",(function(n,r){n.data.id===e.id&&(t.hideAlert(n.data),c.removeEventListener(r))})),(null==e?void 0:e.closeAfter)<100&&(console.warn("Message with id='".concat(e.id,"' has too small 'closeAfter' value. It needs to be at least 100ms.")),e.closeAfter=void 0),c.sendPostMessageToLuigiCore({msg:"luigi.ux.alert.show",data:{settings:e}});var n=this.getPromise("alerts")||{};return n[e.id]={},n[e.id].promise=new Promise((function(t){n[e.id].resolveFn=t})),this.setPromise("alerts",n),n[e.id].promise}},{key:"hideAlert",value:function(e){var t=e.id,n=e.dismissKey,r=this.getPromise("alerts");t&&r[t]&&(r[t].resolveFn(n||t),delete r[t],this.setPromise("alerts",r))}},{key:"getCurrentLocale",value:function(){var e,t;return null===(e=g.currentContext)||void 0===e||null===(t=e.internal)||void 0===t?void 0:t.currentLocale}},{key:"setCurrentLocale",value:function(e){e&&c.sendPostMessageToLuigiCore({msg:"luigi.ux.set-current-locale",data:{currentLocale:e}})}},{key:"isSplitView",value:function(){var e,t;return null===(e=g.currentContext)||void 0===e||null===(t=e.internal)||void 0===t?void 0:t.splitView}},{key:"isModal",value:function(){var e,t;return null===(e=g.currentContext)||void 0===e||null===(t=e.internal)||void 0===t?void 0:t.modal}},{key:"isDrawer",value:function(){var e,t;return null===(e=g.currentContext)||void 0===e||null===(t=e.internal)||void 0===t?void 0:t.drawer}},{key:"getCurrentTheme",value:function(){var e,t;return null===(e=g.currentContext)||void 0===e||null===(t=e.internal)||void 0===t?void 0:t.currentTheme}},{key:"getCSSVariables",value:function(){var e,t;return(null===(e=g.currentContext)||void 0===e||null===(t=e.internal)||void 0===t?void 0:t.cssVariables)||{}}},{key:"applyCSS",value:function(){var e,t;document.querySelectorAll("head style[luigi-injected]").forEach((function(e){e.remove()}));var n=null===(e=g.currentContext)||void 0===e||null===(t=e.internal)||void 0===t?void 0:t.cssVariables;if(n){var r=":root {\n";Object.keys(n).forEach((function(e){var t=n[e];r+=(e.startsWith("--")?"":"--")+e+":"+t+";\n"})),r+="}";var o=document.createElement("style");o.setAttribute("luigi-injected",!0),o.innerHTML=r,document.head.appendChild(o)}}}])&&T(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),a}(a));function A(e){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A(e)}function F(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function V(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,o=function(e){if("object"!==A(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==A(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===A(o)?o:String(o)),r)}var o}function D(e,t,n){return t&&V(e.prototype,t),n&&V(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function U(e,t){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},U(e,t)}function N(e){return N=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},N(e)}var z=new Map,B=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&U(e,t)}(o,e);var t,n,r=(t=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=N(t);if(n){var o=N(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return function(e,t){if(t&&("object"===A(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,e)});function o(){var e;return F(this,o),(e=r.call(this)).storageEventProcessor=new H,c.addEventListener("storage",(function(t,n){return e.storageEventProcessor.processEvent(t,n)})),e}return D(o,[{key:"setItem",value:function(e,t){var n=this;return new Promise((function(r,o){n.storageEventProcessor.execute(r,o,"setItem",{key:e,value:t})}))}},{key:"getItem",value:function(e){var t=this;return new Promise((function(n,r){t.storageEventProcessor.execute(n,r,"getItem",{key:e})}))}},{key:"removeItem",value:function(e){var t=this;return new Promise((function(n,r){t.storageEventProcessor.execute(n,r,"removeItem",{key:e})}))}},{key:"clear",value:function(){var e=this;return new Promise((function(t,n){e.storageEventProcessor.execute(t,n,"clear",{})}))}},{key:"has",value:function(e){var t=this;return new Promise((function(n,r){t.storageEventProcessor.execute(n,r,"has",{key:e})}))}},{key:"getAllKeys",value:function(){var e=this;return new Promise((function(t,n){e.storageEventProcessor.execute(t,n,"getAllKeys",{})}))}}]),o}(a),H=function(){function e(){F(this,e)}return D(e,[{key:"processEvent",value:function(e,t){try{var n=e.data.data;if(!z.has(n.id))return void console.log("Impossible to find Promise method for message "+n.id);var r=z.get(n.id);"ERROR"===n.status?r.reject(n.result):r.resolve(n.result),z.delete(n.id)}catch(e){console.error(e)}}},{key:"waitForSyncResult",value:function(e){for(var t=(new Date).getTime();!syncOperation.has(e);)if((new Date).getTime()-t>1e4)throw"Storage operation is taking more than 1 second...Some problem with Luigi Core communication";var n=syncOperation.get(e);return z.delete(e),n}},{key:"execute",value:function(e,t,n,r){var o=c.getRandomId();this.createPendingOperation(o,e,t),this.sendMessage(o,n,r)}},{key:"createPendingOperation",value:function(e,t,n){z.set(e,{resolve:t,reject:n})}},{key:"sendMessage",value:function(e,t,n){c.sendPostMessageToLuigiCore({msg:"storage",data:{id:e,operation:t,params:n}})}}]),e}(),K=new B;function G(e){return G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},G(e)}function Q(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,(void 0,o=function(e){if("object"!==G(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==G(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key),"symbol"===G(o)?o:String(o)),r)}var o}var q=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),window!==window.top&&("true"!==window.document.head.getAttribute("disable-luigi-history-handling")&&(history.pushState=history.replaceState.bind(history)),"true"!==window.document.head.getAttribute("disable-luigi-runtime-error-handling")&&window.addEventListener("error",(function(e){var t={msg:"luigi-runtime-error-handling",errorObj:{filename:e.filename,message:e.message,lineno:e.lineno,colno:e.colno,error:e.error}};c.sendPostMessageToLuigiCore(t)})))}var t,n;return t=e,(n=[{key:"addInitListener",value:function(e,t){return g.addInitListener(e,t)}},{key:"removeInitListener",value:function(e){return g.removeInitListener(e)}},{key:"addContextUpdateListener",value:function(e){return g.addContextUpdateListener(e)}},{key:"removeContextUpdateListener",value:function(e){return g.removeContextUpdateListener(e)}},{key:"getToken",value:function(){return g.getToken()}},{key:"getEventData",value:function(){return g.getEventData()}},{key:"getContext",value:function(){return g.getContext()}},{key:"addNodeParams",value:function(e,t){return g.addNodeParams(e,t)}},{key:"getNodeParams",value:function(e){return g.getNodeParams(e)}},{key:"getActiveFeatureToggles",value:function(){return g.getActiveFeatureToggles()}},{key:"getPathParams",value:function(){return g.getPathParams()}},{key:"getCoreSearchParams",value:function(){return g.getCoreSearchParams()}},{key:"addCoreSearchParams",value:function(e,t){return g.addCoreSearchParams(e,t)}},{key:"getClientPermissions",value:function(){return g.getClientPermissions()}},{key:"sendCustomMessage",value:function(e){return g.sendCustomMessage(e)}},{key:"addCustomMessageListener",value:function(e,t){return g.addCustomMessageListener(e,t)}},{key:"removeCustomMessageListener",value:function(e){return g.removeCustomMessageListener(e)}},{key:"addInactiveListener",value:function(e,t){return g.addInactiveListener(e,t)}},{key:"removeInactiveListener",value:function(e){return g.removeInactiveListener(e)}},{key:"setTargetOrigin",value:function(e){return g.setTargetOrigin(e)}},{key:"getUserSettings",value:function(){return g.getUserSettings()}},{key:"isLuigiClientInitialized",value:function(){return g.isLuigiClientInitialized()}},{key:"luigiClientInit",value:function(){return g.luigiClientInit()}},{key:"getAnchor",value:function(){return g.getAnchor()}},{key:"setAnchor",value:function(e){return g.setAnchor(e)}},{key:"setViewGroupData",value:function(e){return g.setViewGroupData(e)}},{key:"linkManager",value:function(){return new L({currentContext:g.currentContext})}},{key:"uxManager",value:function(){return R}},{key:"lifecycleManager",value:function(){return g}},{key:"storageManager",value:function(){return K}}])&&Q(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),J=q=new q;return r.default}()}));
|
|
2
2
|
//# sourceMappingURL=luigi-client.js.map
|
package/luigi-element.d.ts
CHANGED
|
@@ -61,7 +61,59 @@ export declare interface NodeParams {
|
|
|
61
61
|
[key: string]: string;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
export declare interface UserSettings {
|
|
65
|
+
[key: string]: number | string | boolean;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Returns the anchor of active URL.
|
|
70
|
+
* @returns {String} the anchor string
|
|
71
|
+
* @memberof Lifecycle
|
|
72
|
+
* @example
|
|
73
|
+
* LuigiClient.getAnchor();
|
|
74
|
+
*/
|
|
75
|
+
export function getAnchor(): String;
|
|
76
|
+
export type getAnchor = () => String;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Returns the current user settings.
|
|
80
|
+
* @returns {Object} current user settings
|
|
81
|
+
* @memberof Lifecycle
|
|
82
|
+
*/
|
|
83
|
+
export function getUserSettings(): UserSettings;
|
|
84
|
+
export type getUserSettings = () => UserSettings;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Allows you to change node labels within the same view group, e.g. in your node config: `label: 'my Node {viewGroupData.vg1}'`.
|
|
88
|
+
* @param {Object} value a data object containing the view group name and desired label
|
|
89
|
+
* @memberof Lifecycle
|
|
90
|
+
* @example
|
|
91
|
+
* LuigiClient.setViewGroupData({'vg1':' Luigi rocks!'})
|
|
92
|
+
*/
|
|
93
|
+
export function setViewGroupData(value: Object): void;
|
|
94
|
+
export type setViewGroupData = (value: Object) => void;
|
|
95
|
+
|
|
64
96
|
export declare interface UxManager {
|
|
97
|
+
/**
|
|
98
|
+
* Gets the current theme.
|
|
99
|
+
* @returns {*} current themeObj
|
|
100
|
+
* @memberof uxManager
|
|
101
|
+
*/
|
|
102
|
+
getCurrentTheme: () => any;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Gets the dirty status, which is set by the Client.
|
|
106
|
+
* @returns {boolean} dirty status
|
|
107
|
+
* @memberof uxManager
|
|
108
|
+
*/
|
|
109
|
+
getDirtyStatus: () => boolean;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Removes the backdrop.
|
|
113
|
+
* @memberof uxManager
|
|
114
|
+
*/
|
|
115
|
+
removeBackdrop: () => void;
|
|
116
|
+
|
|
65
117
|
/**
|
|
66
118
|
* Hides the app loading indicator.
|
|
67
119
|
* @memberof uxManager
|
|
@@ -212,6 +264,23 @@ export declare interface LinkManager {
|
|
|
212
264
|
drawerSettings?: DrawerSettings
|
|
213
265
|
) => void;
|
|
214
266
|
|
|
267
|
+
/**
|
|
268
|
+
* Offers an alternative way of navigating with intents. This involves specifying a semanticSlug and an object containing
|
|
269
|
+
* parameters.
|
|
270
|
+
* This method internally generates a URL of the form `#?intent=<semantic object>-<action>?<param_name>=<param_value>` through the given
|
|
271
|
+
* input arguments. This then follows a call to the original `linkManager.navigate(...)` function.
|
|
272
|
+
* Consequently, the following calls shall have the exact same effect:
|
|
273
|
+
* - linkManager().navigateToIntent('Sales-settings', {project: 'pr2', user: 'john'})
|
|
274
|
+
* - linkManager().navigate('/#?intent=Sales-settings?project=pr2&user=john')
|
|
275
|
+
* @memberof LuigiNavigation
|
|
276
|
+
* @param {string} semanticSlug concatenation of semantic object and action connected with a dash (-), i.e.: `<semanticObject>-<action>`
|
|
277
|
+
* @param {Object} params an object representing all the parameters passed, i.e.: `{param1: '1', param2: 2, param3: 'value3'}`.
|
|
278
|
+
* @example
|
|
279
|
+
* LuigiClient.linkManager().navigateToIntent('Sales-settings', {project: 'pr2', user: 'john'})
|
|
280
|
+
* LuigiClient.linkManager().navigateToIntent('Sales-settings')
|
|
281
|
+
*/
|
|
282
|
+
navigateToIntent: (semanticSlug: string, params?: Object) => void;
|
|
283
|
+
|
|
215
284
|
/**
|
|
216
285
|
* Opens a view in a modal. You can specify the modal's title and size. If you do not 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.
|
|
217
286
|
* @memberof linkManager
|
|
@@ -271,6 +340,15 @@ export declare interface LinkManager {
|
|
|
271
340
|
*/
|
|
272
341
|
fromContext: (navigationContext: string) => this;
|
|
273
342
|
|
|
343
|
+
/**
|
|
344
|
+
* Enables navigating to sibling nodes without knowing the absolute path
|
|
345
|
+
* @memberof linkManager
|
|
346
|
+
* @returns {linkManager} link manager instance
|
|
347
|
+
* @example
|
|
348
|
+
* LuigiClient.linkManager().fromParent().navigate('/sibling')
|
|
349
|
+
*/
|
|
350
|
+
fromParent: () => this;
|
|
351
|
+
|
|
274
352
|
/**
|
|
275
353
|
* Sets the current navigation context which is then used by the `navigate` function. This has to be a parent navigation context, it is not possible to use the child navigation contexts.
|
|
276
354
|
* @memberof linkManager
|
package/package.json
CHANGED