@ixon-cdk/iframe-adapter 1.19.0-next.0 → 1.19.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/dist/index.js +417 -588
- package/dist/index.umd.cjs +1 -1
- package/package.json +2 -5
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(g,i){typeof exports=="object"&&typeof module<"u"?i(exports):typeof define=="function"&&define.amd?define(["exports"],i):(g=typeof globalThis<"u"?globalThis:g||self,i(g["@ixon-cdk/iframe-adapter"]={}))})(this,function(g){"use strict";var Ot=Object.defineProperty;var $t=(g,i,s)=>i in g?Ot(g,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):g[i]=s;var p=(g,i,s)=>($t(g,typeof i!="symbol"?i+"":i,s),s);const i="cdk:cmpctx:",s={Create:`${i}create`,Created:`${i}created`,Destroy:`${i}destroy`,BackendComponentClientCreate:`${i}bcc:create`,BackendComponentClientDestroy:`${i}bcc:destroy`,BackendComponentClientCall:`${i}bcc:call`,BackendComponentClientCallResult:`${i}bcc:callresult`,LoggingDataClientCreate:`${i}ldc:create`,LoggingDataClientDestroy:`${i}ldc:destroy`,LoggingDataClientQuery:`${i}ldc:query`,LoggingDataClientQueryResult:`${i}ldc:queryresult`,ResourceDataClientCreate:`${i}rdc:create`,ResourceDataClientDestroy:`${i}rdc:destroy`,ResourceDataClientQuery:`${i}rdc:query`,ResourceDataClientQueryResult:`${i}rdc:queryresult`,ResourceDataClientRender:`${i}rdc:render`,ResourceDataClientRenderResult:`${i}rdc:renderresult`,ResourceDataClientUpdate:`${i}rdc:update`,ResourceDataClientUpdated:`${i}rdc:updated`,OpenActionMenu:`${i}openactionmenu`,OpenActionMenuResult:`${i}openactionmenuresult`,OpenActionBottomSheet:`${i}openactionbottomsheet`,OpenActionBottomSheetResult:`${i}openactionbottomsheetresult`,OpenAlertDialog:`${i}openalertdialog`,OpenAlertDialogResult:`${i}openalertdialogresult`,OpenConfirmDialog:`${i}openconfirmdialog`,OpenConfirmDialogResult:`${i}openconfirmdialogresult`,OpenContentDialog:`${i}opencontentdialog`,OpenContentDialogResult:`${i}opencontentdialogresult`,OpenFormDialog:`${i}openformdialog`,OpenFormDialogResult:`${i}openformdialogresult`,OpenSelectPanel:`${i}openselectpanel`,OpenSelectPanelResult:`${i}openselectpanelresult`,OpenToast:`${i}opentoast`,OpenToastResult:`${i}opentoastresult`,ShowVpnStatusDetails:`${i}showvpnstatusdetails`,ToggleVpn:`${i}togglevpn`,VpnClientStatusChange:`${i}vpnclientstatuschange`,NavigateByUrl:`${i}navigatebyurl`,SetTimeRange:`${i}settimerange`,TimeRangeChange:`${i}timerangechange`},Z=["color-scheme","background","on-background","primary","on-primary","secondary","on-secondary","error","on-error","success","on-success"];function ee({iframe:t,context:e}){return window.addEventListener("message",a,!1),e.ontimerangechange=(...o)=>{t.contentWindow&&t.contentWindow.postMessage({type:s.TimeRangeChange,payload:o},"*")},e.onvpnclientstatuschange=(...o)=>{t.contentWindow&&t.contentWindow.postMessage({type:s.VpnClientStatusChange,payload:o},"*")},{destroy(){window.removeEventListener("message",a,!1)}};function n(o){return{_apiLinkEntries:[...o._getApiLinks().entries()],_designTokenEntries:Z.map(r=>[r,o.getDesignToken(r)]),appData:o.appData,componentBaseUrl:o.componentBaseUrl,destroyed:o.destroyed,mode:o.mode,inputs:o.inputs,timeRange:o.timeRange,timeRangeIsAdjustable:o.timeRangeIsAdjustable,vpnClientStatus:o.vpnClientStatus}}function a(o){if(a._clients=a._clients||new Map([]),o.source===t.contentWindow)switch(o.data.type){case s.Create:t.contentWindow.postMessage({type:s.Created,payload:n(e)},"*");break;case s.Destroy:e.destroy();break;case s.BackendComponentClientCreate:{const{clientId:r}=o.data.payload,l=e.createBackendComponentClient(r);a._clients.set(r,l);break}case s.BackendComponentClientDestroy:{const{clientId:r}=o.data.payload;a._clients.has(r)&&(a._clients.get(r).destroy(),a._clients.delete(r));break}case s.BackendComponentClientCall:{const{clientId:r,callId:l,functionName:c,functionArguments:d}=o.data.payload;let u=a._clients.get(r);u&&!u._destroyed&&u.call(c,d).then(f=>{u&&!u.destroyed&&t.contentWindow.postMessage({type:s.BackendComponentClientCallResult,payload:{callId:l,result:f}},"*")});break}case s.LoggingDataClientCreate:{const{clientId:r}=o.data.payload,l=e.createLoggingDataClient(r);a._clients.set(r,l);break}case s.LoggingDataClientDestroy:{const{clientId:r}=o.data.payload;a._clients.has(r)&&(a._clients.get(r).destroy(),a._clients.delete(r));break}case s.LoggingDataClientQuery:{const{clientId:r,queryId:l,query:c}=o.data.payload;let d=a._clients.get(r);d&&!d._destroyed&&d.query(c,u=>{d._destroyed||t.contentWindow.postMessage({type:s.LoggingDataClientQueryResult,payload:{queryId:l,results:u}},"*")});break}case s.ResourceDataClientCreate:{const{clientId:r}=o.data.payload,l=e.createResourceDataClient(r);a._clients.set(r,l);break}case s.ResourceDataClientDestroy:{const{clientId:r}=o.data.payload;a._clients.has(r)&&(a._clients.get(r).destroy(),a._clients.delete(r));break}case s.ResourceDataClientQuery:{const{clientId:r,queryId:l,query:c}=o.data.payload;let d=a._clients.get(r);d&&!d._destroyed&&d.query(c,u=>{d._destroyed||t.contentWindow.postMessage({type:s.ResourceDataClientQueryResult,payload:{queryId:l,results:u}},"*")});break}case s.ResourceDataClientRender:{const{clientId:r,queryId:l,query:c}=o.data.payload;let d=a._clients.get(r);d&&!d._destroyed&&d.render(c,u=>{d._destroyed||t.contentWindow.postMessage({type:s.ResourceDataClientRenderResult,payload:{queryId:l,results:u}},"*")});break}case s.ResourceDataClientUpdate:{const{clientId:r,updateId:l,update:c}=o.data.payload;let d=a._clients.get(r);d&&!d._destroyed&&d.update(c).then(()=>{d&&!d._destroyed&&t.contentWindow.postMessage({type:s.ResourceDataClientUpdated,payload:{updateId:l}},"*")});break}case s.OpenActionBottomSheet:e.openActionBottomSheet(o.data.payload.options).then(r=>{t.contentWindow.postMessage({type:s.OpenActionBottomSheetResult,payload:{result:r}},"*")});break;case s.OpenActionMenu:{const r=t.contentDocument.querySelector(o.data.payload.selector),l={getBoundingClientRect:()=>{const c=t.getBoundingClientRect(),d=r.getBoundingClientRect();return{...JSON.parse(JSON.stringify(d)),top:c.top+d.top,x:c.x+d.x}}};e.openActionMenu(l,o.data.payload.options).then(c=>{t.contentWindow.postMessage({type:s.OpenActionMenuResult,payload:{result:c}},"*")})}break;case s.OpenAlertDialog:e.openAlertDialog(o.data.payload.options).then(r=>{t.contentWindow.postMessage({type:s.OpenAlertDialogResult,payload:{result:r}},"*")});break;case s.OpenConfirmDialog:e.openConfirmDialog(o.data.payload.options).then(r=>{t.contentWindow.postMessage({type:s.OpenConfirmDialogResult,payload:{result:r}},"*")});break;case s.OpenContentDialog:e.openContentDialog(o.data.payload.options).then(r=>{t.contentWindow.postMessage({type:s.OpenContentDialogResult,payload:{result:r}},"*")});break;case s.OpenFormDialog:e.openFormDialog(o.data.payload.options).then(r=>{t.contentWindow.postMessage({type:s.OpenFormDialogResult,payload:{result:r}},"*")});break;case s.OpenSelectPanel:{const r=t.contentDocument.querySelector(o.data.payload.selector),l={getBoundingClientRect:()=>{const c=t.getBoundingClientRect(),d=r.getBoundingClientRect();return{...JSON.parse(JSON.stringify(d)),top:c.top+d.top,x:c.x+d.x}}};e.openSelectPanel(l,o.data.payload.options).then(c=>{t.contentWindow.postMessage({type:s.OpenSelectPanelResult,payload:{result:c}},"*")})}break;case s.OpenToast:e.openToast(o.data.payload.options).then(r=>{const{id:l}=o.data.payload;t.contentWindow&&t.contentWindow.postMessage({type:s.OpenToastResult,payload:{id:l,result:r}},"*")});break;case s.ShowVpnStatusDetails:e.showVpnStatusDetails(o.data.payload.agentId);break;case s.ToggleVpn:e.toggleVpn(o.data.payload.agentId);break;case s.NavigateByUrl:e.navigateByUrl(o.data.payload.url);break;case s.SetTimeRange:e.setTimeRange(o.data.payload.timeRange);break}}}class te{constructor(e,n,a,o){this.query=e,this.variable=n,this.tag=a,this._onCancel=o,Object.freeze(this)}cancel(){this._onCancel&&this._onCancel()}}var ne=typeof global=="object"&&global&&global.Object===Object&&global;const ae=ne;var oe=typeof self=="object"&&self&&self.Object===Object&&self,re=ae||oe||Function("return this")();const I=re;var se=I.Symbol;const R=se;var k=Object.prototype,ie=k.hasOwnProperty,le=k.toString,_=R?R.toStringTag:void 0;function de(t){var e=ie.call(t,_),n=t[_];try{t[_]=void 0;var a=!0}catch{}var o=le.call(t);return a&&(e?t[_]=n:delete t[_]),o}var ce=Object.prototype,ue=ce.toString;function pe(t){return ue.call(t)}var ge="[object Null]",ye="[object Undefined]",N=R?R.toStringTag:void 0;function fe(t){return t==null?t===void 0?ye:ge:N&&N in Object(t)?de(t):pe(t)}function P(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var he="[object AsyncFunction]",me="[object Function]",we="[object GeneratorFunction]",Ce="[object Proxy]";function _e(t){if(!P(t))return!1;var e=fe(t);return e==me||e==we||e==he||e==Ce}var De=I["__core-js_shared__"];const L=De;var j=function(){var t=/[^.]+$/.exec(L&&L.keys&&L.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Re(t){return!!j&&j in t}var be=Function.prototype,Se=be.toString;function Oe(t){if(t!=null){try{return Se.call(t)}catch{}try{return t+""}catch{}}return""}var $e=/[\\^$.*+?()[\]{}|]/g,Me=/^\[object .+?Constructor\]$/,Te=Function.prototype,ve=Object.prototype,Ee=Te.toString,Ie=ve.hasOwnProperty,Le=RegExp("^"+Ee.call(Ie).replace($e,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function qe(t){if(!P(t)||Re(t))return!1;var e=_e(t)?Le:Me;return e.test(Oe(t))}function Ae(t,e){return t==null?void 0:t[e]}function B(t,e){var n=Ae(t,e);return qe(n)?n:void 0}function Ue(t,e){return t===e||t!==t&&e!==e}var ke=B(Object,"create");const D=ke;function Ne(){this.__data__=D?D(null):{},this.size=0}function Pe(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var je="__lodash_hash_undefined__",Be=Object.prototype,Fe=Be.hasOwnProperty;function He(t){var e=this.__data__;if(D){var n=e[t];return n===je?void 0:n}return Fe.call(e,t)?e[t]:void 0}var Ve=Object.prototype,We=Ve.hasOwnProperty;function ze(t){var e=this.__data__;return D?e[t]!==void 0:We.call(e,t)}var Qe="__lodash_hash_undefined__";function Ge(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=D&&e===void 0?Qe:e,this}function m(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var a=t[e];this.set(a[0],a[1])}}m.prototype.clear=Ne,m.prototype.delete=Pe,m.prototype.get=He,m.prototype.has=ze,m.prototype.set=Ge;function Je(){this.__data__=[],this.size=0}function b(t,e){for(var n=t.length;n--;)if(Ue(t[n][0],e))return n;return-1}var Ke=Array.prototype,Xe=Ke.splice;function xe(t){var e=this.__data__,n=b(e,t);if(n<0)return!1;var a=e.length-1;return n==a?e.pop():Xe.call(e,n,1),--this.size,!0}function Ye(t){var e=this.__data__,n=b(e,t);return n<0?void 0:e[n][1]}function Ze(t){return b(this.__data__,t)>-1}function et(t,e){var n=this.__data__,a=b(n,t);return a<0?(++this.size,n.push([t,e])):n[a][1]=e,this}function C(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var a=t[e];this.set(a[0],a[1])}}C.prototype.clear=Je,C.prototype.delete=xe,C.prototype.get=Ye,C.prototype.has=Ze,C.prototype.set=et;var tt=B(I,"Map");const nt=tt;function at(){this.size=0,this.__data__={hash:new m,map:new(nt||C),string:new m}}function ot(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function S(t,e){var n=t.__data__;return ot(e)?n[typeof e=="string"?"string":"hash"]:n.map}function rt(t){var e=S(this,t).delete(t);return this.size-=e?1:0,e}function st(t){return S(this,t).get(t)}function it(t){return S(this,t).has(t)}function lt(t,e){var n=S(this,t),a=n.size;return n.set(t,e),this.size+=n.size==a?0:1,this}function w(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var a=t[e];this.set(a[0],a[1])}}w.prototype.clear=at,w.prototype.delete=rt,w.prototype.get=st,w.prototype.has=it,w.prototype.set=lt;var dt="Expected a function";function q(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(dt);var n=function(){var a=arguments,o=e?e.apply(this,a):a[0],r=n.cache;if(r.has(o))return r.get(o);var l=t.apply(this,a);return n.cache=r.set(o,l)||r,l};return n.cache=new(q.Cache||w),n}q.Cache=w;const ct=2,F=1,H="";class O{constructor(e,n,a){this.locale=e,this.queryRef=n,this.rawValue=a}static create(e,n,a){return n.query.postAggr==="count"?new ut(e,n,a):new O(e,n,a)}getDecimals(e=ct){return this.decimals??this.queryRef.query.decimals??e}getFactor(){var e,n,a;return this.factor??this.queryRef.query.factor??((n=(e=this.queryRef.tag)==null?void 0:e.variable)!=null&&n.factor?parseFloat(this.queryRef.tag.variable.factor):null)??((a=this.queryRef.variable)!=null&&a.factor?parseFloat(this.queryRef.variable.factor):null)??F}getUnit(){var e,n,a;return this.unit??this.queryRef.query.unit??((n=(e=this.queryRef.tag)==null?void 0:e.variable)==null?void 0:n.unit)??((a=this.queryRef.variable)==null?void 0:a.unit)??H}setDecimals(e){this.decimals=e}setFactor(e){this.factor=e}setUnit(e){this.unit=e}getValue(){return this.rawValue}toString(){var a,o,r,l;const e=this.locale??void 0,n=q((c,d,u,f)=>{const St={style:"decimal",minimumFractionDigits:Math.floor(d),maximumFractionDigits:Math.floor(d)};return`${new Intl.NumberFormat(f,St).format(c)}${u?" "+u:""}`});return this.rawValue===null?"":this.queryRef.query.postAggr==="count"?n(this.rawValue,this.getDecimals(0),this.unit??this.queryRef.query.unit,e):((a=this.queryRef.variable)==null?void 0:a.type)==="str"?this.rawValue:((o=this.queryRef.variable)==null?void 0:o.type)==="bool"?this.rawValue?"True":"False":((r=this.queryRef.variable)==null?void 0:r.type)==="int"?n(this.rawValue,Number.isInteger(this.getFactor())?this.getDecimals(0):this.getDecimals(),this.getUnit(),e):((l=this.queryRef.variable)==null?void 0:l.type)==="float"?n(this.rawValue,this.getDecimals(),this.getUnit(),e):String(this.getValue())}}class ut extends O{getFactor(){return this.factor??this.queryRef.query.factor??F}getUnit(){return this.unit??this.queryRef.query.unit??H}}function V(t){return t.map(({queryRef:n,time:a,value:o})=>{const r=new te(n.query,n.variable,n.tag),l=O.create(o.locale,r,o.rawValue);return{queryRef:r,time:a,value:l}})}let y,A,W;function z(t,e){if(W=new Date,t.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if(t.tagName.toLowerCase()==="html")return"html";const n={root:document.body,idName:o=>!0,className:o=>!0,tagName:o=>!0,attr:(o,r)=>!1,seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4,timeoutMs:void 0};y={...n,...e},A=pt(y.root,n);let a=$(t,"all",()=>$(t,"two",()=>$(t,"one",()=>$(t,"none"))));if(a){const o=x(Y(a,t));return o.length>0&&(a=o[0]),M(a)}else throw new Error("Selector was not found.")}function pt(t,e){return t.nodeType===Node.DOCUMENT_NODE?t:t===e.root?t.ownerDocument:t}function $(t,e,n){let a=null,o=[],r=t,l=0;for(;r;){const c=new Date().getTime()-W.getTime();if(y.timeoutMs!==void 0&&c>y.timeoutMs)throw new Error(`Timeout: Can't find a unique selector after ${c}ms`);let d=v(gt(r))||v(...yt(r))||v(...ft(r))||v(ht(r))||[K()];const u=mt(r);if(e=="all")u&&(d=d.concat(d.filter(U).map(f=>T(f,u))));else if(e=="two")d=d.slice(0,1),u&&(d=d.concat(d.filter(U).map(f=>T(f,u))));else if(e=="one"){const[f]=d=d.slice(0,1);u&&U(f)&&(d=[T(f,u)])}else e=="none"&&(d=[K()],u&&(d=[T(d[0],u)]));for(let f of d)f.level=l;if(o.push(d),o.length>=y.seedMinLength&&(a=Q(o,n),a))break;r=r.parentElement,l++}return a||(a=Q(o,n)),!a&&n?n():a}function Q(t,e){const n=x(X(t));if(n.length>y.threshold)return e?e():null;for(let a of n)if(J(a))return a;return null}function M(t){let e=t[0],n=e.name;for(let a=1;a<t.length;a++){const o=t[a].level||0;e.level===o-1?n=`${t[a].name} > ${n}`:n=`${t[a].name} ${n}`,e=t[a]}return n}function G(t){return t.map(e=>e.penalty).reduce((e,n)=>e+n,0)}function J(t){const e=M(t);switch(A.querySelectorAll(e).length){case 0:throw new Error(`Can't select any node with this selector: ${e}`);case 1:return!0;default:return!1}}function gt(t){const e=t.getAttribute("id");return e&&y.idName(e)?{name:"#"+CSS.escape(e),penalty:0}:null}function yt(t){return Array.from(t.attributes).filter(n=>y.attr(n.name,n.value)).map(n=>({name:`[${CSS.escape(n.name)}="${CSS.escape(n.value)}"]`,penalty:.5}))}function ft(t){return Array.from(t.classList).filter(y.className).map(n=>({name:"."+CSS.escape(n),penalty:1}))}function ht(t){const e=t.tagName.toLowerCase();return y.tagName(e)?{name:e,penalty:2}:null}function K(){return{name:"*",penalty:3}}function mt(t){const e=t.parentNode;if(!e)return null;let n=e.firstChild;if(!n)return null;let a=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&a++,n!==t);)n=n.nextSibling;return a}function T(t,e){return{name:t.name+`:nth-child(${e})`,penalty:t.penalty+1}}function U(t){return t.name!=="html"&&!t.name.startsWith("#")}function v(...t){const e=t.filter(wt);return e.length>0?e:null}function wt(t){return t!=null}function*X(t,e=[]){if(t.length>0)for(let n of t[0])yield*X(t.slice(1,t.length),e.concat(n));else yield e}function x(t){return[...t].sort((e,n)=>G(e)-G(n))}function*Y(t,e,n={counter:0,visited:new Map}){if(t.length>2&&t.length>y.optimizedMinLength)for(let a=1;a<t.length-1;a++){if(n.counter>y.maxNumberOfTries)return;n.counter+=1;const o=[...t];o.splice(a,1);const r=M(o);if(n.visited.has(r))return;J(o)&&Ct(o,e)&&(yield o,n.visited.set(r,!0),yield*Y(o,e,n))}}function Ct(t,e){return A.querySelector(M(t))===e}class h extends Error{constructor(e="Method is not implemented"){super(e),this.name="NotImplementedError",this.message=e,this.stack=`NotImplementedError: ${e}`}}class _t{constructor(e){p(this,"ontimerangechange",null);p(this,"onvpnclientstatuschange",null);p(this,"_getApiLinks");p(this,"_getDesignTokens");p(this,"appData");p(this,"componentBaseUrl");p(this,"destroyed");p(this,"mode");p(this,"inputs");p(this,"inputMap");p(this,"timeRange");p(this,"timeRangeIsAdjustable");p(this,"vpnClientStatus");p(this,"getDesignToken");this._getApiLinks=()=>new Map(e._apiLinkEntries),this._getDesignTokens=()=>new Map(e._designTokenEntries),this.appData=e.appData,this.componentBaseUrl=e.componentBaseUrl,this.destroyed=e.destroyed,this.mode=e.mode,this.inputs=e.inputs,this.inputMap=new Map(Object.entries(this.inputs)),this.timeRange=e.timeRange,this.timeRangeIsAdjustable=e.timeRangeIsAdjustable,this.vpnClientStatus=e.vpnClientStatus,this._messageHandler=this._messageHandler.bind(this),window.addEventListener("message",this._messageHandler,!1);const n=r=>this._getDesignTokens().get(r)??"";n.var=r=>`var(--uic-${r})`,this.getDesignToken=n;const a=new CSSStyleSheet,o=e._designTokenEntries.map(([r,l])=>`--uic-${r}:${l}`);a.replaceSync(`:root {${o.join(";")}}`),window.document.adoptedStyleSheets.push(a)}_messageHandler(e){if(e.source===window.parent)switch(e.data.type){case s.TimeRangeChange:this.ontimerangechange&&this.ontimerangechange(...e.data.payload);break;case s.VpnClientStatusChange:this.onvpnclientstatuschange&&this.onvpnclientstatuschange(...e.data.payload);break}}createBackendComponentClient(){const e=crypto.randomUUID();return window.parent.postMessage({type:s.BackendComponentClientCreate,payload:{clientId:e}},"*"),new Dt(e)}createLoggingDataClient(){const e=crypto.randomUUID();return window.parent.postMessage({type:s.LoggingDataClientCreate,payload:{clientId:e}},"*"),new Rt(e)}createObjectStorageClient(){throw new h}createResourceDataClient(){const e=crypto.randomUUID();return window.parent.postMessage({type:s.ResourceDataClientCreate,payload:{clientId:e}},"*"),new bt(e)}createTooltip(){throw new h}destroy(){window.parent.postMessage({type:s.Destroy},"*"),window.removeEventListener("message",this._messageHandler,!1),this.destroyed=!0}getApiUrl(e,n){const a=this._getApiLinks().get(e);if(!a)throw new Error("IxApiError: entry not found");return n?Object.keys(n).sort().reduce((o,r)=>{if(o.includes(`{${r}}`))return o.replace(`{${r}}`,n[r]);const l=new URL(o);return l.searchParams.set(r,n[r]),decodeURIComponent(l.href)},a.href):a.href}navigateByUrl(e){window.parent.postMessage({type:s.NavigateByUrl,payload:{url:e}},"*")}openActionBottomSheet(e){return new Promise(n=>{window.addEventListener("message",a,!1),window.parent.postMessage({type:s.OpenActionBottomSheet,payload:{options:e}},"*");function a(o){o.source===window.parent&&o.data.type===s.OpenActionBottomSheetResult&&(window.removeEventListener("message",a,!1),n(o.data.payload.result))}})}openActionMenu(e,n){return new Promise(a=>{window.addEventListener("message",o,!1),window.parent.postMessage({type:s.OpenActionMenu,payload:{selector:z(e),options:n}},"*");function o(r){r.source===window.parent&&r.data.type===s.OpenActionMenuResult&&(window.removeEventListener("message",o,!1),a(r.data.payload.result))}})}openAlertDialog(e){return new Promise(n=>{window.addEventListener("message",a,!1),window.parent.postMessage({type:s.OpenAlertDialog,payload:{options:e}},"*");function a(o){o.source===window.parent&&o.data.type===s.OpenAlertDialogResult&&(window.removeEventListener("message",a,!1),n(o.data.payload.result))}})}openConfirmDialog(e){return new Promise(n=>{window.addEventListener("message",a,!1),window.parent.postMessage({type:s.OpenConfirmDialog,payload:{options:e}},"*");function a(o){o.source===window.parent&&o.data.type===s.OpenConfirmDialogResult&&(window.removeEventListener("message",a,!1),n(o.data.payload.result))}})}openContentDialog(e){if(typeof e.onopened=="function")throw new h('The "onopened" option is not implemented');if(typeof e.onclose=="function")throw new h('The "onclose" option is not implemented');if(e.pagination)throw new h('The "pagination" option is not implemented');return new Promise(n=>{window.addEventListener("message",a,!1),window.parent.postMessage({type:s.OpenContentDialog,payload:{options:e.htmlContent&&typeof e.htmlContent!="string"?{...e,htmlContent:e.htmlContent.cloneNode(!0).outerHTML}:e}},"*");function a(o){o.source===window.parent&&o.data.type===s.OpenContentDialogResult&&(window.removeEventListener("message",a,!1),n(o.data.payload.result))}})}openFormDialog(e){return new Promise(n=>{window.addEventListener("message",a,!1),window.parent.postMessage({type:s.OpenFormDialog,payload:{options:e}},"*");function a(o){o.source===window.parent&&o.data.type===s.OpenFormDialogResult&&(window.removeEventListener("message",a,!1),n(o.data.payload.result))}})}openSelectPanel(e,n){return new Promise(a=>{window.addEventListener("message",o,!1),window.parent.postMessage({type:s.OpenSelectPanel,payload:{selector:z(e),options:n}},"*");function o(r){r.source===window.parent&&r.data.type===s.OpenSelectPanelResult&&(window.removeEventListener("message",o,!1),a(r.data.payload.result))}})}openToast(...e){return new Promise(n=>{window.addEventListener("message",r,!1);const a=crypto.randomUUID(),o=typeof e[0]=="string"?{...e[1],message:e[0]}:e[0];window.parent.postMessage({type:s.OpenToast,payload:{id:a,options:o}},"*");function r(l){l.source===window.parent&&l.data.type===s.OpenToastResult&&l.data.payload.id===a&&(window.removeEventListener("message",r,!1),n(l.data.payload.result))}})}sanitizeHtml(){throw new h}saveAsFile(){throw new h}setTimeRange(e){window.parent.postMessage({type:s.SetTimeRange,payload:{timeRange:e}},"*")}showVpnStatusDetails(e){window.parent.postMessage({type:s.ShowVpnStatusDetails,payload:{agentId:e}},"*")}testVpnAccess(){throw new h}toggleVpn(e){window.parent.postMessage({type:s.ToggleVpn,payload:{agentId:e}},"*")}translate(){throw new h}}class Dt{constructor(e){this.id=e}call(e,n){return new Promise(a=>{const o=crypto.randomUUID();window.addEventListener("message",r,!1),window.parent.postMessage({type:s.BackendComponentClientCall,payload:{clientId:this.id,callId:o,functionName:e,functionArguments:n}},"*");function r(l){l.source===window.parent&&l.data.type===s.BackendComponentClientCallResult&&l.data.payload.callId===o&&(window.removeEventListener("message",r,!1),a(l.data.payload.result))}})}destroy(){window.parent.postMessage({type:s.BackendComponentClientDestroy,payload:{clientId:this.id}},"*")}}class Rt{constructor(e){this.id=e}query(e,n){const a=crypto.randomUUID();return window.addEventListener("message",o,!1),window.parent.postMessage({type:s.LoggingDataClientQuery,payload:{clientId:this.id,queryId:a,query:e}},"*"),()=>{window.removeEventListener("message",o,!1)};function o(r){if(r.source===window.parent&&r.data.type===s.LoggingDataClientQueryResult&&r.data.payload.queryId===a){const{results:l}=r.data.payload;if(e.length)if(!e.queries||e.format!=="csv"){const c=l.map(d=>V(d));n(c)}else throw new h;else{const c=V(l);n(c)}}}}destroy(){window.parent.postMessage({type:s.LoggingDataClientDestroy,payload:{clientId:this.id}},"*")}}class bt{constructor(e){this.id=e}query(e,n){const a=crypto.randomUUID();return window.addEventListener("message",o,!1),window.parent.postMessage({type:s.ResourceDataClientQuery,payload:{clientId:this.id,queryId:a,query:e}},"*"),()=>{window.removeEventListener("message",o,!1)};function o(r){r.source===window.parent&&r.data.type===s.ResourceDataClientQueryResult&&r.data.payload.queryId===a&&n(r.data.payload.results)}}update(e){return new Promise(n=>{const a=crypto.randomUUID();window.addEventListener("message",o,!1),window.parent.postMessage({type:s.ResourceDataClientUpdate,payload:{clientId:this.id,updateId:a,update:e}},"*");function o(r){r.source===window.parent&&r.data.type===s.ResourceDataClientUpdated&&r.data.payload.updateId===a&&(window.removeEventListener("message",o,!1),n())}})}render(e,n){const a=crypto.randomUUID();return window.addEventListener("message",o,!1),window.parent.postMessage({type:s.ResourceDataClientRender,payload:{clientId:this.id,queryId:a,query:e}},"*"),()=>{window.removeEventListener("message",o,!1)};function o(r){r.source===window.parent&&r.data.type===s.ResourceDataClientRenderResult&&r.data.payload.queryId===a&&n(r.data.payload.results)}}destroy(){window.parent.postMessage({type:s.ResourceDataClientDestroy,payload:{clientId:this.id}},"*")}}function E(t){const e=!!(t&&t.migrateInputs);return!e&&E.__cache__?Promise.resolve(E.__cache__):new Promise(n=>{window.addEventListener("message",function a(o){if(o.source===window.parent&&o.data&&o.data.type===s.Created){let r=o.data.payload;e&&(r.inputs=t.migrateInputs(r.inputs,null));const l=new _t(r);n(l),e||(E.__cache__=l),window.removeEventListener("message",a,!1)}},!1),window.parent.postMessage({type:s.Create},"*")})}g.connect=ee,g.getComponentContext=E,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(g,l){typeof exports=="object"&&typeof module<"u"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(g=typeof globalThis<"u"?globalThis:g||self,l(g["@ixon-cdk/iframe-adapter"]={}))})(this,function(g){"use strict";var tt=Object.defineProperty;var at=(g,l,r)=>l in g?tt(g,l,{enumerable:!0,configurable:!0,writable:!0,value:r}):g[l]=r;var p=(g,l,r)=>(at(g,typeof l!="symbol"?l+"":l,r),r);const l="cdk:cmpctx:",r={Create:`${l}create`,Created:`${l}created`,Destroy:`${l}destroy`,BackendComponentClientCreate:`${l}bcc:create`,BackendComponentClientDestroy:`${l}bcc:destroy`,BackendComponentClientCall:`${l}bcc:call`,BackendComponentClientCallResult:`${l}bcc:callresult`,LoggingDataClientCreate:`${l}ldc:create`,LoggingDataClientDestroy:`${l}ldc:destroy`,LoggingDataClientQuery:`${l}ldc:query`,LoggingDataClientQueryResult:`${l}ldc:queryresult`,ResourceDataClientCreate:`${l}rdc:create`,ResourceDataClientDestroy:`${l}rdc:destroy`,ResourceDataClientQuery:`${l}rdc:query`,ResourceDataClientQueryResult:`${l}rdc:queryresult`,ResourceDataClientRender:`${l}rdc:render`,ResourceDataClientRenderResult:`${l}rdc:renderresult`,ResourceDataClientUpdate:`${l}rdc:update`,ResourceDataClientUpdated:`${l}rdc:updated`,OpenActionMenu:`${l}openactionmenu`,OpenActionMenuResult:`${l}openactionmenuresult`,OpenActionBottomSheet:`${l}openactionbottomsheet`,OpenActionBottomSheetResult:`${l}openactionbottomsheetresult`,OpenAlertDialog:`${l}openalertdialog`,OpenAlertDialogResult:`${l}openalertdialogresult`,OpenConfirmDialog:`${l}openconfirmdialog`,OpenConfirmDialogResult:`${l}openconfirmdialogresult`,OpenContentDialog:`${l}opencontentdialog`,OpenContentDialogResult:`${l}opencontentdialogresult`,OpenFormDialog:`${l}openformdialog`,OpenFormDialogResult:`${l}openformdialogresult`,OpenSelectPanel:`${l}openselectpanel`,OpenSelectPanelResult:`${l}openselectpanelresult`,OpenToast:`${l}opentoast`,OpenToastResult:`${l}opentoastresult`,ShowVpnStatusDetails:`${l}showvpnstatusdetails`,ToggleVpn:`${l}togglevpn`,VpnClientStatusChange:`${l}vpnclientstatuschange`,NavigateByUrl:`${l}navigatebyurl`,SetTimeRange:`${l}settimerange`,TimeRangeChange:`${l}timerangechange`},j=["color-scheme","background","on-background","primary","on-primary","secondary","on-secondary","error","on-error","success","on-success"];function P({iframe:t,context:e}){return window.addEventListener("message",o,!1),e.ontimerangechange=(...n)=>{t.contentWindow&&t.contentWindow.postMessage({type:r.TimeRangeChange,payload:n},"*")},e.onvpnclientstatuschange=(...n)=>{t.contentWindow&&t.contentWindow.postMessage({type:r.VpnClientStatusChange,payload:n},"*")},{destroy(){window.removeEventListener("message",o,!1)}};function s(n){return{_apiLinkEntries:[...n._getApiLinks().entries()],_designTokenEntries:j.map(a=>[a,n.getDesignToken(a)]),appData:n.appData,componentBaseUrl:n.componentBaseUrl,destroyed:n.destroyed,mode:n.mode,inputs:n.inputs,timeRange:n.timeRange,timeRangeIsAdjustable:n.timeRangeIsAdjustable,vpnClientStatus:n.vpnClientStatus}}function o(n){if(o._clients=o._clients||new Map([]),n.source===t.contentWindow)switch(n.data.type){case r.Create:t.contentWindow.postMessage({type:r.Created,payload:s(e)},"*");break;case r.Destroy:e.destroy();break;case r.BackendComponentClientCreate:{const{clientId:a}=n.data.payload,i=e.createBackendComponentClient(a);o._clients.set(a,i);break}case r.BackendComponentClientDestroy:{const{clientId:a}=n.data.payload;o._clients.has(a)&&(o._clients.get(a).destroy(),o._clients.delete(a));break}case r.BackendComponentClientCall:{const{clientId:a,callId:i,functionName:c,functionArguments:d}=n.data.payload;let u=o._clients.get(a);u&&!u._destroyed&&u.call(c,d).then(M=>{u&&!u.destroyed&&t.contentWindow.postMessage({type:r.BackendComponentClientCallResult,payload:{callId:i,result:M}},"*")});break}case r.LoggingDataClientCreate:{const{clientId:a}=n.data.payload,i=e.createLoggingDataClient(a);o._clients.set(a,i);break}case r.LoggingDataClientDestroy:{const{clientId:a}=n.data.payload;o._clients.has(a)&&(o._clients.get(a).destroy(),o._clients.delete(a));break}case r.LoggingDataClientQuery:{const{clientId:a,queryId:i,query:c}=n.data.payload;let d=o._clients.get(a);d&&!d._destroyed&&d.query(c,u=>{d._destroyed||t.contentWindow.postMessage({type:r.LoggingDataClientQueryResult,payload:{queryId:i,results:u}},"*")});break}case r.ResourceDataClientCreate:{const{clientId:a}=n.data.payload,i=e.createResourceDataClient(a);o._clients.set(a,i);break}case r.ResourceDataClientDestroy:{const{clientId:a}=n.data.payload;o._clients.has(a)&&(o._clients.get(a).destroy(),o._clients.delete(a));break}case r.ResourceDataClientQuery:{const{clientId:a,queryId:i,query:c}=n.data.payload;let d=o._clients.get(a);d&&!d._destroyed&&d.query(c,u=>{d._destroyed||t.contentWindow.postMessage({type:r.ResourceDataClientQueryResult,payload:{queryId:i,results:u}},"*")});break}case r.ResourceDataClientRender:{const{clientId:a,queryId:i,query:c}=n.data.payload;let d=o._clients.get(a);d&&!d._destroyed&&d.render(c,u=>{d._destroyed||t.contentWindow.postMessage({type:r.ResourceDataClientRenderResult,payload:{queryId:i,results:u}},"*")});break}case r.ResourceDataClientUpdate:{const{clientId:a,updateId:i,update:c}=n.data.payload;let d=o._clients.get(a);d&&!d._destroyed&&d.update(c).then(()=>{d&&!d._destroyed&&t.contentWindow.postMessage({type:r.ResourceDataClientUpdated,payload:{updateId:i}},"*")});break}case r.OpenActionBottomSheet:e.openActionBottomSheet(n.data.payload.options).then(a=>{t.contentWindow.postMessage({type:r.OpenActionBottomSheetResult,payload:{result:a}},"*")});break;case r.OpenActionMenu:{const a=n.data.payload.targetRect,i={getBoundingClientRect:()=>{const c=t.getBoundingClientRect();return{...JSON.parse(JSON.stringify(a)),top:c.top+a.top,x:c.x+a.x}}};e.openActionMenu(i,n.data.payload.options).then(c=>{t.contentWindow.postMessage({type:r.OpenActionMenuResult,payload:{result:c}},"*")})}break;case r.OpenAlertDialog:e.openAlertDialog(n.data.payload.options).then(a=>{t.contentWindow.postMessage({type:r.OpenAlertDialogResult,payload:{result:a}},"*")});break;case r.OpenConfirmDialog:e.openConfirmDialog(n.data.payload.options).then(a=>{t.contentWindow.postMessage({type:r.OpenConfirmDialogResult,payload:{result:a}},"*")});break;case r.OpenContentDialog:e.openContentDialog(n.data.payload.options).then(a=>{t.contentWindow.postMessage({type:r.OpenContentDialogResult,payload:{result:a}},"*")});break;case r.OpenFormDialog:e.openFormDialog(n.data.payload.options).then(a=>{t.contentWindow.postMessage({type:r.OpenFormDialogResult,payload:{result:a}},"*")});break;case r.OpenSelectPanel:{const a=n.data.payload.targetRect,i={getBoundingClientRect:()=>{const c=t.getBoundingClientRect();return{...JSON.parse(JSON.stringify(a)),top:c.top+a.top,x:c.x+a.x}}};e.openSelectPanel(i,n.data.payload.options).then(c=>{t.contentWindow.postMessage({type:r.OpenSelectPanelResult,payload:{result:c}},"*")})}break;case r.OpenToast:e.openToast(n.data.payload.options).then(a=>{const{id:i}=n.data.payload;t.contentWindow&&t.contentWindow.postMessage({type:r.OpenToastResult,payload:{id:i,result:a}},"*")});break;case r.ShowVpnStatusDetails:e.showVpnStatusDetails(n.data.payload.agentId);break;case r.ToggleVpn:e.toggleVpn(n.data.payload.agentId);break;case r.NavigateByUrl:e.navigateByUrl(n.data.payload.url);break;case r.SetTimeRange:e.setTimeRange(n.data.payload.timeRange);break}}}class B{constructor(e,s,o,n){this.query=e,this.variable=s,this.tag=o,this._onCancel=n,Object.freeze(this)}cancel(){this._onCancel&&this._onCancel()}}var F=typeof global=="object"&&global&&global.Object===Object&&global;const H=F;var V=typeof self=="object"&&self&&self.Object===Object&&self,N=H||V||Function("return this")();const S=N;var W=S.Symbol;const _=W;var v=Object.prototype,Q=v.hasOwnProperty,z=v.toString,m=_?_.toStringTag:void 0;function G(t){var e=Q.call(t,m),s=t[m];try{t[m]=void 0;var o=!0}catch{}var n=z.call(t);return o&&(e?t[m]=s:delete t[m]),n}var J=Object.prototype,K=J.toString;function X(t){return K.call(t)}var Y="[object Null]",Z="[object Undefined]",T=_?_.toStringTag:void 0;function x(t){return t==null?t===void 0?Z:Y:T&&T in Object(t)?G(t):X(t)}function E(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var ee="[object AsyncFunction]",te="[object Function]",ae="[object GeneratorFunction]",ne="[object Proxy]";function oe(t){if(!E(t))return!1;var e=x(t);return e==te||e==ae||e==ee||e==ne}var se=S["__core-js_shared__"];const $=se;var L=function(){var t=/[^.]+$/.exec($&&$.keys&&$.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function re(t){return!!L&&L in t}var ie=Function.prototype,le=ie.toString;function de(t){if(t!=null){try{return le.call(t)}catch{}try{return t+""}catch{}}return""}var ce=/[\\^$.*+?()[\]{}|]/g,pe=/^\[object .+?Constructor\]$/,ue=Function.prototype,ge=Object.prototype,ye=ue.toString,he=ge.hasOwnProperty,fe=RegExp("^"+ye.call(he).replace(ce,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function we(t){if(!E(t)||re(t))return!1;var e=oe(t)?fe:pe;return e.test(de(t))}function me(t,e){return t==null?void 0:t[e]}function k(t,e){var s=me(t,e);return we(s)?s:void 0}function Ce(t,e){return t===e||t!==t&&e!==e}var _e=k(Object,"create");const C=_e;function De(){this.__data__=C?C(null):{},this.size=0}function Re(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var be="__lodash_hash_undefined__",Oe=Object.prototype,Se=Oe.hasOwnProperty;function $e(t){var e=this.__data__;if(C){var s=e[t];return s===be?void 0:s}return Se.call(e,t)?e[t]:void 0}var Ie=Object.prototype,Me=Ie.hasOwnProperty;function ve(t){var e=this.__data__;return C?e[t]!==void 0:Me.call(e,t)}var Te="__lodash_hash_undefined__";function Ee(t,e){var s=this.__data__;return this.size+=this.has(t)?0:1,s[t]=C&&e===void 0?Te:e,this}function h(t){var e=-1,s=t==null?0:t.length;for(this.clear();++e<s;){var o=t[e];this.set(o[0],o[1])}}h.prototype.clear=De,h.prototype.delete=Re,h.prototype.get=$e,h.prototype.has=ve,h.prototype.set=Ee;function Le(){this.__data__=[],this.size=0}function D(t,e){for(var s=t.length;s--;)if(Ce(t[s][0],e))return s;return-1}var ke=Array.prototype,Ae=ke.splice;function Ue(t){var e=this.__data__,s=D(e,t);if(s<0)return!1;var o=e.length-1;return s==o?e.pop():Ae.call(e,s,1),--this.size,!0}function qe(t){var e=this.__data__,s=D(e,t);return s<0?void 0:e[s][1]}function je(t){return D(this.__data__,t)>-1}function Pe(t,e){var s=this.__data__,o=D(s,t);return o<0?(++this.size,s.push([t,e])):s[o][1]=e,this}function w(t){var e=-1,s=t==null?0:t.length;for(this.clear();++e<s;){var o=t[e];this.set(o[0],o[1])}}w.prototype.clear=Le,w.prototype.delete=Ue,w.prototype.get=qe,w.prototype.has=je,w.prototype.set=Pe;var Be=k(S,"Map");const Fe=Be;function He(){this.size=0,this.__data__={hash:new h,map:new(Fe||w),string:new h}}function Ve(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function R(t,e){var s=t.__data__;return Ve(e)?s[typeof e=="string"?"string":"hash"]:s.map}function Ne(t){var e=R(this,t).delete(t);return this.size-=e?1:0,e}function We(t){return R(this,t).get(t)}function Qe(t){return R(this,t).has(t)}function ze(t,e){var s=R(this,t),o=s.size;return s.set(t,e),this.size+=s.size==o?0:1,this}function f(t){var e=-1,s=t==null?0:t.length;for(this.clear();++e<s;){var o=t[e];this.set(o[0],o[1])}}f.prototype.clear=He,f.prototype.delete=Ne,f.prototype.get=We,f.prototype.has=Qe,f.prototype.set=ze;var Ge="Expected a function";function I(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Ge);var s=function(){var o=arguments,n=e?e.apply(this,o):o[0],a=s.cache;if(a.has(n))return a.get(n);var i=t.apply(this,o);return s.cache=a.set(n,i)||a,i};return s.cache=new(I.Cache||f),s}I.Cache=f;const Je=2,A=1,U="";class b{constructor(e,s,o){this.locale=e,this.queryRef=s,this.rawValue=o}static create(e,s,o){return s.query.postAggr==="count"?new Ke(e,s,o):new b(e,s,o)}getDecimals(e=Je){return this.decimals??this.queryRef.query.decimals??e}getFactor(){var e,s,o;return this.factor??this.queryRef.query.factor??((s=(e=this.queryRef.tag)==null?void 0:e.variable)!=null&&s.factor?parseFloat(this.queryRef.tag.variable.factor):null)??((o=this.queryRef.variable)!=null&&o.factor?parseFloat(this.queryRef.variable.factor):null)??A}getUnit(){var e,s,o;return this.unit??this.queryRef.query.unit??((s=(e=this.queryRef.tag)==null?void 0:e.variable)==null?void 0:s.unit)??((o=this.queryRef.variable)==null?void 0:o.unit)??U}setDecimals(e){this.decimals=e}setFactor(e){this.factor=e}setUnit(e){this.unit=e}getValue(){return this.rawValue}toString(){var o,n,a,i;const e=this.locale??void 0,s=I((c,d,u,M)=>{const et={style:"decimal",minimumFractionDigits:Math.floor(d),maximumFractionDigits:Math.floor(d)};return`${new Intl.NumberFormat(M,et).format(c)}${u?" "+u:""}`});return this.rawValue===null?"":this.queryRef.query.postAggr==="count"?s(this.rawValue,this.getDecimals(0),this.unit??this.queryRef.query.unit,e):((o=this.queryRef.variable)==null?void 0:o.type)==="str"?this.rawValue:((n=this.queryRef.variable)==null?void 0:n.type)==="bool"?this.rawValue?"True":"False":((a=this.queryRef.variable)==null?void 0:a.type)==="int"?s(this.rawValue,Number.isInteger(this.getFactor())?this.getDecimals(0):this.getDecimals(),this.getUnit(),e):((i=this.queryRef.variable)==null?void 0:i.type)==="float"?s(this.rawValue,this.getDecimals(),this.getUnit(),e):String(this.getValue())}}class Ke extends b{getFactor(){return this.factor??this.queryRef.query.factor??A}getUnit(){return this.unit??this.queryRef.query.unit??U}}function q(t){return t.map(({queryRef:s,time:o,value:n})=>{const a=new B(s.query,s.variable,s.tag),i=b.create(n.locale,a,n.rawValue);return{queryRef:a,time:o,value:i}})}class y extends Error{constructor(e="Method is not implemented"){super(e),this.name="NotImplementedError",this.message=e,this.stack=`NotImplementedError: ${e}`}}class Xe{constructor(e){p(this,"ontimerangechange",null);p(this,"onvpnclientstatuschange",null);p(this,"_getApiLinks");p(this,"_getDesignTokens");p(this,"appData");p(this,"componentBaseUrl");p(this,"destroyed");p(this,"mode");p(this,"inputs");p(this,"inputMap");p(this,"timeRange");p(this,"timeRangeIsAdjustable");p(this,"vpnClientStatus");p(this,"getDesignToken");this._getApiLinks=()=>new Map(e._apiLinkEntries),this._getDesignTokens=()=>new Map(e._designTokenEntries),this.appData=e.appData,this.componentBaseUrl=e.componentBaseUrl,this.destroyed=e.destroyed,this.mode=e.mode,this.inputs=e.inputs,this.inputMap=new Map(Object.entries(this.inputs)),this.timeRange=e.timeRange,this.timeRangeIsAdjustable=e.timeRangeIsAdjustable,this.vpnClientStatus=e.vpnClientStatus,this._messageHandler=this._messageHandler.bind(this),window.addEventListener("message",this._messageHandler,!1);const s=a=>this._getDesignTokens().get(a)??"";s.var=a=>`var(--uic-${a})`,this.getDesignToken=s;const o=new CSSStyleSheet,n=e._designTokenEntries.map(([a,i])=>`--uic-${a}:${i}`);o.replaceSync(`:root {${n.join(";")}}`),window.document.adoptedStyleSheets.push(o)}_messageHandler(e){if(e.source===window.parent)switch(e.data.type){case r.TimeRangeChange:this.ontimerangechange&&this.ontimerangechange(...e.data.payload);break;case r.VpnClientStatusChange:this.onvpnclientstatuschange&&this.onvpnclientstatuschange(...e.data.payload);break}}createBackendComponentClient(){const e=crypto.randomUUID();return window.parent.postMessage({type:r.BackendComponentClientCreate,payload:{clientId:e}},"*"),new Ye(e)}createLoggingDataClient(){const e=crypto.randomUUID();return window.parent.postMessage({type:r.LoggingDataClientCreate,payload:{clientId:e}},"*"),new Ze(e)}createObjectStorageClient(){throw new y}createResourceDataClient(){const e=crypto.randomUUID();return window.parent.postMessage({type:r.ResourceDataClientCreate,payload:{clientId:e}},"*"),new xe(e)}createTooltip(){throw new y}destroy(){window.parent.postMessage({type:r.Destroy},"*"),window.removeEventListener("message",this._messageHandler,!1),this.destroyed=!0}getApiUrl(e,s){const o=this._getApiLinks().get(e);if(!o)throw new Error("IxApiError: entry not found");return s?Object.keys(s).sort().reduce((n,a)=>{if(n.includes(`{${a}}`))return n.replace(`{${a}}`,s[a]);const i=new URL(n);return i.searchParams.set(a,s[a]),decodeURIComponent(i.href)},o.href):o.href}navigateByUrl(e){window.parent.postMessage({type:r.NavigateByUrl,payload:{url:e}},"*")}openActionBottomSheet(e){return new Promise(s=>{window.addEventListener("message",o,!1),window.parent.postMessage({type:r.OpenActionBottomSheet,payload:{options:e}},"*");function o(n){n.source===window.parent&&n.data.type===r.OpenActionBottomSheetResult&&(window.removeEventListener("message",o,!1),s(n.data.payload.result))}})}openActionMenu(e,s){return new Promise(o=>{window.addEventListener("message",a,!1);const n=e.getBoundingClientRect();window.parent.postMessage({type:r.OpenActionMenu,payload:{targetRect:n,options:s}},"*");function a(i){i.source===window.parent&&i.data.type===r.OpenActionMenuResult&&(window.removeEventListener("message",a,!1),o(i.data.payload.result))}})}openAlertDialog(e){return new Promise(s=>{window.addEventListener("message",o,!1),window.parent.postMessage({type:r.OpenAlertDialog,payload:{options:e}},"*");function o(n){n.source===window.parent&&n.data.type===r.OpenAlertDialogResult&&(window.removeEventListener("message",o,!1),s(n.data.payload.result))}})}openConfirmDialog(e){return new Promise(s=>{window.addEventListener("message",o,!1),window.parent.postMessage({type:r.OpenConfirmDialog,payload:{options:e}},"*");function o(n){n.source===window.parent&&n.data.type===r.OpenConfirmDialogResult&&(window.removeEventListener("message",o,!1),s(n.data.payload.result))}})}openContentDialog(e){if(typeof e.onopened=="function")throw new y('The "onopened" option is not implemented');if(typeof e.onclose=="function")throw new y('The "onclose" option is not implemented');if(e.pagination)throw new y('The "pagination" option is not implemented');return new Promise(s=>{window.addEventListener("message",o,!1),window.parent.postMessage({type:r.OpenContentDialog,payload:{options:e.htmlContent&&typeof e.htmlContent!="string"?{...e,htmlContent:e.htmlContent.cloneNode(!0).outerHTML}:e}},"*");function o(n){n.source===window.parent&&n.data.type===r.OpenContentDialogResult&&(window.removeEventListener("message",o,!1),s(n.data.payload.result))}})}openFormDialog(e){return new Promise(s=>{window.addEventListener("message",o,!1),window.parent.postMessage({type:r.OpenFormDialog,payload:{options:e}},"*");function o(n){n.source===window.parent&&n.data.type===r.OpenFormDialogResult&&(window.removeEventListener("message",o,!1),s(n.data.payload.result))}})}openSelectPanel(e,s){return new Promise(o=>{window.addEventListener("message",a,!1);const n=e.getBoundingClientRect();window.parent.postMessage({type:r.OpenSelectPanel,payload:{targetRect:n,options:s}},"*");function a(i){i.source===window.parent&&i.data.type===r.OpenSelectPanelResult&&(window.removeEventListener("message",a,!1),o(i.data.payload.result))}})}openToast(...e){return new Promise(s=>{window.addEventListener("message",a,!1);const o=crypto.randomUUID(),n=typeof e[0]=="string"?{...e[1],message:e[0]}:e[0];window.parent.postMessage({type:r.OpenToast,payload:{id:o,options:n}},"*");function a(i){i.source===window.parent&&i.data.type===r.OpenToastResult&&i.data.payload.id===o&&(window.removeEventListener("message",a,!1),s(i.data.payload.result))}})}sanitizeHtml(){throw new y}saveAsFile(){throw new y}setTimeRange(e){window.parent.postMessage({type:r.SetTimeRange,payload:{timeRange:e}},"*")}showVpnStatusDetails(e){window.parent.postMessage({type:r.ShowVpnStatusDetails,payload:{agentId:e}},"*")}testVpnAccess(){throw new y}toggleVpn(e){window.parent.postMessage({type:r.ToggleVpn,payload:{agentId:e}},"*")}translate(){throw new y}}class Ye{constructor(e){this.id=e}call(e,s){return new Promise(o=>{const n=crypto.randomUUID();window.addEventListener("message",a,!1),window.parent.postMessage({type:r.BackendComponentClientCall,payload:{clientId:this.id,callId:n,functionName:e,functionArguments:s}},"*");function a(i){i.source===window.parent&&i.data.type===r.BackendComponentClientCallResult&&i.data.payload.callId===n&&(window.removeEventListener("message",a,!1),o(i.data.payload.result))}})}destroy(){window.parent.postMessage({type:r.BackendComponentClientDestroy,payload:{clientId:this.id}},"*")}}class Ze{constructor(e){this.id=e}query(e,s){const o=crypto.randomUUID();return window.addEventListener("message",n,!1),window.parent.postMessage({type:r.LoggingDataClientQuery,payload:{clientId:this.id,queryId:o,query:e}},"*"),()=>{window.removeEventListener("message",n,!1)};function n(a){if(a.source===window.parent&&a.data.type===r.LoggingDataClientQueryResult&&a.data.payload.queryId===o){const{results:i}=a.data.payload;if(e.length)if(!e.queries||e.format!=="csv"){const c=i.map(d=>q(d));s(c)}else throw new y;else{const c=q(i);s(c)}}}}destroy(){window.parent.postMessage({type:r.LoggingDataClientDestroy,payload:{clientId:this.id}},"*")}}class xe{constructor(e){this.id=e}query(e,s){const o=crypto.randomUUID();return window.addEventListener("message",n,!1),window.parent.postMessage({type:r.ResourceDataClientQuery,payload:{clientId:this.id,queryId:o,query:e}},"*"),()=>{window.removeEventListener("message",n,!1)};function n(a){a.source===window.parent&&a.data.type===r.ResourceDataClientQueryResult&&a.data.payload.queryId===o&&s(a.data.payload.results)}}update(e){return new Promise(s=>{const o=crypto.randomUUID();window.addEventListener("message",n,!1),window.parent.postMessage({type:r.ResourceDataClientUpdate,payload:{clientId:this.id,updateId:o,update:e}},"*");function n(a){a.source===window.parent&&a.data.type===r.ResourceDataClientUpdated&&a.data.payload.updateId===o&&(window.removeEventListener("message",n,!1),s())}})}render(e,s){const o=crypto.randomUUID();return window.addEventListener("message",n,!1),window.parent.postMessage({type:r.ResourceDataClientRender,payload:{clientId:this.id,queryId:o,query:e}},"*"),()=>{window.removeEventListener("message",n,!1)};function n(a){a.source===window.parent&&a.data.type===r.ResourceDataClientRenderResult&&a.data.payload.queryId===o&&s(a.data.payload.results)}}destroy(){window.parent.postMessage({type:r.ResourceDataClientDestroy,payload:{clientId:this.id}},"*")}}function O(t){const e=!!(t&&t.migrateInputs);return!e&&O.__cache__?Promise.resolve(O.__cache__):new Promise(s=>{window.addEventListener("message",function o(n){if(n.source===window.parent&&n.data&&n.data.type===r.Created){let a=n.data.payload;e&&(a.inputs=t.migrateInputs(a.inputs,null));const i=new Xe(a);s(i),e||(O.__cache__=i),window.removeEventListener("message",o,!1)}},!1),window.parent.postMessage({type:r.Create},"*")})}g.connect=P,g.getComponentContext=O,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ixon-cdk/iframe-adapter",
|
|
3
|
-
"version": "1.19.0
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,11 +13,8 @@
|
|
|
13
13
|
"author": "",
|
|
14
14
|
"type": "module",
|
|
15
15
|
"license": "ISC",
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"@medv/finder": "3.2.0"
|
|
18
|
-
},
|
|
19
16
|
"peerDependencies": {
|
|
20
|
-
"@ixon-cdk/types": "^1.19.0
|
|
17
|
+
"@ixon-cdk/types": "^1.19.0"
|
|
21
18
|
},
|
|
22
19
|
"devDependencies": {
|
|
23
20
|
"typescript": "~5.5.4",
|