@luzmo/embed 5.1.3-beta.0 → 5.1.3

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.
@@ -42,8 +42,7 @@ var __decorateClass = (decorators, target, key, kind) => {
42
42
  // libs/embed-libs/embed/src/index.libs.ts
43
43
  var index_libs_exports = {};
44
44
  __export(index_libs_exports, {
45
- LuzmoDashboardWebComponent: () => LuzmoDashboardWebComponent,
46
- LuzmoVizItemWebComponent: () => LuzmoVizItemWebComponent
45
+ LuzmoDashboardWebComponent: () => LuzmoDashboardWebComponent
47
46
  });
48
47
  module.exports = __toCommonJS(index_libs_exports);
49
48
 
@@ -1490,21 +1489,6 @@ var _extendAndValidate = (dashboardContent) => {
1490
1489
  }
1491
1490
  };
1492
1491
 
1493
- // libs/embed-libs/shared-embed/src/lib/models/viz-item.model.ts
1494
- var libraryTypeToWebComponentTypeMapping = {
1495
- type: "type",
1496
- theme: "theme",
1497
- slots: "slots",
1498
- options: "options",
1499
- appServer: "app-server",
1500
- apiHost: "api-host",
1501
- authKey: "auth-key",
1502
- authToken: "auth-token",
1503
- contextId: "context-id",
1504
- canFilter: "can-filter",
1505
- filters: "filters"
1506
- };
1507
-
1508
1492
  // libs/embed-libs/shared-embed/src/lib/constants/class-constants.ts
1509
1493
  var luzmoEmbedContainerClass = "luzmo-embed-container";
1510
1494
 
@@ -1572,21 +1556,6 @@ function __federationMethodWrapDefault(module2, need) {
1572
1556
  async function __federationMethodGetRemote(remoteName, componentName) {
1573
1557
  return __federationMethodEnsure(remoteName).then((remote) => remote.get(componentName).then((factory) => factory()));
1574
1558
  }
1575
- async function loadLibrary(appServer, componentName = "DashboardApp") {
1576
- if (remotesMap[appServer]) {
1577
- return remotesMap[appServer].module;
1578
- }
1579
- remotesMap[appServer] = {
1580
- url: appServer?.startsWith("http://localhost") ? `${removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
1581
- format: "esm",
1582
- from: "vite",
1583
- module: void 0
1584
- };
1585
- const module2 = await __federationMethodGetRemote(appServer, `./${componentName}`);
1586
- const wrappedModule = __federationMethodWrapDefault(module2, true);
1587
- remotesMap[appServer].module = wrappedModule;
1588
- return wrappedModule;
1589
- }
1590
1559
 
1591
1560
  // node_modules/lit-html/lit-html.js
1592
1561
  var t3 = globalThis;
@@ -1937,7 +1906,7 @@ var o5 = e6(class extends i4 {
1937
1906
  });
1938
1907
 
1939
1908
  // libs/embed-libs/embed/package.json
1940
- var version = "5.1.3-beta.0";
1909
+ var version = "5.1.3";
1941
1910
 
1942
1911
  // libs/embed-libs/embed/src/lib/luzmo-service.ts
1943
1912
  var LuzmoService = class {
@@ -2107,6 +2076,7 @@ var _setEventHandler = () => {
2107
2076
  var dashboardStyles = i`
2108
2077
  :host {
2109
2078
  display: block;
2079
+ height: 100%;
2110
2080
  }
2111
2081
 
2112
2082
  @-webkit-keyframes spin {
@@ -2141,6 +2111,9 @@ var dashboardStyles = i`
2141
2111
  border: 0;
2142
2112
  }
2143
2113
 
2114
+ .luzmo-embed-dashboard-ede {
2115
+ }
2116
+
2144
2117
  .luzmo-embed-container-ede {
2145
2118
  width: 100%;
2146
2119
  height: 100%;
@@ -2217,7 +2190,7 @@ var dashboardStyles = i`
2217
2190
 
2218
2191
  // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-base.ts
2219
2192
  var LuzmoDashboard = class extends s3 {
2220
- constructor() {
2193
+ constructor(inputParameters) {
2221
2194
  super();
2222
2195
  this.language = "auto";
2223
2196
  this.screenMode = "auto";
@@ -2236,11 +2209,10 @@ var LuzmoDashboard = class extends s3 {
2236
2209
  this.browserErrorMsg = "";
2237
2210
  this.dashboardError = false;
2238
2211
  this.browserNotSupported = [];
2239
- this.version = version + "-wc-luzmo";
2212
+ this.VERSION = version + "-wc-luzmo";
2240
2213
  this.isLibraryLoaded = false;
2241
2214
  this.currentAuthKey = null;
2242
2215
  this.currentAuthToken = null;
2243
- this.isInitCalled = false;
2244
2216
  this.attributesMap = {
2245
2217
  dashboardId: "dashboard-id",
2246
2218
  dashboardSlug: "dashboard-slug",
@@ -2270,6 +2242,7 @@ var LuzmoDashboard = class extends s3 {
2270
2242
  this._iframeId = `luzmo-dashboard-${this._containerId}`;
2271
2243
  this.iframeLoaded = false;
2272
2244
  this.promises = {};
2245
+ this.setInputParameters(inputParameters);
2273
2246
  this.params = this._setOptions();
2274
2247
  this._onResize = () => {
2275
2248
  if (this.shadowRoot?.querySelector(".dashboard-container")) {
@@ -2300,6 +2273,60 @@ var LuzmoDashboard = class extends s3 {
2300
2273
  });
2301
2274
  });
2302
2275
  }
2276
+ loadLibrary(appServer) {
2277
+ if (remotesMap[appServer]) {
2278
+ return Promise.resolve(remotesMap[appServer].module);
2279
+ }
2280
+ remotesMap[appServer] = {
2281
+ url: appServer?.startsWith("http://localhost") ? `${removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
2282
+ format: "esm",
2283
+ from: "vite",
2284
+ module: void 0
2285
+ };
2286
+ return __federationMethodGetRemote(appServer, "./DashboardApp").then((module2) => {
2287
+ const wrappedModule = __federationMethodWrapDefault(module2, true);
2288
+ remotesMap[appServer].module = wrappedModule;
2289
+ return wrappedModule;
2290
+ });
2291
+ }
2292
+ setInputParameters(inputParameters) {
2293
+ if (!inputParameters) {
2294
+ return;
2295
+ }
2296
+ const params = [
2297
+ "dashboardId",
2298
+ "dashboardSlug",
2299
+ "itemId",
2300
+ "language",
2301
+ "qeVersion",
2302
+ "screenMode",
2303
+ "switchScreenModeOnResize",
2304
+ "accentColor",
2305
+ "mainColor",
2306
+ "authToken",
2307
+ "authKey",
2308
+ "editMode",
2309
+ "loaderBackground",
2310
+ "loaderFontColor",
2311
+ "loaderSpinnerColor",
2312
+ "loaderSpinnerBackground",
2313
+ "timezoneId",
2314
+ "itemDimensions",
2315
+ "apiHost"
2316
+ ];
2317
+ for (const key of params) {
2318
+ const value = inputParameters[key];
2319
+ if (value) {
2320
+ this[key] = value;
2321
+ }
2322
+ }
2323
+ if (inputParameters.experimental) {
2324
+ this.experimental = inputParameters.experimental;
2325
+ }
2326
+ if (inputParameters.appServer) {
2327
+ this.appServer = addTrailingSlash(inputParameters.appServer);
2328
+ }
2329
+ }
2303
2330
  // Set resize event listener
2304
2331
  connectedCallback() {
2305
2332
  super.connectedCallback();
@@ -2318,6 +2345,7 @@ var LuzmoDashboard = class extends s3 {
2318
2345
  this._loaderMsg = getLoader(this)?.loadingMsg;
2319
2346
  this._loaderStyles();
2320
2347
  luzmo_service_default._components.push(this);
2348
+ this.initComponent();
2321
2349
  if (this.luzmoEmbedContainer) {
2322
2350
  this._resizeObserver.observe(this.luzmoEmbedContainer);
2323
2351
  }
@@ -2325,7 +2353,7 @@ var LuzmoDashboard = class extends s3 {
2325
2353
  initComponent() {
2326
2354
  this.params = this._setOptions();
2327
2355
  if (this.getIsViewMode()) {
2328
- loadLibrary(this.params.appServer).then(async () => {
2356
+ this.loadLibrary(this.params.appServer).then(async () => {
2329
2357
  this.isLibraryLoaded = true;
2330
2358
  await this.updateComplete;
2331
2359
  const oldReference = this.renderRoot.querySelector("dashboard-component");
@@ -2397,21 +2425,11 @@ var LuzmoDashboard = class extends s3 {
2397
2425
  "timezoneId",
2398
2426
  "itemDimensions"
2399
2427
  ]);
2400
- const conditionsToCheck = ["dashboardId", "dashboardSlug", "itemId"];
2401
- let callInitComponent = false;
2402
- for (const condition of conditionsToCheck) {
2403
- callInitComponent = callInitComponent || changedProperties.get(condition) === void 0 && this[condition];
2404
- }
2405
- if (callInitComponent && !this.isInitCalled) {
2406
- this.initComponent();
2407
- this.isInitCalled = true;
2408
- return;
2409
- }
2410
2428
  if (this.getIsViewMode()) {
2411
2429
  if (this.dashboardReference) {
2412
2430
  for (const [propertyName] of changedProperties.entries()) {
2413
2431
  if (propertyName === "appSever") {
2414
- loadLibrary(changedProperties[propertyName]).then(async () => {
2432
+ this.loadLibrary(changedProperties[propertyName]).then(async () => {
2415
2433
  this.isLibraryLoaded = true;
2416
2434
  await this.updateComplete;
2417
2435
  this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
@@ -2619,7 +2637,7 @@ var LuzmoDashboard = class extends s3 {
2619
2637
  ${this.dashboardId || this.dashboardSlug ? x`
2620
2638
  ${loader}
2621
2639
  <iframe
2622
- class="luzmo-embed-dashboard"
2640
+ class="luzmo-embed-dashboard ${!this.getIsViewMode() ? `luzmo-embed-dashboard-ede` : ""}"
2623
2641
  id="${this._iframeId}"
2624
2642
  name="${this._iframeId}"
2625
2643
  style=${o5(this.iframeStyle)}
@@ -2910,7 +2928,7 @@ __decorateClass([
2910
2928
  ], LuzmoDashboard.prototype, "browserNotSupported", 2);
2911
2929
  __decorateClass([
2912
2930
  n3()
2913
- ], LuzmoDashboard.prototype, "version", 2);
2931
+ ], LuzmoDashboard.prototype, "VERSION", 2);
2914
2932
  __decorateClass([
2915
2933
  r4()
2916
2934
  ], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
@@ -2923,9 +2941,6 @@ __decorateClass([
2923
2941
  __decorateClass([
2924
2942
  r4()
2925
2943
  ], LuzmoDashboard.prototype, "currentAuthToken", 2);
2926
- __decorateClass([
2927
- r4()
2928
- ], LuzmoDashboard.prototype, "isInitCalled", 2);
2929
2944
 
2930
2945
  // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-web-component.ts
2931
2946
  var LuzmoDashboardWebComponent = class extends LuzmoDashboard {
@@ -2933,127 +2948,6 @@ var LuzmoDashboardWebComponent = class extends LuzmoDashboard {
2933
2948
  LuzmoDashboardWebComponent = __decorateClass([
2934
2949
  t("luzmo-dashboard-web-component")
2935
2950
  ], LuzmoDashboardWebComponent);
2936
-
2937
- // libs/embed-libs/embed/src/lib/viz-item/viz-item.base.ts
2938
- var LuzmoBaseVizItem = class extends s3 {
2939
- constructor() {
2940
- super();
2941
- this.appServer = "https://app.luzmo.com";
2942
- this.apiHost = "https://api.luzmo.com";
2943
- this.slots = [];
2944
- this.options = {
2945
- title: {
2946
- en: ""
2947
- },
2948
- theme: "default"
2949
- };
2950
- this.version = version + "-wc-luzmo";
2951
- }
2952
- static {
2953
- // Static styles to set host display to block, else it is not shown at all for some reason.
2954
- this.styles = i`
2955
- :host {
2956
- display: block;
2957
- width: 100%;
2958
- height: 100%;
2959
- }
2960
- `;
2961
- }
2962
- async firstUpdated(_changedProperties) {
2963
- super.firstUpdated(_changedProperties);
2964
- if (this.type) {
2965
- await loadLibrary(this.appServer, "DashboardApp");
2966
- this.createAndAppendElement();
2967
- }
2968
- }
2969
- createAndAppendElement() {
2970
- if (!this.chartElement) {
2971
- this.chartElement = document.createElement("chart-component");
2972
- this.chartElement.setAttribute("embedding-mode", "chart");
2973
- this.updateVizItemProperties();
2974
- this.renderRoot.append(this.chartElement);
2975
- }
2976
- }
2977
- updateVizItemProperties() {
2978
- if (this.chartElement) {
2979
- for (const key in libraryTypeToWebComponentTypeMapping) {
2980
- const value = this[key];
2981
- if (value) {
2982
- const attributeValue = ["appServer", "apiHost"].includes(key) ? removeTrailingSlash(value) : value;
2983
- this.chartElement.setAttribute(
2984
- libraryTypeToWebComponentTypeMapping[key],
2985
- typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
2986
- );
2987
- }
2988
- }
2989
- }
2990
- }
2991
- async updated(changedProperties) {
2992
- if (this.chartElement) {
2993
- for (const [propertyName] of changedProperties.entries()) {
2994
- const mappedAttributeName = libraryTypeToWebComponentTypeMapping[propertyName] ?? propertyName;
2995
- const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
2996
- this.chartElement.setAttribute(mappedAttributeName, attributeValue);
2997
- }
2998
- } else {
2999
- if (this.type) {
3000
- await loadLibrary(this.appServer, "DashboardApp");
3001
- this.createAndAppendElement();
3002
- }
3003
- }
3004
- }
3005
- render() {
3006
- return x` `;
3007
- }
3008
- };
3009
- __decorateClass([
3010
- n3()
3011
- ], LuzmoBaseVizItem.prototype, "appServer", 2);
3012
- __decorateClass([
3013
- n3()
3014
- ], LuzmoBaseVizItem.prototype, "apiHost", 2);
3015
- __decorateClass([
3016
- n3({ type: Array })
3017
- ], LuzmoBaseVizItem.prototype, "slots", 2);
3018
- __decorateClass([
3019
- n3({ type: Object })
3020
- ], LuzmoBaseVizItem.prototype, "options", 2);
3021
- __decorateClass([
3022
- n3()
3023
- ], LuzmoBaseVizItem.prototype, "type", 2);
3024
- __decorateClass([
3025
- n3()
3026
- ], LuzmoBaseVizItem.prototype, "authKey", 2);
3027
- __decorateClass([
3028
- n3()
3029
- ], LuzmoBaseVizItem.prototype, "authToken", 2);
3030
- __decorateClass([
3031
- n3()
3032
- ], LuzmoBaseVizItem.prototype, "version", 2);
3033
- __decorateClass([
3034
- n3()
3035
- ], LuzmoBaseVizItem.prototype, "contextId", 2);
3036
- __decorateClass([
3037
- n3({
3038
- converter: (value) => {
3039
- try {
3040
- return JSON.parse(value);
3041
- } catch (exc) {
3042
- return value;
3043
- }
3044
- }
3045
- })
3046
- ], LuzmoBaseVizItem.prototype, "canFilter", 2);
3047
- __decorateClass([
3048
- n3({ type: Array })
3049
- ], LuzmoBaseVizItem.prototype, "filters", 2);
3050
-
3051
- // libs/embed-libs/embed/src/lib/viz-item/viz-item-web-component.ts
3052
- var LuzmoVizItemWebComponent = class extends LuzmoBaseVizItem {
3053
- };
3054
- LuzmoVizItemWebComponent = __decorateClass([
3055
- t("luzmo-viz-item-web-component")
3056
- ], LuzmoVizItemWebComponent);
3057
2951
  /*! Bundled license information:
3058
2952
 
3059
2953
  @lit/reactive-element/decorators/custom-element.js: