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