@luzmo/embed 7.5.0 → 8.0.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.
Files changed (82) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/README.md +2 -2
  3. package/index.cjs +1589 -143
  4. package/index.js +1583 -129
  5. package/index.rn.cjs +1375 -0
  6. package/index.rn.js +1305 -0
  7. package/index.shared.cjs +1486 -0
  8. package/index.shared.js +1412 -0
  9. package/luzmo-embed.min.js +197 -96
  10. package/package.json +22 -2
  11. package/src/index.common.d.ts +18 -0
  12. package/src/index.d.ts +3 -3
  13. package/src/index.rn.d.ts +1 -0
  14. package/src/index.shared.d.ts +2 -0
  15. package/src/lib/dashboard/dashboard-base.d.ts +5 -1
  16. package/src/lib/iq-components/luzmo-iq-answer.d.ts +1 -2
  17. package/src/lib/iq-components/luzmo-iq-chat.d.ts +1 -1
  18. package/src/lib/shared/constants/class-constants.d.ts +1 -0
  19. package/src/lib/shared/helpers/browser-check.d.ts +2 -0
  20. package/src/lib/shared/helpers/default-parameters.d.ts +2 -0
  21. package/src/lib/shared/helpers/error.d.ts +5 -0
  22. package/src/lib/shared/helpers/extents.d.ts +7 -0
  23. package/src/lib/shared/helpers/get-loader.d.ts +5 -0
  24. package/src/lib/shared/helpers/iframe-url.d.ts +1 -0
  25. package/src/lib/shared/helpers/promise-dispatch.d.ts +3 -0
  26. package/src/lib/shared/helpers/remote-federation.d.ts +56 -0
  27. package/src/lib/shared/helpers/set-selected-data-utils.d.ts +7 -0
  28. package/src/lib/shared/helpers/styles.d.ts +8 -0
  29. package/src/lib/shared/helpers/translations.d.ts +24 -0
  30. package/src/lib/shared/helpers/update-iframe-url.d.ts +1 -0
  31. package/src/lib/shared/helpers/utils.d.ts +27 -0
  32. package/src/lib/shared/methods/export-dashboard.d.ts +5 -0
  33. package/src/lib/shared/methods/get-accessible-dashboards.d.ts +3 -0
  34. package/src/lib/shared/methods/get-dashboard-context.d.ts +3 -0
  35. package/src/lib/shared/methods/get-data.d.ts +3 -0
  36. package/src/lib/shared/methods/get-filters.d.ts +3 -0
  37. package/src/lib/shared/methods/get-insights.d.ts +3 -0
  38. package/src/lib/shared/methods/index.d.ts +13 -0
  39. package/src/lib/shared/methods/refresh-data.d.ts +2 -0
  40. package/src/lib/shared/methods/reload-dashboard.d.ts +2 -0
  41. package/src/lib/shared/methods/send-export-email.d.ts +4 -0
  42. package/src/lib/shared/methods/set-authorization.d.ts +2 -0
  43. package/src/lib/shared/methods/set-edit-mode.d.ts +3 -0
  44. package/src/lib/shared/methods/set-preview.d.ts +3 -0
  45. package/src/lib/shared/methods/set-selected-data.d.ts +4 -0
  46. package/src/lib/shared/models/common.model.d.ts +105 -0
  47. package/src/lib/shared/models/dashboard-context.model.d.ts +50 -0
  48. package/src/lib/shared/models/dashboard.model.d.ts +59 -0
  49. package/src/lib/shared/models/embed-error-event.model.d.ts +17 -0
  50. package/src/lib/shared/models/events.model.d.ts +94 -0
  51. package/src/lib/shared/models/filter-input.model.d.ts +101 -0
  52. package/src/lib/shared/models/filter-output.model.d.ts +17 -0
  53. package/src/lib/shared/models/filters.model.d.ts +26 -0
  54. package/src/lib/shared/models/index.d.ts +12 -0
  55. package/src/lib/shared/models/styles.model.d.ts +32 -0
  56. package/src/lib/shared/models/translation.model.d.ts +2 -0
  57. package/src/lib/shared/models/viz-item-post-message.model.d.ts +56 -0
  58. package/src/lib/shared/models/viz-item.model.d.ts +8 -0
  59. package/src/lib/shared/models/viz-items/areachart.model.d.ts +13 -0
  60. package/src/lib/shared/models/viz-items/barchart.model.d.ts +24 -0
  61. package/src/lib/shared/models/viz-items/choroplethmap.model.d.ts +13 -0
  62. package/src/lib/shared/models/viz-items/circlepack.model.d.ts +2 -0
  63. package/src/lib/shared/models/viz-items/columnchart.model.d.ts +24 -0
  64. package/src/lib/shared/models/viz-items/datetime.model.d.ts +13 -0
  65. package/src/lib/shared/models/viz-items/donutchart.model.d.ts +2 -0
  66. package/src/lib/shared/models/viz-items/dropdownfilter.model.d.ts +13 -0
  67. package/src/lib/shared/models/viz-items/index.d.ts +36 -0
  68. package/src/lib/shared/models/viz-items/linechart.model.d.ts +36 -0
  69. package/src/lib/shared/models/viz-items/parallelcoordinatesplot.model.d.ts +14 -0
  70. package/src/lib/shared/models/viz-items/piechart.model.d.ts +24 -0
  71. package/src/lib/shared/models/viz-items/scatterplot.model.d.ts +13 -0
  72. package/src/lib/shared/models/viz-items/slicer.model.d.ts +24 -0
  73. package/src/lib/shared/models/viz-items/slider.model.d.ts +13 -0
  74. package/src/lib/shared/models/viz-items/stripplot.model.d.ts +15 -0
  75. package/src/lib/shared/models/viz-items/sunburst.model.d.ts +14 -0
  76. package/src/lib/shared/models/viz-items/treemap.model.d.ts +24 -0
  77. package/src/lib/shared/service/calculate-dimensions.d.ts +1 -0
  78. package/src/lib/shared/service/extend-and-validate.d.ts +2 -0
  79. package/src/lib/{helper → utils}/embed-error.utils.d.ts +1 -1
  80. package/src/lib/viz-item/viz-item.base.d.ts +2 -2
  81. /package/src/lib/{helper → utils}/event-bus-handler.d.ts +0 -0
  82. /package/src/lib/{helper → utils}/json-schema-utils.d.ts +0 -0
@@ -46,7 +46,7 @@ __export(index_exports, {
46
46
  });
47
47
  module.exports = __toCommonJS(index_exports);
48
48
 
49
- // libs/embed-libs/shared-embed/src/lib/helpers/error.ts
49
+ // libs/embed-libs/embed/src/lib/shared/helpers/error.ts
50
50
  var _handleError = (errorMessage, parameters) => {
51
51
  let message = "The dashboard component encountered an error";
52
52
  if (typeof parameters?.dashboardId === "string") {
@@ -65,7 +65,7 @@ ${errorMessage}`;
65
65
  }
66
66
  };
67
67
 
68
- // libs/embed-libs/shared-embed/src/lib/helpers/browser-check.ts
68
+ // libs/embed-libs/embed/src/lib/shared/helpers/browser-check.ts
69
69
  var _browserCheck = (dashboardComponent) => {
70
70
  let hasError = false;
71
71
  let errorMessage = "";
@@ -98,7 +98,7 @@ var _browserCheck = (dashboardComponent) => {
98
98
  }
99
99
  };
100
100
 
101
- // libs/embed-libs/shared-embed/src/lib/helpers/default-parameters.ts
101
+ // libs/embed-libs/embed/src/lib/shared/helpers/default-parameters.ts
102
102
  var DEFAULT_PARAMETERS = {
103
103
  appServer: "https://app.luzmo.com/",
104
104
  apiHost: "https://api.luzmo.com/",
@@ -127,7 +127,7 @@ var DEFAULT_PARAMETERS = {
127
127
  contextId: null
128
128
  };
129
129
 
130
- // libs/embed-libs/shared-embed/src/lib/helpers/extents.ts
130
+ // libs/embed-libs/embed/src/lib/shared/helpers/extents.ts
131
131
  var EXTENTS = [
132
132
  { mode: "mobile", width: [150, 767] },
133
133
  { mode: "tablet", width: [768, 1199] },
@@ -136,7 +136,7 @@ var EXTENTS = [
136
136
  { mode: "fixed", width: [] }
137
137
  ];
138
138
 
139
- // libs/embed-libs/shared-embed/src/lib/helpers/translations.ts
139
+ // libs/embed-libs/embed/src/lib/shared/helpers/translations.ts
140
140
  var TRANSLATIONS = {
141
141
  initializing: {
142
142
  en: "Initializing...",
@@ -162,7 +162,7 @@ var TRANSLATIONS = {
162
162
  };
163
163
  var translations_default = TRANSLATIONS;
164
164
 
165
- // libs/embed-libs/shared-embed/src/lib/helpers/utils.ts
165
+ // libs/embed-libs/embed/src/lib/shared/helpers/utils.ts
166
166
  var addTrailingSlash = (serverUrl) => {
167
167
  if (!serverUrl) {
168
168
  return "";
@@ -176,8 +176,8 @@ var removeTrailingSlash = (serverUrl) => {
176
176
  return serverUrl.endsWith("/") ? serverUrl.slice(0, -1) : serverUrl;
177
177
  };
178
178
  var formatDashboardList = (dashboards, integrationId, user, dashboardComponent) => {
179
- const combineRights = (securable, user2) => {
180
- const matchingUser = securable.users.find((u3) => u3.id === user2.id);
179
+ const combineRights = (securable, accessUser) => {
180
+ const matchingUser = securable.users.find((u3) => u3.id === accessUser.id);
181
181
  const securableAccessRights = matchingUser && matchingUser.userAccessRight ? {
182
182
  flagRead: matchingUser.userAccessRight.flagRead,
183
183
  flagUse: matchingUser.userAccessRight.flagUse,
@@ -190,7 +190,7 @@ var formatDashboardList = (dashboards, integrationId, user, dashboardComponent)
190
190
  flagOwn: false
191
191
  };
192
192
  const groups = securable.groups.filter(
193
- (group) => user2.userGroups.includes(group.id) || group.public === true
193
+ (group) => accessUser.userGroups.includes(group.id) || group.public === true
194
194
  );
195
195
  const groupsAccess = groups.map((group) => {
196
196
  if (group.groupAccessRight) {
@@ -307,7 +307,6 @@ var sanitizeUrl = (url) => {
307
307
  }
308
308
  return sanitizedUrl;
309
309
  };
310
- var cloneDeep = (obj) => JSON.parse(JSON.stringify(obj));
311
310
  var isObject = (o7) => o7 && typeof o7 === "object";
312
311
  var defaultsDeep = (target, defaults) => {
313
312
  Object.entries(defaults).forEach(([k2, v2]) => {
@@ -327,12 +326,12 @@ var defaultsDeep = (target, defaults) => {
327
326
  return target;
328
327
  };
329
328
  var uuidv4 = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g, function(c4) {
330
- const r6 = Math.random() * 16 | 0;
331
- const v2 = c4 == "x" ? r6 : r6 & 3 | 8;
329
+ const r6 = Math.trunc(Math.random() * 16);
330
+ const v2 = c4 === "x" ? r6 : r6 & 3 | 8;
332
331
  return v2.toString(16);
333
332
  });
334
333
 
335
- // libs/embed-libs/shared-embed/src/lib/helpers/iframe-url.ts
334
+ // libs/embed-libs/embed/src/lib/shared/helpers/iframe-url.ts
336
335
  var createIframeUrl = (dashboardContent) => {
337
336
  const searchString = [];
338
337
  const {
@@ -406,7 +405,7 @@ var createIframeUrl = (dashboardContent) => {
406
405
  return sanitizeUrl(iframeUrl);
407
406
  };
408
407
 
409
- // libs/embed-libs/shared-embed/src/lib/helpers/get-loader.ts
408
+ // libs/embed-libs/embed/src/lib/shared/helpers/get-loader.ts
410
409
  var getLoader = (dashboardComponent) => {
411
410
  let errorMsg;
412
411
  if (dashboardComponent.params.error || dashboardComponent.browserNotSupported.length > 0) {
@@ -419,7 +418,7 @@ var getLoader = (dashboardComponent) => {
419
418
  return dashboardComponent.browserNotSupported || dashboardComponent.params.error ? { loadingMsg, errorMsg } : { loadingMsg, errorMsg: "" };
420
419
  };
421
420
 
422
- // libs/embed-libs/shared-embed/src/lib/helpers/promise-dispatch.ts
421
+ // libs/embed-libs/embed/src/lib/shared/helpers/promise-dispatch.ts
423
422
  function resolvePromise(dashboardComponent, requestId, data) {
424
423
  if (dashboardComponent.promises[requestId]) {
425
424
  dashboardComponent.promises[requestId].resolve(data);
@@ -433,7 +432,7 @@ function rejectPromise(dashboardComponent, requestId, data) {
433
432
  }
434
433
  }
435
434
 
436
- // libs/embed-libs/shared-embed/src/lib/helpers/styles.ts
435
+ // libs/embed-libs/embed/src/lib/shared/helpers/styles.ts
437
436
  function containerStyles(dashboardComponent) {
438
437
  const styles = {};
439
438
  if (dashboardComponent.params.loaderBackground && !dashboardComponent.iframeLoaded) {
@@ -471,6 +470,9 @@ function loaderStyles(dashboardComponent) {
471
470
  background
472
471
  };
473
472
  }
473
+ function generateBorderStyle(borderWidth, color) {
474
+ return `${borderWidth}px solid ${color}`;
475
+ }
474
476
  function plStyles(dashboardComponent) {
475
477
  const {
476
478
  loaderSpinnerColor: defaultSpinnerColor,
@@ -531,18 +533,15 @@ function calculateIframeStyles(dashboardComponent) {
531
533
  }
532
534
  return styles;
533
535
  }
534
- function generateBorderStyle(borderWidth, color) {
535
- return `${borderWidth}px solid ${color}`;
536
- }
537
536
 
538
- // libs/embed-libs/shared-embed/src/lib/helpers/update-iframe-url.ts
537
+ // libs/embed-libs/embed/src/lib/shared/helpers/update-iframe-url.ts
539
538
  var updateIframeUrl = (iframe, iframeUrl) => {
540
539
  if (iframe?.contentWindow) {
541
540
  iframe.contentWindow.location.replace(iframeUrl);
542
541
  }
543
542
  };
544
543
 
545
- // libs/embed-libs/shared-embed/src/lib/helpers/set-selected-data-utils.ts
544
+ // libs/embed-libs/embed/src/lib/shared/helpers/set-selected-data-utils.ts
546
545
  var selectedDataUtils = {
547
546
  merge(...filters) {
548
547
  return filters.reduce((acc, filter) => {
@@ -606,7 +605,7 @@ var selectedDataUtils = {
606
605
  }
607
606
  };
608
607
 
609
- // libs/embed-libs/shared-embed/src/lib/methods/export-dashboard.ts
608
+ // libs/embed-libs/embed/src/lib/shared/methods/export-dashboard.ts
610
609
  var exportDashboard = (dashboardComponent, iframe, format) => {
611
610
  const requestId = uuidv4();
612
611
  if (iframe?.contentWindow) {
@@ -635,7 +634,7 @@ var exportDashboard = (dashboardComponent, iframe, format) => {
635
634
  return Promise.reject(new Error("Cannot retrieve contentWindow."));
636
635
  };
637
636
 
638
- // libs/embed-libs/shared-embed/src/lib/methods/get-accessible-dashboards.ts
637
+ // libs/embed-libs/embed/src/lib/shared/methods/get-accessible-dashboards.ts
639
638
  var getAccessibleDashboards = async (dashboardComponent) => {
640
639
  await dashboardComponent.updateComplete;
641
640
  if ((dashboardComponent.currentAuthKey ?? dashboardComponent.authKey) && (dashboardComponent.currentAuthToken ?? dashboardComponent.authToken)) {
@@ -745,7 +744,7 @@ var getAccessibleDashboards = async (dashboardComponent) => {
745
744
  throw new Error("No authKey or authToken found in the luzmo-dashboard component.");
746
745
  };
747
746
 
748
- // libs/embed-libs/shared-embed/src/lib/methods/get-dashboard-context.ts
747
+ // libs/embed-libs/embed/src/lib/shared/methods/get-dashboard-context.ts
749
748
  var getDashboardContext = (dashboardComponent, iframe) => {
750
749
  if (iframe?.contentWindow) {
751
750
  const requestId = uuidv4();
@@ -769,7 +768,7 @@ var getDashboardContext = (dashboardComponent, iframe) => {
769
768
  return Promise.reject(new Error("Cannot retrieve contentWindow."));
770
769
  };
771
770
 
772
- // libs/embed-libs/shared-embed/src/lib/methods/get-data.ts
771
+ // libs/embed-libs/embed/src/lib/shared/methods/get-data.ts
773
772
  var getData = (dashboardComponent, iframe, itemId) => {
774
773
  if (iframe?.contentWindow) {
775
774
  const requestId = uuidv4();
@@ -798,7 +797,7 @@ var getData = (dashboardComponent, iframe, itemId) => {
798
797
  return Promise.reject(new Error("Cannot retrieve contentWindow."));
799
798
  };
800
799
 
801
- // libs/embed-libs/shared-embed/src/lib/methods/get-filters.ts
800
+ // libs/embed-libs/embed/src/lib/shared/methods/get-filters.ts
802
801
  var getFilters = (dashboardComponent, iframe) => {
803
802
  if (iframe?.contentWindow) {
804
803
  const requestId = uuidv4();
@@ -822,7 +821,7 @@ var getFilters = (dashboardComponent, iframe) => {
822
821
  return Promise.reject(new Error("Cannot retrieve contentWindow."));
823
822
  };
824
823
 
825
- // libs/embed-libs/shared-embed/src/lib/methods/get-insights.ts
824
+ // libs/embed-libs/embed/src/lib/shared/methods/get-insights.ts
826
825
  var getInsights = (dashboardComponent, iframe, options = {}) => {
827
826
  if (!iframe?.contentWindow) {
828
827
  return Promise.reject(new Error("Cannot retrieve contentWindow."));
@@ -848,7 +847,7 @@ var getInsights = (dashboardComponent, iframe, options = {}) => {
848
847
  });
849
848
  };
850
849
 
851
- // libs/embed-libs/shared-embed/src/lib/methods/refresh-data.ts
850
+ // libs/embed-libs/embed/src/lib/shared/methods/refresh-data.ts
852
851
  var refreshData = (dashboardComponent, iframe, itemId) => {
853
852
  if (iframe) {
854
853
  iframe.contentWindow.postMessage(
@@ -864,7 +863,7 @@ var refreshData = (dashboardComponent, iframe, itemId) => {
864
863
  return Promise.reject(new Error("Cannot retrieve contentWindow."));
865
864
  };
866
865
 
867
- // libs/embed-libs/shared-embed/src/lib/methods/reload-dashboard.ts
866
+ // libs/embed-libs/embed/src/lib/shared/methods/reload-dashboard.ts
868
867
  var reloadDashboard = (dashboardComponent, iframe) => {
869
868
  if (iframe) {
870
869
  iframe.contentWindow.postMessage(
@@ -876,7 +875,7 @@ var reloadDashboard = (dashboardComponent, iframe) => {
876
875
  return Promise.reject(new Error("Cannot retrieve contentWindow."));
877
876
  };
878
877
 
879
- // libs/embed-libs/shared-embed/src/lib/methods/send-export-email.ts
878
+ // libs/embed-libs/embed/src/lib/shared/methods/send-export-email.ts
880
879
  var sendExportEmail = (dashboardComponent, iframe, type, subject, message) => {
881
880
  if (iframe) {
882
881
  iframe.contentWindow.postMessage(
@@ -894,7 +893,7 @@ var sendExportEmail = (dashboardComponent, iframe, type, subject, message) => {
894
893
  return Promise.reject(new Error("Cannot retrieve contentWindow."));
895
894
  };
896
895
 
897
- // libs/embed-libs/shared-embed/src/lib/methods/set-authorization.ts
896
+ // libs/embed-libs/embed/src/lib/shared/methods/set-authorization.ts
898
897
  var setAuthorization = (dashboardComponent, iframe, key, token) => {
899
898
  if (iframe) {
900
899
  iframe.contentWindow.postMessage(
@@ -911,7 +910,7 @@ var setAuthorization = (dashboardComponent, iframe, key, token) => {
911
910
  return Promise.reject(new Error("Cannot retrieve contentWindow."));
912
911
  };
913
912
 
914
- // libs/embed-libs/shared-embed/src/lib/methods/set-edit-mode.ts
913
+ // libs/embed-libs/embed/src/lib/shared/methods/set-edit-mode.ts
915
914
  var setEditMode = (dashboardComponent, iframe, editMode) => {
916
915
  if (iframe && iframe.contentWindow) {
917
916
  const requestId = uuidv4();
@@ -942,7 +941,7 @@ var setEditMode = (dashboardComponent, iframe, editMode) => {
942
941
  return Promise.reject(new Error("Cannot retrieve contentWindow."));
943
942
  };
944
943
 
945
- // libs/embed-libs/shared-embed/src/lib/methods/set-preview.ts
944
+ // libs/embed-libs/embed/src/lib/shared/methods/set-preview.ts
946
945
  var setPreview = (dashboardComponent, iframe, preview) => {
947
946
  if (iframe) {
948
947
  const requestId = uuidv4();
@@ -971,7 +970,7 @@ var setPreview = (dashboardComponent, iframe, preview) => {
971
970
  return Promise.reject(new Error("Cannot retrieve contentWindow."));
972
971
  };
973
972
 
974
- // libs/embed-libs/shared-embed/src/lib/methods/set-selected-data.ts
973
+ // libs/embed-libs/embed/src/lib/shared/methods/set-selected-data.ts
975
974
  var setSelectedData = (dashboardComponent, iframe, itemId, filters) => {
976
975
  if (iframe) {
977
976
  const requestId = uuidv4();
@@ -1001,7 +1000,7 @@ var setSelectedData = (dashboardComponent, iframe, itemId, filters) => {
1001
1000
  return Promise.reject();
1002
1001
  };
1003
1002
 
1004
- // libs/embed-libs/shared-embed/src/lib/service/calculate-dimensions.ts
1003
+ // libs/embed-libs/embed/src/lib/shared/service/calculate-dimensions.ts
1005
1004
  var _setCalculatedDimensions = (dashboardComponent) => {
1006
1005
  if (!dashboardComponent.dimensions) {
1007
1006
  dashboardComponent.params.error = true;
@@ -1031,11 +1030,11 @@ var _setCalculatedDimensions = (dashboardComponent) => {
1031
1030
  ];
1032
1031
  if (dashboardComponent.params.itemEmbedding) {
1033
1032
  const [firstMatch] = dashboardDimensionKeys;
1034
- let match = cloneDeep(firstMatch);
1033
+ let match = firstMatch;
1035
1034
  for (const screenMode of screenModes) {
1036
1035
  const found = dashboardDimensionKeys.find((key) => key === screenMode);
1037
1036
  if (found) {
1038
- match = cloneDeep(found);
1037
+ match = found;
1039
1038
  } else {
1040
1039
  dashboardComponent.dimensions[screenMode] = dashboardComponent.dimensions[match];
1041
1040
  }
@@ -1165,7 +1164,7 @@ var _setCalculatedDimensions = (dashboardComponent) => {
1165
1164
  dashboardComponent.iframeStyle = style;
1166
1165
  };
1167
1166
 
1168
- // libs/embed-libs/shared-embed/src/lib/service/extend-and-validate.ts
1167
+ // libs/embed-libs/embed/src/lib/shared/service/extend-and-validate.ts
1169
1168
  var _extendAndValidate = (dashboardContent) => {
1170
1169
  const defaultKeys = Object.keys(
1171
1170
  DEFAULT_PARAMETERS
@@ -1282,7 +1281,7 @@ var _extendAndValidate = (dashboardContent) => {
1282
1281
  }
1283
1282
  };
1284
1283
 
1285
- // libs/embed-libs/shared-embed/src/lib/models/viz-item.model.ts
1284
+ // libs/embed-libs/embed/src/lib/shared/models/viz-item.model.ts
1286
1285
  var libraryTypeToWebComponentTypeMapping = {
1287
1286
  type: "type",
1288
1287
  slots: "slots",
@@ -1301,7 +1300,7 @@ var libraryTypeToWebComponentTypeMapping = {
1301
1300
  libVersion: "lib-version"
1302
1301
  };
1303
1302
 
1304
- // libs/embed-libs/shared-embed/src/lib/constants/class-constants.ts
1303
+ // libs/embed-libs/embed/src/lib/shared/constants/class-constants.ts
1305
1304
  var luzmoEmbedContainerClass = "luzmo-embed-container";
1306
1305
 
1307
1306
  // node_modules/@module-federation/sdk/dist/constant.js
@@ -5355,7 +5354,7 @@ function createInstance(options) {
5355
5354
  }
5356
5355
  setGlobalFederationConstructor(ModuleFederation);
5357
5356
 
5358
- // libs/embed-libs/shared-embed/src/lib/helpers/remote-federation.ts
5357
+ // libs/embed-libs/embed/src/lib/shared/helpers/remote-federation.ts
5359
5358
  var federationRuntime = createInstance({
5360
5359
  name: "luzmo-embed-runtime",
5361
5360
  remotes: []
@@ -6119,9 +6118,9 @@ var o6 = e6(class extends i5 {
6119
6118
  });
6120
6119
 
6121
6120
  // libs/embed-libs/embed/package.json
6122
- var version = "7.5.0";
6121
+ var version = "8.0.0";
6123
6122
 
6124
- // libs/embed-libs/embed/src/lib/helper/embed-error.utils.ts
6123
+ // libs/embed-libs/embed/src/lib/utils/embed-error.utils.ts
6125
6124
  function buildEmbedErrorDetail(errorMsg) {
6126
6125
  const payload = {
6127
6126
  type: "error",
@@ -6135,7 +6134,9 @@ function firstString(...values) {
6135
6134
  }
6136
6135
  function normalizeEmbedErrorDetail(detail) {
6137
6136
  const wrapped = detail;
6138
- const raw = wrapped?.data ?? detail ?? {};
6137
+ const fromWrapped = wrapped?.data;
6138
+ const fromDetail = detail && typeof detail === "object" ? detail : void 0;
6139
+ const raw = fromWrapped ?? fromDetail ?? {};
6139
6140
  const errorMsg = firstString(raw.errorMsg, raw.error?.msg) ?? "Unknown error";
6140
6141
  return buildEmbedErrorDetail(errorMsg);
6141
6142
  }
@@ -6148,7 +6149,7 @@ var LuzmoDashboardService = class {
6148
6149
  };
6149
6150
  var luzmo_service_default = new LuzmoDashboardService();
6150
6151
 
6151
- // libs/embed-libs/embed/src/lib/helper/event-bus-handler.ts
6152
+ // libs/embed-libs/embed/src/lib/utils/event-bus-handler.ts
6152
6153
  var _setEventHandler = () => {
6153
6154
  if (typeof window.__luzmoMessageHandler === "function") {
6154
6155
  return;
@@ -6424,6 +6425,31 @@ var dashboardStyles = i`
6424
6425
  margin: 0 auto;
6425
6426
  }
6426
6427
 
6428
+ .luzmo-embed-container:not(.luzmo-embed-container-ede) .luzmo-container-loader {
6429
+ height: 100% !important;
6430
+ }
6431
+
6432
+ .luzmo-embed-container:not(.luzmo-embed-container-ede) .luzmo-loader {
6433
+ display: flex;
6434
+ align-items: center;
6435
+ justify-content: center;
6436
+ height: 100%;
6437
+ }
6438
+
6439
+ .luzmo-embed-container:not(.luzmo-embed-container-ede) .luzmo-lc {
6440
+ display: flex;
6441
+ flex-direction: column;
6442
+ align-items: center;
6443
+ padding: 0 !important;
6444
+ }
6445
+
6446
+ .luzmo-embed-container:not(.luzmo-embed-container-ede) .luzmo-loading-message {
6447
+ height: auto;
6448
+ margin: 12px 0 0;
6449
+ line-height: 1.5;
6450
+ font-weight: 300;
6451
+ }
6452
+
6427
6453
  .luzmo-loading-message {
6428
6454
  width: 100%;
6429
6455
  height: 20px;
@@ -6494,7 +6520,7 @@ var LuzmoDashboard = class extends i4 {
6494
6520
  this.screenMode = "auto";
6495
6521
  this.switchScreenModeOnResize = true;
6496
6522
  this.editMode = "view";
6497
- this.embedMode = "iframe";
6523
+ this.embedMode = "webComponent";
6498
6524
  this.iframeStyle = {};
6499
6525
  this._containerStyle = {};
6500
6526
  this._loaderStyle = {};
@@ -6506,6 +6532,7 @@ var LuzmoDashboard = class extends i4 {
6506
6532
  this.browserError = false;
6507
6533
  this.browserErrorMsg = "";
6508
6534
  this.dashboardError = false;
6535
+ this.dashboardErrorMsg = "";
6509
6536
  this.browserNotSupported = [];
6510
6537
  this.libVersion = version + "-wc-luzmo";
6511
6538
  this.isLibraryLoaded = false;
@@ -6517,9 +6544,8 @@ var LuzmoDashboard = class extends i4 {
6517
6544
  dashboardSlug: "dashboard-slug",
6518
6545
  itemId: "item-id",
6519
6546
  language: "language",
6520
- editorLanguage: "editorLanguage",
6547
+ editorLanguage: "editor-language",
6521
6548
  screenMode: "screen-mode",
6522
- switchScreenModeOnResize: "switch-screen-mode-on-resize",
6523
6549
  authKey: "auth-key",
6524
6550
  authToken: "auth-token",
6525
6551
  editMode: "edit-mode",
@@ -6538,6 +6564,7 @@ var LuzmoDashboard = class extends i4 {
6538
6564
  this.borderWidth = 3;
6539
6565
  this.minHeight = 400;
6540
6566
  this._viewportTrackingActive = false;
6567
+ this._webComponentLibraryLoadId = 0;
6541
6568
  // Post synchronously on scroll/resize (not via requestAnimationFrame) so the iframe receives the
6542
6569
  // new slice as early as possible in the frame, minimizing the lag of the pinned analyst panel.
6543
6570
  this._onViewportChange = () => {
@@ -6596,7 +6623,7 @@ var LuzmoDashboard = class extends i4 {
6596
6623
  // overlays (e.g. the IQ analyst) can pin themselves to the visible area while the host page
6597
6624
  // scrolls the full-height iframe. Opt-in: started when the iframe requests it via 'trackViewport'.
6598
6625
  _startViewportTracking() {
6599
- if (this.embedMode !== "iframe") {
6626
+ if (this.isWebComponentViewMode()) {
6600
6627
  return;
6601
6628
  }
6602
6629
  if (!this._viewportTrackingActive) {
@@ -6638,15 +6665,37 @@ var LuzmoDashboard = class extends i4 {
6638
6665
  initComponent() {
6639
6666
  this.params = this._setOptions();
6640
6667
  if (this.isWebComponentViewMode()) {
6641
- loadLibrary(this.params.appServer, dashboardRemote).then(async () => {
6668
+ this.params.itemEmbedding = this._itemEmbedding;
6669
+ this.iframeLoaded = false;
6670
+ this._loaderStyles();
6671
+ if (!this.iframeStyle.height) {
6672
+ this.iframeStyle = calculateIframeStyles(this);
6673
+ }
6674
+ this.dashboardError = false;
6675
+ this.dashboardErrorMsg = "";
6676
+ const appServer = this.params.appServer;
6677
+ const libraryLoadId = ++this._webComponentLibraryLoadId;
6678
+ loadLibrary(appServer, dashboardRemote).then(async () => {
6679
+ if (libraryLoadId !== this._webComponentLibraryLoadId || !this.isWebComponentViewMode() || this.params.appServer !== appServer) {
6680
+ return;
6681
+ }
6642
6682
  this.isLibraryLoaded = true;
6643
6683
  await this.updateComplete;
6684
+ if (libraryLoadId !== this._webComponentLibraryLoadId) {
6685
+ return;
6686
+ }
6644
6687
  const el = document.createElement("dashboard-component");
6645
6688
  this.setAllAttributesOnElement(el);
6646
6689
  el.addEventListener("load", (payload) => {
6690
+ this.dashboardErrorMsg = "";
6647
6691
  this.containerWidth = el.offsetWidth;
6648
6692
  this.dimensions = payload.detail.dimensions;
6649
- _setCalculatedDimensions(this);
6693
+ if (this._loadTimeoutHandle) {
6694
+ clearTimeout(this._loadTimeoutHandle);
6695
+ this._loadTimeoutHandle = void 0;
6696
+ }
6697
+ this.iframeLoaded = true;
6698
+ this._calculateDimAfterDashboardLoaded();
6650
6699
  window.dispatchEvent(new Event("resize"));
6651
6700
  this.dispatchEvent(new CustomEvent("load", payload));
6652
6701
  });
@@ -6664,6 +6713,12 @@ var LuzmoDashboard = class extends i4 {
6664
6713
  container.append(el);
6665
6714
  this.dashboardReference = el;
6666
6715
  }
6716
+ }).catch((error3) => {
6717
+ if (libraryLoadId !== this._webComponentLibraryLoadId || !this.isWebComponentViewMode() || this.params.appServer !== appServer) {
6718
+ return;
6719
+ }
6720
+ const errorMsg = error3 instanceof Error ? error3.message : "Failed to load the dashboard application.";
6721
+ this._handleEmbedError({ errorMsg });
6667
6722
  });
6668
6723
  } else {
6669
6724
  this.containerWidth = this.container?.clientWidth;
@@ -6688,29 +6743,37 @@ var LuzmoDashboard = class extends i4 {
6688
6743
  if (!el) {
6689
6744
  return;
6690
6745
  }
6691
- if (this.params.dashboardId) {
6692
- el.setAttribute("dashboard-id", this.params.dashboardId);
6693
- }
6694
- if (this.params.appServer) {
6695
- el.setAttribute("app-server", this.params.appServer);
6746
+ const propertyNames = Object.keys(this.attributesMap);
6747
+ const prioritizedPropertyNames = ["dashboardId", "appServer", "apiHost"];
6748
+ for (const propertyName of [
6749
+ ...prioritizedPropertyNames,
6750
+ ...propertyNames.filter((name) => !prioritizedPropertyNames.includes(name))
6751
+ ]) {
6752
+ this.setAttributeOnElement(el, propertyName);
6696
6753
  }
6697
- if (this.params.apiHost) {
6698
- el.setAttribute("api-host", removeTrailingSlash(this.params.apiHost));
6699
- }
6700
- for (const key in this.attributesMap) {
6701
- if (!["authKey", "authToken", "apiHost", "itemDimensions", "dashboardId", "appServer"].includes(key) && this.params[key]) {
6702
- el.setAttribute(this.attributesMap[key], this.params[key]);
6703
- }
6754
+ }
6755
+ getAttributeValue(propertyName) {
6756
+ if (propertyName === "authKey") {
6757
+ return this.params.key;
6704
6758
  }
6705
- if (this.params.itemDimensions) {
6706
- el.setAttribute("item-dimensions", JSON.stringify(this.params.itemDimensions));
6759
+ if (propertyName === "authToken") {
6760
+ return this.params.token;
6707
6761
  }
6708
- if (this.params.key) {
6709
- el.setAttribute("auth-key", this.params.key);
6762
+ return this.params[propertyName];
6763
+ }
6764
+ setAttributeOnElement(el, propertyName) {
6765
+ const attributeName = this.attributesMap[propertyName];
6766
+ if (!attributeName) {
6767
+ return;
6710
6768
  }
6711
- if (this.params.token) {
6712
- el.setAttribute("auth-token", this.params.token);
6769
+ const value = this.getAttributeValue(propertyName);
6770
+ if (value === null || value === void 0) {
6771
+ el.removeAttribute(attributeName);
6772
+ return;
6713
6773
  }
6774
+ const normalizedValue = ["appServer", "apiHost"].includes(propertyName) && typeof value === "string" ? removeTrailingSlash(value) : value;
6775
+ const attributeValue = typeof normalizedValue === "object" ? JSON.stringify(normalizedValue) : String(normalizedValue);
6776
+ el.setAttribute(attributeName, attributeValue);
6714
6777
  }
6715
6778
  // Reload dashboard when triggerproperty changes
6716
6779
  updated(changedProperties) {
@@ -6731,19 +6794,36 @@ var LuzmoDashboard = class extends i4 {
6731
6794
  "timezoneId",
6732
6795
  "itemDimensions"
6733
6796
  ]);
6797
+ const webComponentRenderProperties = /* @__PURE__ */ new Set([
6798
+ "dashboardId",
6799
+ "dashboardSlug",
6800
+ "itemId",
6801
+ "language",
6802
+ "editorLanguage",
6803
+ "theme",
6804
+ "screenMode",
6805
+ "timezoneId",
6806
+ "itemDimensions"
6807
+ ]);
6734
6808
  const conditionsToCheck = ["dashboardId", "dashboardSlug", "itemId"];
6735
6809
  let callInitComponent = false;
6736
6810
  for (const condition of conditionsToCheck) {
6737
- callInitComponent = callInitComponent || changedProperties.get(condition) === void 0 && this[condition] !== void 0;
6811
+ callInitComponent = callInitComponent || changedProperties.has(condition) && changedProperties.get(condition) === void 0 && this[condition] !== void 0;
6738
6812
  }
6739
- if (callInitComponent && !this.isInitCalled) {
6813
+ const isDashboardReferenceMissing = !this.dashboardReference || !this.dashboardReference.isConnected;
6814
+ if (callInitComponent && (!this.isInitCalled || isDashboardReferenceMissing)) {
6815
+ if (isDashboardReferenceMissing) {
6816
+ this.dashboardReference = void 0;
6817
+ }
6740
6818
  this.initComponent();
6741
6819
  this.isInitCalled = true;
6742
6820
  return;
6743
6821
  }
6744
6822
  if (this.isWebComponentViewMode()) {
6745
- if (changedProperties.has("editMode") && !this.dashboardReference) {
6823
+ if (changedProperties.has("editMode") && (!this.dashboardReference || !this.dashboardReference.isConnected)) {
6746
6824
  this.iframeLoaded = false;
6825
+ this.dashboardReference = void 0;
6826
+ this._webComponentLibraryLoadId++;
6747
6827
  if (this._loadTimeoutHandle) {
6748
6828
  clearTimeout(this._loadTimeoutHandle);
6749
6829
  this._loadTimeoutHandle = void 0;
@@ -6752,24 +6832,37 @@ var LuzmoDashboard = class extends i4 {
6752
6832
  this.initComponent();
6753
6833
  return;
6754
6834
  }
6835
+ if ([...changedProperties.keys()].some((propertyName) => triggerProperties.has(propertyName))) {
6836
+ this.params = this._setOptions();
6837
+ }
6838
+ if (changedProperties.has("screenMode") || changedProperties.has("switchScreenModeOnResize")) {
6839
+ this._onResize();
6840
+ }
6841
+ if (changedProperties.has("appServer") || changedProperties.has("apiHost") || changedProperties.has("authKey") || changedProperties.has("authToken")) {
6842
+ this.dashboardReference?.remove();
6843
+ this.dashboardReference = void 0;
6844
+ this.initComponent();
6845
+ return;
6846
+ }
6755
6847
  if (this.dashboardReference) {
6848
+ if ([...changedProperties.keys()].some((propertyName) => webComponentRenderProperties.has(propertyName))) {
6849
+ this.iframeLoaded = false;
6850
+ this._loaderStyles();
6851
+ }
6756
6852
  for (const [propertyName] of changedProperties.entries()) {
6757
- if (propertyName === "appSever") {
6758
- loadLibrary(changedProperties[propertyName], dashboardRemote).then(async () => {
6759
- this.isLibraryLoaded = true;
6760
- await this.updateComplete;
6761
- this.dashboardReference = this.renderRoot.querySelector("dashboard-component");
6762
- this.setAllAttributes();
6763
- });
6764
- } else if (this.attributesMap[propertyName]) {
6765
- const mappedAttributeName = this.attributesMap[propertyName] ?? propertyName;
6766
- const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() || this[propertyName];
6767
- this.dashboardReference.setAttribute(mappedAttributeName, attributeValue);
6853
+ if (this.attributesMap[propertyName] && propertyName !== "editMode") {
6854
+ this.setAttributeOnElement(this.dashboardReference, propertyName);
6768
6855
  }
6769
6856
  }
6770
6857
  }
6771
6858
  } else {
6772
- for (const [propertyName] of changedProperties.entries()) {
6859
+ for (const [propertyName, previousValue] of changedProperties.entries()) {
6860
+ if (propertyName === "editMode" && this.embedMode === "webComponent" && (previousValue === "view" || previousValue === void 0)) {
6861
+ this.dashboardReference = void 0;
6862
+ this._webComponentLibraryLoadId++;
6863
+ this._reloadIframeContent();
6864
+ return;
6865
+ }
6773
6866
  if (triggerProperties.has(propertyName) && propertyName !== "editMode") {
6774
6867
  this._reloadIframeContent();
6775
6868
  } else if (triggerProperties.has(propertyName) && propertyName === "editMode") {
@@ -6909,6 +7002,7 @@ var LuzmoDashboard = class extends i4 {
6909
7002
  this.browserErrorMsg = errorMsg;
6910
7003
  } else {
6911
7004
  this.dashboardError = true;
7005
+ this.dashboardErrorMsg = errorMsg;
6912
7006
  this.iframeLoaded = true;
6913
7007
  }
6914
7008
  if (this._loadTimeoutHandle) {
@@ -6982,15 +7076,19 @@ var LuzmoDashboard = class extends i4 {
6982
7076
  </div>
6983
7077
  `;
6984
7078
  if (this.isWebComponentViewMode()) {
6985
- toBeRenderedHTML = this.isLibraryLoaded ? b2`
6986
- ${this.dashboardId || this.dashboardSlug ? b2`
6987
- <div id="dashboard-wc-container"></div>
6988
- ` : b2`
6989
- <div id="luzmo-error-${this._containerId}">
6990
- <h3 class="luzmo-error">${this.browserErrorMsg}</h3>
6991
- </div>
6992
- `}
6993
- ` : b2`${loader}`;
7079
+ toBeRenderedHTML = this.dashboardError ? b2`
7080
+ <div id="luzmo-error-${this._containerId}">
7081
+ <h3 class="luzmo-error">${this.dashboardErrorMsg}</h3>
7082
+ </div>
7083
+ ` : this.isLibraryLoaded ? b2`
7084
+ ${this.dashboardId || this.dashboardSlug ? b2`
7085
+ <div id="dashboard-wc-container"></div>
7086
+ ` : b2`
7087
+ <div id="luzmo-error-${this._containerId}">
7088
+ <h3 class="luzmo-error">${this.browserErrorMsg}</h3>
7089
+ </div>
7090
+ `}
7091
+ ` : b2`${loader}`;
6994
7092
  } else {
6995
7093
  toBeRenderedHTML = b2`
6996
7094
  ${this.dashboardId || this.dashboardSlug ? b2`
@@ -7034,7 +7132,7 @@ var LuzmoDashboard = class extends i4 {
7034
7132
  // Public methods
7035
7133
  getData(itemId) {
7036
7134
  if (this.isWebComponentViewMode() && this.dashboardReference) {
7037
- return this.dashboardReference.getData(itemId);
7135
+ return Promise.resolve().then(() => this.dashboardReference.getData(itemId));
7038
7136
  }
7039
7137
  if (!this.isWebComponentViewMode()) {
7040
7138
  return getData(this, this.iframe, itemId);
@@ -7303,6 +7401,9 @@ __decorateClass([
7303
7401
  __decorateClass([
7304
7402
  n4({ attribute: false })
7305
7403
  ], LuzmoDashboard.prototype, "dashboardError", 2);
7404
+ __decorateClass([
7405
+ n4({ attribute: false })
7406
+ ], LuzmoDashboard.prototype, "dashboardErrorMsg", 2);
7306
7407
  __decorateClass([
7307
7408
  n4({ attribute: false })
7308
7409
  ], LuzmoDashboard.prototype, "browserNotSupported", 2);
@@ -7333,7 +7434,7 @@ if (!customElements.get("luzmo-embed-dashboard")) {
7333
7434
  }
7334
7435
 
7335
7436
  // libs/dashboard-contents-types/src/lib/shared/version.ts
7336
- var CONTENTS_VERSION = "0.1.103";
7437
+ var CONTENTS_VERSION = "0.1.104";
7337
7438
 
7338
7439
  // libs/embed-libs/embed/src/lib/viz-item/viz-item.base.ts
7339
7440
  var dashboardContentsVersion = CONTENTS_VERSION;
@@ -7869,7 +7970,7 @@ if (!customElements.get(componentTag)) {
7869
7970
  customElements.define(componentTag, LuzmoIQEmbedAnswerComponent);
7870
7971
  }
7871
7972
 
7872
- // libs/embed-libs/embed/src/lib/helper/json-schema-utils.ts
7973
+ // libs/embed-libs/embed/src/lib/utils/json-schema-utils.ts
7873
7974
  var cachedSchemas = {};
7874
7975
  function addJSONSchemas(schemas) {
7875
7976
  if (schemas.some((schema) => !schema.$id)) {