@luzmo/embed 6.13.5 → 6.13.6-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 CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## [6.13.6] - 2026-07-03
6
+
7
+ ### Added
8
+ - `getDashboardContext()` on `<luzmo-embed-dashboard>`, returning the live dashboard context as the unified `dashboard` aiprompt input (`{ type, value }`, where `value` carries the current screen mode as `value.currentScreenMode`) in both iframe and web-component embed modes.
9
+ - `getVizItemContext()` on `<luzmo-embed-viz-item>`, returning a flex chart's live context (id, type, slots, options, filters and datasetIds).
10
+ - `contextChanged` event on `<luzmo-embed-dashboard>` and `<luzmo-embed-viz-item>`, emitted on any change and carrying the full context.
11
+ - Context-aware IQ chat: `dashboardId`, `contextIds` and `availableDatasets` properties on `<luzmo-iq-embed-chat>` to auto-connect the chat to an embedded dashboard or flex charts on the same page, plus a `connectionStatusChanged` event reporting `standalone` / `connecting` / `connected` / `not-found`.
12
+
5
13
  ## [6.13.5] - 2026-06-09
6
14
 
7
15
  ### Fixed
package/README.md CHANGED
@@ -82,13 +82,14 @@ Below a list of available properties on the viz item web component
82
82
 
83
83
  ### Events luzmo-embed-viz-item
84
84
 
85
- | Name | Description |
86
- |----------------|----------------------------------------|
87
- | changedFilters | Emitted when filters are changed |
88
- | customEvent | Emitted when a custom event is fired |
89
- | exported | Emitted when export completes or fails |
90
- | rendered | Emitted when the item is rendered |
91
- | load | Emitted when viz item is loaded |
85
+ | Name | Description |
86
+ |----------------|-------------------------------------------------------------|
87
+ | changedFilters | Emitted when filters are changed |
88
+ | contextChanged | Emitted on any change, carries the full viz-item context |
89
+ | customEvent | Emitted when a custom event is fired |
90
+ | exported | Emitted when export completes or fails |
91
+ | rendered | Emitted when the item is rendered |
92
+ | load | Emitted when viz item is loaded |
92
93
 
93
94
  <br/>
94
95
 
@@ -101,6 +102,10 @@ getData(): ItemData;
101
102
  // Return an array of active filters on the viz item.
102
103
  getFilters(): FilterGroup[];
103
104
 
105
+ // Return the live context of the viz item: id (contextId/DOM id), type, slots, options, filters and datasetIds.
106
+ // Used to feed a flex chart's context into an IQ chat or an /aiprompt call.
107
+ getVizItemContext(): VizItemContext;
108
+
104
109
  // Refresh the data of the viz item.
105
110
  refreshData(): void;
106
111
 
@@ -196,13 +201,14 @@ Below a list of available properties on the dashboard web component
196
201
 
197
202
  ### Events luzmo-embed-dashboard
198
203
 
199
- | Name | Description | Event Arguments |
200
- | -------------- | -------------------------------------- | --------------------- |
201
- | changedFilters | Emitted when filters are changed | `ChangedFiltersEvent` |
202
- | customEvent | Emitted when a custom event is fired | `CustomEvent` |
203
- | exported | Emitted when export completes or fails | `ExportedEvent` |
204
- | itemsRendered | Emitted when all items are rendered | `ItemsRenderedEvent` |
205
- | load | Emitted when dashboard is loaded | `LoadEvent` |
204
+ | Name | Description | Event Arguments |
205
+ | -------------- | ------------------------------------------------------------ | ---------------------- |
206
+ | changedFilters | Emitted when filters are changed | `ChangedFiltersEvent` |
207
+ | contextChanged | Emitted on any dashboard change, carries the full context | `ContextChangedEvent` |
208
+ | customEvent | Emitted when a custom event is fired | `CustomEvent` |
209
+ | exported | Emitted when export completes or fails | `ExportedEvent` |
210
+ | itemsRendered | Emitted when all items are rendered | `ItemsRenderedEvent` |
211
+ | load | Emitted when dashboard is loaded | `LoadEvent` |
206
212
 
207
213
  <br/>
208
214
 
@@ -218,6 +224,13 @@ getData(itemId: string): Promise<ItemData>;
218
224
  // Returns an array of active filters.
219
225
  getFilters(): Promise<FilterGroup[]>;
220
226
 
227
+ // Returns the live dashboard context (current views, runtime filters and titles) as the
228
+ // unified `dashboard` aiprompt input (`{ type: 'dashboard', value }`, where `value` carries
229
+ // the current screen mode as `value.currentScreenMode`).
230
+ // Works in both iframe and web-component embed modes. Feed it into an IQ chat (via its
231
+ // `dashboardContext` input) or an /aiprompt call.
232
+ getDashboardContext(): Promise<DashboardContext | undefined>;
233
+
221
234
  // Changes the authorization of all or one dashboard. To fetch data based on new authorization parameters, reloadDashboard() or refreshData() needs to be called.
222
235
  setAuthorization(key: string, token: string): Promise<void>;
223
236
 
@@ -354,6 +367,33 @@ All available properties for the IQ chat component can be seen in the table belo
354
367
  | `apiHost` | string | Tenancy of Luzmo API to connect to (Default: 'https://api.luzmo.com/' , for US set apiHost to 'https://api.us.luzmo.com/') |
355
368
  | `options` | IQChatOptions | Specifies the customization options of the IQ chat component that affect its appearance and functionality. |
356
369
  | `initialSuggestionsDatasetId` | string | ID of a dataset that assists the AI service in generating automated, initial prompts based on the provided data. |
370
+ | `availableDatasets` | string[] | Restrict the analyst to these dataset ids. Accepts a JSON array string attribute. |
371
+ | `dashboardContext` | DashboardContext | A `dashboard-context` to answer over (manual API path). Accepts a JSON object string attribute. |
372
+ | `dashboardId` | string | Connect the chat to a dashboard embedded on the same page; it auto-reads live context and refreshes on change. |
373
+ | `contextIds` | string[] | Connect the chat to one or more flex charts by their `context-id`; a synthetic dashboard-context is assembled. JSON array. |
374
+
375
+ <br/>
376
+
377
+ #### Context-aware chat (dashboards & flex charts)
378
+
379
+ The IQ chat can answer using the **live context** of an embedded dashboard or one/more standalone flex charts on the same page. Connection is always explicit:
380
+
381
+ - Set neither `dashboardId` nor `contextIds` → standalone chat (no context).
382
+ - Set `dashboardId` → the chat finds the `luzmo-embed-dashboard` with that id, reads its context via `getDashboardContext()` and refreshes on each `contextChanged`.
383
+ - Set `contextIds` → the chat finds each `luzmo-embed-viz-item` whose `context-id` matches, reads each via `getVizItemContext()` and assembles a synthetic dashboard-context.
384
+ - If an id is not found on the page, the chat does not connect and surfaces a clear message; a `connectionStatusChanged` event reports the status (`standalone` / `connecting` / `connected` / `not-found`).
385
+
386
+ For a customer's own UI you can also skip auto-connect and forward context yourself: listen to the dashboard's `contextChanged` (or call `getDashboardContext()`), then pass the payload into the chat's `dashboardContext` input or into an `/aiprompt` call.
387
+
388
+ ```html
389
+ <!-- Auto-connect to a dashboard on the same page -->
390
+ <luzmo-embed-dashboard dashboardId="<dashboard-id>" authKey="..." authToken="..."></luzmo-embed-dashboard>
391
+ <luzmo-iq-embed-chat dashboardId="<dashboard-id>" authKey="..." authToken="..."></luzmo-iq-embed-chat>
392
+
393
+ <!-- Auto-connect to one or more flex charts -->
394
+ <luzmo-embed-viz-item context-id="sales-by-product" authKey="..." authToken="..."></luzmo-embed-viz-item>
395
+ <luzmo-iq-embed-chat contextIds='["sales-by-product"]' authKey="..." authToken="..."></luzmo-iq-embed-chat>
396
+ ```
357
397
 
358
398
  <br/>
359
399
 
package/index.cjs CHANGED
@@ -65,7 +65,7 @@ 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 = "6.13.5";
68
+ var version = "6.13.6";
69
69
 
70
70
  // libs/embed-libs/embed/src/lib/helper/event-bus-handler.ts
71
71
  var SharedLib = __toESM(require("@luzmo/shared-embed"));
@@ -131,6 +131,14 @@ var _setEventHandler = () => {
131
131
  );
132
132
  break;
133
133
  }
134
+ case "dashboardContext": {
135
+ SharedLib.resolvePromise(
136
+ dashboardComponent,
137
+ event.data.requestId,
138
+ event.data.context
139
+ );
140
+ break;
141
+ }
134
142
  case "getAccessibleDashboards": {
135
143
  SharedLib.resolvePromise(
136
144
  dashboardComponent,
@@ -170,6 +178,12 @@ var _setEventHandler = () => {
170
178
  );
171
179
  break;
172
180
  }
181
+ case "contextChanged": {
182
+ dashboardComponent.dispatchEvent(
183
+ new CustomEvent("contextChanged", { detail: { data: event.data } })
184
+ );
185
+ break;
186
+ }
173
187
  case "customEvent": {
174
188
  dashboardComponent.dispatchEvent(
175
189
  new CustomEvent("customEvent", { detail: { data: event.data } })
@@ -565,6 +579,7 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
565
579
  el.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
566
580
  el.addEventListener("dashboardAction", (payload) => this.dispatchEvent(new CustomEvent("dashboardAction", payload)));
567
581
  el.addEventListener("export", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
582
+ el.addEventListener("contextChanged", (payload) => this.dispatchEvent(new CustomEvent("contextChanged", payload)));
568
583
  const container = this.renderRoot.querySelector("#dashboard-wc-container");
569
584
  if (container) {
570
585
  container.append(el);
@@ -920,6 +935,15 @@ var LuzmoDashboard = class extends import_lit2.LitElement {
920
935
  }
921
936
  return Promise.reject();
922
937
  }
938
+ getDashboardContext() {
939
+ if (this.isWebComponentViewMode() && this.dashboardReference) {
940
+ return this.dashboardReference.getDashboardContext();
941
+ }
942
+ if (!this.isWebComponentViewMode()) {
943
+ return SharedLib2.getDashboardContext(this, this.iframe);
944
+ }
945
+ return Promise.reject(new Error("getDashboardContext is not available: dashboard reference is not ready."));
946
+ }
923
947
  setSelectedData(itemId, filters) {
924
948
  if (this.isWebComponentViewMode() && this.dashboardReference) {
925
949
  return this.dashboardReference.setSelectedData(itemId, filters);
@@ -1197,6 +1221,19 @@ var import_lit3 = require("lit");
1197
1221
  var import_decorators2 = require("lit/decorators.js");
1198
1222
  var dashboardContentsVersion = import_dashboard_contents_types.CONTENTS_VERSION;
1199
1223
  var vizItemRemote = "VizItemApp";
1224
+ function collectVizItemDatasetIds(slots) {
1225
+ const ids = /* @__PURE__ */ new Set();
1226
+ for (const slot of slots ?? []) {
1227
+ for (const content of slot?.content ?? []) {
1228
+ const column = content;
1229
+ const datasetId = column.datasetId ?? column.set;
1230
+ if (datasetId) {
1231
+ ids.add(datasetId);
1232
+ }
1233
+ }
1234
+ }
1235
+ return [...ids];
1236
+ }
1200
1237
  var LuzmoBaseVizItem = class extends import_lit3.LitElement {
1201
1238
  constructor() {
1202
1239
  super(...arguments);
@@ -1208,22 +1245,6 @@ var LuzmoBaseVizItem = class extends import_lit3.LitElement {
1208
1245
  this.libVersion = version + "-wc-luzmo";
1209
1246
  this.postInitCallQueue = [];
1210
1247
  }
1211
- static {
1212
- // Static styles to set host display to block, else it is not shown at all for some reason.
1213
- this.styles = import_lit3.css`
1214
- :host {
1215
- display: block;
1216
- width: 100%;
1217
- height: 100%;
1218
- }
1219
-
1220
- luzmo-embed-viz-item {
1221
- width: 100%;
1222
- height: 1000%;
1223
- display: block;
1224
- }
1225
- `;
1226
- }
1227
1248
  createRenderRoot() {
1228
1249
  if (!this.style.display) {
1229
1250
  this.style.display = "block";
@@ -1242,6 +1263,22 @@ var LuzmoBaseVizItem = class extends import_lit3.LitElement {
1242
1263
  getFilters() {
1243
1264
  return this.chartElement.getFilters();
1244
1265
  }
1266
+ /**
1267
+ * Snapshot of this flex chart's live context: its definition (type, slots,
1268
+ * options), current filters and the datasets it reads. Used by context-aware
1269
+ * embeds such as the Luzmo IQ chat component.
1270
+ */
1271
+ getVizItemContext() {
1272
+ const slots = this.slots ?? [];
1273
+ return {
1274
+ id: this.contextId ?? this.getAttribute("context-id") ?? this.id ?? this.itemId ?? "",
1275
+ type: this.type,
1276
+ slots,
1277
+ options: this.options,
1278
+ filters: typeof this.chartElement?.getFilters === "function" ? this.getFilters() : this.filters ?? [],
1279
+ datasetIds: collectVizItemDatasetIds(slots)
1280
+ };
1281
+ }
1245
1282
  export(type = "png") {
1246
1283
  return this.chartElement.export(type);
1247
1284
  }
@@ -1294,7 +1331,12 @@ var LuzmoBaseVizItem = class extends import_lit3.LitElement {
1294
1331
  }
1295
1332
  this.dispatchEvent(new CustomEvent("rendered", payload));
1296
1333
  });
1297
- this.chartElement.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
1334
+ this.chartElement.addEventListener("changedFilters", (payload) => {
1335
+ this.dispatchEvent(new CustomEvent("changedFilters", payload));
1336
+ this.dispatchEvent(new CustomEvent("contextChanged", {
1337
+ detail: { data: { type: "contextChanged", context: this.getVizItemContext() } }
1338
+ }));
1339
+ });
1298
1340
  this.chartElement.addEventListener("exported", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
1299
1341
  this.chartElement.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
1300
1342
  this.chartElement.addEventListener("authorizationExpired", (payload) => this.dispatchEvent(new CustomEvent("authorizationExpired", payload)));
@@ -1334,6 +1376,20 @@ var LuzmoBaseVizItem = class extends import_lit3.LitElement {
1334
1376
  return import_lit3.html` `;
1335
1377
  }
1336
1378
  };
1379
+ // Static styles to set host display to block, else it is not shown at all for some reason.
1380
+ LuzmoBaseVizItem.styles = import_lit3.css`
1381
+ :host {
1382
+ display: block;
1383
+ width: 100%;
1384
+ height: 100%;
1385
+ }
1386
+
1387
+ luzmo-embed-viz-item {
1388
+ width: 100%;
1389
+ height: 1000%;
1390
+ display: block;
1391
+ }
1392
+ `;
1337
1393
  __decorateClass([
1338
1394
  (0, import_decorators2.property)()
1339
1395
  ], LuzmoBaseVizItem.prototype, "appServer", 2);
@@ -1417,7 +1473,9 @@ var inputMap = {
1417
1473
  libVersion: "lib-version",
1418
1474
  aydHost: "ayd-host",
1419
1475
  availableDatasets: "available-datasets",
1420
- dashboardContext: "dashboard-context"
1476
+ dashboardContext: "dashboard-context",
1477
+ dashboardId: "dashboard-id",
1478
+ contextIds: "context-ids"
1421
1479
  };
1422
1480
  var embedChatTag = "luzmo-iq-embed-chat";
1423
1481
  var chatComponentTag = "luzmo-iq-chat-component";
@@ -1431,16 +1489,6 @@ var LuzmoIQEmbedChatComponent = class extends import_lit4.LitElement {
1431
1489
  this.remoteEntryServer = "http://localhost:4202/";
1432
1490
  this.aydHost = "https://ayd.luzmo.com/";
1433
1491
  }
1434
- static {
1435
- // Static styles to set host display to block, else it is not shown at all for some reason.
1436
- this.styles = import_lit4.css`
1437
- :host {
1438
- display: block;
1439
- width: 100%;
1440
- height: 100%;
1441
- }
1442
- `;
1443
- }
1444
1492
  createRenderRoot() {
1445
1493
  return this;
1446
1494
  }
@@ -1456,6 +1504,10 @@ var LuzmoIQEmbedChatComponent = class extends import_lit4.LitElement {
1456
1504
  if (!this.chartElement) {
1457
1505
  this.chartElement = document.createElement(chatComponentTag);
1458
1506
  this.chartElement.addEventListener("load", (payload) => this.dispatchEvent(new CustomEvent("load", payload)));
1507
+ this.chartElement.addEventListener(
1508
+ "connectionStatusChanged",
1509
+ (event) => this.dispatchEvent(new CustomEvent("connectionStatusChanged", { detail: event.detail }))
1510
+ );
1459
1511
  this.updateVizItemProperties();
1460
1512
  this.renderRoot.append(this.chartElement);
1461
1513
  }
@@ -1478,7 +1530,12 @@ var LuzmoIQEmbedChatComponent = class extends import_lit4.LitElement {
1478
1530
  if (this.chartElement) {
1479
1531
  for (const [propertyName] of changedProperties.entries()) {
1480
1532
  const mappedAttributeName = inputMap[propertyName] ?? propertyName;
1481
- const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
1533
+ const propertyValue = this[propertyName];
1534
+ if (propertyValue == null) {
1535
+ this.chartElement.removeAttribute(mappedAttributeName);
1536
+ continue;
1537
+ }
1538
+ const attributeValue = typeof propertyValue === "object" ? JSON.stringify(propertyValue) : propertyValue.toString();
1482
1539
  this.chartElement.setAttribute(mappedAttributeName, attributeValue);
1483
1540
  }
1484
1541
  } else {
@@ -1509,6 +1566,14 @@ var LuzmoIQEmbedChatComponent = class extends import_lit4.LitElement {
1509
1566
  observer.observe(embedChat, { childList: true, subtree: true });
1510
1567
  }
1511
1568
  };
1569
+ // Static styles to set host display to block, else it is not shown at all for some reason.
1570
+ LuzmoIQEmbedChatComponent.styles = import_lit4.css`
1571
+ :host {
1572
+ display: block;
1573
+ width: 100%;
1574
+ height: 100%;
1575
+ }
1576
+ `;
1512
1577
  __decorateClass([
1513
1578
  (0, import_decorators3.property)()
1514
1579
  ], LuzmoIQEmbedChatComponent.prototype, "appServer", 2);
@@ -1548,6 +1613,12 @@ __decorateClass([
1548
1613
  __decorateClass([
1549
1614
  (0, import_decorators3.property)({ type: Object })
1550
1615
  ], LuzmoIQEmbedChatComponent.prototype, "dashboardContext", 2);
1616
+ __decorateClass([
1617
+ (0, import_decorators3.property)()
1618
+ ], LuzmoIQEmbedChatComponent.prototype, "dashboardId", 2);
1619
+ __decorateClass([
1620
+ (0, import_decorators3.property)({ type: Array })
1621
+ ], LuzmoIQEmbedChatComponent.prototype, "contextIds", 2);
1551
1622
  if (!customElements.get(embedChatTag)) {
1552
1623
  customElements.define(embedChatTag, LuzmoIQEmbedChatComponent);
1553
1624
  }
@@ -1577,16 +1648,6 @@ var LuzmoIQEmbedAnswerComponent = class extends import_lit5.LitElement {
1577
1648
  this.libVersion = version + "-wc-luzmo";
1578
1649
  this.remoteEntryServer = "http://localhost:4202";
1579
1650
  }
1580
- static {
1581
- // Static styles to set host display to block, else it is not shown at all for some reason.
1582
- this.styles = import_lit5.css`
1583
- :host {
1584
- display: block;
1585
- width: 100%;
1586
- height: 100%;
1587
- }
1588
- `;
1589
- }
1590
1651
  createRenderRoot() {
1591
1652
  return this;
1592
1653
  }
@@ -1637,6 +1698,14 @@ var LuzmoIQEmbedAnswerComponent = class extends import_lit5.LitElement {
1637
1698
  return import_lit5.html` `;
1638
1699
  }
1639
1700
  };
1701
+ // Static styles to set host display to block, else it is not shown at all for some reason.
1702
+ LuzmoIQEmbedAnswerComponent.styles = import_lit5.css`
1703
+ :host {
1704
+ display: block;
1705
+ width: 100%;
1706
+ height: 100%;
1707
+ }
1708
+ `;
1640
1709
  __decorateClass([
1641
1710
  (0, import_decorators4.property)()
1642
1711
  ], LuzmoIQEmbedAnswerComponent.prototype, "appServer", 2);
package/index.js CHANGED
@@ -23,7 +23,7 @@ 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 = "6.13.5";
26
+ var version = "6.13.6";
27
27
 
28
28
  // libs/embed-libs/embed/src/lib/helper/event-bus-handler.ts
29
29
  import * as SharedLib from "@luzmo/shared-embed";
@@ -89,6 +89,14 @@ var _setEventHandler = () => {
89
89
  );
90
90
  break;
91
91
  }
92
+ case "dashboardContext": {
93
+ SharedLib.resolvePromise(
94
+ dashboardComponent,
95
+ event.data.requestId,
96
+ event.data.context
97
+ );
98
+ break;
99
+ }
92
100
  case "getAccessibleDashboards": {
93
101
  SharedLib.resolvePromise(
94
102
  dashboardComponent,
@@ -128,6 +136,12 @@ var _setEventHandler = () => {
128
136
  );
129
137
  break;
130
138
  }
139
+ case "contextChanged": {
140
+ dashboardComponent.dispatchEvent(
141
+ new CustomEvent("contextChanged", { detail: { data: event.data } })
142
+ );
143
+ break;
144
+ }
131
145
  case "customEvent": {
132
146
  dashboardComponent.dispatchEvent(
133
147
  new CustomEvent("customEvent", { detail: { data: event.data } })
@@ -523,6 +537,7 @@ var LuzmoDashboard = class extends LitElement {
523
537
  el.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
524
538
  el.addEventListener("dashboardAction", (payload) => this.dispatchEvent(new CustomEvent("dashboardAction", payload)));
525
539
  el.addEventListener("export", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
540
+ el.addEventListener("contextChanged", (payload) => this.dispatchEvent(new CustomEvent("contextChanged", payload)));
526
541
  const container = this.renderRoot.querySelector("#dashboard-wc-container");
527
542
  if (container) {
528
543
  container.append(el);
@@ -878,6 +893,15 @@ var LuzmoDashboard = class extends LitElement {
878
893
  }
879
894
  return Promise.reject();
880
895
  }
896
+ getDashboardContext() {
897
+ if (this.isWebComponentViewMode() && this.dashboardReference) {
898
+ return this.dashboardReference.getDashboardContext();
899
+ }
900
+ if (!this.isWebComponentViewMode()) {
901
+ return SharedLib2.getDashboardContext(this, this.iframe);
902
+ }
903
+ return Promise.reject(new Error("getDashboardContext is not available: dashboard reference is not ready."));
904
+ }
881
905
  setSelectedData(itemId, filters) {
882
906
  if (this.isWebComponentViewMode() && this.dashboardReference) {
883
907
  return this.dashboardReference.setSelectedData(itemId, filters);
@@ -1155,6 +1179,19 @@ import { css as css2, html as html2, LitElement as LitElement2 } from "lit";
1155
1179
  import { property as property2 } from "lit/decorators.js";
1156
1180
  var dashboardContentsVersion = CONTENTS_VERSION;
1157
1181
  var vizItemRemote = "VizItemApp";
1182
+ function collectVizItemDatasetIds(slots) {
1183
+ const ids = /* @__PURE__ */ new Set();
1184
+ for (const slot of slots ?? []) {
1185
+ for (const content of slot?.content ?? []) {
1186
+ const column = content;
1187
+ const datasetId = column.datasetId ?? column.set;
1188
+ if (datasetId) {
1189
+ ids.add(datasetId);
1190
+ }
1191
+ }
1192
+ }
1193
+ return [...ids];
1194
+ }
1158
1195
  var LuzmoBaseVizItem = class extends LitElement2 {
1159
1196
  constructor() {
1160
1197
  super(...arguments);
@@ -1166,22 +1203,6 @@ var LuzmoBaseVizItem = class extends LitElement2 {
1166
1203
  this.libVersion = version + "-wc-luzmo";
1167
1204
  this.postInitCallQueue = [];
1168
1205
  }
1169
- static {
1170
- // Static styles to set host display to block, else it is not shown at all for some reason.
1171
- this.styles = css2`
1172
- :host {
1173
- display: block;
1174
- width: 100%;
1175
- height: 100%;
1176
- }
1177
-
1178
- luzmo-embed-viz-item {
1179
- width: 100%;
1180
- height: 1000%;
1181
- display: block;
1182
- }
1183
- `;
1184
- }
1185
1206
  createRenderRoot() {
1186
1207
  if (!this.style.display) {
1187
1208
  this.style.display = "block";
@@ -1200,6 +1221,22 @@ var LuzmoBaseVizItem = class extends LitElement2 {
1200
1221
  getFilters() {
1201
1222
  return this.chartElement.getFilters();
1202
1223
  }
1224
+ /**
1225
+ * Snapshot of this flex chart's live context: its definition (type, slots,
1226
+ * options), current filters and the datasets it reads. Used by context-aware
1227
+ * embeds such as the Luzmo IQ chat component.
1228
+ */
1229
+ getVizItemContext() {
1230
+ const slots = this.slots ?? [];
1231
+ return {
1232
+ id: this.contextId ?? this.getAttribute("context-id") ?? this.id ?? this.itemId ?? "",
1233
+ type: this.type,
1234
+ slots,
1235
+ options: this.options,
1236
+ filters: typeof this.chartElement?.getFilters === "function" ? this.getFilters() : this.filters ?? [],
1237
+ datasetIds: collectVizItemDatasetIds(slots)
1238
+ };
1239
+ }
1203
1240
  export(type = "png") {
1204
1241
  return this.chartElement.export(type);
1205
1242
  }
@@ -1252,7 +1289,12 @@ var LuzmoBaseVizItem = class extends LitElement2 {
1252
1289
  }
1253
1290
  this.dispatchEvent(new CustomEvent("rendered", payload));
1254
1291
  });
1255
- this.chartElement.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
1292
+ this.chartElement.addEventListener("changedFilters", (payload) => {
1293
+ this.dispatchEvent(new CustomEvent("changedFilters", payload));
1294
+ this.dispatchEvent(new CustomEvent("contextChanged", {
1295
+ detail: { data: { type: "contextChanged", context: this.getVizItemContext() } }
1296
+ }));
1297
+ });
1256
1298
  this.chartElement.addEventListener("exported", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
1257
1299
  this.chartElement.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
1258
1300
  this.chartElement.addEventListener("authorizationExpired", (payload) => this.dispatchEvent(new CustomEvent("authorizationExpired", payload)));
@@ -1292,6 +1334,20 @@ var LuzmoBaseVizItem = class extends LitElement2 {
1292
1334
  return html2` `;
1293
1335
  }
1294
1336
  };
1337
+ // Static styles to set host display to block, else it is not shown at all for some reason.
1338
+ LuzmoBaseVizItem.styles = css2`
1339
+ :host {
1340
+ display: block;
1341
+ width: 100%;
1342
+ height: 100%;
1343
+ }
1344
+
1345
+ luzmo-embed-viz-item {
1346
+ width: 100%;
1347
+ height: 1000%;
1348
+ display: block;
1349
+ }
1350
+ `;
1295
1351
  __decorateClass([
1296
1352
  property2()
1297
1353
  ], LuzmoBaseVizItem.prototype, "appServer", 2);
@@ -1375,7 +1431,9 @@ var inputMap = {
1375
1431
  libVersion: "lib-version",
1376
1432
  aydHost: "ayd-host",
1377
1433
  availableDatasets: "available-datasets",
1378
- dashboardContext: "dashboard-context"
1434
+ dashboardContext: "dashboard-context",
1435
+ dashboardId: "dashboard-id",
1436
+ contextIds: "context-ids"
1379
1437
  };
1380
1438
  var embedChatTag = "luzmo-iq-embed-chat";
1381
1439
  var chatComponentTag = "luzmo-iq-chat-component";
@@ -1389,16 +1447,6 @@ var LuzmoIQEmbedChatComponent = class extends LitElement3 {
1389
1447
  this.remoteEntryServer = "http://localhost:4202/";
1390
1448
  this.aydHost = "https://ayd.luzmo.com/";
1391
1449
  }
1392
- static {
1393
- // Static styles to set host display to block, else it is not shown at all for some reason.
1394
- this.styles = css3`
1395
- :host {
1396
- display: block;
1397
- width: 100%;
1398
- height: 100%;
1399
- }
1400
- `;
1401
- }
1402
1450
  createRenderRoot() {
1403
1451
  return this;
1404
1452
  }
@@ -1414,6 +1462,10 @@ var LuzmoIQEmbedChatComponent = class extends LitElement3 {
1414
1462
  if (!this.chartElement) {
1415
1463
  this.chartElement = document.createElement(chatComponentTag);
1416
1464
  this.chartElement.addEventListener("load", (payload) => this.dispatchEvent(new CustomEvent("load", payload)));
1465
+ this.chartElement.addEventListener(
1466
+ "connectionStatusChanged",
1467
+ (event) => this.dispatchEvent(new CustomEvent("connectionStatusChanged", { detail: event.detail }))
1468
+ );
1417
1469
  this.updateVizItemProperties();
1418
1470
  this.renderRoot.append(this.chartElement);
1419
1471
  }
@@ -1436,7 +1488,12 @@ var LuzmoIQEmbedChatComponent = class extends LitElement3 {
1436
1488
  if (this.chartElement) {
1437
1489
  for (const [propertyName] of changedProperties.entries()) {
1438
1490
  const mappedAttributeName = inputMap[propertyName] ?? propertyName;
1439
- const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
1491
+ const propertyValue = this[propertyName];
1492
+ if (propertyValue == null) {
1493
+ this.chartElement.removeAttribute(mappedAttributeName);
1494
+ continue;
1495
+ }
1496
+ const attributeValue = typeof propertyValue === "object" ? JSON.stringify(propertyValue) : propertyValue.toString();
1440
1497
  this.chartElement.setAttribute(mappedAttributeName, attributeValue);
1441
1498
  }
1442
1499
  } else {
@@ -1467,6 +1524,14 @@ var LuzmoIQEmbedChatComponent = class extends LitElement3 {
1467
1524
  observer.observe(embedChat, { childList: true, subtree: true });
1468
1525
  }
1469
1526
  };
1527
+ // Static styles to set host display to block, else it is not shown at all for some reason.
1528
+ LuzmoIQEmbedChatComponent.styles = css3`
1529
+ :host {
1530
+ display: block;
1531
+ width: 100%;
1532
+ height: 100%;
1533
+ }
1534
+ `;
1470
1535
  __decorateClass([
1471
1536
  property3()
1472
1537
  ], LuzmoIQEmbedChatComponent.prototype, "appServer", 2);
@@ -1506,6 +1571,12 @@ __decorateClass([
1506
1571
  __decorateClass([
1507
1572
  property3({ type: Object })
1508
1573
  ], LuzmoIQEmbedChatComponent.prototype, "dashboardContext", 2);
1574
+ __decorateClass([
1575
+ property3()
1576
+ ], LuzmoIQEmbedChatComponent.prototype, "dashboardId", 2);
1577
+ __decorateClass([
1578
+ property3({ type: Array })
1579
+ ], LuzmoIQEmbedChatComponent.prototype, "contextIds", 2);
1509
1580
  if (!customElements.get(embedChatTag)) {
1510
1581
  customElements.define(embedChatTag, LuzmoIQEmbedChatComponent);
1511
1582
  }
@@ -1535,16 +1606,6 @@ var LuzmoIQEmbedAnswerComponent = class extends LitElement4 {
1535
1606
  this.libVersion = version + "-wc-luzmo";
1536
1607
  this.remoteEntryServer = "http://localhost:4202";
1537
1608
  }
1538
- static {
1539
- // Static styles to set host display to block, else it is not shown at all for some reason.
1540
- this.styles = css4`
1541
- :host {
1542
- display: block;
1543
- width: 100%;
1544
- height: 100%;
1545
- }
1546
- `;
1547
- }
1548
1609
  createRenderRoot() {
1549
1610
  return this;
1550
1611
  }
@@ -1595,6 +1656,14 @@ var LuzmoIQEmbedAnswerComponent = class extends LitElement4 {
1595
1656
  return html4` `;
1596
1657
  }
1597
1658
  };
1659
+ // Static styles to set host display to block, else it is not shown at all for some reason.
1660
+ LuzmoIQEmbedAnswerComponent.styles = css4`
1661
+ :host {
1662
+ display: block;
1663
+ width: 100%;
1664
+ height: 100%;
1665
+ }
1666
+ `;
1598
1667
  __decorateClass([
1599
1668
  property4()
1600
1669
  ], LuzmoIQEmbedAnswerComponent.prototype, "appServer", 2);
@@ -754,6 +754,30 @@ var getAccessibleDashboards = async (dashboardComponent) => {
754
754
  throw new Error("No authKey or authToken found in the luzmo-dashboard component.");
755
755
  };
756
756
 
757
+ // libs/embed-libs/shared-embed/src/lib/methods/get-dashboard-context.ts
758
+ var getDashboardContext = (dashboardComponent, iframe) => {
759
+ if (iframe?.contentWindow) {
760
+ const requestId = uuidv4();
761
+ iframe.contentWindow.postMessage(
762
+ { action: "getDashboardContext", _version: dashboardComponent.libVersion, requestId },
763
+ "*"
764
+ );
765
+ return new Promise((resolve, reject) => {
766
+ dashboardComponent.promises[requestId] = { resolve, reject };
767
+ setTimeout(() => {
768
+ if (dashboardComponent.promises[requestId]) {
769
+ const errorMessage = "getDashboardContext request timed out.";
770
+ dashboardComponent.promises[requestId].reject(
771
+ new Error(errorMessage)
772
+ );
773
+ delete dashboardComponent.promises[requestId];
774
+ }
775
+ }, 2e3);
776
+ });
777
+ }
778
+ return Promise.reject(new Error("Cannot retrieve contentWindow."));
779
+ };
780
+
757
781
  // libs/embed-libs/shared-embed/src/lib/methods/get-data.ts
758
782
  var getData = (dashboardComponent, iframe, itemId) => {
759
783
  if (iframe?.contentWindow) {
@@ -5743,7 +5767,7 @@ var o6 = e6(class extends i5 {
5743
5767
  });
5744
5768
 
5745
5769
  // libs/embed-libs/embed/package.json
5746
- var version = "6.13.5";
5770
+ var version = "6.13.6";
5747
5771
 
5748
5772
  // libs/embed-libs/embed/src/lib/luzmo-service.ts
5749
5773
  var LuzmoDashboardService = class {
@@ -5806,6 +5830,14 @@ var _setEventHandler = () => {
5806
5830
  );
5807
5831
  break;
5808
5832
  }
5833
+ case "dashboardContext": {
5834
+ resolvePromise(
5835
+ dashboardComponent,
5836
+ event.data.requestId,
5837
+ event.data.context
5838
+ );
5839
+ break;
5840
+ }
5809
5841
  case "getAccessibleDashboards": {
5810
5842
  resolvePromise(
5811
5843
  dashboardComponent,
@@ -5845,6 +5877,12 @@ var _setEventHandler = () => {
5845
5877
  );
5846
5878
  break;
5847
5879
  }
5880
+ case "contextChanged": {
5881
+ dashboardComponent.dispatchEvent(
5882
+ new CustomEvent("contextChanged", { detail: { data: event.data } })
5883
+ );
5884
+ break;
5885
+ }
5848
5886
  case "customEvent": {
5849
5887
  dashboardComponent.dispatchEvent(
5850
5888
  new CustomEvent("customEvent", { detail: { data: event.data } })
@@ -6239,6 +6277,7 @@ var LuzmoDashboard = class extends i4 {
6239
6277
  el.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
6240
6278
  el.addEventListener("dashboardAction", (payload) => this.dispatchEvent(new CustomEvent("dashboardAction", payload)));
6241
6279
  el.addEventListener("export", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
6280
+ el.addEventListener("contextChanged", (payload) => this.dispatchEvent(new CustomEvent("contextChanged", payload)));
6242
6281
  const container = this.renderRoot.querySelector("#dashboard-wc-container");
6243
6282
  if (container) {
6244
6283
  container.append(el);
@@ -6594,6 +6633,15 @@ var LuzmoDashboard = class extends i4 {
6594
6633
  }
6595
6634
  return Promise.reject();
6596
6635
  }
6636
+ getDashboardContext() {
6637
+ if (this.isWebComponentViewMode() && this.dashboardReference) {
6638
+ return this.dashboardReference.getDashboardContext();
6639
+ }
6640
+ if (!this.isWebComponentViewMode()) {
6641
+ return getDashboardContext(this, this.iframe);
6642
+ }
6643
+ return Promise.reject(new Error("getDashboardContext is not available: dashboard reference is not ready."));
6644
+ }
6597
6645
  setSelectedData(itemId, filters) {
6598
6646
  if (this.isWebComponentViewMode() && this.dashboardReference) {
6599
6647
  return this.dashboardReference.setSelectedData(itemId, filters);
@@ -6870,6 +6918,19 @@ var CONTENTS_VERSION = "0.1.100";
6870
6918
  // libs/embed-libs/embed/src/lib/viz-item/viz-item.base.ts
6871
6919
  var dashboardContentsVersion = CONTENTS_VERSION;
6872
6920
  var vizItemRemote = "VizItemApp";
6921
+ function collectVizItemDatasetIds(slots) {
6922
+ const ids = /* @__PURE__ */ new Set();
6923
+ for (const slot of slots ?? []) {
6924
+ for (const content of slot?.content ?? []) {
6925
+ const column = content;
6926
+ const datasetId = column.datasetId ?? column.set;
6927
+ if (datasetId) {
6928
+ ids.add(datasetId);
6929
+ }
6930
+ }
6931
+ }
6932
+ return [...ids];
6933
+ }
6873
6934
  var LuzmoBaseVizItem = class extends i4 {
6874
6935
  constructor() {
6875
6936
  super(...arguments);
@@ -6881,22 +6942,6 @@ var LuzmoBaseVizItem = class extends i4 {
6881
6942
  this.libVersion = version + "-wc-luzmo";
6882
6943
  this.postInitCallQueue = [];
6883
6944
  }
6884
- static {
6885
- // Static styles to set host display to block, else it is not shown at all for some reason.
6886
- this.styles = i`
6887
- :host {
6888
- display: block;
6889
- width: 100%;
6890
- height: 100%;
6891
- }
6892
-
6893
- luzmo-embed-viz-item {
6894
- width: 100%;
6895
- height: 1000%;
6896
- display: block;
6897
- }
6898
- `;
6899
- }
6900
6945
  createRenderRoot() {
6901
6946
  if (!this.style.display) {
6902
6947
  this.style.display = "block";
@@ -6915,6 +6960,22 @@ var LuzmoBaseVizItem = class extends i4 {
6915
6960
  getFilters() {
6916
6961
  return this.chartElement.getFilters();
6917
6962
  }
6963
+ /**
6964
+ * Snapshot of this flex chart's live context: its definition (type, slots,
6965
+ * options), current filters and the datasets it reads. Used by context-aware
6966
+ * embeds such as the Luzmo IQ chat component.
6967
+ */
6968
+ getVizItemContext() {
6969
+ const slots = this.slots ?? [];
6970
+ return {
6971
+ id: this.contextId ?? this.getAttribute("context-id") ?? this.id ?? this.itemId ?? "",
6972
+ type: this.type,
6973
+ slots,
6974
+ options: this.options,
6975
+ filters: typeof this.chartElement?.getFilters === "function" ? this.getFilters() : this.filters ?? [],
6976
+ datasetIds: collectVizItemDatasetIds(slots)
6977
+ };
6978
+ }
6918
6979
  export(type = "png") {
6919
6980
  return this.chartElement.export(type);
6920
6981
  }
@@ -6967,7 +7028,12 @@ var LuzmoBaseVizItem = class extends i4 {
6967
7028
  }
6968
7029
  this.dispatchEvent(new CustomEvent("rendered", payload));
6969
7030
  });
6970
- this.chartElement.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
7031
+ this.chartElement.addEventListener("changedFilters", (payload) => {
7032
+ this.dispatchEvent(new CustomEvent("changedFilters", payload));
7033
+ this.dispatchEvent(new CustomEvent("contextChanged", {
7034
+ detail: { data: { type: "contextChanged", context: this.getVizItemContext() } }
7035
+ }));
7036
+ });
6971
7037
  this.chartElement.addEventListener("exported", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
6972
7038
  this.chartElement.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
6973
7039
  this.chartElement.addEventListener("authorizationExpired", (payload) => this.dispatchEvent(new CustomEvent("authorizationExpired", payload)));
@@ -7007,6 +7073,20 @@ var LuzmoBaseVizItem = class extends i4 {
7007
7073
  return b2` `;
7008
7074
  }
7009
7075
  };
7076
+ // Static styles to set host display to block, else it is not shown at all for some reason.
7077
+ LuzmoBaseVizItem.styles = i`
7078
+ :host {
7079
+ display: block;
7080
+ width: 100%;
7081
+ height: 100%;
7082
+ }
7083
+
7084
+ luzmo-embed-viz-item {
7085
+ width: 100%;
7086
+ height: 1000%;
7087
+ display: block;
7088
+ }
7089
+ `;
7010
7090
  __decorateClass([
7011
7091
  n4()
7012
7092
  ], LuzmoBaseVizItem.prototype, "appServer", 2);
@@ -7087,7 +7167,9 @@ var inputMap = {
7087
7167
  libVersion: "lib-version",
7088
7168
  aydHost: "ayd-host",
7089
7169
  availableDatasets: "available-datasets",
7090
- dashboardContext: "dashboard-context"
7170
+ dashboardContext: "dashboard-context",
7171
+ dashboardId: "dashboard-id",
7172
+ contextIds: "context-ids"
7091
7173
  };
7092
7174
  var embedChatTag = "luzmo-iq-embed-chat";
7093
7175
  var chatComponentTag = "luzmo-iq-chat-component";
@@ -7101,16 +7183,6 @@ var LuzmoIQEmbedChatComponent = class extends i4 {
7101
7183
  this.remoteEntryServer = "http://localhost:4202/";
7102
7184
  this.aydHost = "https://ayd.luzmo.com/";
7103
7185
  }
7104
- static {
7105
- // Static styles to set host display to block, else it is not shown at all for some reason.
7106
- this.styles = i`
7107
- :host {
7108
- display: block;
7109
- width: 100%;
7110
- height: 100%;
7111
- }
7112
- `;
7113
- }
7114
7186
  createRenderRoot() {
7115
7187
  return this;
7116
7188
  }
@@ -7126,6 +7198,10 @@ var LuzmoIQEmbedChatComponent = class extends i4 {
7126
7198
  if (!this.chartElement) {
7127
7199
  this.chartElement = document.createElement(chatComponentTag);
7128
7200
  this.chartElement.addEventListener("load", (payload) => this.dispatchEvent(new CustomEvent("load", payload)));
7201
+ this.chartElement.addEventListener(
7202
+ "connectionStatusChanged",
7203
+ (event) => this.dispatchEvent(new CustomEvent("connectionStatusChanged", { detail: event.detail }))
7204
+ );
7129
7205
  this.updateVizItemProperties();
7130
7206
  this.renderRoot.append(this.chartElement);
7131
7207
  }
@@ -7148,7 +7224,12 @@ var LuzmoIQEmbedChatComponent = class extends i4 {
7148
7224
  if (this.chartElement) {
7149
7225
  for (const [propertyName] of changedProperties.entries()) {
7150
7226
  const mappedAttributeName = inputMap[propertyName] ?? propertyName;
7151
- const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
7227
+ const propertyValue = this[propertyName];
7228
+ if (propertyValue == null) {
7229
+ this.chartElement.removeAttribute(mappedAttributeName);
7230
+ continue;
7231
+ }
7232
+ const attributeValue = typeof propertyValue === "object" ? JSON.stringify(propertyValue) : propertyValue.toString();
7152
7233
  this.chartElement.setAttribute(mappedAttributeName, attributeValue);
7153
7234
  }
7154
7235
  } else {
@@ -7179,6 +7260,14 @@ var LuzmoIQEmbedChatComponent = class extends i4 {
7179
7260
  observer.observe(embedChat, { childList: true, subtree: true });
7180
7261
  }
7181
7262
  };
7263
+ // Static styles to set host display to block, else it is not shown at all for some reason.
7264
+ LuzmoIQEmbedChatComponent.styles = i`
7265
+ :host {
7266
+ display: block;
7267
+ width: 100%;
7268
+ height: 100%;
7269
+ }
7270
+ `;
7182
7271
  __decorateClass([
7183
7272
  n4()
7184
7273
  ], LuzmoIQEmbedChatComponent.prototype, "appServer", 2);
@@ -7218,6 +7307,12 @@ __decorateClass([
7218
7307
  __decorateClass([
7219
7308
  n4({ type: Object })
7220
7309
  ], LuzmoIQEmbedChatComponent.prototype, "dashboardContext", 2);
7310
+ __decorateClass([
7311
+ n4()
7312
+ ], LuzmoIQEmbedChatComponent.prototype, "dashboardId", 2);
7313
+ __decorateClass([
7314
+ n4({ type: Array })
7315
+ ], LuzmoIQEmbedChatComponent.prototype, "contextIds", 2);
7221
7316
  if (!customElements.get(embedChatTag)) {
7222
7317
  customElements.define(embedChatTag, LuzmoIQEmbedChatComponent);
7223
7318
  }
@@ -7244,16 +7339,6 @@ var LuzmoIQEmbedAnswerComponent = class extends i4 {
7244
7339
  this.libVersion = version + "-wc-luzmo";
7245
7340
  this.remoteEntryServer = "http://localhost:4202";
7246
7341
  }
7247
- static {
7248
- // Static styles to set host display to block, else it is not shown at all for some reason.
7249
- this.styles = i`
7250
- :host {
7251
- display: block;
7252
- width: 100%;
7253
- height: 100%;
7254
- }
7255
- `;
7256
- }
7257
7342
  createRenderRoot() {
7258
7343
  return this;
7259
7344
  }
@@ -7304,6 +7389,14 @@ var LuzmoIQEmbedAnswerComponent = class extends i4 {
7304
7389
  return b2` `;
7305
7390
  }
7306
7391
  };
7392
+ // Static styles to set host display to block, else it is not shown at all for some reason.
7393
+ LuzmoIQEmbedAnswerComponent.styles = i`
7394
+ :host {
7395
+ display: block;
7396
+ width: 100%;
7397
+ height: 100%;
7398
+ }
7399
+ `;
7307
7400
  __decorateClass([
7308
7401
  n4()
7309
7402
  ], LuzmoIQEmbedAnswerComponent.prototype, "appServer", 2);
package/package.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "name": "@luzmo/embed",
3
- "version": "6.13.5",
3
+ "version": "6.13.6-es2021",
4
4
  "dependencies": {
5
5
  "lit": "^3.3.1",
6
- "@luzmo/shared-embed": "5.12.2"
6
+ "@luzmo/shared-embed": "5.12.3"
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
  }
@@ -89,6 +89,7 @@ export declare class LuzmoDashboard extends LitElement implements SharedLib.WebC
89
89
  getDashboards(): Promise<LuzmoDashboard[]>;
90
90
  getData(itemId: string): Promise<SharedLib.ItemData>;
91
91
  getFilters(): Promise<FilterGroup[]>;
92
+ getDashboardContext(): Promise<SharedLib.DashboardContext | undefined>;
92
93
  setSelectedData<K extends CombinedSelectedDataInput>(itemId: string, filters: K): Promise<SharedLib.SetSelectedData>;
93
94
  setAuthorization(key: string, token: string): Promise<void>;
94
95
  refreshData(itemId?: string): Promise<void>;
@@ -1,17 +1,14 @@
1
1
  import type { IQChatOptions } from '@luzmo/dashboard-contents-types';
2
+ import { type DashboardContext } from '@luzmo/shared-embed';
2
3
  import { LitElement, PropertyValues } from 'lit';
3
4
  import type { TemplateResult } from 'lit-html';
4
- export interface SerializedDashboardContext {
5
- type: 'dashboard-context';
6
- id: string;
7
- json: unknown;
8
- screen_mode?: string;
9
- meta?: {
10
- title?: string;
11
- description?: string;
12
- };
13
- runtime_filters?: unknown[];
14
- }
5
+ /**
6
+ * Dashboard context accepted by the embedded IQ chat. Alias of the shared embed
7
+ * {@link DashboardContext} so the published contract stays in lockstep with
8
+ * `getDashboardContext()` and the `contextChanged` event (including the typed
9
+ * `runtimeFilters`).
10
+ */
11
+ export type SerializedDashboardContext = DashboardContext;
15
12
  export declare class LuzmoIQEmbedChatComponent extends LitElement {
16
13
  appServer?: string;
17
14
  apiHost?: string;
@@ -26,6 +23,8 @@ export declare class LuzmoIQEmbedChatComponent extends LitElement {
26
23
  aydHost: string;
27
24
  availableDatasets?: string[];
28
25
  dashboardContext?: SerializedDashboardContext;
26
+ dashboardId?: string;
27
+ contextIds?: string[];
29
28
  chartElement: HTMLElement;
30
29
  static styles: import("lit").CSSResult;
31
30
  protected createRenderRoot(): HTMLElement | DocumentFragment;
@@ -26,6 +26,7 @@ interface LuzmoVizItemComponentInterface extends HTMLElement {
26
26
  itemId?: string;
27
27
  aiMessageAssetId?: string;
28
28
  getFilters: () => FilterGroup[];
29
+ getVizItemContext?: () => SharedLib.VizItemContext;
29
30
  export: (type?: VizItemExportType) => Promise<string | void>;
30
31
  refreshData: () => void;
31
32
  getData: () => SharedLib.ItemData;
@@ -59,6 +60,12 @@ export declare class LuzmoBaseVizItem extends LitElement implements LuzmoVizItem
59
60
  protected createRenderRoot(): HTMLElement | DocumentFragment;
60
61
  canInitializeVizItem(): boolean;
61
62
  getFilters(): FilterGroup[];
63
+ /**
64
+ * Snapshot of this flex chart's live context: its definition (type, slots,
65
+ * options), current filters and the datasets it reads. Used by context-aware
66
+ * embeds such as the Luzmo IQ chat component.
67
+ */
68
+ getVizItemContext(): SharedLib.VizItemContext;
62
69
  export(type?: VizItemExportType): Promise<string | void>;
63
70
  getData(): SharedLib.ItemData;
64
71
  refreshData(): void;