@ixon-cdk/iframe-adapter 1.4.0-next.1 → 1.4.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 +2 -2
- package/dist/index.umd.cjs +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -472,7 +472,7 @@ class R {
|
|
|
472
472
|
}
|
|
473
473
|
getFactor() {
|
|
474
474
|
var e, a, n;
|
|
475
|
-
return this.factor ?? this.queryRef.query.factor ?? ((a = (e = this.queryRef.tag) == null ? void 0 : e.variable)
|
|
475
|
+
return this.factor ?? this.queryRef.query.factor ?? ((a = (e = this.queryRef.tag) == null ? void 0 : e.variable) != null && a.factor ? parseFloat(this.queryRef.tag.variable.factor) : null) ?? ((n = this.queryRef.variable) != null && n.factor ? parseFloat(this.queryRef.variable.factor) : null) ?? T;
|
|
476
476
|
}
|
|
477
477
|
getUnit() {
|
|
478
478
|
var e, a, n;
|
|
@@ -493,7 +493,7 @@ class R {
|
|
|
493
493
|
}
|
|
494
494
|
toString() {
|
|
495
495
|
var n, r, o, i;
|
|
496
|
-
const e = this.locale
|
|
496
|
+
const e = this.locale ?? void 0, a = S((c, d, p, b) => {
|
|
497
497
|
const j = {
|
|
498
498
|
style: "decimal",
|
|
499
499
|
minimumFractionDigits: Math.floor(d),
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(u,i){typeof exports=="object"&&typeof module<"u"?i(exports):typeof define=="function"&&define.amd?define(["exports"],i):(u=typeof globalThis<"u"?globalThis:u||self,i(u["@ixon-cdk/iframe-adapter"]={}))})(this,function(u){"use strict";var et=Object.defineProperty;var tt=(u,i,s)=>i in u?et(u,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):u[i]=s;var g=(u,i,s)=>(tt(u,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`,OpenActionBottomSheet:`${i}openactionbottomsheet`,OpenActionBottomSheetResult:`${i}openactionbottomsheetresult`,OpenAlertDialog:`${i}openalertdialog`,OpenAlertDialogResult:`${i}openalertdialogresult`,OpenConfirmDialog:`${i}openconfirmdialog`,OpenConfirmDialogResult:`${i}openconfirmdialogresult`,OpenFormDialog:`${i}openformdialog`,OpenFormDialogResult:`${i}openformdialogresult`,ShowVpnStatusDetails:`${i}showvpnstatusdetails`,ToggleVpn:`${i}togglevpn`,VpnClientStatusChange:`${i}vpnclientstatuschange`,NavigateByUrl:`${i}navigatebyurl`,SetTimeRange:`${i}settimerange`,TimeRangeChange:`${i}timerangechange`};function k({iframe:t,context:e}){return window.addEventListener("message",a,!1),e.ontimerangechange=(...r)=>{t.contentWindow&&t.contentWindow.postMessage({type:s.TimeRangeChange,payload:r},"*")},e.onvpnclientstatuschange=(...r)=>{t.contentWindow&&t.contentWindow.postMessage({type:s.VpnClientStatusChange,payload:r},"*")},{destroy(){window.removeEventListener("message",a,!1)}};function n(r){return{_apiLinkEntries:[...r._getApiLinks().entries()],appData:r.appData,componentBaseUrl:r.componentBaseUrl,destroyed:r.destroyed,mode:r.mode,inputs:r.inputs,timeRange:r.timeRange,timeRangeIsAdjustable:r.timeRangeIsAdjustable,vpnClientStatus:r.vpnClientStatus}}function a(r){if(a._clients=a._clients||new Map([]),r.source===t.contentWindow)switch(r.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:o}=r.data.payload,l=e.createBackendComponentClient(o);a._clients.set(o,l);break}case s.BackendComponentClientDestroy:{const{clientId:o}=r.data.payload;a._clients.has(o)&&(a._clients.get(o).destroy(),a._clients.delete(o));break}case s.BackendComponentClientCall:{const{clientId:o,callId:l,functionName:c,functionArguments:d}=r.data.payload;let p=a._clients.get(o);p&&!p._destroyed&&p.call(c,d).then(O=>{p&&!p.destroyed&&t.contentWindow.postMessage({type:s.BackendComponentClientCallResult,payload:{callId:l,result:O}},"*")});break}case s.LoggingDataClientCreate:{const{clientId:o}=r.data.payload,l=e.createLoggingDataClient(o);a._clients.set(o,l);break}case s.LoggingDataClientDestroy:{const{clientId:o}=r.data.payload;a._clients.has(o)&&(a._clients.get(o).destroy(),a._clients.delete(o));break}case s.LoggingDataClientQuery:{const{clientId:o,queryId:l,query:c}=r.data.payload;let d=a._clients.get(o);d&&!d._destroyed&&d.query(c,p=>{d._destroyed||t.contentWindow.postMessage({type:s.LoggingDataClientQueryResult,payload:{queryId:l,results:p}},"*")});break}case s.ResourceDataClientCreate:{const{clientId:o}=r.data.payload,l=e.createResourceDataClient(o);a._clients.set(o,l);break}case s.ResourceDataClientDestroy:{const{clientId:o}=r.data.payload;a._clients.has(o)&&(a._clients.get(o).destroy(),a._clients.delete(o));break}case s.ResourceDataClientQuery:{const{clientId:o,queryId:l,query:c}=r.data.payload;let d=a._clients.get(o);d&&!d._destroyed&&d.query(c,p=>{d._destroyed||t.contentWindow.postMessage({type:s.ResourceDataClientQueryResult,payload:{queryId:l,results:p}},"*")});break}case s.ResourceDataClientRender:{const{clientId:o,queryId:l,query:c}=r.data.payload;let d=a._clients.get(o);d&&!d._destroyed&&d.render(c,p=>{d._destroyed||t.contentWindow.postMessage({type:s.ResourceDataClientRenderResult,payload:{queryId:l,results:p}},"*")});break}case s.ResourceDataClientUpdate:{const{clientId:o,updateId:l,update:c}=r.data.payload;let d=a._clients.get(o);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(r.data.payload.options).then(o=>{t.contentWindow.postMessage({type:s.OpenActionBottomSheetResult,payload:{result:o}},"*")});break;case s.OpenAlertDialog:e.openAlertDialog(r.data.payload.options).then(o=>{t.contentWindow.postMessage({type:s.OpenAlertDialogResult,payload:{result:o}},"*")});break;case s.OpenConfirmDialog:e.openConfirmDialog(r.data.payload.options).then(o=>{t.contentWindow.postMessage({type:s.OpenConfirmDialogResult,payload:{result:o}},"*")});break;case s.OpenFormDialog:e.openFormDialog(r.data.payload.options).then(o=>{t.contentWindow.postMessage({type:s.OpenFormDialogResult,payload:{result:o}},"*")});break;case s.ShowVpnStatusDetails:e.showVpnStatusDetails(r.data.payload.agentId);break;case s.ToggleVpn:e.toggleVpn(r.data.payload.agentId);break;case s.NavigateByUrl:e.navigateByUrl(r.data.payload.url);break;case s.SetTimeRange:e.setTimeRange(r.data.payload.timeRange);break}}}class B{constructor(e,n,a,r){this.query=e,this.variable=n,this.tag=a,this._onCancel=r,Object.freeze(this)}cancel(){this._onCancel&&this._onCancel()}}var F=typeof global=="object"&&global&&global.Object===Object&&global;const V=F;var P=typeof self=="object"&&self&&self.Object===Object&&self,H=V||P||Function("return this")();const v=H;var N=v.Symbol;const _=N;var L=Object.prototype,W=L.hasOwnProperty,Q=L.toString,w=_?_.toStringTag:void 0;function z(t){var e=W.call(t,w),n=t[w];try{t[w]=void 0;var a=!0}catch{}var r=Q.call(t);return a&&(e?t[w]=n:delete t[w]),r}var G=Object.prototype,J=G.toString;function K(t){return J.call(t)}var X="[object Null]",Y="[object Undefined]",M=_?_.toStringTag:void 0;function Z(t){return t==null?t===void 0?Y:X:M&&M in Object(t)?z(t):K(t)}function E(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var x="[object AsyncFunction]",ee="[object Function]",te="[object GeneratorFunction]",ae="[object Proxy]";function ne(t){if(!E(t))return!1;var e=Z(t);return e==ee||e==te||e==x||e==ae}var re=v["__core-js_shared__"];const $=re;var U=function(){var t=/[^.]+$/.exec($&&$.keys&&$.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function oe(t){return!!U&&U in t}var se=Function.prototype,ie=se.toString;function le(t){if(t!=null){try{return ie.call(t)}catch{}try{return t+""}catch{}}return""}var de=/[\\^$.*+?()[\]{}|]/g,ce=/^\[object .+?Constructor\]$/,pe=Function.prototype,ue=Object.prototype,ge=pe.toString,ye=ue.hasOwnProperty,he=RegExp("^"+ge.call(ye).replace(de,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function fe(t){if(!E(t)||oe(t))return!1;var e=ne(t)?he:ce;return e.test(le(t))}function me(t,e){return t==null?void 0:t[e]}function T(t,e){var n=me(t,e);return fe(n)?n:void 0}function we(t,e){return t===e||t!==t&&e!==e}var Ce=T(Object,"create");const C=Ce;function _e(){this.__data__=C?C(null):{},this.size=0}function De(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Re="__lodash_hash_undefined__",be=Object.prototype,Ie=be.hasOwnProperty;function ve(t){var e=this.__data__;if(C){var n=e[t];return n===Re?void 0:n}return Ie.call(e,t)?e[t]:void 0}var $e=Object.prototype,Se=$e.hasOwnProperty;function Oe(t){var e=this.__data__;return C?e[t]!==void 0:Se.call(e,t)}var Le="__lodash_hash_undefined__";function Me(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=C&&e===void 0?Le:e,this}function y(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])}}y.prototype.clear=_e,y.prototype.delete=De,y.prototype.get=ve,y.prototype.has=Oe,y.prototype.set=Me;function Ee(){this.__data__=[],this.size=0}function D(t,e){for(var n=t.length;n--;)if(we(t[n][0],e))return n;return-1}var Ue=Array.prototype,Te=Ue.splice;function qe(t){var e=this.__data__,n=D(e,t);if(n<0)return!1;var a=e.length-1;return n==a?e.pop():Te.call(e,n,1),--this.size,!0}function je(t){var e=this.__data__,n=D(e,t);return n<0?void 0:e[n][1]}function Ae(t){return D(this.__data__,t)>-1}function ke(t,e){var n=this.__data__,a=D(n,t);return a<0?(++this.size,n.push([t,e])):n[a][1]=e,this}function f(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])}}f.prototype.clear=Ee,f.prototype.delete=qe,f.prototype.get=je,f.prototype.has=Ae,f.prototype.set=ke;var Be=T(v,"Map");const Fe=Be;function Ve(){this.size=0,this.__data__={hash:new y,map:new(Fe||f),string:new y}}function Pe(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function R(t,e){var n=t.__data__;return Pe(e)?n[typeof e=="string"?"string":"hash"]:n.map}function He(t){var e=R(this,t).delete(t);return this.size-=e?1:0,e}function Ne(t){return R(this,t).get(t)}function We(t){return R(this,t).has(t)}function Qe(t,e){var n=R(this,t),a=n.size;return n.set(t,e),this.size+=n.size==a?0:1,this}function h(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])}}h.prototype.clear=Ve,h.prototype.delete=He,h.prototype.get=Ne,h.prototype.has=We,h.prototype.set=Qe;var ze="Expected a function";function S(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(ze);var n=function(){var a=arguments,r=e?e.apply(this,a):a[0],o=n.cache;if(o.has(r))return o.get(r);var l=t.apply(this,a);return n.cache=o.set(r,l)||o,l};return n.cache=new(S.Cache||h),n}S.Cache=h;const Ge=2,q=1,j="";class b{constructor(e,n,a){this.locale=e,this.queryRef=n,this.rawValue=a}static create(e,n,a){return n.query.postAggr==="count"?new Je(e,n,a):new b(e,n,a)}getDecimals(e=Ge){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?void 0:n.factor)??((a=this.queryRef.variable)==null?void 0:a.factor)??q}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)??j}setDecimals(e){this.decimals=e}setFactor(e){this.factor=e}setUnit(e){this.unit=e}getValue(){return this.rawValue}toString(){var a,r,o,l;const e=this.locale!==null?this.locale:void 0,n=S((c,d,p,O)=>{const xe={style:"decimal",minimumFractionDigits:Math.floor(d),maximumFractionDigits:Math.floor(d)};return`${new Intl.NumberFormat(O,xe).format(c)}${p?" "+p:""}`});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:((r=this.queryRef.variable)==null?void 0:r.type)==="bool"?this.rawValue?"True":"False":((o=this.queryRef.variable)==null?void 0:o.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 Je extends b{getFactor(){return this.factor??this.queryRef.query.factor??q}getUnit(){return this.unit??this.queryRef.query.unit??j}}function A(t){return t.map(({queryRef:n,time:a,value:r})=>{const o=new B(n.query,n.variable,n.tag),l=b.create(r.locale,o,r.rawValue);return{queryRef:o,time:a,value:l}})}class m extends Error{constructor(){super("Method is not implemented"),this.name="NotImplementedError",this.message="Method is not implemented",this.stack="NotImplementedError: Method is not implemented"}}class Ke{constructor(e){g(this,"ontimerangechange",null);g(this,"onvpnclientstatuschange",null);g(this,"_getApiLinks");g(this,"appData");g(this,"componentBaseUrl");g(this,"destroyed");g(this,"mode");g(this,"inputs");g(this,"inputMap");g(this,"timeRange");g(this,"timeRangeIsAdjustable");g(this,"vpnClientStatus");this._getApiLinks=()=>new Map(e._apiLinkEntries),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)}_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 Xe(e)}createLoggingDataClient(){const e=crypto.randomUUID();return window.parent.postMessage({type:s.LoggingDataClientCreate,payload:{clientId:e}},"*"),new Ye(e)}createObjectStorageClient(){throw new m}createResourceDataClient(){const e=crypto.randomUUID();return window.parent.postMessage({type:s.ResourceDataClientCreate,payload:{clientId:e}},"*"),new Ze(e)}createTooltip(){throw new m}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((r,o)=>{if(r.includes(`{${o}}`))return r.replace(`{${o}}`,n[o]);const l=new URL(r);return l.searchParams.set(o,n[o]),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(r){r.source===window.parent&&r.data.type===s.OpenActionBottomSheetResult&&(window.removeEventListener("message",a,!1),n(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(r){r.source===window.parent&&r.data.type===s.OpenAlertDialogResult&&(window.removeEventListener("message",a,!1),n(r.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(r){r.source===window.parent&&r.data.type===s.OpenConfirmDialogResult&&(window.removeEventListener("message",a,!1),n(r.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(r){r.source===window.parent&&r.data.type===s.OpenFormDialogResult&&(window.removeEventListener("message",a,!1),n(r.data.payload.result))}})}saveAsFile(){throw new m}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 m}toggleVpn(e){window.parent.postMessage({type:s.ToggleVpn,payload:{agentId:e}},"*")}translate(){throw new m}}class Xe{constructor(e){this.id=e}call(e,n){return new Promise(a=>{const r=crypto.randomUUID();window.addEventListener("message",o,!1),window.parent.postMessage({type:s.BackendComponentClientCall,payload:{clientId:this.id,callId:r,functionName:e,functionArguments:n}});function o(l){l.source===window.parent&&l.data.type===s.BackendComponentClientCallResult&&l.data.payload.callId===r&&(window.removeEventListener("message",o,!1),a(l.data.payload.result))}})}destroy(){window.parent.postMessage({type:s.BackendComponentClientDestroy,payload:{clientId:this.id}},"*")}}class Ye{constructor(e){this.id=e}query(e,n){const a=crypto.randomUUID();return window.addEventListener("message",r,!1),window.parent.postMessage({type:s.LoggingDataClientQuery,payload:{clientId:this.id,queryId:a,query:e}},"*"),()=>{window.removeEventListener("message",r,!1)};function r(o){if(o.source===window.parent&&o.data.type===s.LoggingDataClientQueryResult&&o.data.payload.queryId===a){const{results:l}=o.data.payload;if(e.length)if(!e.queries||e.format!=="csv"){const c=l.map(d=>A(d));n(c)}else throw new m;else{const c=A(l);n(c)}}}}destroy(){window.parent.postMessage({type:s.LoggingDataClientDestroy,payload:{clientId:this.id}},"*")}}class Ze{constructor(e){this.id=e}query(e,n){const a=crypto.randomUUID();return window.addEventListener("message",r,!1),window.parent.postMessage({type:s.ResourceDataClientQuery,payload:{clientId:this.id,queryId:a,query:e}},"*"),()=>{window.removeEventListener("message",r,!1)};function r(o){o.source===window.parent&&o.data.type===s.ResourceDataClientQueryResult&&o.data.payload.queryId===a&&n(o.data.payload.results)}}update(e){return new Promise(n=>{const a=crypto.randomUUID();window.addEventListener("message",r,!1),window.parent.postMessage({type:s.ResourceDataClientUpdate,payload:{clientId:this.id,updateId:a,update:e}},"*");function r(o){o.source===window.parent&&o.data.type===s.ResourceDataClientUpdated&&o.data.payload.updateId===a&&(window.removeEventListener("message",r,!1),n())}})}render(e,n){const a=crypto.randomUUID();return window.addEventListener("message",r,!1),window.parent.postMessage({type:s.ResourceDataClientRender,payload:{clientId:this.id,queryId:a,query:e}},"*"),()=>{window.removeEventListener("message",r,!1)};function r(o){o.source===window.parent&&o.data.type===s.ResourceDataClientRenderResult&&o.data.payload.queryId===a&&n(o.data.payload.results)}}destroy(){window.parent.postMessage({type:s.ResourceDataClientDestroy,payload:{clientId:this.id}},"*")}}function I(t){const e=!!(t&&t.migrateInputs);return!e&&I.__cache__?Promise.resolve(I.__cache__):new Promise(n=>{window.addEventListener("message",function a(r){if(r.source===window.parent&&r.data&&r.data.type===s.Created){let o=r.data.payload;e&&(o.inputs=t.migrateInputs(o.inputs,null));const l=new Ke(o);n(l),e||(I.__cache__=l),window.removeEventListener("message",a,!1)}},!1),window.parent.postMessage({type:s.Create},"*")})}u.connect=k,u.getComponentContext=I,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(u,i){typeof exports=="object"&&typeof module<"u"?i(exports):typeof define=="function"&&define.amd?define(["exports"],i):(u=typeof globalThis<"u"?globalThis:u||self,i(u["@ixon-cdk/iframe-adapter"]={}))})(this,function(u){"use strict";var et=Object.defineProperty;var tt=(u,i,s)=>i in u?et(u,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):u[i]=s;var g=(u,i,s)=>(tt(u,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`,OpenActionBottomSheet:`${i}openactionbottomsheet`,OpenActionBottomSheetResult:`${i}openactionbottomsheetresult`,OpenAlertDialog:`${i}openalertdialog`,OpenAlertDialogResult:`${i}openalertdialogresult`,OpenConfirmDialog:`${i}openconfirmdialog`,OpenConfirmDialogResult:`${i}openconfirmdialogresult`,OpenFormDialog:`${i}openformdialog`,OpenFormDialogResult:`${i}openformdialogresult`,ShowVpnStatusDetails:`${i}showvpnstatusdetails`,ToggleVpn:`${i}togglevpn`,VpnClientStatusChange:`${i}vpnclientstatuschange`,NavigateByUrl:`${i}navigatebyurl`,SetTimeRange:`${i}settimerange`,TimeRangeChange:`${i}timerangechange`};function k({iframe:t,context:e}){return window.addEventListener("message",a,!1),e.ontimerangechange=(...r)=>{t.contentWindow&&t.contentWindow.postMessage({type:s.TimeRangeChange,payload:r},"*")},e.onvpnclientstatuschange=(...r)=>{t.contentWindow&&t.contentWindow.postMessage({type:s.VpnClientStatusChange,payload:r},"*")},{destroy(){window.removeEventListener("message",a,!1)}};function n(r){return{_apiLinkEntries:[...r._getApiLinks().entries()],appData:r.appData,componentBaseUrl:r.componentBaseUrl,destroyed:r.destroyed,mode:r.mode,inputs:r.inputs,timeRange:r.timeRange,timeRangeIsAdjustable:r.timeRangeIsAdjustable,vpnClientStatus:r.vpnClientStatus}}function a(r){if(a._clients=a._clients||new Map([]),r.source===t.contentWindow)switch(r.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:o}=r.data.payload,l=e.createBackendComponentClient(o);a._clients.set(o,l);break}case s.BackendComponentClientDestroy:{const{clientId:o}=r.data.payload;a._clients.has(o)&&(a._clients.get(o).destroy(),a._clients.delete(o));break}case s.BackendComponentClientCall:{const{clientId:o,callId:l,functionName:c,functionArguments:d}=r.data.payload;let p=a._clients.get(o);p&&!p._destroyed&&p.call(c,d).then(O=>{p&&!p.destroyed&&t.contentWindow.postMessage({type:s.BackendComponentClientCallResult,payload:{callId:l,result:O}},"*")});break}case s.LoggingDataClientCreate:{const{clientId:o}=r.data.payload,l=e.createLoggingDataClient(o);a._clients.set(o,l);break}case s.LoggingDataClientDestroy:{const{clientId:o}=r.data.payload;a._clients.has(o)&&(a._clients.get(o).destroy(),a._clients.delete(o));break}case s.LoggingDataClientQuery:{const{clientId:o,queryId:l,query:c}=r.data.payload;let d=a._clients.get(o);d&&!d._destroyed&&d.query(c,p=>{d._destroyed||t.contentWindow.postMessage({type:s.LoggingDataClientQueryResult,payload:{queryId:l,results:p}},"*")});break}case s.ResourceDataClientCreate:{const{clientId:o}=r.data.payload,l=e.createResourceDataClient(o);a._clients.set(o,l);break}case s.ResourceDataClientDestroy:{const{clientId:o}=r.data.payload;a._clients.has(o)&&(a._clients.get(o).destroy(),a._clients.delete(o));break}case s.ResourceDataClientQuery:{const{clientId:o,queryId:l,query:c}=r.data.payload;let d=a._clients.get(o);d&&!d._destroyed&&d.query(c,p=>{d._destroyed||t.contentWindow.postMessage({type:s.ResourceDataClientQueryResult,payload:{queryId:l,results:p}},"*")});break}case s.ResourceDataClientRender:{const{clientId:o,queryId:l,query:c}=r.data.payload;let d=a._clients.get(o);d&&!d._destroyed&&d.render(c,p=>{d._destroyed||t.contentWindow.postMessage({type:s.ResourceDataClientRenderResult,payload:{queryId:l,results:p}},"*")});break}case s.ResourceDataClientUpdate:{const{clientId:o,updateId:l,update:c}=r.data.payload;let d=a._clients.get(o);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(r.data.payload.options).then(o=>{t.contentWindow.postMessage({type:s.OpenActionBottomSheetResult,payload:{result:o}},"*")});break;case s.OpenAlertDialog:e.openAlertDialog(r.data.payload.options).then(o=>{t.contentWindow.postMessage({type:s.OpenAlertDialogResult,payload:{result:o}},"*")});break;case s.OpenConfirmDialog:e.openConfirmDialog(r.data.payload.options).then(o=>{t.contentWindow.postMessage({type:s.OpenConfirmDialogResult,payload:{result:o}},"*")});break;case s.OpenFormDialog:e.openFormDialog(r.data.payload.options).then(o=>{t.contentWindow.postMessage({type:s.OpenFormDialogResult,payload:{result:o}},"*")});break;case s.ShowVpnStatusDetails:e.showVpnStatusDetails(r.data.payload.agentId);break;case s.ToggleVpn:e.toggleVpn(r.data.payload.agentId);break;case s.NavigateByUrl:e.navigateByUrl(r.data.payload.url);break;case s.SetTimeRange:e.setTimeRange(r.data.payload.timeRange);break}}}class B{constructor(e,n,a,r){this.query=e,this.variable=n,this.tag=a,this._onCancel=r,Object.freeze(this)}cancel(){this._onCancel&&this._onCancel()}}var F=typeof global=="object"&&global&&global.Object===Object&&global;const V=F;var P=typeof self=="object"&&self&&self.Object===Object&&self,H=V||P||Function("return this")();const I=H;var N=I.Symbol;const _=N;var L=Object.prototype,W=L.hasOwnProperty,Q=L.toString,w=_?_.toStringTag:void 0;function z(t){var e=W.call(t,w),n=t[w];try{t[w]=void 0;var a=!0}catch{}var r=Q.call(t);return a&&(e?t[w]=n:delete t[w]),r}var G=Object.prototype,J=G.toString;function K(t){return J.call(t)}var X="[object Null]",Y="[object Undefined]",M=_?_.toStringTag:void 0;function Z(t){return t==null?t===void 0?Y:X:M&&M in Object(t)?z(t):K(t)}function E(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var x="[object AsyncFunction]",ee="[object Function]",te="[object GeneratorFunction]",ae="[object Proxy]";function ne(t){if(!E(t))return!1;var e=Z(t);return e==ee||e==te||e==x||e==ae}var re=I["__core-js_shared__"];const $=re;var U=function(){var t=/[^.]+$/.exec($&&$.keys&&$.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function oe(t){return!!U&&U in t}var se=Function.prototype,ie=se.toString;function le(t){if(t!=null){try{return ie.call(t)}catch{}try{return t+""}catch{}}return""}var de=/[\\^$.*+?()[\]{}|]/g,ce=/^\[object .+?Constructor\]$/,pe=Function.prototype,ue=Object.prototype,ge=pe.toString,ye=ue.hasOwnProperty,he=RegExp("^"+ge.call(ye).replace(de,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function fe(t){if(!E(t)||oe(t))return!1;var e=ne(t)?he:ce;return e.test(le(t))}function me(t,e){return t==null?void 0:t[e]}function q(t,e){var n=me(t,e);return fe(n)?n:void 0}function we(t,e){return t===e||t!==t&&e!==e}var Ce=q(Object,"create");const C=Ce;function _e(){this.__data__=C?C(null):{},this.size=0}function De(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Re="__lodash_hash_undefined__",be=Object.prototype,ve=be.hasOwnProperty;function Ie(t){var e=this.__data__;if(C){var n=e[t];return n===Re?void 0:n}return ve.call(e,t)?e[t]:void 0}var $e=Object.prototype,Se=$e.hasOwnProperty;function Oe(t){var e=this.__data__;return C?e[t]!==void 0:Se.call(e,t)}var Le="__lodash_hash_undefined__";function Me(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=C&&e===void 0?Le:e,this}function y(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])}}y.prototype.clear=_e,y.prototype.delete=De,y.prototype.get=Ie,y.prototype.has=Oe,y.prototype.set=Me;function Ee(){this.__data__=[],this.size=0}function D(t,e){for(var n=t.length;n--;)if(we(t[n][0],e))return n;return-1}var Ue=Array.prototype,qe=Ue.splice;function Te(t){var e=this.__data__,n=D(e,t);if(n<0)return!1;var a=e.length-1;return n==a?e.pop():qe.call(e,n,1),--this.size,!0}function je(t){var e=this.__data__,n=D(e,t);return n<0?void 0:e[n][1]}function Ae(t){return D(this.__data__,t)>-1}function ke(t,e){var n=this.__data__,a=D(n,t);return a<0?(++this.size,n.push([t,e])):n[a][1]=e,this}function f(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])}}f.prototype.clear=Ee,f.prototype.delete=Te,f.prototype.get=je,f.prototype.has=Ae,f.prototype.set=ke;var Be=q(I,"Map");const Fe=Be;function Ve(){this.size=0,this.__data__={hash:new y,map:new(Fe||f),string:new y}}function Pe(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function R(t,e){var n=t.__data__;return Pe(e)?n[typeof e=="string"?"string":"hash"]:n.map}function He(t){var e=R(this,t).delete(t);return this.size-=e?1:0,e}function Ne(t){return R(this,t).get(t)}function We(t){return R(this,t).has(t)}function Qe(t,e){var n=R(this,t),a=n.size;return n.set(t,e),this.size+=n.size==a?0:1,this}function h(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])}}h.prototype.clear=Ve,h.prototype.delete=He,h.prototype.get=Ne,h.prototype.has=We,h.prototype.set=Qe;var ze="Expected a function";function S(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(ze);var n=function(){var a=arguments,r=e?e.apply(this,a):a[0],o=n.cache;if(o.has(r))return o.get(r);var l=t.apply(this,a);return n.cache=o.set(r,l)||o,l};return n.cache=new(S.Cache||h),n}S.Cache=h;const Ge=2,T=1,j="";class b{constructor(e,n,a){this.locale=e,this.queryRef=n,this.rawValue=a}static create(e,n,a){return n.query.postAggr==="count"?new Je(e,n,a):new b(e,n,a)}getDecimals(e=Ge){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)??T}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)??j}setDecimals(e){this.decimals=e}setFactor(e){this.factor=e}setUnit(e){this.unit=e}getValue(){return this.rawValue}toString(){var a,r,o,l;const e=this.locale??void 0,n=S((c,d,p,O)=>{const xe={style:"decimal",minimumFractionDigits:Math.floor(d),maximumFractionDigits:Math.floor(d)};return`${new Intl.NumberFormat(O,xe).format(c)}${p?" "+p:""}`});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:((r=this.queryRef.variable)==null?void 0:r.type)==="bool"?this.rawValue?"True":"False":((o=this.queryRef.variable)==null?void 0:o.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 Je extends b{getFactor(){return this.factor??this.queryRef.query.factor??T}getUnit(){return this.unit??this.queryRef.query.unit??j}}function A(t){return t.map(({queryRef:n,time:a,value:r})=>{const o=new B(n.query,n.variable,n.tag),l=b.create(r.locale,o,r.rawValue);return{queryRef:o,time:a,value:l}})}class m extends Error{constructor(){super("Method is not implemented"),this.name="NotImplementedError",this.message="Method is not implemented",this.stack="NotImplementedError: Method is not implemented"}}class Ke{constructor(e){g(this,"ontimerangechange",null);g(this,"onvpnclientstatuschange",null);g(this,"_getApiLinks");g(this,"appData");g(this,"componentBaseUrl");g(this,"destroyed");g(this,"mode");g(this,"inputs");g(this,"inputMap");g(this,"timeRange");g(this,"timeRangeIsAdjustable");g(this,"vpnClientStatus");this._getApiLinks=()=>new Map(e._apiLinkEntries),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)}_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 Xe(e)}createLoggingDataClient(){const e=crypto.randomUUID();return window.parent.postMessage({type:s.LoggingDataClientCreate,payload:{clientId:e}},"*"),new Ye(e)}createObjectStorageClient(){throw new m}createResourceDataClient(){const e=crypto.randomUUID();return window.parent.postMessage({type:s.ResourceDataClientCreate,payload:{clientId:e}},"*"),new Ze(e)}createTooltip(){throw new m}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((r,o)=>{if(r.includes(`{${o}}`))return r.replace(`{${o}}`,n[o]);const l=new URL(r);return l.searchParams.set(o,n[o]),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(r){r.source===window.parent&&r.data.type===s.OpenActionBottomSheetResult&&(window.removeEventListener("message",a,!1),n(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(r){r.source===window.parent&&r.data.type===s.OpenAlertDialogResult&&(window.removeEventListener("message",a,!1),n(r.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(r){r.source===window.parent&&r.data.type===s.OpenConfirmDialogResult&&(window.removeEventListener("message",a,!1),n(r.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(r){r.source===window.parent&&r.data.type===s.OpenFormDialogResult&&(window.removeEventListener("message",a,!1),n(r.data.payload.result))}})}saveAsFile(){throw new m}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 m}toggleVpn(e){window.parent.postMessage({type:s.ToggleVpn,payload:{agentId:e}},"*")}translate(){throw new m}}class Xe{constructor(e){this.id=e}call(e,n){return new Promise(a=>{const r=crypto.randomUUID();window.addEventListener("message",o,!1),window.parent.postMessage({type:s.BackendComponentClientCall,payload:{clientId:this.id,callId:r,functionName:e,functionArguments:n}});function o(l){l.source===window.parent&&l.data.type===s.BackendComponentClientCallResult&&l.data.payload.callId===r&&(window.removeEventListener("message",o,!1),a(l.data.payload.result))}})}destroy(){window.parent.postMessage({type:s.BackendComponentClientDestroy,payload:{clientId:this.id}},"*")}}class Ye{constructor(e){this.id=e}query(e,n){const a=crypto.randomUUID();return window.addEventListener("message",r,!1),window.parent.postMessage({type:s.LoggingDataClientQuery,payload:{clientId:this.id,queryId:a,query:e}},"*"),()=>{window.removeEventListener("message",r,!1)};function r(o){if(o.source===window.parent&&o.data.type===s.LoggingDataClientQueryResult&&o.data.payload.queryId===a){const{results:l}=o.data.payload;if(e.length)if(!e.queries||e.format!=="csv"){const c=l.map(d=>A(d));n(c)}else throw new m;else{const c=A(l);n(c)}}}}destroy(){window.parent.postMessage({type:s.LoggingDataClientDestroy,payload:{clientId:this.id}},"*")}}class Ze{constructor(e){this.id=e}query(e,n){const a=crypto.randomUUID();return window.addEventListener("message",r,!1),window.parent.postMessage({type:s.ResourceDataClientQuery,payload:{clientId:this.id,queryId:a,query:e}},"*"),()=>{window.removeEventListener("message",r,!1)};function r(o){o.source===window.parent&&o.data.type===s.ResourceDataClientQueryResult&&o.data.payload.queryId===a&&n(o.data.payload.results)}}update(e){return new Promise(n=>{const a=crypto.randomUUID();window.addEventListener("message",r,!1),window.parent.postMessage({type:s.ResourceDataClientUpdate,payload:{clientId:this.id,updateId:a,update:e}},"*");function r(o){o.source===window.parent&&o.data.type===s.ResourceDataClientUpdated&&o.data.payload.updateId===a&&(window.removeEventListener("message",r,!1),n())}})}render(e,n){const a=crypto.randomUUID();return window.addEventListener("message",r,!1),window.parent.postMessage({type:s.ResourceDataClientRender,payload:{clientId:this.id,queryId:a,query:e}},"*"),()=>{window.removeEventListener("message",r,!1)};function r(o){o.source===window.parent&&o.data.type===s.ResourceDataClientRenderResult&&o.data.payload.queryId===a&&n(o.data.payload.results)}}destroy(){window.parent.postMessage({type:s.ResourceDataClientDestroy,payload:{clientId:this.id}},"*")}}function v(t){const e=!!(t&&t.migrateInputs);return!e&&v.__cache__?Promise.resolve(v.__cache__):new Promise(n=>{window.addEventListener("message",function a(r){if(r.source===window.parent&&r.data&&r.data.type===s.Created){let o=r.data.payload;e&&(o.inputs=t.migrateInputs(o.inputs,null));const l=new Ke(o);n(l),e||(v.__cache__=l),window.removeEventListener("message",a,!1)}},!1),window.parent.postMessage({type:s.Create},"*")})}u.connect=k,u.getComponentContext=v,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ixon-cdk/iframe-adapter",
|
|
3
|
-
"version": "1.4.0
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "vite build",
|
|
8
|
-
"
|
|
8
|
+
"prepare": "vite build"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist/**"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"type": "module",
|
|
15
15
|
"license": "ISC",
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@ixon-cdk/types": "^1.4.0
|
|
17
|
+
"@ixon-cdk/types": "^1.4.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"typescript": "~5.1.6",
|