@luzmo/embed 5.1.3-beta.3 → 5.1.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/CHANGELOG.md CHANGED
@@ -1,8 +1,29 @@
1
1
 
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [5.1.4] - 2024-05-02
5
+
6
+ ### Bugfixes
7
+
8
+ - Fix build issues with CRA 5.0 and Webpack 5.0
9
+
10
+ ## [5.1.3] - 2024-05-02
11
+
12
+ ### Bugfixes
13
+
14
+ - Height in edit mode is set to 100%, taking 100% of parent height.
15
+
16
+ ## [5.1.2] - 2024-04-29
17
+
18
+ ### Bugfixes
19
+
20
+ - Height in edit mode is set to a minimum of 100vh.
21
+
22
+
4
23
  ## [5.1.1] - 2024-04-24
5
24
 
25
+ ### Updates
26
+
6
27
  - Show actual error messages from luzmo application
7
28
 
8
29
  ## [5.1.0] - 2024-04-17
package/index.cjs CHANGED
@@ -40,8 +40,7 @@ var __decorateClass = (decorators, target, key, kind) => {
40
40
  var src_exports = {};
41
41
  __export(src_exports, {
42
42
  LuzmoDashboard: () => LuzmoDashboard2,
43
- LuzmoEmbedDashboard: () => LuzmoEmbedDashboard,
44
- LuzmoVizItem: () => LuzmoVizItem
43
+ LuzmoEmbedDashboard: () => LuzmoEmbedDashboard
45
44
  });
46
45
  module.exports = __toCommonJS(src_exports);
47
46
 
@@ -56,7 +55,7 @@ var import_style_map = require("lit/directives/style-map.js");
56
55
  var import_shared_embed = require("@luzmo/shared-embed");
57
56
 
58
57
  // libs/embed-libs/embed/package.json
59
- var version = "5.1.3-beta.3";
58
+ var version = "5.1.4";
60
59
 
61
60
  // libs/embed-libs/embed/src/lib/luzmo-service.ts
62
61
  var LuzmoService = class {
@@ -228,6 +227,7 @@ var import_lit = require("lit");
228
227
  var dashboardStyles = import_lit.css`
229
228
  :host {
230
229
  display: block;
230
+ height: 100%;
231
231
  }
232
232
 
233
233
  @-webkit-keyframes spin {
@@ -262,6 +262,9 @@ var dashboardStyles = import_lit.css`
262
262
  border: 0;
263
263
  }
264
264
 
265
+ .luzmo-embed-dashboard-ede {
266
+ }
267
+
265
268
  .luzmo-embed-container-ede {
266
269
  width: 100%;
267
270
  height: 100%;
@@ -338,7 +341,7 @@ var dashboardStyles = import_lit.css`
338
341
 
339
342
  // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-base.ts
340
343
  var LuzmoDashboard = class extends import_lit2.LitElement {
341
- constructor() {
344
+ constructor(inputParameters) {
342
345
  super();
343
346
  this.language = "auto";
344
347
  this.screenMode = "auto";
@@ -357,11 +360,10 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
357
360
  this.browserErrorMsg = "";
358
361
  this.dashboardError = false;
359
362
  this.browserNotSupported = [];
360
- this.libVersion = version + "-wc-luzmo";
363
+ this.VERSION = version + "-wc-luzmo";
361
364
  this.isLibraryLoaded = false;
362
365
  this.currentAuthKey = null;
363
366
  this.currentAuthToken = null;
364
- this.isInitCalled = false;
365
367
  this.attributesMap = {
366
368
  dashboardId: "dashboard-id",
367
369
  dashboardSlug: "dashboard-slug",
@@ -391,6 +393,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
391
393
  this._iframeId = `luzmo-dashboard-${this._containerId}`;
392
394
  this.iframeLoaded = false;
393
395
  this.promises = {};
396
+ this.setInputParameters(inputParameters);
394
397
  this.params = this._setOptions();
395
398
  this._onResize = () => {
396
399
  if (this.shadowRoot?.querySelector(".dashboard-container")) {
@@ -421,6 +424,60 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
421
424
  });
422
425
  });
423
426
  }
427
+ loadLibrary(appServer) {
428
+ if (import_shared_embed.remotesMap[appServer]) {
429
+ return Promise.resolve(import_shared_embed.remotesMap[appServer].module);
430
+ }
431
+ import_shared_embed.remotesMap[appServer] = {
432
+ url: appServer?.startsWith("http://localhost") ? `${SharedLib2.removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${SharedLib2.removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
433
+ format: "esm",
434
+ from: "vite",
435
+ module: void 0
436
+ };
437
+ return (0, import_shared_embed.__federationMethodGetRemote)(appServer, "./DashboardApp").then((module2) => {
438
+ const wrappedModule = (0, import_shared_embed.__federationMethodWrapDefault)(module2, true);
439
+ import_shared_embed.remotesMap[appServer].module = wrappedModule;
440
+ return wrappedModule;
441
+ });
442
+ }
443
+ setInputParameters(inputParameters) {
444
+ if (!inputParameters) {
445
+ return;
446
+ }
447
+ const params = [
448
+ "dashboardId",
449
+ "dashboardSlug",
450
+ "itemId",
451
+ "language",
452
+ "qeVersion",
453
+ "screenMode",
454
+ "switchScreenModeOnResize",
455
+ "accentColor",
456
+ "mainColor",
457
+ "authToken",
458
+ "authKey",
459
+ "editMode",
460
+ "loaderBackground",
461
+ "loaderFontColor",
462
+ "loaderSpinnerColor",
463
+ "loaderSpinnerBackground",
464
+ "timezoneId",
465
+ "itemDimensions",
466
+ "apiHost"
467
+ ];
468
+ for (const key of params) {
469
+ const value = inputParameters[key];
470
+ if (value) {
471
+ this[key] = value;
472
+ }
473
+ }
474
+ if (inputParameters.experimental) {
475
+ this.experimental = inputParameters.experimental;
476
+ }
477
+ if (inputParameters.appServer) {
478
+ this.appServer = SharedLib2.addTrailingSlash(inputParameters.appServer);
479
+ }
480
+ }
424
481
  // Set resize event listener
425
482
  connectedCallback() {
426
483
  super.connectedCallback();
@@ -439,6 +496,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
439
496
  this._loaderMsg = SharedLib2.getLoader(this)?.loadingMsg;
440
497
  this._loaderStyles();
441
498
  luzmo_service_default._components.push(this);
499
+ this.initComponent();
442
500
  if (this.luzmoEmbedContainer) {
443
501
  this._resizeObserver.observe(this.luzmoEmbedContainer);
444
502
  }
@@ -446,7 +504,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
446
504
  initComponent() {
447
505
  this.params = this._setOptions();
448
506
  if (this.getIsViewMode()) {
449
- SharedLib2.loadLibrary(this.params.appServer).then(async () => {
507
+ this.loadLibrary(this.params.appServer).then(async () => {
450
508
  this.isLibraryLoaded = true;
451
509
  await this.updateComplete;
452
510
  const oldReference = this.renderRoot.querySelector("dashboard-component");
@@ -518,21 +576,11 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
518
576
  "timezoneId",
519
577
  "itemDimensions"
520
578
  ]);
521
- const conditionsToCheck = ["dashboardId", "dashboardSlug", "itemId"];
522
- let callInitComponent = false;
523
- for (const condition of conditionsToCheck) {
524
- callInitComponent = callInitComponent || changedProperties.get(condition) === void 0 && this[condition];
525
- }
526
- if (callInitComponent && !this.isInitCalled) {
527
- this.initComponent();
528
- this.isInitCalled = true;
529
- return;
530
- }
531
579
  if (this.getIsViewMode()) {
532
580
  if (this.dashboardReference) {
533
581
  for (const [propertyName] of changedProperties.entries()) {
534
582
  if (propertyName === "appSever") {
535
- SharedLib2.loadLibrary(changedProperties[propertyName]).then(async () => {
583
+ this.loadLibrary(changedProperties[propertyName]).then(async () => {
536
584
  this.isLibraryLoaded = true;
537
585
  await this.updateComplete;
538
586
  this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
@@ -740,7 +788,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
740
788
  ${this.dashboardId || this.dashboardSlug ? import_lit2.html`
741
789
  ${loader}
742
790
  <iframe
743
- class="luzmo-embed-dashboard"
791
+ class="luzmo-embed-dashboard ${!this.getIsViewMode() ? `luzmo-embed-dashboard-ede` : ""}"
744
792
  id="${this._iframeId}"
745
793
  name="${this._iframeId}"
746
794
  style=${(0, import_style_map.styleMap)(this.iframeStyle)}
@@ -1031,7 +1079,7 @@ __decorateClass([
1031
1079
  ], LuzmoDashboard.prototype, "browserNotSupported", 2);
1032
1080
  __decorateClass([
1033
1081
  (0, import_decorators.property)()
1034
- ], LuzmoDashboard.prototype, "libVersion", 2);
1082
+ ], LuzmoDashboard.prototype, "VERSION", 2);
1035
1083
  __decorateClass([
1036
1084
  (0, import_decorators.state)()
1037
1085
  ], LuzmoDashboard.prototype, "isLibraryLoaded", 2);
@@ -1044,9 +1092,6 @@ __decorateClass([
1044
1092
  __decorateClass([
1045
1093
  (0, import_decorators.state)()
1046
1094
  ], LuzmoDashboard.prototype, "currentAuthToken", 2);
1047
- __decorateClass([
1048
- (0, import_decorators.state)()
1049
- ], LuzmoDashboard.prototype, "isInitCalled", 2);
1050
1095
 
1051
1096
  // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
1052
1097
  var LuzmoDashboard2 = class extends LuzmoDashboard {
@@ -1059,157 +1104,8 @@ var LuzmoEmbedDashboard = class extends LuzmoDashboard {
1059
1104
  LuzmoEmbedDashboard = __decorateClass([
1060
1105
  (0, import_decorators2.customElement)("luzmo-embed-dashboard")
1061
1106
  ], LuzmoEmbedDashboard);
1062
-
1063
- // libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
1064
- var import_decorators4 = require("lit/decorators.js");
1065
-
1066
- // libs/embed-libs/embed/src/lib/viz-item/viz-item.base.ts
1067
- var import_decorators3 = require("lit/decorators.js");
1068
- var import_lit3 = require("lit");
1069
- var SharedLib3 = __toESM(require("@luzmo/shared-embed"), 1);
1070
- var import_zod_validation_error = require("zod-validation-error");
1071
- var LuzmoBaseVizItem = class extends import_lit3.LitElement {
1072
- constructor() {
1073
- super();
1074
- this.appServer = "https://app.luzmo.com";
1075
- this.apiHost = "https://api.luzmo.com";
1076
- this.slots = [];
1077
- this.options = {
1078
- title: {
1079
- en: ""
1080
- },
1081
- theme: "default"
1082
- };
1083
- this.version = version + "-wc-luzmo";
1084
- }
1085
- static {
1086
- // Static styles to set host display to block, else it is not shown at all for some reason.
1087
- this.styles = import_lit3.css`
1088
- :host {
1089
- display: block;
1090
- width: 100%;
1091
- height: 100%;
1092
- }
1093
- `;
1094
- }
1095
- async firstUpdated(_changedProperties) {
1096
- super.firstUpdated(_changedProperties);
1097
- if (this.type) {
1098
- await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
1099
- this.createAndAppendElement();
1100
- }
1101
- }
1102
- createAndAppendElement() {
1103
- if (!this.chartElement) {
1104
- this.chartElement = document.createElement("chart-component");
1105
- this.chartElement.setAttribute("embedding-mode", "chart");
1106
- this.updateVizItemProperties();
1107
- this.renderRoot.append(this.chartElement);
1108
- }
1109
- }
1110
- updateVizItemProperties() {
1111
- if (this.chartElement) {
1112
- for (const key in SharedLib3.libraryTypeToWebComponentTypeMapping) {
1113
- const value = this[key];
1114
- if (value) {
1115
- this.parseAndValidate(key);
1116
- const attributeValue = ["appServer", "apiHost"].includes(key) ? SharedLib3.removeTrailingSlash(value) : value;
1117
- this.chartElement.setAttribute(
1118
- SharedLib3.libraryTypeToWebComponentTypeMapping[key],
1119
- typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
1120
- );
1121
- }
1122
- }
1123
- }
1124
- }
1125
- async updated(changedProperties) {
1126
- if (this.chartElement) {
1127
- for (const [propertyName] of changedProperties.entries()) {
1128
- const mappedAttributeName = SharedLib3.libraryTypeToWebComponentTypeMapping[propertyName] ?? propertyName;
1129
- this.parseAndValidate(propertyName);
1130
- const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
1131
- this.chartElement.setAttribute(mappedAttributeName, attributeValue);
1132
- }
1133
- } else {
1134
- if (this.type) {
1135
- this.parseAndValidate("type");
1136
- await SharedLib3.loadLibrary(this.appServer, "DashboardApp");
1137
- this.createAndAppendElement();
1138
- }
1139
- }
1140
- }
1141
- parseAndValidate(key) {
1142
- try {
1143
- if (key === "slots") {
1144
- SharedLib3.slotsParser.parse(this.slots);
1145
- } else if (key === "options") {
1146
- SharedLib3.vizItemOptionsParser.parse(this.options);
1147
- } else if (key === "canFilter") {
1148
- SharedLib3.canFilterParser.parse(this.canFilter);
1149
- } else if (key === "type") {
1150
- SharedLib3.itemTypeParser.parse(this.type);
1151
- }
1152
- } catch (err) {
1153
- const validationError = (0, import_zod_validation_error.fromError)(err);
1154
- console.error(err);
1155
- console.error(validationError.toString());
1156
- }
1157
- }
1158
- render() {
1159
- return import_lit3.html` `;
1160
- }
1161
- };
1162
- __decorateClass([
1163
- (0, import_decorators3.property)()
1164
- ], LuzmoBaseVizItem.prototype, "appServer", 2);
1165
- __decorateClass([
1166
- (0, import_decorators3.property)()
1167
- ], LuzmoBaseVizItem.prototype, "apiHost", 2);
1168
- __decorateClass([
1169
- (0, import_decorators3.property)({ type: Array })
1170
- ], LuzmoBaseVizItem.prototype, "slots", 2);
1171
- __decorateClass([
1172
- (0, import_decorators3.property)({ type: Object })
1173
- ], LuzmoBaseVizItem.prototype, "options", 2);
1174
- __decorateClass([
1175
- (0, import_decorators3.property)()
1176
- ], LuzmoBaseVizItem.prototype, "type", 2);
1177
- __decorateClass([
1178
- (0, import_decorators3.property)()
1179
- ], LuzmoBaseVizItem.prototype, "authKey", 2);
1180
- __decorateClass([
1181
- (0, import_decorators3.property)()
1182
- ], LuzmoBaseVizItem.prototype, "authToken", 2);
1183
- __decorateClass([
1184
- (0, import_decorators3.property)()
1185
- ], LuzmoBaseVizItem.prototype, "version", 2);
1186
- __decorateClass([
1187
- (0, import_decorators3.property)()
1188
- ], LuzmoBaseVizItem.prototype, "contextId", 2);
1189
- __decorateClass([
1190
- (0, import_decorators3.property)({
1191
- converter: (value) => {
1192
- try {
1193
- return JSON.parse(value);
1194
- } catch (exc) {
1195
- return value;
1196
- }
1197
- }
1198
- })
1199
- ], LuzmoBaseVizItem.prototype, "canFilter", 2);
1200
- __decorateClass([
1201
- (0, import_decorators3.property)({ type: Array })
1202
- ], LuzmoBaseVizItem.prototype, "filters", 2);
1203
-
1204
- // libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
1205
- var LuzmoVizItem = class extends LuzmoBaseVizItem {
1206
- };
1207
- LuzmoVizItem = __decorateClass([
1208
- (0, import_decorators4.customElement)("luzmo-viz-item")
1209
- ], LuzmoVizItem);
1210
1107
  // Annotate the CommonJS export names for ESM import in node:
1211
1108
  0 && (module.exports = {
1212
1109
  LuzmoDashboard,
1213
- LuzmoEmbedDashboard,
1214
- LuzmoVizItem
1110
+ LuzmoEmbedDashboard
1215
1111
  });
package/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';