@luzmo/embed 5.0.2 → 5.0.4
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/README.md +9 -2
- package/index.d.ts +1 -0
- package/index.js +2848 -0
- package/index.mjs +2849 -0
- package/index.umd.js +2852 -0
- package/{src/lib → lib}/dashboard-component/dashboard-component.d.ts +11 -3
- package/luzmo-embed.min.js +2852 -2
- package/package.json +4 -6
- package/index.cjs.d.ts +0 -1
- package/index.cjs.js +0 -1
- package/index.esm.js +0 -1
- package/luzmo-embed.min.js.map +0 -1
- package/src/index.d.ts +0 -2
- package/src/lib/models/filters.model.d.ts +0 -6
- /package/{src/lib → lib}/dashboard-component/dashboard-styles.d.ts +0 -0
- /package/{src/lib → lib}/helper/event-bus-handler.d.ts +0 -0
- /package/{src/lib → lib}/luzmo-service.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luzmo/embed",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.4",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"lit": "
|
|
6
|
-
"@luzmo/shared-embed": "5.0.
|
|
5
|
+
"lit": "3.0.2",
|
|
6
|
+
"@luzmo/shared-embed": "5.0.2"
|
|
7
7
|
},
|
|
8
8
|
"keywords": [
|
|
9
9
|
"es6",
|
|
@@ -18,7 +18,5 @@
|
|
|
18
18
|
"chart",
|
|
19
19
|
"cumul.io",
|
|
20
20
|
"component"
|
|
21
|
-
]
|
|
22
|
-
"module": "./index.esm.js",
|
|
23
|
-
"main": "./index.cjs.js"
|
|
21
|
+
]
|
|
24
22
|
}
|
package/index.cjs.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./src/index";
|
package/index.cjs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@luzmo/shared-embed"),t=require("lit"),r=require("lit/decorators.js"),o=require("lit/directives/style-map.js");function a(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=a(e);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(a=o.key,n=void 0,"symbol"==typeof(n=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(a,"string"))?n:String(n)),o)}var a,n}function d(e,t,r){return t&&s(e.prototype,t),r&&s(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}function u(e,t){if(t&&("object"==typeof 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)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,o=p(e);if(t){var a=p(this).constructor;r=Reflect.construct(o,arguments,a)}else r=o.apply(this,arguments);return u(this,r)}}function h(){return h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var o=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=p(e)););return e}(e,t);if(o){var a=Object.getOwnPropertyDescriptor(o,t);return a.get?a.get.call(arguments.length<3?e:r):a.value}},h.apply(this,arguments)}function y(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o,a,n,i,s=[],d=!0,p=!1;try{if(n=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;d=!1}else for(;!(d=(o=n.call(r)).done)&&(s.push(o.value),s.length!==t);d=!0);}catch(e){p=!0,a=e}finally{try{if(!d&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(p)throw a}}return s}}(e,t)||b(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 b(e,t){if(e){if("string"==typeof e)return f(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(e,t):void 0}}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}function v(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=b(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var o=0,a=function(){};return{s:a,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:a}}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 n,i=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){s=!0,n=e},f:function(){try{i||null==r.return||r.return()}finally{if(s)throw n}}}}function g(e,t,r,o){var a,n=arguments.length,i=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(i=(n<3?a(i):n>3?a(t,r,i):a(t,r))||i);return n>3&&i&&Object.defineProperty(t,r,i),i}function S(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}"function"==typeof SuppressedError&&SuppressedError;var _,z,w,O,D,x,j=new(d((function e(){i(this,e),this._components=[]}))),k=t.css(_||(_=y(["\n @-webkit-keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n\n @keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n :host {\n position: relative;\n width: 100%;\n }\n\n .luzmo-embed-dashboard {\n background: transparent;\n padding: 0;\n border: 0;\n }\n\n .luzmo-container-loader {\n width: 100%;\n position: relative;\n }\n\n .luzmo-lc {\n margin: 0 auto;\n }\n\n .luzmo-loading-message {\n width: 100%;\n height: 20px;\n text-align: center;\n margin-bottom: 16px;\n font-family: Helvetica, Arial, sans-serif;\n font-size: 14px;\n }\n\n .luzmo-loading-circle {\n box-sizing: border-box;\n margin: 16px auto;\n position: relative;\n text-indent: -9999em;\n animation: spin 0.6s infinite linear;\n }\n\n .luzmo-loading-circle,\n .luzmo-loading-circle:after {\n border-radius: 50%;\n width: 32px;\n height: 32px;\n }\n\n .itemEmbedding:after {\n width: 24px;\n height: 24px;\n }\n\n .luzmo-error {\n background: transparent;\n padding: 48px 0;\n margin: 0 auto;\n width: 80%;\n border: 0;\n text-align: center;\n min-height: 192px;\n }\n\n .dashboard-error {\n font-size: 30px;\n background: transparent;\n padding: 48px 0;\n margin: 0 auto;\n width: 80%;\n border: 0;\n text-align: center;\n min-height: 192px;\n }\n\n .luzmo-loader {\n top: 0;\n left: 0;\n width: 100%;\n min-height: 400px;\n position: absolute;\n transition-duration: 0.3s;\n }\n"])));exports.LuzmoDashboard=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(a,t.LitElement);var r=c(a);function a(e){var t;return i(this,a),(t=r.call(this)).language="auto",t.screenMode="auto",t.switchScreenModeOnResize=!0,t.editMode="view",t.iframeStyle={},t._containerStyle={},t._loaderStyle={},t._lcStyle={},t._loadingCircleStyle={},t._containerLoaderStyle={},t._loaderMsg="",t._itemEmbedding=!1,t.browserError=!1,t.browserErrorMsg="",t.dashboardError=!1,t.browserNotSupported=[],t.VERSION="5.0.2-wc-luzmo",t.loaderSize=32,t.borderWidth=3,t.minHeight=400,t._containerId=n.uuidv4(),t._iframeId="luzmo-dashboard-".concat(t._containerId),t.iframeLoaded=!1,t.promises={},t.setInputParameters(e),t.params=t._setOptions(),t._onResize=function(){var e;if(null!==(e=t.shadowRoot)&&void 0!==e&&e.querySelector(".dashboard-container")){if(t.containerWidth=t.container.clientWidth,t.params.switchScreenModeOnResize&&"auto"===t.params.screenMode){var r,o=v(n.EXTENTS);try{for(o.s();!(r=o.n()).done;){var a=r.value;a.width[0]<=window.innerWidth&&window.innerWidth<=a.width[1]&&(t.currentScreenMode=a.mode)}}catch(e){o.e(e)}finally{o.f()}}t.iframeLoaded&&t._calculateDimAfterDashboardLoaded()}},t._resizeObserver=new ResizeObserver((function(e){window.requestAnimationFrame((function(){Array.isArray(e)&&0!==e.length&&t._onResize()}))})),t}return d(a,[{key:"setInputParameters",value:function(e){if(e){for(var t=0,r=["dashboardId","dashboardSlug","itemId","language","qeVersion","screenMode","switchScreenModeOnResize","accentColor","mainColor","authToken","authKey","editMode","loaderBackground","loaderFontColor","loaderSpinnerColor","loaderSpinnerBackground","timezoneId","itemDimensions","apiHost"];t<r.length;t++){var o=r[t],a=e[o];a&&(this[o]=a)}e.appServer&&(this.appServer=n.addTrailingSlash(e.appServer))}}},{key:"connectedCallback",value:function(){h(p(a.prototype),"connectedCallback",this).call(this)}},{key:"disconnectedCallback",value:function(){h(p(a.prototype),"disconnectedCallback",this).call(this),this._resizeObserver.disconnect();for(var e=0,t=Object.keys(this.promises);e<t.length;e++){var r=t[e];this.promises[r].reject(new Error("Dashboard component was removed"))}}},{key:"firstUpdated",value:function(){var e;(j._components.push(this),this.containerWidth=this.container.clientWidth,this.params=this._setOptions(),n._extendAndValidate(this),n._browserCheck(this),this._setupLoader(),this.params.error)||(this._loaderStyles(),"function"!=typeof window.__luzmoMessageHandler&&(window.__luzmoMessageHandler=function(e){var t,r=j._components.find((function(t){return e.data.name===t._iframeId}));if(r)switch(null===(t=e.data)||void 0===t?void 0:t.type){case"load":r.dispatchEvent(new CustomEvent("load",{detail:{data:e.data}})),r._loadTimeoutHandle&&(clearTimeout(r._loadTimeoutHandle),r._loadTimeoutHandle=void 0),r.iframeLoaded=!0,r.dimensions=e.data.dimensions,r._calculateDimAfterDashboardLoaded();break;case"error":r.dashboardError=!0,r._loadTimeoutHandle&&(clearTimeout(r._loadTimeoutHandle),r._loadTimeoutHandle=void 0),r.iframeLoaded=!0,r._displayError();break;case"data":n.resolvePromise(r,e.data.requestId,e.data.data);break;case"filters":n.resolvePromise(r,e.data.requestId,e.data.filters);break;case"getAccessibleDashboards":n.resolvePromise(r,e.data.requestId,e.data.accessibleDashboards);break;case"dashboardAction":r.dispatchEvent(new CustomEvent("dashboardAction",{detail:{data:e.data}}));break;case"export":e.data.error?n.rejectPromise(r,e.data.requestId,e.data):(r.dispatchEvent(new CustomEvent("exported",{detail:{data:e.data}})),n.resolvePromise(r,e.data.requestId,e.data));break;case"changedFilters":r.dispatchEvent(new CustomEvent("changedFilters",{detail:{data:e.data}}));break;case"customEvent":r.dispatchEvent(new CustomEvent("customEvent",{detail:{data:e.data}}));break;case"chartsRendered":case"itemsRendered":e.data.type="itemsRendered",r.dispatchEvent(new CustomEvent("itemsRendered",{detail:{data:e.data}}));break;case"setEditMode":e.data.error?n.rejectPromise(r,e.data.requestId,e.data):(n.resolvePromise(r,e.data.requestId,e.data),r.params.editMode=e.data.editMode,r._containerStyle=n.containerStyles(r),r.dimensions&&n._setCalculatedDimensions(r));break;case"setFilters":case"setPreview":e.data.error?n.rejectPromise(r,e.data.requestId,e.data):n.resolvePromise(r,e.data.requestId,e.data)}},window.addEventListener("message",window.__luzmoMessageHandler,!1)),this._iframeUrl=n.createIframeUrl(this),null===(e=this.iframe)||void 0===e||e.setAttribute("src",this._iframeUrl),this.iframeStyle=n.calculateIframeStyles(this));this.container&&this._resizeObserver.observe(this.container)}},{key:"updated",value:function(e){var t,r=new Set(["dashboardId","dashboardSlug","itemId","language","qeVersion","editMode","screenMode","switchScreenModeOnResize","authToken","authKey","appServer","timezoneId","itemDimensions"]),o=v(e.entries());try{for(o.s();!(t=o.n()).done;){var a=m(t.value,1)[0];r.has(a)&&"editMode"!==a?(this.iframeLoaded=!1,this._loadTimeoutHandle&&clearTimeout(this._loadTimeoutHandle),this._loadTimeoutHandle=setTimeout((function(){console.error("Failed to load dashboard, appServer is likely down or unreachable.")}),15e3),this.params=this._setOptions(),n._extendAndValidate(this),this._setupLoader(),this._loaderStyles(),this._iframeUrl=n.createIframeUrl(this),this.iframe&&this._updateIframeUrl(),this.iframeStyle=n.calculateIframeStyles(this)):r.has(a)&&"editMode"===a&&(this.iframeLoaded&&this.setEditMode(this.editMode),this.params=this._setOptions())}}catch(e){o.e(e)}finally{o.f()}}},{key:"_setOptions",value:function(){var e={dashboardId:this.dashboardId,dashboardSlug:this.dashboardSlug};return this.itemId?(e.itemId=this.itemId,this._itemEmbedding=!0):this._itemEmbedding=!1,this.language&&(e.language=this.language),this.qeVersion&&(e.qeVersion=this.qeVersion),this.screenMode&&(e.screenMode=this.screenMode),e.switchScreenModeOnResize=this.switchScreenModeOnResize,this.authToken&&(e.token=this.authToken),this.authKey&&(e.key=this.authKey),this.editMode&&(e.editMode=this.editMode),this.mainColor&&(e.mainColor=this.mainColor),this.accentColor&&(e.accentColor=this.accentColor),this.loaderBackground&&(e.loaderBackground=this.loaderBackground),this.loaderFontColor&&(e.loaderFontColor=this.loaderFontColor),this.loaderSpinnerColor&&(e.loaderSpinnerColor=this.loaderSpinnerColor),this.loaderSpinnerBackground&&(e.loaderSpinnerBackground=this.loaderSpinnerBackground),this.timezoneId&&(e.timezoneId=this.timezoneId),this.itemDimensions&&(e.itemDimensions=this.itemDimensions),this.appServer?(this.appServer=n.addTrailingSlash(this.appServer),e.appServer=this.appServer):(this.appServer=n.addTrailingSlash(n.DEFAULT_PARAMETERS.appServer),e.appServer=this.appServer),this.apiHost?(this.apiHost=n.addTrailingSlash(this.apiHost),e.apiHost=this.apiHost):(this.apiHost=this.appServer.endsWith("luzmo.com/")?this.appServer.replace("app","api"):this.appServer,e.apiHost=this.apiHost),e}},{key:"_updateIframeUrl",value:function(){n.updateIframeUrl(this.iframe,this._iframeUrl)}},{key:"_setupLoader",value:function(){var e=n.getLoader(this);this._loaderMsg=e.loadingMsg,e.errorMsg&&(this.browserError=!0,this.browserErrorMsg=e.errorMsg,this._displayError())}},{key:"_displayError",value:function(){this.dashboardError&&(this._loaderStyles(),this.iframeStyle.opacity=1),this.browserError&&(this._containerStyle.display="none")}},{key:"_calculateDimAfterDashboardLoaded",value:function(){this.dashboardError=!1,this._loaderStyles(),n._setCalculatedDimensions(this)}},{key:"_loaderStyles",value:function(){this._containerStyle=n.containerStyles(this),this._loaderStyle=n.loaderStyles(this),this._loadingCircleStyle=n.plStyles(this),this._containerLoaderStyle=n.containerLoaderStyles(this),this._lcStyle=n.lcStyles(this)}},{key:"render",value:function(){return t.html(z||(z=y(['\n <div\n class="dashboard-container"\n style=',"\n >\n ","\n </div>\n ","\n "])),o.styleMap(this._containerStyle),this.dashboardId||this.dashboardSlug?t.html(w||(w=y(['\n <div\n class="luzmo-container-loader"\n id="luzmo-container-loader-','"\n style=','\n >\n <div\n class="luzmo-loader"\n id="luzmo-loader-','"\n style=','\n >\n <div\n class="luzmo-lc"\n style=','\n >\n <div\n class="luzmo-loading-circle"\n style=',"\n ></div>\n ",'\n </div>\n </div>\n </div>\n\n <iframe\n class="luzmo-embed-dashboard"\n id="','"\n name="','"\n style=','\n frameborder="0"\n ></iframe>\n '])),this._containerId,o.styleMap(this._containerLoaderStyle),this._containerId,o.styleMap(this._loaderStyle),o.styleMap(this._lcStyle),o.styleMap(this._loadingCircleStyle),this._itemEmbedding?"":t.html(O||(O=y(['\n <div\n class="luzmo-loading-message"\n style=',"\n >\n ","\n </div>\n "])),o.styleMap({color:this.loaderFontColor}),this._loaderMsg),this._iframeId,this._iframeId,o.styleMap(this.iframeStyle)):t.html(D||(D=y(["\x3c!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId --\x3e"]))),this.browserError?t.html(x||(x=y(['\n <div id="luzmo-error-','">\n <h3 class="luzmo-error">',"</h3>\n </div>\n "])),this._containerId,this.browserErrorMsg):"")}},{key:"getDashboards",value:function(){return new Promise((function(e){return e(j._components)}))}},{key:"getData",value:function(e){return n.getData(this,this.iframe,e)}},{key:"getFilters",value:function(){return n.getFilters(this,this.iframe)}},{key:"setFilters",value:function(e,t){return n.setFilters(this,this.iframe,e,t)}},{key:"setAuthorization",value:function(e,t){return n.setAuthorization(this,this.iframe,e,t)}},{key:"refreshData",value:function(e){return e?n.refreshData(this,this.iframe,e):n.refreshData(this,this.iframe)}},{key:"reloadDashboard",value:function(){return n.reloadDashboard(this,this.iframe)}},{key:"exportDashboard",value:function(e){return e?n.exportDashboard(this,this.iframe,e):n.exportDashboard(this,this.iframe)}},{key:"getAccessibleDashboards",value:function(){return n.getAccessibleDashboards(this,this.iframe)}},{key:"setEditMode",value:function(e){return n.setEditMode(this,this.iframe,e)}},{key:"setPreview",value:function(e){return n.setPreview(this,this.iframe,e)}}],[{key:"styles",get:function(){return[k]}}]),a}(),g([r.query(".dashboard-container"),S("design:type",HTMLElement)],exports.LuzmoDashboard.prototype,"container",void 0),g([r.query("iframe"),S("design:type",HTMLIFrameElement)],exports.LuzmoDashboard.prototype,"iframe",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"dashboardId",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"dashboardSlug",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"itemId",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"language",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"qeVersion",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"screenMode",void 0),g([r.property({converter:{fromAttribute:function(e){return"true"===e},toAttribute:String}}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"switchScreenModeOnResize",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"editMode",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"mainColor",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"accentColor",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"authToken",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"authKey",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"loaderBackground",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"loaderFontColor",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"loaderSpinnerColor",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"loaderSpinnerBackground",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"appServer",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"timezoneId",void 0),g([r.property(),S("design:type",Object)],exports.LuzmoDashboard.prototype,"apiHost",void 0),g([r.property({type:Object}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"itemDimensions",void 0),g([r.property({attribute:!1}),S("design:type",String)],exports.LuzmoDashboard.prototype,"_containerId",void 0),g([r.property({attribute:!1}),S("design:type",String)],exports.LuzmoDashboard.prototype,"_iframeId",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"params",void 0),g([r.property({attribute:!1}),S("design:type",String)],exports.LuzmoDashboard.prototype,"_iframeUrl",void 0),g([r.property({attribute:!1}),S("design:type",Boolean)],exports.LuzmoDashboard.prototype,"iframeLoaded",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"promises",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"iframeStyle",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"_containerStyle",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"_loaderStyle",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"_lcStyle",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"_loadingCircleStyle",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"_containerLoaderStyle",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"_loaderMsg",void 0),g([r.property({attribute:!1}),S("design:type",Number)],exports.LuzmoDashboard.prototype,"containerWidth",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"dimensions",void 0),g([r.property({attribute:!1}),S("design:type",String)],exports.LuzmoDashboard.prototype,"currentScreenMode",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"_itemEmbedding",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"browserError",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"browserErrorMsg",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"dashboardError",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"browserNotSupported",void 0),g([r.property({attribute:!1}),S("design:type",Object)],exports.LuzmoDashboard.prototype,"VERSION",void 0),exports.LuzmoDashboard=g([r.customElement("luzmo-dashboard"),S("design:paramtypes",[Object])],exports.LuzmoDashboard);
|
package/index.esm.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as e from"@luzmo/shared-embed";import{css as t,LitElement as r,html as i}from"lit";import{customElement as n,query as o,property as a}from"lit/decorators.js";import{styleMap as s}from"lit/directives/style-map.js";function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,E(i.key),i)}}function c(e,t,r){return t&&l(e.prototype,t),r&&l(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function f(e,t){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},f(e,t)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function m(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=u(e);if(t){var n=u(this).constructor;r=Reflect.construct(i,arguments,n)}else r=i.apply(this,arguments);return function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}(this,r)}}function p(){return p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=u(e)););return e}(e,t);if(i){var n=Object.getOwnPropertyDescriptor(i,t);return n.get?n.get.call(arguments.length<3?e:r):n.value}},p.apply(this,arguments)}function v(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function y(e,t){return b(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,o,a,s=[],d=!0,l=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;d=!1}else for(;!(d=(i=o.call(r)).done)&&(s.push(i.value),s.length!==t);d=!0);}catch(e){l=!0,n=e}finally{try{if(!d&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw n}}return s}}(e,t)||g(e,t)||S()}function k(e){return b(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||g(e)||S()}function b(e){if(Array.isArray(e))return e}function g(e,t){if(e){if("string"==typeof e)return w(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?w(e,t):void 0}}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function S(){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,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=g(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}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,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function E(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function z(){z=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var n=t.placement;if(t.kind===i&&("static"===n||"prototype"===n)){var o="static"===n?e:r;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],i=[],n={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,n)}),this),e.forEach((function(e){if(!D(e))return r.push(e);var t=this.decorateElement(e,n);r.push(t.element),r.push.apply(r,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:r,finishers:i};var o=this.decorateConstructor(r,t);return i.push.apply(i,o.finishers),o.finishers=i,o},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var r=[],i=[],n=e.decorators,o=n.length-1;o>=0;o--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),d=this.toElementFinisherExtras((0,n[o])(s)||s);e=d.element,this.addElementPlacement(e,t),d.finisher&&i.push(d.finisher);var l=d.extras;if(l){for(var c=0;c<l.length;c++)this.addElementPlacement(l[c],t);r.push.apply(r,l)}}return{element:e,finishers:i,extras:r}},decorateConstructor:function(e,t){for(var r=[],i=t.length-1;i>=0;i--){var n=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[i])(n)||n);if(void 0!==o.finisher&&r.push(o.finisher),void 0!==o.elements){e=o.elements;for(var a=0;a<e.length-1;a++)for(var s=a+1;s<e.length;s++)if(e[a].key===e[s].key&&e[a].placement===e[s].placement)throw new TypeError("Duplicated element ("+e[a].key+")")}}return{elements:e,finishers:r}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===e.kind&&(t.initializer=e.initializer),t},toElementDescriptors:function(e){if(void 0!==e)return k(e).map((function(e){var t=this.toElementDescriptor(e);return this.disallowProperty(e,"finisher","An element descriptor"),this.disallowProperty(e,"extras","An element descriptor"),t}),this)},toElementDescriptor:function(e){var t=String(e.kind);if("method"!==t&&"field"!==t)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+t+'"');var r=E(e.key),i=String(e.placement);if("static"!==i&&"prototype"!==i&&"own"!==i)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+i+'"');var n=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:r,placement:i,descriptor:Object.assign({},n)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(n,"get","The property descriptor of a field descriptor"),this.disallowProperty(n,"set","The property descriptor of a field descriptor"),this.disallowProperty(n,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:P(e,"finisher"),extras:this.toElementDescriptors(e.extras)}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),t},toClassDescriptor:function(e){var t=String(e.kind);if("class"!==t)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+t+'"');this.disallowProperty(e,"key","A class descriptor"),this.disallowProperty(e,"placement","A class descriptor"),this.disallowProperty(e,"descriptor","A class descriptor"),this.disallowProperty(e,"initializer","A class descriptor"),this.disallowProperty(e,"extras","A class descriptor");var r=P(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var i=(0,t[r])(e);if(void 0!==i){if("function"!=typeof i)throw new TypeError("Finishers must return a constructor.");e=i}}return e},disallowProperty:function(e,t,r){if(void 0!==e[t])throw new TypeError(r+" can't have a ."+t+" property.")}};return e}function I(e){var t,r=E(e.key);"method"===e.kind?t={value:e.value,writable:!0,configurable:!0,enumerable:!1}:"get"===e.kind?t={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?t={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(t={configurable:!0,writable:!0,enumerable:!0});var i={kind:"field"===e.kind?"field":"method",key:r,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(i.decorators=e.decorators),"field"===e.kind&&(i.initializer=e.value),i}function C(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function D(e){return e.decorators&&e.decorators.length}function O(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function P(e,t){var r=e[t];if(void 0!==r&&"function"!=typeof r)throw new TypeError("Expected '"+t+"' to be a function");return r}var x,T,M,A,j,R,H=new(c((function e(){var t,r,i;d(this,e),t=this,i=[],(r=E(r="_components"))in t?Object.defineProperty(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i}))),F=t(x||(x=v(["\n @-webkit-keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n\n @keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n :host {\n position: relative;\n width: 100%;\n }\n\n .luzmo-embed-dashboard {\n background: transparent;\n padding: 0;\n border: 0;\n }\n\n .luzmo-container-loader {\n width: 100%;\n position: relative;\n }\n\n .luzmo-lc {\n margin: 0 auto;\n }\n\n .luzmo-loading-message {\n width: 100%;\n height: 20px;\n text-align: center;\n margin-bottom: 16px;\n font-family: Helvetica, Arial, sans-serif;\n font-size: 14px;\n }\n\n .luzmo-loading-circle {\n box-sizing: border-box;\n margin: 16px auto;\n position: relative;\n text-indent: -9999em;\n animation: spin 0.6s infinite linear;\n }\n\n .luzmo-loading-circle,\n .luzmo-loading-circle:after {\n border-radius: 50%;\n width: 32px;\n height: 32px;\n }\n\n .itemEmbedding:after {\n width: 24px;\n height: 24px;\n }\n\n .luzmo-error {\n background: transparent;\n padding: 48px 0;\n margin: 0 auto;\n width: 80%;\n border: 0;\n text-align: center;\n min-height: 192px;\n }\n\n .dashboard-error {\n font-size: 30px;\n background: transparent;\n padding: 48px 0;\n margin: 0 auto;\n width: 80%;\n border: 0;\n text-align: center;\n min-height: 192px;\n }\n\n .luzmo-loader {\n top: 0;\n left: 0;\n width: 100%;\n min-height: 400px;\n position: absolute;\n transition-duration: 0.3s;\n }\n"]))),L=function(e,t,r,i){var n=z();if(i)for(var o=0;o<i.length;o++)n=i[o](n);var a=t((function(e){n.initializeInstanceElements(e,s.elements)}),r),s=n.decorateClass(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},i=0;i<e.length;i++){var n,o=e[i];if("method"===o.kind&&(n=t.find(r)))if(O(o.descriptor)||O(n.descriptor)){if(D(o)||D(n))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");n.descriptor=o.descriptor}else{if(D(o)){if(D(n))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");n.decorators=o.decorators}C(o,n)}else t.push(o)}return t}(a.d.map(I)),e);return n.initializeClassElements(a.F,s.elements),n.runClassFinishers(a.F,s.finishers)}([n("luzmo-dashboard")],(function(t,r){var n=function(r){!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&&f(e,t)}(n,r);var i=m(n);function n(r){var o;return d(this,n),o=i.call(this),t(h(o)),o._containerId=e.uuidv4(),o._iframeId="luzmo-dashboard-".concat(o._containerId),o.iframeLoaded=!1,o.promises={},o.setInputParameters(r),o.params=o._setOptions(),o._onResize=function(){var t;if(null!==(t=o.shadowRoot)&&void 0!==t&&t.querySelector(".dashboard-container")){if(o.containerWidth=o.container.clientWidth,o.params.switchScreenModeOnResize&&"auto"===o.params.screenMode){var r,i=_(e.EXTENTS);try{for(i.s();!(r=i.n()).done;){var n=r.value;n.width[0]<=window.innerWidth&&window.innerWidth<=n.width[1]&&(o.currentScreenMode=n.mode)}}catch(e){i.e(e)}finally{i.f()}}o.iframeLoaded&&o._calculateDimAfterDashboardLoaded()}},o._resizeObserver=new ResizeObserver((function(e){window.requestAnimationFrame((function(){Array.isArray(e)&&0!==e.length&&o._onResize()}))})),o}return c(n)}(r);return{F:n,d:[{kind:"field",decorators:[o(".dashboard-container")],key:"container",value:void 0},{kind:"field",decorators:[o("iframe")],key:"iframe",value:void 0},{kind:"field",decorators:[a()],key:"dashboardId",value:void 0},{kind:"field",decorators:[a()],key:"dashboardSlug",value:void 0},{kind:"field",decorators:[a()],key:"itemId",value:void 0},{kind:"field",decorators:[a()],key:"language",value:function(){return"auto"}},{kind:"field",decorators:[a()],key:"qeVersion",value:void 0},{kind:"field",decorators:[a()],key:"screenMode",value:function(){return"auto"}},{kind:"field",decorators:[a({converter:{fromAttribute:function(e){return"true"===e},toAttribute:String}})],key:"switchScreenModeOnResize",value:function(){return!0}},{kind:"field",decorators:[a()],key:"editMode",value:function(){return"view"}},{kind:"field",decorators:[a()],key:"mainColor",value:void 0},{kind:"field",decorators:[a()],key:"accentColor",value:void 0},{kind:"field",decorators:[a()],key:"authToken",value:void 0},{kind:"field",decorators:[a()],key:"authKey",value:void 0},{kind:"field",decorators:[a()],key:"loaderBackground",value:void 0},{kind:"field",decorators:[a()],key:"loaderFontColor",value:void 0},{kind:"field",decorators:[a()],key:"loaderSpinnerColor",value:void 0},{kind:"field",decorators:[a()],key:"loaderSpinnerBackground",value:void 0},{kind:"field",decorators:[a()],key:"appServer",value:void 0},{kind:"field",decorators:[a()],key:"timezoneId",value:void 0},{kind:"field",decorators:[a()],key:"apiHost",value:void 0},{kind:"field",decorators:[a({type:Object})],key:"itemDimensions",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"_containerId",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"_iframeId",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"params",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"_iframeUrl",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"iframeLoaded",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"promises",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"iframeStyle",value:function(){return{}}},{kind:"field",decorators:[a({attribute:!1})],key:"_containerStyle",value:function(){return{}}},{kind:"field",decorators:[a({attribute:!1})],key:"_loaderStyle",value:function(){return{}}},{kind:"field",decorators:[a({attribute:!1})],key:"_lcStyle",value:function(){return{}}},{kind:"field",decorators:[a({attribute:!1})],key:"_loadingCircleStyle",value:function(){return{}}},{kind:"field",decorators:[a({attribute:!1})],key:"_containerLoaderStyle",value:function(){return{}}},{kind:"field",decorators:[a({attribute:!1})],key:"_loaderMsg",value:function(){return""}},{kind:"field",decorators:[a({attribute:!1})],key:"containerWidth",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"dimensions",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"currentScreenMode",value:void 0},{kind:"field",decorators:[a({attribute:!1})],key:"_itemEmbedding",value:function(){return!1}},{kind:"field",decorators:[a({attribute:!1})],key:"browserError",value:function(){return!1}},{kind:"field",decorators:[a({attribute:!1})],key:"browserErrorMsg",value:function(){return""}},{kind:"field",decorators:[a({attribute:!1})],key:"dashboardError",value:function(){return!1}},{kind:"field",decorators:[a({attribute:!1})],key:"browserNotSupported",value:function(){return[]}},{kind:"field",decorators:[a({attribute:!1})],key:"VERSION",value:function(){return"5.0.2-wc-luzmo"}},{kind:"field",key:"_loadTimeoutHandle",value:void 0},{kind:"field",key:"_onResize",value:void 0},{kind:"field",key:"loaderSize",value:function(){return 32}},{kind:"field",key:"borderWidth",value:function(){return 3}},{kind:"field",key:"minHeight",value:function(){return 400}},{kind:"field",key:"iframeHeight",value:void 0},{kind:"field",key:"iframeWidth",value:void 0},{kind:"field",key:"_resizeObserver",value:void 0},{kind:"method",key:"setInputParameters",value:function(t){if(t){for(var r=0,i=["dashboardId","dashboardSlug","itemId","language","qeVersion","screenMode","switchScreenModeOnResize","accentColor","mainColor","authToken","authKey","editMode","loaderBackground","loaderFontColor","loaderSpinnerColor","loaderSpinnerBackground","timezoneId","itemDimensions","apiHost"];r<i.length;r++){var n=i[r],o=t[n];o&&(this[n]=o)}t.appServer&&(this.appServer=e.addTrailingSlash(t.appServer))}}},{kind:"method",key:"connectedCallback",value:function(){p(u(n.prototype),"connectedCallback",this).call(this)}},{kind:"method",key:"disconnectedCallback",value:function(){p(u(n.prototype),"disconnectedCallback",this).call(this),this._resizeObserver.disconnect();for(var e=0,t=Object.keys(this.promises);e<t.length;e++){var r=t[e];this.promises[r].reject(new Error("Dashboard component was removed"))}}},{kind:"method",key:"firstUpdated",value:function(){var t;(H._components.push(this),this.containerWidth=this.container.clientWidth,this.params=this._setOptions(),e._extendAndValidate(this),e._browserCheck(this),this._setupLoader(),this.params.error)||(this._loaderStyles(),"function"!=typeof window.__luzmoMessageHandler&&(window.__luzmoMessageHandler=function(t){var r,i=H._components.find((function(e){return t.data.name===e._iframeId}));if(i)switch(null===(r=t.data)||void 0===r?void 0:r.type){case"load":i.dispatchEvent(new CustomEvent("load",{detail:{data:t.data}})),i._loadTimeoutHandle&&(clearTimeout(i._loadTimeoutHandle),i._loadTimeoutHandle=void 0),i.iframeLoaded=!0,i.dimensions=t.data.dimensions,i._calculateDimAfterDashboardLoaded();break;case"error":i.dashboardError=!0,i._loadTimeoutHandle&&(clearTimeout(i._loadTimeoutHandle),i._loadTimeoutHandle=void 0),i.iframeLoaded=!0,i._displayError();break;case"data":e.resolvePromise(i,t.data.requestId,t.data.data);break;case"filters":e.resolvePromise(i,t.data.requestId,t.data.filters);break;case"getAccessibleDashboards":e.resolvePromise(i,t.data.requestId,t.data.accessibleDashboards);break;case"dashboardAction":i.dispatchEvent(new CustomEvent("dashboardAction",{detail:{data:t.data}}));break;case"export":t.data.error?e.rejectPromise(i,t.data.requestId,t.data):(i.dispatchEvent(new CustomEvent("exported",{detail:{data:t.data}})),e.resolvePromise(i,t.data.requestId,t.data));break;case"changedFilters":i.dispatchEvent(new CustomEvent("changedFilters",{detail:{data:t.data}}));break;case"customEvent":i.dispatchEvent(new CustomEvent("customEvent",{detail:{data:t.data}}));break;case"chartsRendered":case"itemsRendered":t.data.type="itemsRendered",i.dispatchEvent(new CustomEvent("itemsRendered",{detail:{data:t.data}}));break;case"setEditMode":t.data.error?e.rejectPromise(i,t.data.requestId,t.data):(e.resolvePromise(i,t.data.requestId,t.data),i.params.editMode=t.data.editMode,i._containerStyle=e.containerStyles(i),i.dimensions&&e._setCalculatedDimensions(i));break;case"setFilters":case"setPreview":t.data.error?e.rejectPromise(i,t.data.requestId,t.data):e.resolvePromise(i,t.data.requestId,t.data)}},window.addEventListener("message",window.__luzmoMessageHandler,!1)),this._iframeUrl=e.createIframeUrl(this),null===(t=this.iframe)||void 0===t||t.setAttribute("src",this._iframeUrl),this.iframeStyle=e.calculateIframeStyles(this));this.container&&this._resizeObserver.observe(this.container)}},{kind:"method",key:"updated",value:function(t){var r,i=new Set(["dashboardId","dashboardSlug","itemId","language","qeVersion","editMode","screenMode","switchScreenModeOnResize","authToken","authKey","appServer","timezoneId","itemDimensions"]),n=_(t.entries());try{for(n.s();!(r=n.n()).done;){var o=y(r.value,1)[0];i.has(o)&&"editMode"!==o?(this.iframeLoaded=!1,this._loadTimeoutHandle&&clearTimeout(this._loadTimeoutHandle),this._loadTimeoutHandle=setTimeout((function(){console.error("Failed to load dashboard, appServer is likely down or unreachable.")}),15e3),this.params=this._setOptions(),e._extendAndValidate(this),this._setupLoader(),this._loaderStyles(),this._iframeUrl=e.createIframeUrl(this),this.iframe&&this._updateIframeUrl(),this.iframeStyle=e.calculateIframeStyles(this)):i.has(o)&&"editMode"===o&&(this.iframeLoaded&&this.setEditMode(this.editMode),this.params=this._setOptions())}}catch(e){n.e(e)}finally{n.f()}}},{kind:"method",key:"_setOptions",value:function(){var t={dashboardId:this.dashboardId,dashboardSlug:this.dashboardSlug};return this.itemId?(t.itemId=this.itemId,this._itemEmbedding=!0):this._itemEmbedding=!1,this.language&&(t.language=this.language),this.qeVersion&&(t.qeVersion=this.qeVersion),this.screenMode&&(t.screenMode=this.screenMode),t.switchScreenModeOnResize=this.switchScreenModeOnResize,this.authToken&&(t.token=this.authToken),this.authKey&&(t.key=this.authKey),this.editMode&&(t.editMode=this.editMode),this.mainColor&&(t.mainColor=this.mainColor),this.accentColor&&(t.accentColor=this.accentColor),this.loaderBackground&&(t.loaderBackground=this.loaderBackground),this.loaderFontColor&&(t.loaderFontColor=this.loaderFontColor),this.loaderSpinnerColor&&(t.loaderSpinnerColor=this.loaderSpinnerColor),this.loaderSpinnerBackground&&(t.loaderSpinnerBackground=this.loaderSpinnerBackground),this.timezoneId&&(t.timezoneId=this.timezoneId),this.itemDimensions&&(t.itemDimensions=this.itemDimensions),this.appServer?(this.appServer=e.addTrailingSlash(this.appServer),t.appServer=this.appServer):(this.appServer=e.addTrailingSlash(e.DEFAULT_PARAMETERS.appServer),t.appServer=this.appServer),this.apiHost?(this.apiHost=e.addTrailingSlash(this.apiHost),t.apiHost=this.apiHost):(this.apiHost=this.appServer.endsWith("luzmo.com/")?this.appServer.replace("app","api"):this.appServer,t.apiHost=this.apiHost),t}},{kind:"method",key:"_updateIframeUrl",value:function(){e.updateIframeUrl(this.iframe,this._iframeUrl)}},{kind:"method",key:"_setupLoader",value:function(){var t=e.getLoader(this);this._loaderMsg=t.loadingMsg,t.errorMsg&&(this.browserError=!0,this.browserErrorMsg=t.errorMsg,this._displayError())}},{kind:"method",key:"_displayError",value:function(){this.dashboardError&&(this._loaderStyles(),this.iframeStyle.opacity=1),this.browserError&&(this._containerStyle.display="none")}},{kind:"method",key:"_calculateDimAfterDashboardLoaded",value:function(){this.dashboardError=!1,this._loaderStyles(),e._setCalculatedDimensions(this)}},{kind:"method",key:"_loaderStyles",value:function(){this._containerStyle=e.containerStyles(this),this._loaderStyle=e.loaderStyles(this),this._loadingCircleStyle=e.plStyles(this),this._containerLoaderStyle=e.containerLoaderStyles(this),this._lcStyle=e.lcStyles(this)}},{kind:"get",static:!0,key:"styles",value:function(){return[F]}},{kind:"method",key:"render",value:function(){return i(T||(T=v(['\n <div\n class="dashboard-container"\n style=',"\n >\n ","\n </div>\n ","\n "])),s(this._containerStyle),this.dashboardId||this.dashboardSlug?i(M||(M=v(['\n <div\n class="luzmo-container-loader"\n id="luzmo-container-loader-','"\n style=','\n >\n <div\n class="luzmo-loader"\n id="luzmo-loader-','"\n style=','\n >\n <div\n class="luzmo-lc"\n style=','\n >\n <div\n class="luzmo-loading-circle"\n style=',"\n ></div>\n ",'\n </div>\n </div>\n </div>\n\n <iframe\n class="luzmo-embed-dashboard"\n id="','"\n name="','"\n style=','\n frameborder="0"\n ></iframe>\n '])),this._containerId,s(this._containerLoaderStyle),this._containerId,s(this._loaderStyle),s(this._lcStyle),s(this._loadingCircleStyle),this._itemEmbedding?"":i(A||(A=v(['\n <div\n class="luzmo-loading-message"\n style=',"\n >\n ","\n </div>\n "])),s({color:this.loaderFontColor}),this._loaderMsg),this._iframeId,this._iframeId,s(this.iframeStyle)):i(j||(j=v(["\x3c!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId --\x3e"]))),this.browserError?i(R||(R=v(['\n <div id="luzmo-error-','">\n <h3 class="luzmo-error">',"</h3>\n </div>\n "])),this._containerId,this.browserErrorMsg):"")}},{kind:"method",key:"getDashboards",value:function(){return new Promise((function(e){return e(H._components)}))}},{kind:"method",key:"getData",value:function(t){return e.getData(this,this.iframe,t)}},{kind:"method",key:"getFilters",value:function(){return e.getFilters(this,this.iframe)}},{kind:"method",key:"setFilters",value:function(t,r){return e.setFilters(this,this.iframe,t,r)}},{kind:"method",key:"setAuthorization",value:function(t,r){return e.setAuthorization(this,this.iframe,t,r)}},{kind:"method",key:"refreshData",value:function(t){return t?e.refreshData(this,this.iframe,t):e.refreshData(this,this.iframe)}},{kind:"method",key:"reloadDashboard",value:function(){return e.reloadDashboard(this,this.iframe)}},{kind:"method",key:"exportDashboard",value:function(t){return t?e.exportDashboard(this,this.iframe,t):e.exportDashboard(this,this.iframe)}},{kind:"method",key:"getAccessibleDashboards",value:function(){return e.getAccessibleDashboards(this,this.iframe)}},{kind:"method",key:"setEditMode",value:function(t){return e.setEditMode(this,this.iframe,t)}},{kind:"method",key:"setPreview",value:function(t){return e.setPreview(this,this.iframe,t)}}]}}),r);export{L as LuzmoDashboard};
|