@luzmo/embed 5.1.1 → 5.1.3-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42,7 +42,8 @@ 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
45
+ LuzmoDashboardWebComponent: () => LuzmoDashboardWebComponent,
46
+ LuzmoVizItemWebComponent: () => LuzmoVizItemWebComponent
46
47
  });
47
48
  module.exports = __toCommonJS(index_libs_exports);
48
49
 
@@ -1489,6 +1490,21 @@ var _extendAndValidate = (dashboardContent) => {
1489
1490
  }
1490
1491
  };
1491
1492
 
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
+
1492
1508
  // libs/embed-libs/shared-embed/src/lib/constants/class-constants.ts
1493
1509
  var luzmoEmbedContainerClass = "luzmo-embed-container";
1494
1510
 
@@ -1556,6 +1572,21 @@ function __federationMethodWrapDefault(module2, need) {
1556
1572
  async function __federationMethodGetRemote(remoteName, componentName) {
1557
1573
  return __federationMethodEnsure(remoteName).then((remote) => remote.get(componentName).then((factory) => factory()));
1558
1574
  }
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
+ }
1559
1590
 
1560
1591
  // node_modules/lit-html/lit-html.js
1561
1592
  var t3 = globalThis;
@@ -1906,7 +1937,7 @@ var o5 = e6(class extends i4 {
1906
1937
  });
1907
1938
 
1908
1939
  // libs/embed-libs/embed/package.json
1909
- var version = "5.1.1";
1940
+ var version = "5.1.3-beta.0";
1910
1941
 
1911
1942
  // libs/embed-libs/embed/src/lib/luzmo-service.ts
1912
1943
  var LuzmoService = class {
@@ -2186,7 +2217,7 @@ var dashboardStyles = i`
2186
2217
 
2187
2218
  // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-base.ts
2188
2219
  var LuzmoDashboard = class extends s3 {
2189
- constructor(inputParameters) {
2220
+ constructor() {
2190
2221
  super();
2191
2222
  this.language = "auto";
2192
2223
  this.screenMode = "auto";
@@ -2205,10 +2236,11 @@ var LuzmoDashboard = class extends s3 {
2205
2236
  this.browserErrorMsg = "";
2206
2237
  this.dashboardError = false;
2207
2238
  this.browserNotSupported = [];
2208
- this.VERSION = version + "-wc-luzmo";
2239
+ this.version = version + "-wc-luzmo";
2209
2240
  this.isLibraryLoaded = false;
2210
2241
  this.currentAuthKey = null;
2211
2242
  this.currentAuthToken = null;
2243
+ this.isInitCalled = false;
2212
2244
  this.attributesMap = {
2213
2245
  dashboardId: "dashboard-id",
2214
2246
  dashboardSlug: "dashboard-slug",
@@ -2238,7 +2270,6 @@ var LuzmoDashboard = class extends s3 {
2238
2270
  this._iframeId = `luzmo-dashboard-${this._containerId}`;
2239
2271
  this.iframeLoaded = false;
2240
2272
  this.promises = {};
2241
- this.setInputParameters(inputParameters);
2242
2273
  this.params = this._setOptions();
2243
2274
  this._onResize = () => {
2244
2275
  if (this.shadowRoot?.querySelector(".dashboard-container")) {
@@ -2269,60 +2300,6 @@ var LuzmoDashboard = class extends s3 {
2269
2300
  });
2270
2301
  });
2271
2302
  }
2272
- loadLibrary(appServer) {
2273
- if (remotesMap[appServer]) {
2274
- return Promise.resolve(remotesMap[appServer].module);
2275
- }
2276
- remotesMap[appServer] = {
2277
- url: appServer?.startsWith("http://localhost") ? `${removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
2278
- format: "esm",
2279
- from: "vite",
2280
- module: void 0
2281
- };
2282
- return __federationMethodGetRemote(appServer, "./DashboardApp").then((module2) => {
2283
- const wrappedModule = __federationMethodWrapDefault(module2, true);
2284
- remotesMap[appServer].module = wrappedModule;
2285
- return wrappedModule;
2286
- });
2287
- }
2288
- setInputParameters(inputParameters) {
2289
- if (!inputParameters) {
2290
- return;
2291
- }
2292
- const params = [
2293
- "dashboardId",
2294
- "dashboardSlug",
2295
- "itemId",
2296
- "language",
2297
- "qeVersion",
2298
- "screenMode",
2299
- "switchScreenModeOnResize",
2300
- "accentColor",
2301
- "mainColor",
2302
- "authToken",
2303
- "authKey",
2304
- "editMode",
2305
- "loaderBackground",
2306
- "loaderFontColor",
2307
- "loaderSpinnerColor",
2308
- "loaderSpinnerBackground",
2309
- "timezoneId",
2310
- "itemDimensions",
2311
- "apiHost"
2312
- ];
2313
- for (const key of params) {
2314
- const value = inputParameters[key];
2315
- if (value) {
2316
- this[key] = value;
2317
- }
2318
- }
2319
- if (inputParameters.experimental) {
2320
- this.experimental = inputParameters.experimental;
2321
- }
2322
- if (inputParameters.appServer) {
2323
- this.appServer = addTrailingSlash(inputParameters.appServer);
2324
- }
2325
- }
2326
2303
  // Set resize event listener
2327
2304
  connectedCallback() {
2328
2305
  super.connectedCallback();
@@ -2341,7 +2318,6 @@ var LuzmoDashboard = class extends s3 {
2341
2318
  this._loaderMsg = getLoader(this)?.loadingMsg;
2342
2319
  this._loaderStyles();
2343
2320
  luzmo_service_default._components.push(this);
2344
- this.initComponent();
2345
2321
  if (this.luzmoEmbedContainer) {
2346
2322
  this._resizeObserver.observe(this.luzmoEmbedContainer);
2347
2323
  }
@@ -2349,7 +2325,7 @@ var LuzmoDashboard = class extends s3 {
2349
2325
  initComponent() {
2350
2326
  this.params = this._setOptions();
2351
2327
  if (this.getIsViewMode()) {
2352
- this.loadLibrary(this.params.appServer).then(async () => {
2328
+ loadLibrary(this.params.appServer).then(async () => {
2353
2329
  this.isLibraryLoaded = true;
2354
2330
  await this.updateComplete;
2355
2331
  const oldReference = this.renderRoot.querySelector("dashboard-component");
@@ -2421,11 +2397,21 @@ var LuzmoDashboard = class extends s3 {
2421
2397
  "timezoneId",
2422
2398
  "itemDimensions"
2423
2399
  ]);
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
+ }
2424
2410
  if (this.getIsViewMode()) {
2425
2411
  if (this.dashboardReference) {
2426
2412
  for (const [propertyName] of changedProperties.entries()) {
2427
2413
  if (propertyName === "appSever") {
2428
- this.loadLibrary(changedProperties[propertyName]).then(async () => {
2414
+ loadLibrary(changedProperties[propertyName]).then(async () => {
2429
2415
  this.isLibraryLoaded = true;
2430
2416
  await this.updateComplete;
2431
2417
  this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
@@ -2924,7 +2910,7 @@ __decorateClass([
2924
2910
  ], LuzmoDashboard.prototype, "browserNotSupported", 2);
2925
2911
  __decorateClass([
2926
2912
  n3()
2927
- ], LuzmoDashboard.prototype, "VERSION", 2);
2913
+ ], LuzmoDashboard.prototype, "version", 2);
2928
2914
  __decorateClass([
2929
2915
  r4()
2930
2916
  ], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
@@ -2937,6 +2923,9 @@ __decorateClass([
2937
2923
  __decorateClass([
2938
2924
  r4()
2939
2925
  ], LuzmoDashboard.prototype, "currentAuthToken", 2);
2926
+ __decorateClass([
2927
+ r4()
2928
+ ], LuzmoDashboard.prototype, "isInitCalled", 2);
2940
2929
 
2941
2930
  // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-web-component.ts
2942
2931
  var LuzmoDashboardWebComponent = class extends LuzmoDashboard {
@@ -2944,6 +2933,127 @@ var LuzmoDashboardWebComponent = class extends LuzmoDashboard {
2944
2933
  LuzmoDashboardWebComponent = __decorateClass([
2945
2934
  t("luzmo-dashboard-web-component")
2946
2935
  ], 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);
2947
3057
  /*! Bundled license information:
2948
3058
 
2949
3059
  @lit/reactive-element/decorators/custom-element.js:
@@ -43,7 +43,8 @@ var __decorateClass = (decorators, target, key, kind) => {
43
43
  var src_exports2 = {};
44
44
  __export(src_exports2, {
45
45
  LuzmoDashboard: () => LuzmoDashboard2,
46
- LuzmoEmbedDashboard: () => LuzmoEmbedDashboard
46
+ LuzmoEmbedDashboard: () => LuzmoEmbedDashboard,
47
+ LuzmoVizItem: () => LuzmoVizItem
47
48
  });
48
49
  module.exports = __toCommonJS(src_exports2);
49
50
 
@@ -1490,6 +1491,21 @@ var _extendAndValidate = (dashboardContent) => {
1490
1491
  }
1491
1492
  };
1492
1493
 
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
+
1493
1509
  // libs/embed-libs/shared-embed/src/lib/constants/class-constants.ts
1494
1510
  var luzmoEmbedContainerClass = "luzmo-embed-container";
1495
1511
 
@@ -1557,6 +1573,21 @@ function __federationMethodWrapDefault(module2, need) {
1557
1573
  async function __federationMethodGetRemote(remoteName, componentName) {
1558
1574
  return __federationMethodEnsure(remoteName).then((remote) => remote.get(componentName).then((factory) => factory()));
1559
1575
  }
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
+ }
1560
1591
 
1561
1592
  // node_modules/lit-html/lit-html.js
1562
1593
  var t3 = globalThis;
@@ -1907,7 +1938,7 @@ var o5 = e6(class extends i4 {
1907
1938
  });
1908
1939
 
1909
1940
  // libs/embed-libs/embed/package.json
1910
- var version = "5.1.1";
1941
+ var version = "5.1.3-beta.0";
1911
1942
 
1912
1943
  // libs/embed-libs/embed/src/lib/luzmo-service.ts
1913
1944
  var LuzmoService = class {
@@ -2187,7 +2218,7 @@ var dashboardStyles = i`
2187
2218
 
2188
2219
  // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-base.ts
2189
2220
  var LuzmoDashboard = class extends s3 {
2190
- constructor(inputParameters) {
2221
+ constructor() {
2191
2222
  super();
2192
2223
  this.language = "auto";
2193
2224
  this.screenMode = "auto";
@@ -2206,10 +2237,11 @@ var LuzmoDashboard = class extends s3 {
2206
2237
  this.browserErrorMsg = "";
2207
2238
  this.dashboardError = false;
2208
2239
  this.browserNotSupported = [];
2209
- this.VERSION = version + "-wc-luzmo";
2240
+ this.version = version + "-wc-luzmo";
2210
2241
  this.isLibraryLoaded = false;
2211
2242
  this.currentAuthKey = null;
2212
2243
  this.currentAuthToken = null;
2244
+ this.isInitCalled = false;
2213
2245
  this.attributesMap = {
2214
2246
  dashboardId: "dashboard-id",
2215
2247
  dashboardSlug: "dashboard-slug",
@@ -2239,7 +2271,6 @@ var LuzmoDashboard = class extends s3 {
2239
2271
  this._iframeId = `luzmo-dashboard-${this._containerId}`;
2240
2272
  this.iframeLoaded = false;
2241
2273
  this.promises = {};
2242
- this.setInputParameters(inputParameters);
2243
2274
  this.params = this._setOptions();
2244
2275
  this._onResize = () => {
2245
2276
  if (this.shadowRoot?.querySelector(".dashboard-container")) {
@@ -2270,60 +2301,6 @@ var LuzmoDashboard = class extends s3 {
2270
2301
  });
2271
2302
  });
2272
2303
  }
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
- }
2289
- setInputParameters(inputParameters) {
2290
- if (!inputParameters) {
2291
- return;
2292
- }
2293
- const params = [
2294
- "dashboardId",
2295
- "dashboardSlug",
2296
- "itemId",
2297
- "language",
2298
- "qeVersion",
2299
- "screenMode",
2300
- "switchScreenModeOnResize",
2301
- "accentColor",
2302
- "mainColor",
2303
- "authToken",
2304
- "authKey",
2305
- "editMode",
2306
- "loaderBackground",
2307
- "loaderFontColor",
2308
- "loaderSpinnerColor",
2309
- "loaderSpinnerBackground",
2310
- "timezoneId",
2311
- "itemDimensions",
2312
- "apiHost"
2313
- ];
2314
- for (const key of params) {
2315
- const value = inputParameters[key];
2316
- if (value) {
2317
- this[key] = value;
2318
- }
2319
- }
2320
- if (inputParameters.experimental) {
2321
- this.experimental = inputParameters.experimental;
2322
- }
2323
- if (inputParameters.appServer) {
2324
- this.appServer = addTrailingSlash(inputParameters.appServer);
2325
- }
2326
- }
2327
2304
  // Set resize event listener
2328
2305
  connectedCallback() {
2329
2306
  super.connectedCallback();
@@ -2342,7 +2319,6 @@ var LuzmoDashboard = class extends s3 {
2342
2319
  this._loaderMsg = getLoader(this)?.loadingMsg;
2343
2320
  this._loaderStyles();
2344
2321
  luzmo_service_default._components.push(this);
2345
- this.initComponent();
2346
2322
  if (this.luzmoEmbedContainer) {
2347
2323
  this._resizeObserver.observe(this.luzmoEmbedContainer);
2348
2324
  }
@@ -2350,7 +2326,7 @@ var LuzmoDashboard = class extends s3 {
2350
2326
  initComponent() {
2351
2327
  this.params = this._setOptions();
2352
2328
  if (this.getIsViewMode()) {
2353
- this.loadLibrary(this.params.appServer).then(async () => {
2329
+ loadLibrary(this.params.appServer).then(async () => {
2354
2330
  this.isLibraryLoaded = true;
2355
2331
  await this.updateComplete;
2356
2332
  const oldReference = this.renderRoot.querySelector("dashboard-component");
@@ -2422,11 +2398,21 @@ var LuzmoDashboard = class extends s3 {
2422
2398
  "timezoneId",
2423
2399
  "itemDimensions"
2424
2400
  ]);
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
+ }
2425
2411
  if (this.getIsViewMode()) {
2426
2412
  if (this.dashboardReference) {
2427
2413
  for (const [propertyName] of changedProperties.entries()) {
2428
2414
  if (propertyName === "appSever") {
2429
- this.loadLibrary(changedProperties[propertyName]).then(async () => {
2415
+ loadLibrary(changedProperties[propertyName]).then(async () => {
2430
2416
  this.isLibraryLoaded = true;
2431
2417
  await this.updateComplete;
2432
2418
  this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
@@ -2925,7 +2911,7 @@ __decorateClass([
2925
2911
  ], LuzmoDashboard.prototype, "browserNotSupported", 2);
2926
2912
  __decorateClass([
2927
2913
  n3()
2928
- ], LuzmoDashboard.prototype, "VERSION", 2);
2914
+ ], LuzmoDashboard.prototype, "version", 2);
2929
2915
  __decorateClass([
2930
2916
  r4()
2931
2917
  ], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
@@ -2938,6 +2924,9 @@ __decorateClass([
2938
2924
  __decorateClass([
2939
2925
  r4()
2940
2926
  ], LuzmoDashboard.prototype, "currentAuthToken", 2);
2927
+ __decorateClass([
2928
+ r4()
2929
+ ], LuzmoDashboard.prototype, "isInitCalled", 2);
2941
2930
 
2942
2931
  // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
2943
2932
  var LuzmoDashboard2 = class extends LuzmoDashboard {
@@ -2950,6 +2939,127 @@ var LuzmoEmbedDashboard = class extends LuzmoDashboard {
2950
2939
  LuzmoEmbedDashboard = __decorateClass([
2951
2940
  t("luzmo-embed-dashboard")
2952
2941
  ], 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);
2953
3063
  /*! Bundled license information:
2954
3064
 
2955
3065
  @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.1",
3
+ "version": "5.1.3-beta.0",
4
4
  "dependencies": {
5
5
  "lit": "3.1.2",
6
- "@luzmo/shared-embed": "5.0.8"
6
+ "@luzmo/shared-embed": "5.0.8-beta.2"
7
7
  },
8
8
  "type": "module",
9
9
  "keywords": [
package/src/index.d.ts CHANGED
@@ -1,2 +1,3 @@
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';