@luzmo/embed 7.0.0 → 7.1.0-es2021
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 +6 -1
- package/README.md +13 -0
- package/index.cjs +81 -47
- package/index.js +81 -47
- package/luzmo-embed.min.js +81 -47
- package/package.json +9 -3
- package/src/index.d.ts +1 -1
- package/src/lib/dashboard/dashboard-base.d.ts +5 -0
- package/src/lib/helper/embed-error.utils.d.ts +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented in this file.
|
|
4
4
|
|
|
5
|
-
## [7.
|
|
5
|
+
## [7.1.0] - 2026-07-20
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- `error` event on `<luzmo-embed-dashboard>` and `<luzmo-embed-viz-item>`. Fires when the embed cannot be loaded or hits a fatal error (connectivity, permissions, invalid configuration, etc.), so you can handle it in your host app instead of showing a stuck loader.
|
|
9
|
+
|
|
10
|
+
## [7.0.0] - 2026-07-10
|
|
6
11
|
|
|
7
12
|
### Removed
|
|
8
13
|
- Removed the `accentColor` property and `accent-color` attribute from `<luzmo-embed-dashboard>`.
|
package/README.md
CHANGED
|
@@ -87,6 +87,7 @@ Below a list of available properties on the viz item web component
|
|
|
87
87
|
| changedFilters | Emitted when filters are changed |
|
|
88
88
|
| contextChanged | Emitted on any change, carries the full viz-item context |
|
|
89
89
|
| customEvent | Emitted when a custom event is fired |
|
|
90
|
+
| error | Emitted when the viz item cannot be loaded or encounters a fatal error. Check `event.detail.errorMsg` for details. |
|
|
90
91
|
| exported | Emitted when export completes or fails |
|
|
91
92
|
| rendered | Emitted when the item is rendered |
|
|
92
93
|
| load | Emitted when viz item is loaded |
|
|
@@ -195,6 +196,17 @@ Below a list of available properties on the dashboard web component
|
|
|
195
196
|
| `apiHost` | string | API server to connect to (Default: 'https://api.luzmo.com/' , for US set apiHost to 'https://api.us.luzmo.com/') |
|
|
196
197
|
| `editMode` | string | Specifies if the embedded dashboard should be editable or not. Accepted values: "view" , "editLimited" , "editFull" . Use "view" if you don't want the embedded dashboard to be editable. (Default: "view" ) |
|
|
197
198
|
| `mainColor` | string | Optional override of the main color used in the whitelabeling of the embedded dashboard editor. If not provided, the main color of the whitelabeling colors set on the organization will be used. Should be specified as a string of rgb values (i.e. "rgb(50,50,50)"). |
|
|
199
|
+
| `embedMode` | `'iframe' \| 'webComponent'` | How the dashboard is mounted inside your page. Defaults to `'iframe'` (rendered inside an `<iframe>`). Use `'webComponent'` to render the dashboard directly on your page (no iframe), which gives you full control over styling via CSS variables. `'webComponent'` is view-mode only; edit modes always fall back to iframe. See ["Embed modes and network requirements"](#embed-modes-and-network-requirements) below. |
|
|
200
|
+
|
|
201
|
+
<br/>
|
|
202
|
+
|
|
203
|
+
### Embed modes and network requirements
|
|
204
|
+
|
|
205
|
+
`embedMode="webComponent"` renders the dashboard directly on your page (no iframe), which gives you full control over styling via CSS variables. Because the dashboard then connects to your Luzmo API host directly from your domain, keep the following in mind:
|
|
206
|
+
|
|
207
|
+
- **WebSocket connectivity** to your Luzmo API host must be allowed by any reverse proxy, CSP or corporate firewall in front of your users. Your API host is whatever you set as `apiHost` (`api.luzmo.com` by default); make sure `wss://` connections to it are permitted. This lets the embed load reliably without relying on third-party cookies, which modern browsers and incognito windows block by default.
|
|
208
|
+
- **CNAME whitelabeling** (serving the Luzmo API from a subdomain of your own site) is still supported and is a good option if you want a fully first-party setup, but it is no longer required.
|
|
209
|
+
- **Error handling.** When the embed hits a fatal error (including connection failures after ~15 seconds), it fires an `error` event (see below) instead of showing an endless loader. Handle that event to show your own message.
|
|
198
210
|
|
|
199
211
|
<br/>
|
|
200
212
|
|
|
@@ -205,6 +217,7 @@ Below a list of available properties on the dashboard web component
|
|
|
205
217
|
| changedFilters | Emitted when filters are changed | `ChangedFiltersEvent` |
|
|
206
218
|
| contextChanged | Emitted on any dashboard change, carries the full context | `ContextChangedEvent` |
|
|
207
219
|
| customEvent | Emitted when a custom event is fired | `CustomEvent` |
|
|
220
|
+
| error | Emitted when the dashboard cannot be loaded or encounters a fatal error. Check `event.detail.errorMsg` for details. | `EmbedErrorEvent` |
|
|
208
221
|
| exported | Emitted when export completes or fails | `ExportedEvent` |
|
|
209
222
|
| itemsRendered | Emitted when all items are rendered | `ItemsRenderedEvent` |
|
|
210
223
|
| load | Emitted when dashboard is loaded | `LoadEvent` |
|
package/index.cjs
CHANGED
|
@@ -65,7 +65,26 @@ var import_decorators = require("lit/decorators.js");
|
|
|
65
65
|
var import_style_map = require("lit/directives/style-map.js");
|
|
66
66
|
|
|
67
67
|
// libs/embed-libs/embed/package.json
|
|
68
|
-
var version = "7.
|
|
68
|
+
var version = "7.1.0";
|
|
69
|
+
|
|
70
|
+
// libs/embed-libs/embed/src/lib/helper/embed-error.utils.ts
|
|
71
|
+
function buildEmbedErrorDetail(errorMsg) {
|
|
72
|
+
const payload = {
|
|
73
|
+
type: "error",
|
|
74
|
+
errorMsg,
|
|
75
|
+
error: { msg: errorMsg }
|
|
76
|
+
};
|
|
77
|
+
return { ...payload, data: payload };
|
|
78
|
+
}
|
|
79
|
+
function firstString(...values) {
|
|
80
|
+
return values.find((value) => typeof value === "string" && value.length > 0);
|
|
81
|
+
}
|
|
82
|
+
function normalizeEmbedErrorDetail(detail) {
|
|
83
|
+
const wrapped = detail;
|
|
84
|
+
const raw = wrapped?.data ?? detail ?? {};
|
|
85
|
+
const errorMsg = firstString(raw.errorMsg, raw.error?.msg) ?? "Unknown error";
|
|
86
|
+
return buildEmbedErrorDetail(errorMsg);
|
|
87
|
+
}
|
|
69
88
|
|
|
70
89
|
// libs/embed-libs/embed/src/lib/helper/event-bus-handler.ts
|
|
71
90
|
var SharedLib = __toESM(require("@luzmo/shared-embed"));
|
|
@@ -105,14 +124,7 @@ var _setEventHandler = () => {
|
|
|
105
124
|
break;
|
|
106
125
|
}
|
|
107
126
|
case "error": {
|
|
108
|
-
dashboardComponent.
|
|
109
|
-
if (dashboardComponent._loadTimeoutHandle) {
|
|
110
|
-
clearTimeout(dashboardComponent._loadTimeoutHandle);
|
|
111
|
-
dashboardComponent._loadTimeoutHandle = void 0;
|
|
112
|
-
}
|
|
113
|
-
dashboardComponent.iframeLoaded = true;
|
|
114
|
-
dashboardComponent._displayError();
|
|
115
|
-
console.error("Dashboard error:", event.data.errorMsg ?? event.data.error?.msg);
|
|
127
|
+
dashboardComponent._handleEmbedError(event.data);
|
|
116
128
|
break;
|
|
117
129
|
}
|
|
118
130
|
case "data": {
|
|
@@ -573,6 +585,9 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
573
585
|
this.dispatchEvent(new CustomEvent("load", payload));
|
|
574
586
|
});
|
|
575
587
|
el.addEventListener("itemsRendered", (payload) => this.dispatchEvent(new CustomEvent("itemsRendered", payload)));
|
|
588
|
+
el.addEventListener("error", (event) => {
|
|
589
|
+
this._handleEmbedError(event.detail);
|
|
590
|
+
});
|
|
576
591
|
el.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
|
|
577
592
|
el.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
|
|
578
593
|
el.addEventListener("dashboardAction", (payload) => this.dispatchEvent(new CustomEvent("dashboardAction", payload)));
|
|
@@ -790,10 +805,30 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
|
|
|
790
805
|
const data = SharedLib2.getLoader(this);
|
|
791
806
|
this._loaderMsg = data.loadingMsg;
|
|
792
807
|
if (data.errorMsg) {
|
|
808
|
+
this._handleEmbedError({ errorMsg: data.errorMsg }, "browser");
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* Switch the embed shell into its error state and emit the public `error` event.
|
|
813
|
+
* Used for iframe postMessage errors, webComponent CustomEvents, and browser checks.
|
|
814
|
+
*/
|
|
815
|
+
_handleEmbedError(detail, kind = "dashboard") {
|
|
816
|
+
const normalizedDetail = normalizeEmbedErrorDetail(detail);
|
|
817
|
+
const errorMsg = normalizedDetail.errorMsg;
|
|
818
|
+
if (kind === "browser") {
|
|
793
819
|
this.browserError = true;
|
|
794
|
-
this.browserErrorMsg =
|
|
795
|
-
|
|
820
|
+
this.browserErrorMsg = errorMsg;
|
|
821
|
+
} else {
|
|
822
|
+
this.dashboardError = true;
|
|
823
|
+
this.iframeLoaded = true;
|
|
796
824
|
}
|
|
825
|
+
if (this._loadTimeoutHandle) {
|
|
826
|
+
clearTimeout(this._loadTimeoutHandle);
|
|
827
|
+
this._loadTimeoutHandle = void 0;
|
|
828
|
+
}
|
|
829
|
+
this._displayError();
|
|
830
|
+
console.error("Dashboard error:", errorMsg);
|
|
831
|
+
this.dispatchEvent(new CustomEvent("error", { detail: normalizedDetail }));
|
|
797
832
|
}
|
|
798
833
|
_displayError() {
|
|
799
834
|
if (this.dashboardError) {
|
|
@@ -1230,22 +1265,6 @@ var LuzmoBaseVizItem = class extends import_lit3.LitElement {
|
|
|
1230
1265
|
this.libVersion = version + "-wc-luzmo";
|
|
1231
1266
|
this.postInitCallQueue = [];
|
|
1232
1267
|
}
|
|
1233
|
-
static {
|
|
1234
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1235
|
-
this.styles = import_lit3.css`
|
|
1236
|
-
:host {
|
|
1237
|
-
display: block;
|
|
1238
|
-
width: 100%;
|
|
1239
|
-
height: 100%;
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
luzmo-embed-viz-item {
|
|
1243
|
-
width: 100%;
|
|
1244
|
-
height: 1000%;
|
|
1245
|
-
display: block;
|
|
1246
|
-
}
|
|
1247
|
-
`;
|
|
1248
|
-
}
|
|
1249
1268
|
createRenderRoot() {
|
|
1250
1269
|
if (!this.style.display) {
|
|
1251
1270
|
this.style.display = "block";
|
|
@@ -1340,6 +1359,11 @@ var LuzmoBaseVizItem = class extends import_lit3.LitElement {
|
|
|
1340
1359
|
});
|
|
1341
1360
|
this.chartElement.addEventListener("exported", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
|
|
1342
1361
|
this.chartElement.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
|
|
1362
|
+
this.chartElement.addEventListener("error", (event) => {
|
|
1363
|
+
this.dispatchEvent(new CustomEvent("error", {
|
|
1364
|
+
detail: normalizeEmbedErrorDetail(event.detail)
|
|
1365
|
+
}));
|
|
1366
|
+
});
|
|
1343
1367
|
this.chartElement.addEventListener("authorizationExpired", (payload) => this.dispatchEvent(new CustomEvent("authorizationExpired", payload)));
|
|
1344
1368
|
this.updateVizItemProperties();
|
|
1345
1369
|
this.renderRoot.append(this.chartElement);
|
|
@@ -1377,6 +1401,20 @@ var LuzmoBaseVizItem = class extends import_lit3.LitElement {
|
|
|
1377
1401
|
return import_lit3.html` `;
|
|
1378
1402
|
}
|
|
1379
1403
|
};
|
|
1404
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1405
|
+
LuzmoBaseVizItem.styles = import_lit3.css`
|
|
1406
|
+
:host {
|
|
1407
|
+
display: block;
|
|
1408
|
+
width: 100%;
|
|
1409
|
+
height: 100%;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
luzmo-embed-viz-item {
|
|
1413
|
+
width: 100%;
|
|
1414
|
+
height: 1000%;
|
|
1415
|
+
display: block;
|
|
1416
|
+
}
|
|
1417
|
+
`;
|
|
1380
1418
|
__decorateClass([
|
|
1381
1419
|
(0, import_decorators2.property)()
|
|
1382
1420
|
], LuzmoBaseVizItem.prototype, "appServer", 2);
|
|
@@ -1476,16 +1514,6 @@ var LuzmoIQEmbedChatComponent = class extends import_lit4.LitElement {
|
|
|
1476
1514
|
this.remoteEntryServer = "http://localhost:4202/";
|
|
1477
1515
|
this.aydHost = "https://ayd.luzmo.com/";
|
|
1478
1516
|
}
|
|
1479
|
-
static {
|
|
1480
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1481
|
-
this.styles = import_lit4.css`
|
|
1482
|
-
:host {
|
|
1483
|
-
display: block;
|
|
1484
|
-
width: 100%;
|
|
1485
|
-
height: 100%;
|
|
1486
|
-
}
|
|
1487
|
-
`;
|
|
1488
|
-
}
|
|
1489
1517
|
createRenderRoot() {
|
|
1490
1518
|
return this;
|
|
1491
1519
|
}
|
|
@@ -1563,6 +1591,14 @@ var LuzmoIQEmbedChatComponent = class extends import_lit4.LitElement {
|
|
|
1563
1591
|
observer.observe(embedChat, { childList: true, subtree: true });
|
|
1564
1592
|
}
|
|
1565
1593
|
};
|
|
1594
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1595
|
+
LuzmoIQEmbedChatComponent.styles = import_lit4.css`
|
|
1596
|
+
:host {
|
|
1597
|
+
display: block;
|
|
1598
|
+
width: 100%;
|
|
1599
|
+
height: 100%;
|
|
1600
|
+
}
|
|
1601
|
+
`;
|
|
1566
1602
|
__decorateClass([
|
|
1567
1603
|
(0, import_decorators3.property)()
|
|
1568
1604
|
], LuzmoIQEmbedChatComponent.prototype, "appServer", 2);
|
|
@@ -1637,16 +1673,6 @@ var LuzmoIQEmbedAnswerComponent = class extends import_lit5.LitElement {
|
|
|
1637
1673
|
this.libVersion = version + "-wc-luzmo";
|
|
1638
1674
|
this.remoteEntryServer = "http://localhost:4202";
|
|
1639
1675
|
}
|
|
1640
|
-
static {
|
|
1641
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1642
|
-
this.styles = import_lit5.css`
|
|
1643
|
-
:host {
|
|
1644
|
-
display: block;
|
|
1645
|
-
width: 100%;
|
|
1646
|
-
height: 100%;
|
|
1647
|
-
}
|
|
1648
|
-
`;
|
|
1649
|
-
}
|
|
1650
1676
|
createRenderRoot() {
|
|
1651
1677
|
return this;
|
|
1652
1678
|
}
|
|
@@ -1697,6 +1723,14 @@ var LuzmoIQEmbedAnswerComponent = class extends import_lit5.LitElement {
|
|
|
1697
1723
|
return import_lit5.html` `;
|
|
1698
1724
|
}
|
|
1699
1725
|
};
|
|
1726
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1727
|
+
LuzmoIQEmbedAnswerComponent.styles = import_lit5.css`
|
|
1728
|
+
:host {
|
|
1729
|
+
display: block;
|
|
1730
|
+
width: 100%;
|
|
1731
|
+
height: 100%;
|
|
1732
|
+
}
|
|
1733
|
+
`;
|
|
1700
1734
|
__decorateClass([
|
|
1701
1735
|
(0, import_decorators4.property)()
|
|
1702
1736
|
], LuzmoIQEmbedAnswerComponent.prototype, "appServer", 2);
|
package/index.js
CHANGED
|
@@ -23,7 +23,26 @@ import { property, query, state } from "lit/decorators.js";
|
|
|
23
23
|
import { styleMap } from "lit/directives/style-map.js";
|
|
24
24
|
|
|
25
25
|
// libs/embed-libs/embed/package.json
|
|
26
|
-
var version = "7.
|
|
26
|
+
var version = "7.1.0";
|
|
27
|
+
|
|
28
|
+
// libs/embed-libs/embed/src/lib/helper/embed-error.utils.ts
|
|
29
|
+
function buildEmbedErrorDetail(errorMsg) {
|
|
30
|
+
const payload = {
|
|
31
|
+
type: "error",
|
|
32
|
+
errorMsg,
|
|
33
|
+
error: { msg: errorMsg }
|
|
34
|
+
};
|
|
35
|
+
return { ...payload, data: payload };
|
|
36
|
+
}
|
|
37
|
+
function firstString(...values) {
|
|
38
|
+
return values.find((value) => typeof value === "string" && value.length > 0);
|
|
39
|
+
}
|
|
40
|
+
function normalizeEmbedErrorDetail(detail) {
|
|
41
|
+
const wrapped = detail;
|
|
42
|
+
const raw = wrapped?.data ?? detail ?? {};
|
|
43
|
+
const errorMsg = firstString(raw.errorMsg, raw.error?.msg) ?? "Unknown error";
|
|
44
|
+
return buildEmbedErrorDetail(errorMsg);
|
|
45
|
+
}
|
|
27
46
|
|
|
28
47
|
// libs/embed-libs/embed/src/lib/helper/event-bus-handler.ts
|
|
29
48
|
import * as SharedLib from "@luzmo/shared-embed";
|
|
@@ -63,14 +82,7 @@ var _setEventHandler = () => {
|
|
|
63
82
|
break;
|
|
64
83
|
}
|
|
65
84
|
case "error": {
|
|
66
|
-
dashboardComponent.
|
|
67
|
-
if (dashboardComponent._loadTimeoutHandle) {
|
|
68
|
-
clearTimeout(dashboardComponent._loadTimeoutHandle);
|
|
69
|
-
dashboardComponent._loadTimeoutHandle = void 0;
|
|
70
|
-
}
|
|
71
|
-
dashboardComponent.iframeLoaded = true;
|
|
72
|
-
dashboardComponent._displayError();
|
|
73
|
-
console.error("Dashboard error:", event.data.errorMsg ?? event.data.error?.msg);
|
|
85
|
+
dashboardComponent._handleEmbedError(event.data);
|
|
74
86
|
break;
|
|
75
87
|
}
|
|
76
88
|
case "data": {
|
|
@@ -531,6 +543,9 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
531
543
|
this.dispatchEvent(new CustomEvent("load", payload));
|
|
532
544
|
});
|
|
533
545
|
el.addEventListener("itemsRendered", (payload) => this.dispatchEvent(new CustomEvent("itemsRendered", payload)));
|
|
546
|
+
el.addEventListener("error", (event) => {
|
|
547
|
+
this._handleEmbedError(event.detail);
|
|
548
|
+
});
|
|
534
549
|
el.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
|
|
535
550
|
el.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
|
|
536
551
|
el.addEventListener("dashboardAction", (payload) => this.dispatchEvent(new CustomEvent("dashboardAction", payload)));
|
|
@@ -748,10 +763,30 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
748
763
|
const data = SharedLib2.getLoader(this);
|
|
749
764
|
this._loaderMsg = data.loadingMsg;
|
|
750
765
|
if (data.errorMsg) {
|
|
766
|
+
this._handleEmbedError({ errorMsg: data.errorMsg }, "browser");
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Switch the embed shell into its error state and emit the public `error` event.
|
|
771
|
+
* Used for iframe postMessage errors, webComponent CustomEvents, and browser checks.
|
|
772
|
+
*/
|
|
773
|
+
_handleEmbedError(detail, kind = "dashboard") {
|
|
774
|
+
const normalizedDetail = normalizeEmbedErrorDetail(detail);
|
|
775
|
+
const errorMsg = normalizedDetail.errorMsg;
|
|
776
|
+
if (kind === "browser") {
|
|
751
777
|
this.browserError = true;
|
|
752
|
-
this.browserErrorMsg =
|
|
753
|
-
|
|
778
|
+
this.browserErrorMsg = errorMsg;
|
|
779
|
+
} else {
|
|
780
|
+
this.dashboardError = true;
|
|
781
|
+
this.iframeLoaded = true;
|
|
754
782
|
}
|
|
783
|
+
if (this._loadTimeoutHandle) {
|
|
784
|
+
clearTimeout(this._loadTimeoutHandle);
|
|
785
|
+
this._loadTimeoutHandle = void 0;
|
|
786
|
+
}
|
|
787
|
+
this._displayError();
|
|
788
|
+
console.error("Dashboard error:", errorMsg);
|
|
789
|
+
this.dispatchEvent(new CustomEvent("error", { detail: normalizedDetail }));
|
|
755
790
|
}
|
|
756
791
|
_displayError() {
|
|
757
792
|
if (this.dashboardError) {
|
|
@@ -1188,22 +1223,6 @@ var LuzmoBaseVizItem = class extends LitElement2 {
|
|
|
1188
1223
|
this.libVersion = version + "-wc-luzmo";
|
|
1189
1224
|
this.postInitCallQueue = [];
|
|
1190
1225
|
}
|
|
1191
|
-
static {
|
|
1192
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1193
|
-
this.styles = css2`
|
|
1194
|
-
:host {
|
|
1195
|
-
display: block;
|
|
1196
|
-
width: 100%;
|
|
1197
|
-
height: 100%;
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
luzmo-embed-viz-item {
|
|
1201
|
-
width: 100%;
|
|
1202
|
-
height: 1000%;
|
|
1203
|
-
display: block;
|
|
1204
|
-
}
|
|
1205
|
-
`;
|
|
1206
|
-
}
|
|
1207
1226
|
createRenderRoot() {
|
|
1208
1227
|
if (!this.style.display) {
|
|
1209
1228
|
this.style.display = "block";
|
|
@@ -1298,6 +1317,11 @@ var LuzmoBaseVizItem = class extends LitElement2 {
|
|
|
1298
1317
|
});
|
|
1299
1318
|
this.chartElement.addEventListener("exported", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
|
|
1300
1319
|
this.chartElement.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
|
|
1320
|
+
this.chartElement.addEventListener("error", (event) => {
|
|
1321
|
+
this.dispatchEvent(new CustomEvent("error", {
|
|
1322
|
+
detail: normalizeEmbedErrorDetail(event.detail)
|
|
1323
|
+
}));
|
|
1324
|
+
});
|
|
1301
1325
|
this.chartElement.addEventListener("authorizationExpired", (payload) => this.dispatchEvent(new CustomEvent("authorizationExpired", payload)));
|
|
1302
1326
|
this.updateVizItemProperties();
|
|
1303
1327
|
this.renderRoot.append(this.chartElement);
|
|
@@ -1335,6 +1359,20 @@ var LuzmoBaseVizItem = class extends LitElement2 {
|
|
|
1335
1359
|
return html2` `;
|
|
1336
1360
|
}
|
|
1337
1361
|
};
|
|
1362
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1363
|
+
LuzmoBaseVizItem.styles = css2`
|
|
1364
|
+
:host {
|
|
1365
|
+
display: block;
|
|
1366
|
+
width: 100%;
|
|
1367
|
+
height: 100%;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
luzmo-embed-viz-item {
|
|
1371
|
+
width: 100%;
|
|
1372
|
+
height: 1000%;
|
|
1373
|
+
display: block;
|
|
1374
|
+
}
|
|
1375
|
+
`;
|
|
1338
1376
|
__decorateClass([
|
|
1339
1377
|
property2()
|
|
1340
1378
|
], LuzmoBaseVizItem.prototype, "appServer", 2);
|
|
@@ -1434,16 +1472,6 @@ var LuzmoIQEmbedChatComponent = class extends LitElement3 {
|
|
|
1434
1472
|
this.remoteEntryServer = "http://localhost:4202/";
|
|
1435
1473
|
this.aydHost = "https://ayd.luzmo.com/";
|
|
1436
1474
|
}
|
|
1437
|
-
static {
|
|
1438
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1439
|
-
this.styles = css3`
|
|
1440
|
-
:host {
|
|
1441
|
-
display: block;
|
|
1442
|
-
width: 100%;
|
|
1443
|
-
height: 100%;
|
|
1444
|
-
}
|
|
1445
|
-
`;
|
|
1446
|
-
}
|
|
1447
1475
|
createRenderRoot() {
|
|
1448
1476
|
return this;
|
|
1449
1477
|
}
|
|
@@ -1521,6 +1549,14 @@ var LuzmoIQEmbedChatComponent = class extends LitElement3 {
|
|
|
1521
1549
|
observer.observe(embedChat, { childList: true, subtree: true });
|
|
1522
1550
|
}
|
|
1523
1551
|
};
|
|
1552
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1553
|
+
LuzmoIQEmbedChatComponent.styles = css3`
|
|
1554
|
+
:host {
|
|
1555
|
+
display: block;
|
|
1556
|
+
width: 100%;
|
|
1557
|
+
height: 100%;
|
|
1558
|
+
}
|
|
1559
|
+
`;
|
|
1524
1560
|
__decorateClass([
|
|
1525
1561
|
property3()
|
|
1526
1562
|
], LuzmoIQEmbedChatComponent.prototype, "appServer", 2);
|
|
@@ -1595,16 +1631,6 @@ var LuzmoIQEmbedAnswerComponent = class extends LitElement4 {
|
|
|
1595
1631
|
this.libVersion = version + "-wc-luzmo";
|
|
1596
1632
|
this.remoteEntryServer = "http://localhost:4202";
|
|
1597
1633
|
}
|
|
1598
|
-
static {
|
|
1599
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1600
|
-
this.styles = css4`
|
|
1601
|
-
:host {
|
|
1602
|
-
display: block;
|
|
1603
|
-
width: 100%;
|
|
1604
|
-
height: 100%;
|
|
1605
|
-
}
|
|
1606
|
-
`;
|
|
1607
|
-
}
|
|
1608
1634
|
createRenderRoot() {
|
|
1609
1635
|
return this;
|
|
1610
1636
|
}
|
|
@@ -1655,6 +1681,14 @@ var LuzmoIQEmbedAnswerComponent = class extends LitElement4 {
|
|
|
1655
1681
|
return html4` `;
|
|
1656
1682
|
}
|
|
1657
1683
|
};
|
|
1684
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
1685
|
+
LuzmoIQEmbedAnswerComponent.styles = css4`
|
|
1686
|
+
:host {
|
|
1687
|
+
display: block;
|
|
1688
|
+
width: 100%;
|
|
1689
|
+
height: 100%;
|
|
1690
|
+
}
|
|
1691
|
+
`;
|
|
1658
1692
|
__decorateClass([
|
|
1659
1693
|
property4()
|
|
1660
1694
|
], LuzmoIQEmbedAnswerComponent.prototype, "appServer", 2);
|
package/luzmo-embed.min.js
CHANGED
|
@@ -5881,7 +5881,26 @@ var o6 = e6(class extends i5 {
|
|
|
5881
5881
|
});
|
|
5882
5882
|
|
|
5883
5883
|
// libs/embed-libs/embed/package.json
|
|
5884
|
-
var version = "7.
|
|
5884
|
+
var version = "7.1.0";
|
|
5885
|
+
|
|
5886
|
+
// libs/embed-libs/embed/src/lib/helper/embed-error.utils.ts
|
|
5887
|
+
function buildEmbedErrorDetail(errorMsg) {
|
|
5888
|
+
const payload = {
|
|
5889
|
+
type: "error",
|
|
5890
|
+
errorMsg,
|
|
5891
|
+
error: { msg: errorMsg }
|
|
5892
|
+
};
|
|
5893
|
+
return { ...payload, data: payload };
|
|
5894
|
+
}
|
|
5895
|
+
function firstString(...values) {
|
|
5896
|
+
return values.find((value) => typeof value === "string" && value.length > 0);
|
|
5897
|
+
}
|
|
5898
|
+
function normalizeEmbedErrorDetail(detail) {
|
|
5899
|
+
const wrapped = detail;
|
|
5900
|
+
const raw = wrapped?.data ?? detail ?? {};
|
|
5901
|
+
const errorMsg = firstString(raw.errorMsg, raw.error?.msg) ?? "Unknown error";
|
|
5902
|
+
return buildEmbedErrorDetail(errorMsg);
|
|
5903
|
+
}
|
|
5885
5904
|
|
|
5886
5905
|
// libs/embed-libs/embed/src/lib/luzmo-service.ts
|
|
5887
5906
|
var LuzmoDashboardService = class {
|
|
@@ -5918,14 +5937,7 @@ var _setEventHandler = () => {
|
|
|
5918
5937
|
break;
|
|
5919
5938
|
}
|
|
5920
5939
|
case "error": {
|
|
5921
|
-
dashboardComponent.
|
|
5922
|
-
if (dashboardComponent._loadTimeoutHandle) {
|
|
5923
|
-
clearTimeout(dashboardComponent._loadTimeoutHandle);
|
|
5924
|
-
dashboardComponent._loadTimeoutHandle = void 0;
|
|
5925
|
-
}
|
|
5926
|
-
dashboardComponent.iframeLoaded = true;
|
|
5927
|
-
dashboardComponent._displayError();
|
|
5928
|
-
console.error("Dashboard error:", event.data.errorMsg ?? event.data.error?.msg);
|
|
5940
|
+
dashboardComponent._handleEmbedError(event.data);
|
|
5929
5941
|
break;
|
|
5930
5942
|
}
|
|
5931
5943
|
case "data": {
|
|
@@ -6385,6 +6397,9 @@ var LuzmoDashboard = class extends i4 {
|
|
|
6385
6397
|
this.dispatchEvent(new CustomEvent("load", payload));
|
|
6386
6398
|
});
|
|
6387
6399
|
el.addEventListener("itemsRendered", (payload) => this.dispatchEvent(new CustomEvent("itemsRendered", payload)));
|
|
6400
|
+
el.addEventListener("error", (event) => {
|
|
6401
|
+
this._handleEmbedError(event.detail);
|
|
6402
|
+
});
|
|
6388
6403
|
el.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
|
|
6389
6404
|
el.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
|
|
6390
6405
|
el.addEventListener("dashboardAction", (payload) => this.dispatchEvent(new CustomEvent("dashboardAction", payload)));
|
|
@@ -6602,10 +6617,30 @@ var LuzmoDashboard = class extends i4 {
|
|
|
6602
6617
|
const data = getLoader(this);
|
|
6603
6618
|
this._loaderMsg = data.loadingMsg;
|
|
6604
6619
|
if (data.errorMsg) {
|
|
6620
|
+
this._handleEmbedError({ errorMsg: data.errorMsg }, "browser");
|
|
6621
|
+
}
|
|
6622
|
+
}
|
|
6623
|
+
/**
|
|
6624
|
+
* Switch the embed shell into its error state and emit the public `error` event.
|
|
6625
|
+
* Used for iframe postMessage errors, webComponent CustomEvents, and browser checks.
|
|
6626
|
+
*/
|
|
6627
|
+
_handleEmbedError(detail, kind = "dashboard") {
|
|
6628
|
+
const normalizedDetail = normalizeEmbedErrorDetail(detail);
|
|
6629
|
+
const errorMsg = normalizedDetail.errorMsg;
|
|
6630
|
+
if (kind === "browser") {
|
|
6605
6631
|
this.browserError = true;
|
|
6606
|
-
this.browserErrorMsg =
|
|
6607
|
-
|
|
6632
|
+
this.browserErrorMsg = errorMsg;
|
|
6633
|
+
} else {
|
|
6634
|
+
this.dashboardError = true;
|
|
6635
|
+
this.iframeLoaded = true;
|
|
6608
6636
|
}
|
|
6637
|
+
if (this._loadTimeoutHandle) {
|
|
6638
|
+
clearTimeout(this._loadTimeoutHandle);
|
|
6639
|
+
this._loadTimeoutHandle = void 0;
|
|
6640
|
+
}
|
|
6641
|
+
this._displayError();
|
|
6642
|
+
console.error("Dashboard error:", errorMsg);
|
|
6643
|
+
this.dispatchEvent(new CustomEvent("error", { detail: normalizedDetail }));
|
|
6609
6644
|
}
|
|
6610
6645
|
_displayError() {
|
|
6611
6646
|
if (this.dashboardError) {
|
|
@@ -7041,22 +7076,6 @@ var LuzmoBaseVizItem = class extends i4 {
|
|
|
7041
7076
|
this.libVersion = version + "-wc-luzmo";
|
|
7042
7077
|
this.postInitCallQueue = [];
|
|
7043
7078
|
}
|
|
7044
|
-
static {
|
|
7045
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
7046
|
-
this.styles = i`
|
|
7047
|
-
:host {
|
|
7048
|
-
display: block;
|
|
7049
|
-
width: 100%;
|
|
7050
|
-
height: 100%;
|
|
7051
|
-
}
|
|
7052
|
-
|
|
7053
|
-
luzmo-embed-viz-item {
|
|
7054
|
-
width: 100%;
|
|
7055
|
-
height: 1000%;
|
|
7056
|
-
display: block;
|
|
7057
|
-
}
|
|
7058
|
-
`;
|
|
7059
|
-
}
|
|
7060
7079
|
createRenderRoot() {
|
|
7061
7080
|
if (!this.style.display) {
|
|
7062
7081
|
this.style.display = "block";
|
|
@@ -7151,6 +7170,11 @@ var LuzmoBaseVizItem = class extends i4 {
|
|
|
7151
7170
|
});
|
|
7152
7171
|
this.chartElement.addEventListener("exported", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
|
|
7153
7172
|
this.chartElement.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
|
|
7173
|
+
this.chartElement.addEventListener("error", (event) => {
|
|
7174
|
+
this.dispatchEvent(new CustomEvent("error", {
|
|
7175
|
+
detail: normalizeEmbedErrorDetail(event.detail)
|
|
7176
|
+
}));
|
|
7177
|
+
});
|
|
7154
7178
|
this.chartElement.addEventListener("authorizationExpired", (payload) => this.dispatchEvent(new CustomEvent("authorizationExpired", payload)));
|
|
7155
7179
|
this.updateVizItemProperties();
|
|
7156
7180
|
this.renderRoot.append(this.chartElement);
|
|
@@ -7188,6 +7212,20 @@ var LuzmoBaseVizItem = class extends i4 {
|
|
|
7188
7212
|
return b2` `;
|
|
7189
7213
|
}
|
|
7190
7214
|
};
|
|
7215
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
7216
|
+
LuzmoBaseVizItem.styles = i`
|
|
7217
|
+
:host {
|
|
7218
|
+
display: block;
|
|
7219
|
+
width: 100%;
|
|
7220
|
+
height: 100%;
|
|
7221
|
+
}
|
|
7222
|
+
|
|
7223
|
+
luzmo-embed-viz-item {
|
|
7224
|
+
width: 100%;
|
|
7225
|
+
height: 1000%;
|
|
7226
|
+
display: block;
|
|
7227
|
+
}
|
|
7228
|
+
`;
|
|
7191
7229
|
__decorateClass([
|
|
7192
7230
|
n4()
|
|
7193
7231
|
], LuzmoBaseVizItem.prototype, "appServer", 2);
|
|
@@ -7284,16 +7322,6 @@ var LuzmoIQEmbedChatComponent = class extends i4 {
|
|
|
7284
7322
|
this.remoteEntryServer = "http://localhost:4202/";
|
|
7285
7323
|
this.aydHost = "https://ayd.luzmo.com/";
|
|
7286
7324
|
}
|
|
7287
|
-
static {
|
|
7288
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
7289
|
-
this.styles = i`
|
|
7290
|
-
:host {
|
|
7291
|
-
display: block;
|
|
7292
|
-
width: 100%;
|
|
7293
|
-
height: 100%;
|
|
7294
|
-
}
|
|
7295
|
-
`;
|
|
7296
|
-
}
|
|
7297
7325
|
createRenderRoot() {
|
|
7298
7326
|
return this;
|
|
7299
7327
|
}
|
|
@@ -7371,6 +7399,14 @@ var LuzmoIQEmbedChatComponent = class extends i4 {
|
|
|
7371
7399
|
observer.observe(embedChat, { childList: true, subtree: true });
|
|
7372
7400
|
}
|
|
7373
7401
|
};
|
|
7402
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
7403
|
+
LuzmoIQEmbedChatComponent.styles = i`
|
|
7404
|
+
:host {
|
|
7405
|
+
display: block;
|
|
7406
|
+
width: 100%;
|
|
7407
|
+
height: 100%;
|
|
7408
|
+
}
|
|
7409
|
+
`;
|
|
7374
7410
|
__decorateClass([
|
|
7375
7411
|
n4()
|
|
7376
7412
|
], LuzmoIQEmbedChatComponent.prototype, "appServer", 2);
|
|
@@ -7442,16 +7478,6 @@ var LuzmoIQEmbedAnswerComponent = class extends i4 {
|
|
|
7442
7478
|
this.libVersion = version + "-wc-luzmo";
|
|
7443
7479
|
this.remoteEntryServer = "http://localhost:4202";
|
|
7444
7480
|
}
|
|
7445
|
-
static {
|
|
7446
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
7447
|
-
this.styles = i`
|
|
7448
|
-
:host {
|
|
7449
|
-
display: block;
|
|
7450
|
-
width: 100%;
|
|
7451
|
-
height: 100%;
|
|
7452
|
-
}
|
|
7453
|
-
`;
|
|
7454
|
-
}
|
|
7455
7481
|
createRenderRoot() {
|
|
7456
7482
|
return this;
|
|
7457
7483
|
}
|
|
@@ -7502,6 +7528,14 @@ var LuzmoIQEmbedAnswerComponent = class extends i4 {
|
|
|
7502
7528
|
return b2` `;
|
|
7503
7529
|
}
|
|
7504
7530
|
};
|
|
7531
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
7532
|
+
LuzmoIQEmbedAnswerComponent.styles = i`
|
|
7533
|
+
:host {
|
|
7534
|
+
display: block;
|
|
7535
|
+
width: 100%;
|
|
7536
|
+
height: 100%;
|
|
7537
|
+
}
|
|
7538
|
+
`;
|
|
7505
7539
|
__decorateClass([
|
|
7506
7540
|
n4()
|
|
7507
7541
|
], LuzmoIQEmbedAnswerComponent.prototype, "appServer", 2);
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luzmo/embed",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.0-es2021",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"lit": "^3.3.1",
|
|
6
|
-
"@luzmo/shared-embed": "6.
|
|
6
|
+
"@luzmo/shared-embed": "6.1.0"
|
|
7
7
|
},
|
|
8
8
|
"keywords": [
|
|
9
|
+
"es2021",
|
|
10
|
+
"safari-compatible",
|
|
9
11
|
"es6",
|
|
10
12
|
"web-component",
|
|
11
13
|
"lit",
|
|
@@ -21,5 +23,9 @@
|
|
|
21
23
|
],
|
|
22
24
|
"module": "./index.js",
|
|
23
25
|
"types": "./src/index.d.ts",
|
|
24
|
-
"license": "SEE LICENSE IN LICENSE"
|
|
26
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
27
|
+
"description": "ES2021 build for Safari < 16.3 compatibility",
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"tag": "es2021"
|
|
30
|
+
}
|
|
25
31
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type * from '@luzmo/dashboard-contents-types';
|
|
2
|
-
export type { LoadEvent, ChangedFiltersEvent, CustomEvent, ItemsRenderedEvent, ExportedEvent, DashboardActionEvent, SelectedDataInput, ExportType, DashboardExportType, ItemData, ExportDashboard, AccessibleDashboard, SetEditMode, SetSelectedData, DashboardEditMode, VizItemPostMessageLoadEvent, VizItemPostMessageRenderedEvent, VizItemPostMessageExportedEvent, VizItemPostMessageChangedFiltersEvent, VizItemPostMessageCustomEventEvent, VizItemPostMessageAuthorizationExpiredEvent } from '@luzmo/shared-embed';
|
|
2
|
+
export type { LoadEvent, ChangedFiltersEvent, CustomEvent, ItemsRenderedEvent, ExportedEvent, DashboardActionEvent, SelectedDataInput, ExportType, DashboardExportType, ItemData, ExportDashboard, AccessibleDashboard, SetEditMode, SetSelectedData, DashboardEditMode, VizItemPostMessageLoadEvent, VizItemPostMessageRenderedEvent, VizItemPostMessageExportedEvent, VizItemPostMessageChangedFiltersEvent, VizItemPostMessageCustomEventEvent, VizItemPostMessageAuthorizationExpiredEvent, VizItemPostMessageErrorEvent, EmbedErrorEvent, EmbedErrorEventData } from '@luzmo/shared-embed';
|
|
3
3
|
export { selectedDataUtils, preloadDashboard, preloadVizItem, preloadIQ } from '@luzmo/shared-embed';
|
|
4
4
|
export * from './lib/dashboard/dashboard-component';
|
|
5
5
|
export * from './lib/viz-item/viz-item-component';
|
|
@@ -79,6 +79,11 @@ export declare class LuzmoDashboard extends LitElement implements SharedLib.WebC
|
|
|
79
79
|
_setOptions(): SharedLib.DashboardContentParams;
|
|
80
80
|
_updateIframeUrl(): void;
|
|
81
81
|
_setupLoader(): void;
|
|
82
|
+
/**
|
|
83
|
+
* Switch the embed shell into its error state and emit the public `error` event.
|
|
84
|
+
* Used for iframe postMessage errors, webComponent CustomEvents, and browser checks.
|
|
85
|
+
*/
|
|
86
|
+
_handleEmbedError(detail: unknown, kind?: 'dashboard' | 'browser'): void;
|
|
82
87
|
_displayError(): void;
|
|
83
88
|
_calculateDimAfterDashboardLoaded(): void;
|
|
84
89
|
_loaderStyles(): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EmbedErrorEventData } from '@luzmo/shared-embed';
|
|
2
|
+
export type EmbedErrorDetail = EmbedErrorEventData & {
|
|
3
|
+
data: EmbedErrorEventData;
|
|
4
|
+
};
|
|
5
|
+
export declare function buildEmbedErrorDetail(errorMsg: string): EmbedErrorDetail;
|
|
6
|
+
/**
|
|
7
|
+
* Normalize any error payload shape (postMessage, CustomEvent detail, etc.)
|
|
8
|
+
* into the public `EmbedErrorEvent` detail contract.
|
|
9
|
+
*/
|
|
10
|
+
export declare function normalizeEmbedErrorDetail(detail?: unknown): EmbedErrorDetail;
|