@luzmo/embed 5.1.0-beta.4 → 5.1.1

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.0-beta.4";
1910
+ var version = "5.1.1";
1942
1911
 
1943
1912
  // libs/embed-libs/embed/src/lib/luzmo-service.ts
1944
1913
  var LuzmoService = class {
@@ -2237,7 +2206,7 @@ var LuzmoDashboard = class extends s3 {
2237
2206
  this.browserErrorMsg = "";
2238
2207
  this.dashboardError = false;
2239
2208
  this.browserNotSupported = [];
2240
- this.version = version + "-wc-luzmo";
2209
+ this.VERSION = version + "-wc-luzmo";
2241
2210
  this.isLibraryLoaded = false;
2242
2211
  this.currentAuthKey = null;
2243
2212
  this.currentAuthToken = null;
@@ -2301,6 +2270,22 @@ var LuzmoDashboard = class extends s3 {
2301
2270
  });
2302
2271
  });
2303
2272
  }
2273
+ loadLibrary(appServer) {
2274
+ if (remotesMap[appServer]) {
2275
+ return Promise.resolve(remotesMap[appServer].module);
2276
+ }
2277
+ remotesMap[appServer] = {
2278
+ url: appServer?.startsWith("http://localhost") ? `${removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
2279
+ format: "esm",
2280
+ from: "vite",
2281
+ module: void 0
2282
+ };
2283
+ return __federationMethodGetRemote(appServer, "./DashboardApp").then((module2) => {
2284
+ const wrappedModule = __federationMethodWrapDefault(module2, true);
2285
+ remotesMap[appServer].module = wrappedModule;
2286
+ return wrappedModule;
2287
+ });
2288
+ }
2304
2289
  setInputParameters(inputParameters) {
2305
2290
  if (!inputParameters) {
2306
2291
  return;
@@ -2365,7 +2350,7 @@ var LuzmoDashboard = class extends s3 {
2365
2350
  initComponent() {
2366
2351
  this.params = this._setOptions();
2367
2352
  if (this.getIsViewMode()) {
2368
- loadLibrary(this.params.appServer).then(async () => {
2353
+ this.loadLibrary(this.params.appServer).then(async () => {
2369
2354
  this.isLibraryLoaded = true;
2370
2355
  await this.updateComplete;
2371
2356
  const oldReference = this.renderRoot.querySelector("dashboard-component");
@@ -2441,7 +2426,7 @@ var LuzmoDashboard = class extends s3 {
2441
2426
  if (this.dashboardReference) {
2442
2427
  for (const [propertyName] of changedProperties.entries()) {
2443
2428
  if (propertyName === "appSever") {
2444
- loadLibrary(changedProperties[propertyName]).then(async () => {
2429
+ this.loadLibrary(changedProperties[propertyName]).then(async () => {
2445
2430
  this.isLibraryLoaded = true;
2446
2431
  await this.updateComplete;
2447
2432
  this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
@@ -2940,7 +2925,7 @@ __decorateClass([
2940
2925
  ], LuzmoDashboard.prototype, "browserNotSupported", 2);
2941
2926
  __decorateClass([
2942
2927
  n3()
2943
- ], LuzmoDashboard.prototype, "version", 2);
2928
+ ], LuzmoDashboard.prototype, "VERSION", 2);
2944
2929
  __decorateClass([
2945
2930
  r4()
2946
2931
  ], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
@@ -2965,127 +2950,6 @@ var LuzmoEmbedDashboard = class extends LuzmoDashboard {
2965
2950
  LuzmoEmbedDashboard = __decorateClass([
2966
2951
  t("luzmo-embed-dashboard")
2967
2952
  ], LuzmoEmbedDashboard);
2968
-
2969
- // libs/embed-libs/embed/src/lib/viz-item/viz-item.base.ts
2970
- var LuzmoBaseVizItem = class extends s3 {
2971
- constructor() {
2972
- super();
2973
- this.appServer = "https://app.luzmo.com";
2974
- this.apiHost = "https://api.luzmo.com";
2975
- this.slots = [];
2976
- this.options = {
2977
- title: {
2978
- en: ""
2979
- },
2980
- theme: "default"
2981
- };
2982
- this.version = version + "-wc-luzmo";
2983
- }
2984
- static {
2985
- // Static styles to set host display to block, else it is not shown at all for some reason.
2986
- this.styles = i`
2987
- :host {
2988
- display: block;
2989
- width: 100%;
2990
- height: 100%;
2991
- }
2992
- `;
2993
- }
2994
- async firstUpdated(_changedProperties) {
2995
- super.firstUpdated(_changedProperties);
2996
- if (this.type) {
2997
- await loadLibrary(this.appServer, "DashboardApp");
2998
- this.createAndAppendElement();
2999
- }
3000
- }
3001
- createAndAppendElement() {
3002
- if (!this.chartElement) {
3003
- this.chartElement = document.createElement("chart-component");
3004
- this.chartElement.setAttribute("embedding-mode", "chart");
3005
- this.updateVizItemProperties();
3006
- this.renderRoot.append(this.chartElement);
3007
- }
3008
- }
3009
- updateVizItemProperties() {
3010
- if (this.chartElement) {
3011
- for (const key in libraryTypeToWebComponentTypeMapping) {
3012
- const value = this[key];
3013
- if (value) {
3014
- const attributeValue = ["appServer", "apiHost"].includes(key) ? removeTrailingSlash(value) : value;
3015
- this.chartElement.setAttribute(
3016
- libraryTypeToWebComponentTypeMapping[key],
3017
- typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
3018
- );
3019
- }
3020
- }
3021
- }
3022
- }
3023
- async updated(changedProperties) {
3024
- if (this.chartElement) {
3025
- for (const [propertyName] of changedProperties.entries()) {
3026
- const mappedAttributeName = libraryTypeToWebComponentTypeMapping[propertyName] ?? propertyName;
3027
- const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
3028
- this.chartElement.setAttribute(mappedAttributeName, attributeValue);
3029
- }
3030
- } else {
3031
- if (this.type) {
3032
- await loadLibrary(this.appServer, "DashboardApp");
3033
- this.createAndAppendElement();
3034
- }
3035
- }
3036
- }
3037
- render() {
3038
- return x` `;
3039
- }
3040
- };
3041
- __decorateClass([
3042
- n3()
3043
- ], LuzmoBaseVizItem.prototype, "appServer", 2);
3044
- __decorateClass([
3045
- n3()
3046
- ], LuzmoBaseVizItem.prototype, "apiHost", 2);
3047
- __decorateClass([
3048
- n3({ type: Array })
3049
- ], LuzmoBaseVizItem.prototype, "slots", 2);
3050
- __decorateClass([
3051
- n3({ type: Object })
3052
- ], LuzmoBaseVizItem.prototype, "options", 2);
3053
- __decorateClass([
3054
- n3()
3055
- ], LuzmoBaseVizItem.prototype, "type", 2);
3056
- __decorateClass([
3057
- n3()
3058
- ], LuzmoBaseVizItem.prototype, "authKey", 2);
3059
- __decorateClass([
3060
- n3()
3061
- ], LuzmoBaseVizItem.prototype, "authToken", 2);
3062
- __decorateClass([
3063
- n3()
3064
- ], LuzmoBaseVizItem.prototype, "version", 2);
3065
- __decorateClass([
3066
- n3()
3067
- ], LuzmoBaseVizItem.prototype, "contextId", 2);
3068
- __decorateClass([
3069
- n3({
3070
- converter: (value) => {
3071
- try {
3072
- return JSON.parse(value);
3073
- } catch (exc) {
3074
- return value;
3075
- }
3076
- }
3077
- })
3078
- ], LuzmoBaseVizItem.prototype, "canFilter", 2);
3079
- __decorateClass([
3080
- n3({ type: Array })
3081
- ], LuzmoBaseVizItem.prototype, "filters", 2);
3082
-
3083
- // libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
3084
- var LuzmoVizItem = class extends LuzmoBaseVizItem {
3085
- };
3086
- LuzmoVizItem = __decorateClass([
3087
- t("luzmo-viz-item")
3088
- ], LuzmoVizItem);
3089
2953
  /*! Bundled license information:
3090
2954
 
3091
2955
  @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.0-beta.4",
3
+ "version": "5.1.1",
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 ADDED
@@ -0,0 +1,2 @@
1
+ export type { LoadEvent, ChangedFiltersEvent, CustomEvent, ItemsRenderedEvent, ExportedEvent, DashboardActionEvent, Filter, FilterExpression, FilterOrigin, FilterInput, FilterGroup, ExportType, ItemData, ExportDashboard, AccessibleDashboard, SetEditMode } from '@luzmo/shared-embed';
2
+ export * from './lib/dashboard-component/dashboard-component';
@@ -0,0 +1,98 @@
1
+ import * as SharedLib from '@luzmo/shared-embed';
2
+ import { LitElement, PropertyValues, TemplateResult } from 'lit';
3
+ import { CombinedFilterInput } from '@luzmo/shared-embed';
4
+ /**
5
+ * Luzmo Dashboard
6
+ * Base component isn't registered in customEvents registry so that it can be reused.
7
+ */
8
+ export declare class LuzmoDashboard extends LitElement implements SharedLib.ES6LuzmoDashboard {
9
+ container: HTMLElement;
10
+ luzmoEmbedContainer: HTMLElement;
11
+ iframe: HTMLIFrameElement;
12
+ dashboardId?: SharedLib.DashboardInputs['dashboardId'];
13
+ dashboardSlug?: SharedLib.DashboardInputs['dashboardSlug'];
14
+ itemId?: SharedLib.DashboardInputs['itemId'];
15
+ language: SharedLib.DashboardInputs['language'];
16
+ qeVersion: SharedLib.DashboardInputs['qeVersion'];
17
+ screenMode: SharedLib.DashboardInputs['screenMode'];
18
+ switchScreenModeOnResize: boolean;
19
+ editMode: SharedLib.DashboardInputs['editMode'];
20
+ mainColor?: SharedLib.DashboardInputs['mainColor'];
21
+ accentColor?: SharedLib.DashboardInputs['accentColor'];
22
+ authToken?: SharedLib.DashboardInputs['authToken'];
23
+ authKey?: SharedLib.DashboardInputs['authKey'];
24
+ loaderBackground?: SharedLib.DashboardInputs['loaderBackground'];
25
+ loaderFontColor?: SharedLib.DashboardInputs['loaderFontColor'];
26
+ loaderSpinnerColor?: SharedLib.DashboardInputs['loaderSpinnerColor'];
27
+ loaderSpinnerBackground?: SharedLib.DashboardInputs['loaderSpinnerBackground'];
28
+ appServer?: SharedLib.DashboardInputs['appServer'];
29
+ timezoneId?: SharedLib.DashboardInputs['timezoneId'];
30
+ apiHost?: SharedLib.DashboardInputs['apiHost'];
31
+ itemDimensions: SharedLib.DashboardInputs['itemDimensions'];
32
+ experimental: boolean;
33
+ _containerId: string;
34
+ _iframeId: string;
35
+ params: SharedLib.DashboardContentParams;
36
+ _iframeUrl?: string;
37
+ iframeLoaded: boolean;
38
+ promises: SharedLib.DashboardPromises;
39
+ iframeStyle: SharedLib.IframeStyles;
40
+ _containerStyle: SharedLib.ContainerStyles;
41
+ _loaderStyle: SharedLib.LoaderStyles;
42
+ _lcStyle: SharedLib.LcStyles;
43
+ _loadingCircleStyle: SharedLib.PlStyles;
44
+ _containerLoaderStyle: SharedLib.ContainerLoaderStyles;
45
+ _loaderMsg: string;
46
+ containerWidth?: number;
47
+ dimensions?: SharedLib.DashboardDimensions;
48
+ currentScreenMode?: SharedLib.ScreenMode;
49
+ _itemEmbedding: boolean;
50
+ browserError: boolean;
51
+ browserErrorMsg: string;
52
+ dashboardError: boolean;
53
+ browserNotSupported: any[];
54
+ VERSION: string;
55
+ protected isLibraryLoaded: boolean;
56
+ protected dashboardReference: SharedLib.LuzmoElement;
57
+ currentAuthKey: string;
58
+ currentAuthToken: string;
59
+ private attributesMap;
60
+ _loadTimeoutHandle?: number;
61
+ _onResize: () => void;
62
+ loaderSize: number;
63
+ borderWidth: number;
64
+ minHeight: number;
65
+ iframeHeight?: string;
66
+ iframeWidth?: string;
67
+ _resizeObserver: ResizeObserver;
68
+ constructor(inputParameters?: Record<keyof LuzmoDashboard, any>);
69
+ private loadLibrary;
70
+ private setInputParameters;
71
+ connectedCallback(): void;
72
+ disconnectedCallback(): void;
73
+ firstUpdated(): void;
74
+ initComponent(): void;
75
+ setAllAttributes(): void;
76
+ updated(changedProperties: PropertyValues): void;
77
+ _setOptions(): SharedLib.DashboardContentParams;
78
+ _updateIframeUrl(): void;
79
+ _setupLoader(): void;
80
+ _displayError(): void;
81
+ _calculateDimAfterDashboardLoaded(): void;
82
+ _loaderStyles(): void;
83
+ static get styles(): import("lit").CSSResult[];
84
+ render(): TemplateResult;
85
+ getDashboards(): Promise<LuzmoDashboard[]>;
86
+ getData(itemId: string): Promise<SharedLib.ItemData>;
87
+ getFilters(): Promise<SharedLib.FilterGroup[]>;
88
+ setFilters<K extends CombinedFilterInput>(itemId: string, filters: K): Promise<SharedLib.SetFilters>;
89
+ setAuthorization(key: string, token: string): Promise<void>;
90
+ refreshData(itemId?: string): Promise<void>;
91
+ reloadDashboard(): Promise<void>;
92
+ exportDashboard(format?: SharedLib.ExportType): Promise<SharedLib.ExportDashboard>;
93
+ getAccessibleDashboards(): Promise<SharedLib.AccessibleDashboard[]>;
94
+ addFilters(itemId: string, filters: SharedLib.FilterGroup[]): Promise<SharedLib.AddFilters>;
95
+ setEditMode(editMode?: SharedLib.DashboardEditMode): Promise<SharedLib.SetEditMode>;
96
+ setPreview(preview: boolean): Promise<SharedLib.SetPreview>;
97
+ getIsViewMode(): boolean;
98
+ }
@@ -0,0 +1,16 @@
1
+ import { LuzmoDashboard as LuzmoBaseDashboard } from './dashboard-base';
2
+ /**!
3
+ * @element luzmo-dashboard
4
+ * @description Exposed by @luzmo/embed lib to everyone.
5
+ *
6
+ * @deprecated Will be removed in next major release. Switch to <luzmo-embed-dashboard> instead.
7
+ */
8
+ export declare class LuzmoDashboard extends LuzmoBaseDashboard {
9
+ }
10
+ /**!
11
+ * @element luzmo-embed-dashboard
12
+ * @description Exposed by @luzmo/embed lib to everyone.
13
+ *
14
+ */
15
+ export declare class LuzmoEmbedDashboard extends LuzmoBaseDashboard {
16
+ }
@@ -0,0 +1 @@
1
+ export declare const dashboardStyles: import("lit").CSSResult;
@@ -0,0 +1 @@
1
+ export declare const _setEventHandler: () => void;
@@ -0,0 +1,6 @@
1
+ import { LuzmoDashboard } from './dashboard-component/dashboard-base';
2
+ declare class LuzmoService {
3
+ _components: LuzmoDashboard[];
4
+ }
5
+ declare const _default: LuzmoService;
6
+ export default _default;
@@ -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
- }