@luigi-project/client 2.25.2-dev.20251210044 → 2.26.1-dev.20251220037
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/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,(()=>(()=>{"use strict";var e={224:e=>{e.exports={rE:"2.25.1"}}},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=(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=(e,t)=>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,a(r.key),r)}}function a(e){var t=function(e){if("object"!=o(e)||!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)}(e);return"symbol"==o(t)?t:t+""}n.d(r,{default:()=>ie});var u=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.promises={}},(t=[{key:"setPromise",value:function(e,t){this.promises[e]=t}},{key:"getPromise",value:function(e){return this.promises[e]}}])&&i(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function s(e){return s="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},s(e)}function c(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,l(r.key),r)}}function l(e){var t=function(e){if("object"!=s(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==s(t)?t:t+""}var f=new(function(){return e=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)},t=[{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("/","/")}}],t&&c(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}());function v(e){return v="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},v(e)}function d(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,y(r.key),r)}}function y(e){var t=function(e){if("object"!=v(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=v(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==v(t)?t:t+""}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(p=function(){return!!e})()}function g(e){return g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},g(e)}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},m(e,t)}var h=new(function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=function(e,t,n){return t=g(t),function(e,t){if(t&&("object"==v(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)}(e,p()?Reflect.construct(t,n||[],g(e).constructor):t.apply(e,n))}(this,t)).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 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)}(t,e),r=t,o=[{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)};f.addEventListener("luigi.init",(function(n){t(n.data),r(n.data.authData),f.setLuigiCoreDomain(n.origin),e.luigiInitialized=!0,e._notifyInit(n.origin),e._tpcCheck(),f.sendPostMessageToLuigiCore({msg:"luigi.init.ok"})})),f.addEventListener("luigi-client.inactive-microfrontend",(function(t){e._notifyInactive(t.origin)})),f.addEventListener("luigi.auth.tokenIssued",(function(e){r(e.data.authData)})),f.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(),f.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)&&f.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=f.getRandomId();return this._onInitFns[n]=e,t&&document.head.setAttribute("disable-tpc-check",""),this.luigiInitialized&&f.isFunction(e)&&e(this.currentContext.context,f.getLuigiCoreDomain()),n}},{key:"removeInitListener",value:function(e){return!!this._onInitFns[e]&&(this._onInitFns[e]=void 0,!0)}},{key:"addContextUpdateListener",value:function(e){var t=f.getRandomId();return this._onContextUpdatedFns[t]=e,this.luigiInitialized&&f.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=f.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 f.addEventListener(e,(function(e,n){return t(e,n)}))}},{key:"removeCustomMessageListener",value:function(e){return f.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(){var e;return null!==(e=this.currentContext.internal.activeFeatureToggleList)&&void 0!==e?e:[]}},{key:"addNodeParams",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e&&f.sendPostMessageToLuigiCore({msg:"luigi.addNodeParams",data:e,keepBrowserHistory:t})}},{key:"getNodeParams",value:function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?f.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&&f.sendPostMessageToLuigiCore({msg:"luigi.addSearchParams",data:e,keepBrowserHistory:t})}},{key:"getClientPermissions",value:function(){return this.currentContext.internal.clientPermissions||{}}},{key:"setTargetOrigin",value:function(e){f.setTargetOrigin(e)}},{key:"sendCustomMessage",value:function(e){var t=f.convertCustomMessageUserToInternal(e);f.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){f.sendPostMessageToLuigiCore({msg:"luigi.setAnchor",anchor:e})}},{key:"setViewGroupData",value:function(e){f.sendPostMessageToLuigiCore({msg:"luigi.setVGData",data:e})}}],o&&d(r.prototype,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,o}(u));function b(e){return b="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},b(e)}function w(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,k(r.key),r)}}function k(e){var t=function(e){if("object"!=b(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=b(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==b(t)?t:t+""}function C(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(C=function(){return!!e})()}function P(e){return P=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},P(e)}function S(e,t){return S=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},S(e,t)}var x=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t,n){return t=P(t),function(e,t){if(t&&("object"==b(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)}(e,C()?Reflect.construct(t,n||[],P(e).constructor):t.apply(e,n))}(this,t)).validSplitViewEvents=["expand","collapse","resize","close"],n.splitView={exists:!0,size:40,collapsed:!1},Object.assign(n.splitView,e),n.splitView.listeners=[f.addEventListener("luigi.navigation.splitview.internal",(function(e){Object.assign(n.splitView,e.data.data)}))],n.on("resize",(function(e){n.splitView.size=e})),n.on("close",(function(){n.splitView.listeners.forEach((function(e){return f.removeEventListener(e)}))})),n}return 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&&S(e,t)}(t,e),n=t,r=[{key:"sendSplitViewEvent",value:function(e,t){f.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=f.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 f.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}}],r&&w(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);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 j(e,t){return function(e){if(Array.isArray(e))return e}(e)||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,c=!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){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(e,t)||E(e,t)||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.")}()}function E(e,t){if(e){if("string"==typeof e)return L(e,t);var n={}.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)?L(e,t):void 0}}function L(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}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,T(r.key),r)}}function T(e){var t=function(e){if("object"!=O(e)||!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)}(e);return"symbol"==O(t)?t:t+""}function M(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(M=function(){return!!e})()}function _(e){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_(e)}function A(e,t){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},A(e,t)}var F=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t,n){return t=_(t),function(e,t){if(t&&("object"==O(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)}(e,M()?Reflect.construct(t,n||[],_(e).constructor):t.apply(e,n))}(this,t),Object.assign(n,e),n.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},n}return 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&&A(e,t)}(t,e),n=t,r=[{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:f.hasIntent(e),modal:r,splitView:o,drawer:i})};f.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})};f.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=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="#?intent=";if(r+=e,n&&null!==(t=Object.keys(n))&&void 0!==t&&t.length){var o=Object.entries(n);if(o.length>0){r+="?";var i,a=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=E(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}}}}(o);try{for(a.s();!(i=a.n()).done;){var u=j(i.value,2);r+=u[0]+"="+u[1]+"&"}}catch(e){a.e(e)}finally{a.f()}r=r.slice(0,-1)}}this.navigate(r)}},{key:"openAsModal",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};f.addEventListener("luigi.navigation.modal.close",(function(e,n){var r=t.getPromise("modal");r&&(r.resolveFn(e.data),t.setPromise("modal",void 0)),f.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]};f.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 x(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 f.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=f.getRandomId(),n=this.getPromise("pathExistsPromises")||{};n[t]={resolveFn:function(){},then:function(e){this.resolveFn=e}},this.setPromise("pathExistsPromises",n),f.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)),f.removeEventListener(n))}.bind(this));var r={msg:"luigi.navigation.pathExists",data:Object.assign(this.options,{id:t,link:e,intent:f.hasIntent(e),relative:"/"!==e[0]})};return f.sendPostMessageToLuigiCore(r),n[t]}},{key:"hasBack",value:function(){return!!this.currentContext.internal.modal||0!==this.currentContext.internal.viewStackSize}},{key:"goBack",value:function(e){f.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=f.getRandomId(),n=this.getPromise("getCurrentRoute")||{};return n[t]={resolveFn:function(){},then:function(e){this.resolveFn=e}},this.setPromise("getCurrentRoute",n),f.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)),f.removeEventListener(r)),f.removeEventListener(r)})),f.sendPostMessageToLuigiCore({msg:"luigi.navigation.currentRoute",data:Object.assign(this.options,{id:t})}),n[t]}}],r&&I(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function R(e){return R="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},R(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,D(r.key),r)}}function D(e){var t=function(e){if("object"!=R(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=R(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==R(t)?t:t+""}function U(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(U=function(){return!!e})()}function N(e){return N=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},N(e)}function z(e,t){return z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},z(e,t)}var B=new(function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,n){return t=N(t),function(e,t){if(t&&("object"==R(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)}(e,U()?Reflect.construct(t,n||[],N(e).constructor):t.apply(e,n))}(this,t),f.addEventListener("luigi.current-locale-changed",(function(e){var t;e.data.currentLocale&&null!==(t=h.currentContext)&&void 0!==t&&t.internal&&(h.currentContext.internal.currentLocale=e.data.currentLocale,h._notifyUpdate())})),e}return 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&&z(e,t)}(t,e),n=t,r=[{key:"showLoadingIndicator",value:function(){f.sendPostMessageToLuigiCore({msg:"luigi.show-loading-indicator"})}},{key:"hideLoadingIndicator",value:function(){f.sendPostMessageToLuigiCore({msg:"luigi.hide-loading-indicator"})}},{key:"closeCurrentModal",value:function(){f.sendPostMessageToLuigiCore({msg:"luigi.close-modal"})}},{key:"addBackdrop",value:function(){f.sendPostMessageToLuigiCore({msg:"luigi.add-backdrop"})}},{key:"removeBackdrop",value:function(){f.sendPostMessageToLuigiCore({msg:"luigi.remove-backdrop"})}},{key:"setDirtyStatus",value:function(e){f.sendPostMessageToLuigiCore({msg:"luigi.set-page-dirty",dirty:e})}},{key:"showConfirmationModal",value:function(e){var t=this;f.addEventListener("luigi.ux.confirmationModal.hide",(function(e,n){t.hideConfirmationModal(e.data.data),f.removeEventListener(n)})),f.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=f.getRandomId(),f.addEventListener("luigi.ux.alert.hide",(function(n,r){n.data.id===e.id&&(t.hideAlert(n.data),f.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),f.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=h.currentContext)||void 0===e||null===(t=e.internal)||void 0===t?void 0:t.currentLocale}},{key:"setCurrentLocale",value:function(e){e&&f.sendPostMessageToLuigiCore({msg:"luigi.ux.set-current-locale",data:{currentLocale:e}})}},{key:"isSplitView",value:function(){var e,t;return null===(e=h.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=h.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=h.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=h.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=h.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=h.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)}}}],r&&V(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u));function H(e){return H="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},H(e)}function K(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function G(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,q(r.key),r)}}function Q(e,t,n){return t&&G(e.prototype,t),n&&G(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function q(e){var t=function(e){if("object"!=H(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=H(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==H(t)?t:t+""}function J(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(J=function(){return!!e})()}function W(e){return W=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},W(e)}function Y(e,t){return Y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Y(e,t)}var $=new Map,X=function(e){function t(){var e,n,r,o;return K(this,t),(n=this,r=t,r=W(r),e=function(e,t){if(t&&("object"==H(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)}(n,J()?Reflect.construct(r,o||[],W(n).constructor):r.apply(n,o))).storageEventProcessor=new Z,f.addEventListener("storage",(function(t,n){return e.storageEventProcessor.processEvent(t,n)})),e}return 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&&Y(e,t)}(t,e),Q(t,[{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",{})}))}}])}(u),Z=function(){return Q((function e(){K(this,e)}),[{key:"processEvent",value:function(e,t){try{var n=e.data.data;if(!$.has(n.id))return void console.log("Impossible to find Promise method for message "+n.id);var r=$.get(n.id);"ERROR"===n.status?r.reject(n.result):r.resolve(n.result),$.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 $.delete(e),n}},{key:"execute",value:function(e,t,n,r){var o=f.getRandomId();this.createPendingOperation(o,e,t),this.sendMessage(o,n,r)}},{key:"createPendingOperation",value:function(e,t,n){$.set(e,{resolve:t,reject:n})}},{key:"sendMessage",value:function(e,t,n){f.sendPostMessageToLuigiCore({msg:"storage",data:{id:e,operation:t,params:n}})}}])}(),ee=new X;function te(e){return te="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},te(e)}function ne(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,re(r.key),r)}}function re(e){var t=function(e){if("object"!=te(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=te(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==te(t)?t:t+""}var oe=function(){return e=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}};f.sendPostMessageToLuigiCore(t)})))},(t=[{key:"addInitListener",value:function(e,t){return h.addInitListener(e,t)}},{key:"removeInitListener",value:function(e){return h.removeInitListener(e)}},{key:"addContextUpdateListener",value:function(e){return h.addContextUpdateListener(e)}},{key:"removeContextUpdateListener",value:function(e){return h.removeContextUpdateListener(e)}},{key:"getToken",value:function(){return h.getToken()}},{key:"getEventData",value:function(){return h.getEventData()}},{key:"getContext",value:function(){return h.getContext()}},{key:"addNodeParams",value:function(e,t){return h.addNodeParams(e,t)}},{key:"getNodeParams",value:function(e){return h.getNodeParams(e)}},{key:"getActiveFeatureToggles",value:function(){return h.getActiveFeatureToggles()}},{key:"getPathParams",value:function(){return h.getPathParams()}},{key:"getCoreSearchParams",value:function(){return h.getCoreSearchParams()}},{key:"addCoreSearchParams",value:function(e,t){return h.addCoreSearchParams(e,t)}},{key:"getClientPermissions",value:function(){return h.getClientPermissions()}},{key:"sendCustomMessage",value:function(e){return h.sendCustomMessage(e)}},{key:"addCustomMessageListener",value:function(e,t){return h.addCustomMessageListener(e,t)}},{key:"removeCustomMessageListener",value:function(e){return h.removeCustomMessageListener(e)}},{key:"addInactiveListener",value:function(e,t){return h.addInactiveListener(e,t)}},{key:"removeInactiveListener",value:function(e){return h.removeInactiveListener(e)}},{key:"setTargetOrigin",value:function(e){return h.setTargetOrigin(e)}},{key:"getUserSettings",value:function(){return h.getUserSettings()}},{key:"isLuigiClientInitialized",value:function(){return h.isLuigiClientInitialized()}},{key:"luigiClientInit",value:function(){return h.luigiClientInit()}},{key:"getAnchor",value:function(){return h.getAnchor()}},{key:"setAnchor",value:function(e){return h.setAnchor(e)}},{key:"setViewGroupData",value:function(e){return h.setViewGroupData(e)}},{key:"linkManager",value:function(){return new F({currentContext:h.currentContext})}},{key:"uxManager",value:function(){return B}},{key:"lifecycleManager",value:function(){return h}},{key:"storageManager",value:function(){return ee}}])&&ne(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();const ie=oe=new oe;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,(()=>(()=>{"use strict";var e={224:e=>{e.exports={rE:"2.26.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=(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=(e,t)=>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,a(r.key),r)}}function a(e){var t=function(e){if("object"!=o(e)||!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)}(e);return"symbol"==o(t)?t:t+""}n.d(r,{default:()=>ie});var u=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.promises={}},(t=[{key:"setPromise",value:function(e,t){this.promises[e]=t}},{key:"getPromise",value:function(e){return this.promises[e]}}])&&i(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function s(e){return s="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},s(e)}function c(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,l(r.key),r)}}function l(e){var t=function(e){if("object"!=s(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==s(t)?t:t+""}var f=new(function(){return e=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)},t=[{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("/","/")}}],t&&c(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}());function v(e){return v="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},v(e)}function d(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,y(r.key),r)}}function y(e){var t=function(e){if("object"!=v(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=v(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==v(t)?t:t+""}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(p=function(){return!!e})()}function g(e){return g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},g(e)}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},m(e,t)}var h=new(function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=function(e,t,n){return t=g(t),function(e,t){if(t&&("object"==v(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)}(e,p()?Reflect.construct(t,n||[],g(e).constructor):t.apply(e,n))}(this,t)).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 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)}(t,e),r=t,o=[{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)};f.addEventListener("luigi.init",(function(n){t(n.data),r(n.data.authData),f.setLuigiCoreDomain(n.origin),e.luigiInitialized=!0,e._notifyInit(n.origin),e._tpcCheck(),f.sendPostMessageToLuigiCore({msg:"luigi.init.ok"})})),f.addEventListener("luigi-client.inactive-microfrontend",(function(t){e._notifyInactive(t.origin)})),f.addEventListener("luigi.auth.tokenIssued",(function(e){r(e.data.authData)})),f.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(),f.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)&&f.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=f.getRandomId();return this._onInitFns[n]=e,t&&document.head.setAttribute("disable-tpc-check",""),this.luigiInitialized&&f.isFunction(e)&&e(this.currentContext.context,f.getLuigiCoreDomain()),n}},{key:"removeInitListener",value:function(e){return!!this._onInitFns[e]&&(this._onInitFns[e]=void 0,!0)}},{key:"addContextUpdateListener",value:function(e){var t=f.getRandomId();return this._onContextUpdatedFns[t]=e,this.luigiInitialized&&f.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=f.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 f.addEventListener(e,(function(e,n){return t(e,n)}))}},{key:"removeCustomMessageListener",value:function(e){return f.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(){var e;return null!==(e=this.currentContext.internal.activeFeatureToggleList)&&void 0!==e?e:[]}},{key:"addNodeParams",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e&&f.sendPostMessageToLuigiCore({msg:"luigi.addNodeParams",data:e,keepBrowserHistory:t})}},{key:"getNodeParams",value:function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]?f.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&&f.sendPostMessageToLuigiCore({msg:"luigi.addSearchParams",data:e,keepBrowserHistory:t})}},{key:"getClientPermissions",value:function(){return this.currentContext.internal.clientPermissions||{}}},{key:"setTargetOrigin",value:function(e){f.setTargetOrigin(e)}},{key:"sendCustomMessage",value:function(e){var t=f.convertCustomMessageUserToInternal(e);f.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){f.sendPostMessageToLuigiCore({msg:"luigi.setAnchor",anchor:e})}},{key:"setViewGroupData",value:function(e){f.sendPostMessageToLuigiCore({msg:"luigi.setVGData",data:e})}}],o&&d(r.prototype,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,o}(u));function b(e){return b="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},b(e)}function w(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,k(r.key),r)}}function k(e){var t=function(e){if("object"!=b(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=b(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==b(t)?t:t+""}function C(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(C=function(){return!!e})()}function P(e){return P=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},P(e)}function S(e,t){return S=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},S(e,t)}var x=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t,n){return t=P(t),function(e,t){if(t&&("object"==b(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)}(e,C()?Reflect.construct(t,n||[],P(e).constructor):t.apply(e,n))}(this,t)).validSplitViewEvents=["expand","collapse","resize","close"],n.splitView={exists:!0,size:40,collapsed:!1},Object.assign(n.splitView,e),n.splitView.listeners=[f.addEventListener("luigi.navigation.splitview.internal",(function(e){Object.assign(n.splitView,e.data.data)}))],n.on("resize",(function(e){n.splitView.size=e})),n.on("close",(function(){n.splitView.listeners.forEach((function(e){return f.removeEventListener(e)}))})),n}return 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&&S(e,t)}(t,e),n=t,r=[{key:"sendSplitViewEvent",value:function(e,t){f.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=f.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 f.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}}],r&&w(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);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 j(e,t){return function(e){if(Array.isArray(e))return e}(e)||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,c=!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){c=!0,o=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(e,t)||E(e,t)||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.")}()}function E(e,t){if(e){if("string"==typeof e)return L(e,t);var n={}.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)?L(e,t):void 0}}function L(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}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,T(r.key),r)}}function T(e){var t=function(e){if("object"!=O(e)||!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)}(e);return"symbol"==O(t)?t:t+""}function M(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(M=function(){return!!e})()}function _(e){return _=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_(e)}function A(e,t){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},A(e,t)}var F=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t,n){return t=_(t),function(e,t){if(t&&("object"==O(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)}(e,M()?Reflect.construct(t,n||[],_(e).constructor):t.apply(e,n))}(this,t),Object.assign(n,e),n.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},n}return 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&&A(e,t)}(t,e),n=t,r=[{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:f.hasIntent(e),modal:r,splitView:o,drawer:i})};f.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})};f.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=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="#?intent=";if(r+=e,n&&null!==(t=Object.keys(n))&&void 0!==t&&t.length){var o=Object.entries(n);if(o.length>0){r+="?";var i,a=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=E(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}}}}(o);try{for(a.s();!(i=a.n()).done;){var u=j(i.value,2);r+=u[0]+"="+u[1]+"&"}}catch(e){a.e(e)}finally{a.f()}r=r.slice(0,-1)}}this.navigate(r)}},{key:"openAsModal",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};f.addEventListener("luigi.navigation.modal.close",(function(e,n){var r=t.getPromise("modal");r&&(r.resolveFn(e.data),t.setPromise("modal",void 0)),f.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]};f.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 x(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 f.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=f.getRandomId(),n=this.getPromise("pathExistsPromises")||{};n[t]={resolveFn:function(){},then:function(e){this.resolveFn=e}},this.setPromise("pathExistsPromises",n),f.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)),f.removeEventListener(n))}.bind(this));var r={msg:"luigi.navigation.pathExists",data:Object.assign(this.options,{id:t,link:e,intent:f.hasIntent(e),relative:"/"!==e[0]})};return f.sendPostMessageToLuigiCore(r),n[t]}},{key:"hasBack",value:function(){return!!this.currentContext.internal.modal||0!==this.currentContext.internal.viewStackSize}},{key:"goBack",value:function(e){f.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=f.getRandomId(),n=this.getPromise("getCurrentRoute")||{};return n[t]={resolveFn:function(){},then:function(e){this.resolveFn=e}},this.setPromise("getCurrentRoute",n),f.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)),f.removeEventListener(r)),f.removeEventListener(r)})),f.sendPostMessageToLuigiCore({msg:"luigi.navigation.currentRoute",data:Object.assign(this.options,{id:t})}),n[t]}}],r&&I(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u);function R(e){return R="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},R(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,D(r.key),r)}}function D(e){var t=function(e){if("object"!=R(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=R(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==R(t)?t:t+""}function U(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(U=function(){return!!e})()}function N(e){return N=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},N(e)}function z(e,t){return z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},z(e,t)}var B=new(function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),e=function(e,t,n){return t=N(t),function(e,t){if(t&&("object"==R(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)}(e,U()?Reflect.construct(t,n||[],N(e).constructor):t.apply(e,n))}(this,t),f.addEventListener("luigi.current-locale-changed",(function(e){var t;e.data.currentLocale&&null!==(t=h.currentContext)&&void 0!==t&&t.internal&&(h.currentContext.internal.currentLocale=e.data.currentLocale,h._notifyUpdate())})),e}return 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&&z(e,t)}(t,e),n=t,r=[{key:"showLoadingIndicator",value:function(){f.sendPostMessageToLuigiCore({msg:"luigi.show-loading-indicator"})}},{key:"hideLoadingIndicator",value:function(){f.sendPostMessageToLuigiCore({msg:"luigi.hide-loading-indicator"})}},{key:"closeCurrentModal",value:function(){f.sendPostMessageToLuigiCore({msg:"luigi.close-modal"})}},{key:"addBackdrop",value:function(){f.sendPostMessageToLuigiCore({msg:"luigi.add-backdrop"})}},{key:"removeBackdrop",value:function(){f.sendPostMessageToLuigiCore({msg:"luigi.remove-backdrop"})}},{key:"setDirtyStatus",value:function(e){f.sendPostMessageToLuigiCore({msg:"luigi.set-page-dirty",dirty:e})}},{key:"showConfirmationModal",value:function(e){var t=this;f.addEventListener("luigi.ux.confirmationModal.hide",(function(e,n){t.hideConfirmationModal(e.data.data),f.removeEventListener(n)})),f.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=f.getRandomId(),f.addEventListener("luigi.ux.alert.hide",(function(n,r){n.data.id===e.id&&(t.hideAlert(n.data),f.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),f.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=h.currentContext)||void 0===e||null===(t=e.internal)||void 0===t?void 0:t.currentLocale}},{key:"setCurrentLocale",value:function(e){e&&f.sendPostMessageToLuigiCore({msg:"luigi.ux.set-current-locale",data:{currentLocale:e}})}},{key:"isSplitView",value:function(){var e,t;return null===(e=h.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=h.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=h.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=h.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=h.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=h.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)}}}],r&&V(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(u));function H(e){return H="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},H(e)}function K(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function G(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,q(r.key),r)}}function Q(e,t,n){return t&&G(e.prototype,t),n&&G(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function q(e){var t=function(e){if("object"!=H(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=H(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==H(t)?t:t+""}function J(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(J=function(){return!!e})()}function W(e){return W=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},W(e)}function Y(e,t){return Y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Y(e,t)}var $=new Map,X=function(e){function t(){var e,n,r,o;return K(this,t),(n=this,r=t,r=W(r),e=function(e,t){if(t&&("object"==H(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)}(n,J()?Reflect.construct(r,o||[],W(n).constructor):r.apply(n,o))).storageEventProcessor=new Z,f.addEventListener("storage",(function(t,n){return e.storageEventProcessor.processEvent(t,n)})),e}return 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&&Y(e,t)}(t,e),Q(t,[{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",{})}))}}])}(u),Z=function(){return Q((function e(){K(this,e)}),[{key:"processEvent",value:function(e,t){try{var n=e.data.data;if(!$.has(n.id))return void console.log("Impossible to find Promise method for message "+n.id);var r=$.get(n.id);"ERROR"===n.status?r.reject(n.result):r.resolve(n.result),$.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 $.delete(e),n}},{key:"execute",value:function(e,t,n,r){var o=f.getRandomId();this.createPendingOperation(o,e,t),this.sendMessage(o,n,r)}},{key:"createPendingOperation",value:function(e,t,n){$.set(e,{resolve:t,reject:n})}},{key:"sendMessage",value:function(e,t,n){f.sendPostMessageToLuigiCore({msg:"storage",data:{id:e,operation:t,params:n}})}}])}(),ee=new X;function te(e){return te="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},te(e)}function ne(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,re(r.key),r)}}function re(e){var t=function(e){if("object"!=te(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=te(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==te(t)?t:t+""}var oe=function(){return e=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}};f.sendPostMessageToLuigiCore(t)})))},(t=[{key:"addInitListener",value:function(e,t){return h.addInitListener(e,t)}},{key:"removeInitListener",value:function(e){return h.removeInitListener(e)}},{key:"addContextUpdateListener",value:function(e){return h.addContextUpdateListener(e)}},{key:"removeContextUpdateListener",value:function(e){return h.removeContextUpdateListener(e)}},{key:"getToken",value:function(){return h.getToken()}},{key:"getEventData",value:function(){return h.getEventData()}},{key:"getContext",value:function(){return h.getContext()}},{key:"addNodeParams",value:function(e,t){return h.addNodeParams(e,t)}},{key:"getNodeParams",value:function(e){return h.getNodeParams(e)}},{key:"getActiveFeatureToggles",value:function(){return h.getActiveFeatureToggles()}},{key:"getPathParams",value:function(){return h.getPathParams()}},{key:"getCoreSearchParams",value:function(){return h.getCoreSearchParams()}},{key:"addCoreSearchParams",value:function(e,t){return h.addCoreSearchParams(e,t)}},{key:"getClientPermissions",value:function(){return h.getClientPermissions()}},{key:"sendCustomMessage",value:function(e){return h.sendCustomMessage(e)}},{key:"addCustomMessageListener",value:function(e,t){return h.addCustomMessageListener(e,t)}},{key:"removeCustomMessageListener",value:function(e){return h.removeCustomMessageListener(e)}},{key:"addInactiveListener",value:function(e,t){return h.addInactiveListener(e,t)}},{key:"removeInactiveListener",value:function(e){return h.removeInactiveListener(e)}},{key:"setTargetOrigin",value:function(e){return h.setTargetOrigin(e)}},{key:"getUserSettings",value:function(){return h.getUserSettings()}},{key:"isLuigiClientInitialized",value:function(){return h.isLuigiClientInitialized()}},{key:"luigiClientInit",value:function(){return h.luigiClientInit()}},{key:"getAnchor",value:function(){return h.getAnchor()}},{key:"setAnchor",value:function(e){return h.setAnchor(e)}},{key:"setViewGroupData",value:function(e){return h.setViewGroupData(e)}},{key:"linkManager",value:function(){return new F({currentContext:h.currentContext})}},{key:"uxManager",value:function(){return B}},{key:"lifecycleManager",value:function(){return h}},{key:"storageManager",value:function(){return ee}}])&&ne(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();const ie=oe=new oe;return r.default})()));
|
|
2
2
|
//# sourceMappingURL=luigi-client.js.map
|
package/package.json
CHANGED