@luzmo/embed 6.1.9 → 6.2.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  All notable changes to this project will be documented in this file.
2
2
 
3
+ ## [6.2.2] - 2024-12-10
4
+
5
+ ### Updates
6
+
7
+ - Enable Luzmo IQ custom chat widget button content with WebComponents slot
8
+
9
+ ## [6.2.1] - 2024-11-22
10
+
11
+ ### Updates
12
+
13
+ - Updated dependencies
14
+
15
+ ## [6.2.0] - 2024-11-20
16
+
17
+ ### Updates
18
+
19
+ - [Luzmo IQ](https://developer.luzmo.com/guide/iq--introduction) allows you to generate AI-powered answers to data-related questions. The update adds components that allows you embed chat and answer components onto your page.
20
+
3
21
  ## [6.1.9] - 2024-11-14
4
22
 
5
23
  ### Updates
package/README.md CHANGED
@@ -7,9 +7,10 @@ A modern [Web Component](https://developer.mozilla.org/en-US/docs/Web/Web_Compon
7
7
  1. [Installation instructions](#installation-instructions)
8
8
  2. [Luzmo Embed Viz Item](#luzmo-embed-viz-item)
9
9
  3. [Luzmo Embed Dashboard](#luzmo-embed-dashboard)
10
- 4. [Changelog](#changelog)
11
- 5. [Migration](#migration)
12
- 6. [Quick links](#quick-links)
10
+ 4. [Luzmo IQ Components](#luzmo-iq-components)
11
+ 5. [Changelog](#changelog)
12
+ 6. [Migration](#migration)
13
+ 7. [Quick links](#quick-links)
13
14
 
14
15
  ## Installation instructions
15
16
 
@@ -303,6 +304,174 @@ dashboardComponent.getAccessibleDashboards().then((dashboards) => {
303
304
  });
304
305
  ```
305
306
 
307
+ ## Luzmo IQ components
308
+
309
+ ### How to use the IQ components
310
+
311
+ Use the IQ components as if they were native HTML tags.
312
+
313
+ **In your HTML template.**
314
+
315
+ ```html
316
+ <luzmo-iq-embed-chat authKey="Your auth key" authToken="Your auth token" options="options"> </luzmo-iq-embed-chat>
317
+
318
+ OR
319
+
320
+ <luzmo-iq-embed-answer authKey="Your auth key" authToken="Your auth token" options="options" messages="messages"> </luzmo-iq-embed-answer>
321
+ ```
322
+
323
+ ### Properties
324
+
325
+ #### IQ chat component
326
+
327
+ All available properties for the IQ chat component can be seen in the table below.
328
+
329
+ | Property | Type | Description |
330
+ |-------------------------------|--------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|
331
+ | `authKey` | string | Authorization key generated via Luzmo API |
332
+ | `authToken` | string | Authorization token generated via Luzmo API |
333
+ | `appServer` | string | Tenancy of Luzmo app to connect to (Default: 'https://app.luzmo.com/' for US set appServer to 'https://app.us.luzmo.com/') |
334
+ | `apiHost` | string | Tenancy of Luzmo API to connect to (Default: 'https://api.luzmo.com/' , for US set apiHost to 'https://api.us.luzmo.com/') |
335
+ | `options` | string | Specifies the customization options of the IQ chat component that affect its appearance and functionality. |
336
+ | `initialSuggestionsDatasetId` | string | ID of a dataset that assists the AI service in generating automated, initial prompts based on the provided data. |
337
+
338
+ <br/>
339
+
340
+ #### IQ answer component
341
+
342
+ All available properties for the IQ answer component can be seen in the table below.
343
+
344
+ | Property | Type | Description |
345
+ |-------------|--------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|
346
+ | `authKey` | string | Authorization key generated via Luzmo API |
347
+ | `authToken` | string | Authorization token generated via Luzmo API |
348
+ | `appServer` | string | Tenancy of Luzmo app to connect to (Default: 'https://app.luzmo.com/' for US set appServer to 'https://app.us.luzmo.com/') |
349
+ | `apiHost` | string | Tenancy of Luzmo API to connect to (Default: 'https://api.luzmo.com/' , for US set apiHost to 'https://api.us.luzmo.com/') |
350
+ | `options` | string | Specifies the customization options of the IQ answer component that affect its appearance and functionality. |
351
+ | `messages` | string | Specifies an array of messages to be displayed in the IQ answer component. |
352
+
353
+ <br/>
354
+
355
+ ### Customization options
356
+
357
+ #### IQ chat component
358
+
359
+ The `IQChatOptions` interface provides a range of configuration options that allow you to customize the appearance and functionalitie of the IQ chat component.
360
+ <br>
361
+ These options help tailor the chat experience to fit specific use cases by controlling elements such as welcome messages, translations, interaction options, and whether to display charts or text summaries.
362
+ <br>
363
+ The table below provides a detailed overview of each configurable parameter and its purpose.
364
+
365
+ | Property | Type | Description |
366
+ |-------------------------------|---------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
367
+ | `areChartActionsEnabled` | boolean | Determines whether users should be allowed to trigger **chart actions** that enable them to explore further insights based on the given chart type. |
368
+ | `areWelcomeMessagesVisible` | boolean | Specifies whether to display the **welcome messages** at the chat start. |
369
+ | `chartTheme` | ItemThemeConfig | Defines theme settings for the charts displayed in the component. |
370
+ | `chatWidgetHorizontalOffset` | number | Specifies the horizontal offset for the chat widget overlay position in relation to the chat button. |
371
+ | `chatWidgetOverlayPosition` | string | Defines the position of the chat widget overlay in relation to the chat button. |
372
+ | `chatWidgetPosition` | ConnectedPosition[] | Defines the customized configuration of the chat widget overlay position. |
373
+ | `chatWidgetTitle` | string | The **chat title** to be displayed at the top of the chat container. |
374
+ | `chatWidgetVerticalOffset` | number | Specifies the vertical offset for the chat widget overlay position in relation to the chat button. |
375
+ | `disclaimerText` | string | Defines the **disclaimer text** to be displayed if enabled. Uses a default message if not specified. |
376
+ | `displayMode` | string | Configures the appearance of the chat component as either 'chatWidget' or 'fullChat'. |
377
+ | `initialSuggestions` | IQSuggestion[] | Predefined questions displayed at chat start, sent to the AI service upon click. |
378
+ | `isChartConfigurationEnabled` | boolean | Specifies whether users can configure charts via the chart configuration panel. |
379
+ | `isChartExportEnabled` | boolean | Specifies whether users can export charts as PNGs. |
380
+ | `isChartFeedbackEnabled` | boolean | Enables feedback, allowing users to rate responses and suggest corrections. |
381
+ | `isConversationIdVisible` | boolean | Displays the **conversation ID** for reporting or feedback purposes. |
382
+ | `isDisclaimerVisible` | boolean | Determines if the **disclaimer text** is shown in the chat. |
383
+ | `locale` | string | Specifies the **locale** for localizing text elements and chart configurations.<br/>Accepts values: "de", "en", "es", "fr", "it", "ja", "nl", "no", "pt", "ru", "sv", "tr". |
384
+ | `messages` | IQMessage[] | An array of processed messages to display, following the IQMessages interface. |
385
+ | `responseMode` | string | Specifies the response format as 'chart', 'text', or 'mixed'. |
386
+ | `timezone` | string | Specifies the **timezone** for displaying timestamps in charts. |
387
+ | `welcomeMessages` | IQMessage[] | Array of **welcome messages** displayed at chat start. |
388
+
389
+ <br>
390
+
391
+ #### IQ answer component
392
+
393
+ The `IQAnswerOptions` interface allows to customize the appearance and functionality of the IQ answer component.
394
+ <br>
395
+ These options help define whether certain elements, such as charts, text summaries, or feedback panel, are displayed to users.
396
+ <br>
397
+ The table below provides a detailed overview of each configurable parameter and its purpose:
398
+
399
+ | Property | Type | Description |
400
+ |-------------------------------| ------------------------------------- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
401
+ | `areChartActionsEnabled` | boolean | Determines whether users should be allowed to trigger **chart actions** that enable them to explore further insights based on the given chart type. |
402
+ | `isChartConfigurationEnabled` | boolean | Specifies whether users should be able to configure charts with the chart configuration panel. |
403
+ | `isChartExportEnabled` | boolean | Specifies whether users can export charts as PNGs. |
404
+ | `isChartFeedbackEnabled` | boolean | Specifies whether the feedback mechanism should be displayed, allowing users to rate AI responses and suggest chart corrections. |
405
+ | `locale` | string | Specifies the **locale** used for component interactions, including localization of text elements like welcome messages, responses, and chart configurations. |
406
+ | `responseMode` | string | Defines the **response mode** for the answer component: 'chart', 'text', or 'mixed' (default). 'chart' shows AI responses as charts only, 'text' shows only text summaries, and 'mixed' displays both. |
407
+ | `chartTheme` | ItemThemeConfig | Specifies the theme settings for customizing the appearance of charts displayed in the component. |
408
+
409
+ <br>
410
+
411
+ ### CSS Variables
412
+
413
+ The following CSS variables can be used to customize various aspects of the IQ components. They are grouped based on their functionality, such as general styling, chat appearance, bubble styles, messages, and feedback.
414
+
415
+ #### General Styling
416
+ These variables control the overall appearance of elements like borders, background colors, font sizes, and spacing.
417
+
418
+ ```css
419
+ --luzmo-iq-border-color: rgba(0,0,0,.1); /* Border color */
420
+ --luzmo-iq-border-radius: .5rem; /* Standard border radius */
421
+ --luzmo-iq-border-radius-lg: .75rem; /* Large border radius */
422
+ --luzmo-iq-border-radius-xl: 1rem; /* Extra-large border radius */
423
+ --luzmo-iq-border-radius-full: 999rem; /* Full (circle) border radius */
424
+ --luzmo-iq-border-width: 1px; /* Standard border width */
425
+ --luzmo-iq-background-color: #ffffff; /* Default background color */
426
+ --luzmo-iq-background-hover-color: #f8fafc; /* Background color on hover */
427
+ --luzmo-iq-background-active-color: #f1f5f9; /* Background color when active */
428
+ --luzmo-iq-font-size: .875rem; /* Default font size */
429
+ --luzmo-iq-font-weight: 400; /* Standard font weight */
430
+ --luzmo-iq-font-color: #333; /* Default font color */
431
+ --luzmo-iq-spacing-1: .125rem; /* Small spacing */
432
+ --luzmo-iq-spacing-5: 1rem; /* Large spacing */
433
+ ```
434
+
435
+ #### Messages Styling
436
+ These variables define the appearance of both human and system messages in the chat.
437
+
438
+ ```css
439
+ --luzmo-iq-human-message-background: blue; /* Default background color for human messages */
440
+ --luzmo-iq-human-message-color: white; /* Default text color for human messages */
441
+ --luzmo-iq-system-message-background: rgb(226, 232, 240); /* Default background for system messages */
442
+ --luzmo-iq-system-message-color: #333; /* Default text color for system messages */
443
+ ```
444
+
445
+ #### State Loader and Spinner Styling
446
+ These variables are used for customizing the appearance of state loaders and spinners within the chat component.
447
+
448
+ ```css
449
+ --luzmo-iq-spinner-color: magenta; /* Default spinner color */
450
+ --luzmo-iq-spinner-border-width: .125rem; /* Default spinner border width */
451
+ --luzmo-iq-spinner-opacity: .5; /* Default spinner opacity */
452
+ --luzmo-iq-state-loader-background: #778393; /* Default background color of the loader */
453
+ --luzmo-iq-state-loader-color: #333; /* Default text color for the loader */
454
+ ```
455
+
456
+ #### Feedback and Ratings
457
+ These variables control the appearance of feedback icons and rating elements.
458
+
459
+ ```css
460
+ --luzmo-iq-positive-feedback-icon-hover-color: rgb(20, 120, 63); /* Default hover color for positive feedback */
461
+ --luzmo-iq-negative-feedback-icon-hover-color: rgb(216, 64, 64); /* Default hover color for negative feedback */
462
+ --luzmo-iq-rating-icon-size: 1rem; /* Default size of the rating icons */
463
+ --luzmo-iq-info-icon-size: 1rem; /* Default size of the info icons */
464
+ ```
465
+
466
+ #### Tooltips
467
+ These variables are used to adjust the appearance of tooltips.
468
+
469
+ ```css
470
+ --luzmo-iq-tooltip-background-color: #000; /* Tooltip background color, defaults to #000 (black) */
471
+ --luzmo-iq-tooltip-color: #fff; /* Tooltip text color, defaults to #fff (white) */
472
+ --luzmo-iq-tooltip-font-size: 0.8125rem; /* Tooltip font size, defaults to 0.8125rem */
473
+ ```
474
+
306
475
  ## Changelog
307
476
 
308
477
  - [Changelog](https://embed-libs.luzmo.com/changelogs/embed/)
package/index.cjs CHANGED
@@ -41,6 +41,8 @@ var src_exports = {};
41
41
  __export(src_exports, {
42
42
  LuzmoEmbedDashboard: () => LuzmoEmbedDashboard,
43
43
  LuzmoEmbedVizItem: () => LuzmoEmbedVizItem,
44
+ LuzmoIQEmbedAnswerComponent: () => LuzmoIQEmbedAnswerComponent,
45
+ LuzmoIQEmbedChatComponent: () => LuzmoIQEmbedChatComponent,
44
46
  addJSONSchemas: () => addJSONSchemas,
45
47
  fetchJSONSchema: () => fetchJSONSchema,
46
48
  getCachedJSONSchema: () => getCachedJSONSchema,
@@ -60,7 +62,7 @@ var import_style_map = require("lit/directives/style-map.js");
60
62
  var import_shared_embed = require("@luzmo/shared-embed");
61
63
 
62
64
  // libs/embed-libs/embed/package.json
63
- var version = "6.1.9";
65
+ var version = "6.2.1-beta.0";
64
66
 
65
67
  // libs/embed-libs/embed/src/lib/luzmo-service.ts
66
68
  var LuzmoService = class {
@@ -1069,10 +1071,10 @@ if (!customElements.get("luzmo-embed-dashboard")) {
1069
1071
  var import_decorators2 = require("lit/decorators.js");
1070
1072
  var import_lit3 = require("lit");
1071
1073
  var SharedLib3 = __toESM(require("@luzmo/shared-embed"), 1);
1072
- var dashboardContentsVersion = "0.1.90";
1074
+ var dashboardContentsVersion = "0.1.91";
1073
1075
  var LuzmoBaseVizItem = class extends import_lit3.LitElement {
1074
1076
  constructor() {
1075
- super();
1077
+ super(...arguments);
1076
1078
  this.appServer = "https://app.luzmo.com";
1077
1079
  this.apiHost = "https://api.luzmo.com";
1078
1080
  this.slots = [];
@@ -1238,7 +1240,7 @@ __decorateClass([
1238
1240
  converter: (value) => {
1239
1241
  try {
1240
1242
  return JSON.parse(value);
1241
- } catch (exc) {
1243
+ } catch {
1242
1244
  return value;
1243
1245
  }
1244
1246
  }
@@ -1270,6 +1272,242 @@ if (!customElements.get("luzmo-embed-viz-item")) {
1270
1272
  customElements.define("luzmo-embed-viz-item", LuzmoEmbedVizItem);
1271
1273
  }
1272
1274
 
1275
+ // libs/embed-libs/embed/src/lib/luzmo-iq-components/luzmo-iq-chat.ts
1276
+ var import_decorators3 = require("lit/decorators.js");
1277
+ var import_lit4 = require("lit");
1278
+ var SharedLib4 = __toESM(require("@luzmo/shared-embed"), 1);
1279
+ var inputMap = {
1280
+ aiEndpoint: "ai-endpoint",
1281
+ appServer: "app-server",
1282
+ apiHost: "api-host",
1283
+ options: "options",
1284
+ initialSuggestionsDatasetId: "initialSuggestionsDatasetId",
1285
+ authKey: "auth-key",
1286
+ authToken: "auth-token",
1287
+ version: "version",
1288
+ libVersion: "lib-version",
1289
+ aydHost: "ayd-host"
1290
+ };
1291
+ var LuzmoIQEmbedChatComponent = class extends import_lit4.LitElement {
1292
+ constructor() {
1293
+ super(...arguments);
1294
+ this.appServer = "https://app.luzmo.com";
1295
+ this.apiHost = "https://api.luzmo.com";
1296
+ this.version = version + "-wc-luzmo";
1297
+ this.libVersion = version + "-wc-luzmo";
1298
+ this.remoteEntryServer = "http://localhost:4202/";
1299
+ this.aydHost = "https://ayd.luzmo.com/";
1300
+ }
1301
+ static {
1302
+ // Static styles to set host display to block, else it is not shown at all for some reason.
1303
+ this.styles = import_lit4.css`
1304
+ :host {
1305
+ display: block;
1306
+ width: 100%;
1307
+ height: 100%;
1308
+ }
1309
+ `;
1310
+ }
1311
+ createRenderRoot() {
1312
+ return this;
1313
+ }
1314
+ async firstUpdated(_changedProperties) {
1315
+ super.firstUpdated(_changedProperties);
1316
+ await SharedLib4.loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
1317
+ this.createAndAppendElement();
1318
+ }
1319
+ createAndAppendElement() {
1320
+ if (!this.chartElement) {
1321
+ this.chartElement = document.createElement("luzmo-iq-chat-component");
1322
+ this.chartElement.addEventListener("load", (payload) => this.dispatchEvent(new CustomEvent("load", payload)));
1323
+ this.updateVizItemProperties();
1324
+ this.renderRoot.append(this.chartElement);
1325
+ }
1326
+ }
1327
+ updateVizItemProperties() {
1328
+ if (this.chartElement) {
1329
+ for (const key in inputMap) {
1330
+ const value = this[key];
1331
+ if (value) {
1332
+ const attributeValue = ["appServer", "apiHost", "aydHost"].includes(key) ? SharedLib4.removeTrailingSlash(value) : value;
1333
+ this.chartElement.setAttribute(
1334
+ inputMap[key],
1335
+ typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
1336
+ );
1337
+ }
1338
+ }
1339
+ }
1340
+ }
1341
+ async updated(changedProperties) {
1342
+ if (this.chartElement) {
1343
+ for (const [propertyName] of changedProperties.entries()) {
1344
+ const mappedAttributeName = inputMap[propertyName] ?? propertyName;
1345
+ const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
1346
+ this.chartElement.setAttribute(mappedAttributeName, attributeValue);
1347
+ }
1348
+ } else {
1349
+ await SharedLib4.loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
1350
+ this.createAndAppendElement();
1351
+ }
1352
+ }
1353
+ render() {
1354
+ return import_lit4.html`
1355
+ <slot name="custom-chat-widget-content"></slot>
1356
+ `;
1357
+ }
1358
+ };
1359
+ __decorateClass([
1360
+ (0, import_decorators3.property)()
1361
+ ], LuzmoIQEmbedChatComponent.prototype, "appServer", 2);
1362
+ __decorateClass([
1363
+ (0, import_decorators3.property)()
1364
+ ], LuzmoIQEmbedChatComponent.prototype, "apiHost", 2);
1365
+ __decorateClass([
1366
+ (0, import_decorators3.property)({ type: Object })
1367
+ ], LuzmoIQEmbedChatComponent.prototype, "options", 2);
1368
+ __decorateClass([
1369
+ (0, import_decorators3.property)({ type: String })
1370
+ ], LuzmoIQEmbedChatComponent.prototype, "initialSuggestionsDatasetId", 2);
1371
+ __decorateClass([
1372
+ (0, import_decorators3.property)()
1373
+ ], LuzmoIQEmbedChatComponent.prototype, "aiEndpoint", 2);
1374
+ __decorateClass([
1375
+ (0, import_decorators3.property)()
1376
+ ], LuzmoIQEmbedChatComponent.prototype, "authKey", 2);
1377
+ __decorateClass([
1378
+ (0, import_decorators3.property)()
1379
+ ], LuzmoIQEmbedChatComponent.prototype, "authToken", 2);
1380
+ __decorateClass([
1381
+ (0, import_decorators3.property)()
1382
+ ], LuzmoIQEmbedChatComponent.prototype, "version", 2);
1383
+ __decorateClass([
1384
+ (0, import_decorators3.property)()
1385
+ ], LuzmoIQEmbedChatComponent.prototype, "libVersion", 2);
1386
+ __decorateClass([
1387
+ (0, import_decorators3.property)()
1388
+ ], LuzmoIQEmbedChatComponent.prototype, "remoteEntryServer", 2);
1389
+ __decorateClass([
1390
+ (0, import_decorators3.property)()
1391
+ ], LuzmoIQEmbedChatComponent.prototype, "aydHost", 2);
1392
+ if (!customElements.get("luzmo-iq-embed-chat")) {
1393
+ customElements.define("luzmo-iq-embed-chat", LuzmoIQEmbedChatComponent);
1394
+ }
1395
+
1396
+ // libs/embed-libs/embed/src/lib/luzmo-iq-components/luzmo-iq-answer.ts
1397
+ var import_decorators4 = require("lit/decorators.js");
1398
+ var import_lit5 = require("lit");
1399
+ var SharedLib5 = __toESM(require("@luzmo/shared-embed"), 1);
1400
+ var inputMap2 = {
1401
+ aiEndPoint: "ai-end-point",
1402
+ appServer: "app-server",
1403
+ apiHost: "api-host",
1404
+ options: "options",
1405
+ authKey: "auth-key",
1406
+ authToken: "auth-token",
1407
+ version: "version",
1408
+ libVersion: "lib-version",
1409
+ messages: "messages"
1410
+ };
1411
+ var LuzmoIQEmbedAnswerComponent = class extends import_lit5.LitElement {
1412
+ constructor() {
1413
+ super(...arguments);
1414
+ this.appServer = "https://app.luzmo.com";
1415
+ this.apiHost = "https://api.luzmo.com";
1416
+ this.version = version + "-wc-luzmo";
1417
+ this.libVersion = version + "-wc-luzmo";
1418
+ this.remoteEntryServer = "http://localhost:4202";
1419
+ }
1420
+ static {
1421
+ // Static styles to set host display to block, else it is not shown at all for some reason.
1422
+ this.styles = import_lit5.css`
1423
+ :host {
1424
+ display: block;
1425
+ width: 100%;
1426
+ height: 100%;
1427
+ }
1428
+ `;
1429
+ }
1430
+ createRenderRoot() {
1431
+ return this;
1432
+ }
1433
+ async firstUpdated(_changedProperties) {
1434
+ super.firstUpdated(_changedProperties);
1435
+ await SharedLib5.loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
1436
+ this.createAndAppendElement();
1437
+ }
1438
+ createAndAppendElement() {
1439
+ if (!this.chartElement) {
1440
+ this.chartElement = document.createElement("luzmo-iq-answer-component");
1441
+ this.chartElement.addEventListener("addQuestion", (payload) => this.dispatchEvent(new CustomEvent("addQuestion", payload)));
1442
+ this.chartElement.addEventListener("addAnswer", (payload) => this.dispatchEvent(new CustomEvent("addAnswer", payload)));
1443
+ this.updateVizItemProperties();
1444
+ this.renderRoot.append(this.chartElement);
1445
+ }
1446
+ }
1447
+ updateVizItemProperties() {
1448
+ if (this.chartElement) {
1449
+ for (const key in inputMap2) {
1450
+ const value = this[key];
1451
+ if (value) {
1452
+ const attributeValue = ["appServer", "apiHost"].includes(key) ? SharedLib5.removeTrailingSlash(value) : value;
1453
+ this.chartElement.setAttribute(
1454
+ inputMap2[key],
1455
+ typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
1456
+ );
1457
+ }
1458
+ }
1459
+ }
1460
+ }
1461
+ async updated(changedProperties) {
1462
+ if (this.chartElement) {
1463
+ for (const [propertyName] of changedProperties.entries()) {
1464
+ const mappedAttributeName = inputMap2[propertyName] ?? propertyName;
1465
+ const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
1466
+ this.chartElement.setAttribute(mappedAttributeName, attributeValue);
1467
+ }
1468
+ } else {
1469
+ await SharedLib5.loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
1470
+ this.createAndAppendElement();
1471
+ }
1472
+ }
1473
+ render() {
1474
+ return import_lit5.html` `;
1475
+ }
1476
+ };
1477
+ __decorateClass([
1478
+ (0, import_decorators4.property)()
1479
+ ], LuzmoIQEmbedAnswerComponent.prototype, "appServer", 2);
1480
+ __decorateClass([
1481
+ (0, import_decorators4.property)()
1482
+ ], LuzmoIQEmbedAnswerComponent.prototype, "apiHost", 2);
1483
+ __decorateClass([
1484
+ (0, import_decorators4.property)({ type: Object })
1485
+ ], LuzmoIQEmbedAnswerComponent.prototype, "options", 2);
1486
+ __decorateClass([
1487
+ (0, import_decorators4.property)()
1488
+ ], LuzmoIQEmbedAnswerComponent.prototype, "aiEndPoint", 2);
1489
+ __decorateClass([
1490
+ (0, import_decorators4.property)()
1491
+ ], LuzmoIQEmbedAnswerComponent.prototype, "authKey", 2);
1492
+ __decorateClass([
1493
+ (0, import_decorators4.property)()
1494
+ ], LuzmoIQEmbedAnswerComponent.prototype, "authToken", 2);
1495
+ __decorateClass([
1496
+ (0, import_decorators4.property)()
1497
+ ], LuzmoIQEmbedAnswerComponent.prototype, "messages", 2);
1498
+ __decorateClass([
1499
+ (0, import_decorators4.property)()
1500
+ ], LuzmoIQEmbedAnswerComponent.prototype, "version", 2);
1501
+ __decorateClass([
1502
+ (0, import_decorators4.property)()
1503
+ ], LuzmoIQEmbedAnswerComponent.prototype, "libVersion", 2);
1504
+ __decorateClass([
1505
+ (0, import_decorators4.property)()
1506
+ ], LuzmoIQEmbedAnswerComponent.prototype, "remoteEntryServer", 2);
1507
+ if (!customElements.get("luzmo-iq-embed-answer")) {
1508
+ customElements.define("luzmo-iq-embed-answer", LuzmoIQEmbedAnswerComponent);
1509
+ }
1510
+
1273
1511
  // libs/embed-libs/embed/src/lib/helper/json-schema-utils.ts
1274
1512
  var cachedSchemas = {};
1275
1513
  function addJSONSchemas(schemas) {
@@ -1331,6 +1569,8 @@ var luzmoRefParserOptions = {
1331
1569
  0 && (module.exports = {
1332
1570
  LuzmoEmbedDashboard,
1333
1571
  LuzmoEmbedVizItem,
1572
+ LuzmoIQEmbedAnswerComponent,
1573
+ LuzmoIQEmbedChatComponent,
1334
1574
  addJSONSchemas,
1335
1575
  fetchJSONSchema,
1336
1576
  getCachedJSONSchema,
package/index.js CHANGED
@@ -32,7 +32,7 @@ import {
32
32
  } from "@luzmo/shared-embed";
33
33
 
34
34
  // libs/embed-libs/embed/package.json
35
- var version = "6.1.9";
35
+ var version = "6.2.1-beta.0";
36
36
 
37
37
  // libs/embed-libs/embed/src/lib/luzmo-service.ts
38
38
  var LuzmoService = class {
@@ -1041,10 +1041,10 @@ if (!customElements.get("luzmo-embed-dashboard")) {
1041
1041
  import { property as property2 } from "lit/decorators.js";
1042
1042
  import { LitElement as LitElement2, html as html2, css as css2 } from "lit";
1043
1043
  import * as SharedLib3 from "@luzmo/shared-embed";
1044
- var dashboardContentsVersion = "0.1.90";
1044
+ var dashboardContentsVersion = "0.1.91";
1045
1045
  var LuzmoBaseVizItem = class extends LitElement2 {
1046
1046
  constructor() {
1047
- super();
1047
+ super(...arguments);
1048
1048
  this.appServer = "https://app.luzmo.com";
1049
1049
  this.apiHost = "https://api.luzmo.com";
1050
1050
  this.slots = [];
@@ -1210,7 +1210,7 @@ __decorateClass([
1210
1210
  converter: (value) => {
1211
1211
  try {
1212
1212
  return JSON.parse(value);
1213
- } catch (exc) {
1213
+ } catch {
1214
1214
  return value;
1215
1215
  }
1216
1216
  }
@@ -1242,6 +1242,242 @@ if (!customElements.get("luzmo-embed-viz-item")) {
1242
1242
  customElements.define("luzmo-embed-viz-item", LuzmoEmbedVizItem);
1243
1243
  }
1244
1244
 
1245
+ // libs/embed-libs/embed/src/lib/luzmo-iq-components/luzmo-iq-chat.ts
1246
+ import { property as property3 } from "lit/decorators.js";
1247
+ import { LitElement as LitElement3, html as html3, css as css3 } from "lit";
1248
+ import * as SharedLib4 from "@luzmo/shared-embed";
1249
+ var inputMap = {
1250
+ aiEndpoint: "ai-endpoint",
1251
+ appServer: "app-server",
1252
+ apiHost: "api-host",
1253
+ options: "options",
1254
+ initialSuggestionsDatasetId: "initialSuggestionsDatasetId",
1255
+ authKey: "auth-key",
1256
+ authToken: "auth-token",
1257
+ version: "version",
1258
+ libVersion: "lib-version",
1259
+ aydHost: "ayd-host"
1260
+ };
1261
+ var LuzmoIQEmbedChatComponent = class extends LitElement3 {
1262
+ constructor() {
1263
+ super(...arguments);
1264
+ this.appServer = "https://app.luzmo.com";
1265
+ this.apiHost = "https://api.luzmo.com";
1266
+ this.version = version + "-wc-luzmo";
1267
+ this.libVersion = version + "-wc-luzmo";
1268
+ this.remoteEntryServer = "http://localhost:4202/";
1269
+ this.aydHost = "https://ayd.luzmo.com/";
1270
+ }
1271
+ static {
1272
+ // Static styles to set host display to block, else it is not shown at all for some reason.
1273
+ this.styles = css3`
1274
+ :host {
1275
+ display: block;
1276
+ width: 100%;
1277
+ height: 100%;
1278
+ }
1279
+ `;
1280
+ }
1281
+ createRenderRoot() {
1282
+ return this;
1283
+ }
1284
+ async firstUpdated(_changedProperties) {
1285
+ super.firstUpdated(_changedProperties);
1286
+ await SharedLib4.loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
1287
+ this.createAndAppendElement();
1288
+ }
1289
+ createAndAppendElement() {
1290
+ if (!this.chartElement) {
1291
+ this.chartElement = document.createElement("luzmo-iq-chat-component");
1292
+ this.chartElement.addEventListener("load", (payload) => this.dispatchEvent(new CustomEvent("load", payload)));
1293
+ this.updateVizItemProperties();
1294
+ this.renderRoot.append(this.chartElement);
1295
+ }
1296
+ }
1297
+ updateVizItemProperties() {
1298
+ if (this.chartElement) {
1299
+ for (const key in inputMap) {
1300
+ const value = this[key];
1301
+ if (value) {
1302
+ const attributeValue = ["appServer", "apiHost", "aydHost"].includes(key) ? SharedLib4.removeTrailingSlash(value) : value;
1303
+ this.chartElement.setAttribute(
1304
+ inputMap[key],
1305
+ typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
1306
+ );
1307
+ }
1308
+ }
1309
+ }
1310
+ }
1311
+ async updated(changedProperties) {
1312
+ if (this.chartElement) {
1313
+ for (const [propertyName] of changedProperties.entries()) {
1314
+ const mappedAttributeName = inputMap[propertyName] ?? propertyName;
1315
+ const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
1316
+ this.chartElement.setAttribute(mappedAttributeName, attributeValue);
1317
+ }
1318
+ } else {
1319
+ await SharedLib4.loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
1320
+ this.createAndAppendElement();
1321
+ }
1322
+ }
1323
+ render() {
1324
+ return html3`
1325
+ <slot name="custom-chat-widget-content"></slot>
1326
+ `;
1327
+ }
1328
+ };
1329
+ __decorateClass([
1330
+ property3()
1331
+ ], LuzmoIQEmbedChatComponent.prototype, "appServer", 2);
1332
+ __decorateClass([
1333
+ property3()
1334
+ ], LuzmoIQEmbedChatComponent.prototype, "apiHost", 2);
1335
+ __decorateClass([
1336
+ property3({ type: Object })
1337
+ ], LuzmoIQEmbedChatComponent.prototype, "options", 2);
1338
+ __decorateClass([
1339
+ property3({ type: String })
1340
+ ], LuzmoIQEmbedChatComponent.prototype, "initialSuggestionsDatasetId", 2);
1341
+ __decorateClass([
1342
+ property3()
1343
+ ], LuzmoIQEmbedChatComponent.prototype, "aiEndpoint", 2);
1344
+ __decorateClass([
1345
+ property3()
1346
+ ], LuzmoIQEmbedChatComponent.prototype, "authKey", 2);
1347
+ __decorateClass([
1348
+ property3()
1349
+ ], LuzmoIQEmbedChatComponent.prototype, "authToken", 2);
1350
+ __decorateClass([
1351
+ property3()
1352
+ ], LuzmoIQEmbedChatComponent.prototype, "version", 2);
1353
+ __decorateClass([
1354
+ property3()
1355
+ ], LuzmoIQEmbedChatComponent.prototype, "libVersion", 2);
1356
+ __decorateClass([
1357
+ property3()
1358
+ ], LuzmoIQEmbedChatComponent.prototype, "remoteEntryServer", 2);
1359
+ __decorateClass([
1360
+ property3()
1361
+ ], LuzmoIQEmbedChatComponent.prototype, "aydHost", 2);
1362
+ if (!customElements.get("luzmo-iq-embed-chat")) {
1363
+ customElements.define("luzmo-iq-embed-chat", LuzmoIQEmbedChatComponent);
1364
+ }
1365
+
1366
+ // libs/embed-libs/embed/src/lib/luzmo-iq-components/luzmo-iq-answer.ts
1367
+ import { property as property4 } from "lit/decorators.js";
1368
+ import { LitElement as LitElement4, html as html4, css as css4 } from "lit";
1369
+ import * as SharedLib5 from "@luzmo/shared-embed";
1370
+ var inputMap2 = {
1371
+ aiEndPoint: "ai-end-point",
1372
+ appServer: "app-server",
1373
+ apiHost: "api-host",
1374
+ options: "options",
1375
+ authKey: "auth-key",
1376
+ authToken: "auth-token",
1377
+ version: "version",
1378
+ libVersion: "lib-version",
1379
+ messages: "messages"
1380
+ };
1381
+ var LuzmoIQEmbedAnswerComponent = class extends LitElement4 {
1382
+ constructor() {
1383
+ super(...arguments);
1384
+ this.appServer = "https://app.luzmo.com";
1385
+ this.apiHost = "https://api.luzmo.com";
1386
+ this.version = version + "-wc-luzmo";
1387
+ this.libVersion = version + "-wc-luzmo";
1388
+ this.remoteEntryServer = "http://localhost:4202";
1389
+ }
1390
+ static {
1391
+ // Static styles to set host display to block, else it is not shown at all for some reason.
1392
+ this.styles = css4`
1393
+ :host {
1394
+ display: block;
1395
+ width: 100%;
1396
+ height: 100%;
1397
+ }
1398
+ `;
1399
+ }
1400
+ createRenderRoot() {
1401
+ return this;
1402
+ }
1403
+ async firstUpdated(_changedProperties) {
1404
+ super.firstUpdated(_changedProperties);
1405
+ await SharedLib5.loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
1406
+ this.createAndAppendElement();
1407
+ }
1408
+ createAndAppendElement() {
1409
+ if (!this.chartElement) {
1410
+ this.chartElement = document.createElement("luzmo-iq-answer-component");
1411
+ this.chartElement.addEventListener("addQuestion", (payload) => this.dispatchEvent(new CustomEvent("addQuestion", payload)));
1412
+ this.chartElement.addEventListener("addAnswer", (payload) => this.dispatchEvent(new CustomEvent("addAnswer", payload)));
1413
+ this.updateVizItemProperties();
1414
+ this.renderRoot.append(this.chartElement);
1415
+ }
1416
+ }
1417
+ updateVizItemProperties() {
1418
+ if (this.chartElement) {
1419
+ for (const key in inputMap2) {
1420
+ const value = this[key];
1421
+ if (value) {
1422
+ const attributeValue = ["appServer", "apiHost"].includes(key) ? SharedLib5.removeTrailingSlash(value) : value;
1423
+ this.chartElement.setAttribute(
1424
+ inputMap2[key],
1425
+ typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
1426
+ );
1427
+ }
1428
+ }
1429
+ }
1430
+ }
1431
+ async updated(changedProperties) {
1432
+ if (this.chartElement) {
1433
+ for (const [propertyName] of changedProperties.entries()) {
1434
+ const mappedAttributeName = inputMap2[propertyName] ?? propertyName;
1435
+ const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
1436
+ this.chartElement.setAttribute(mappedAttributeName, attributeValue);
1437
+ }
1438
+ } else {
1439
+ await SharedLib5.loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
1440
+ this.createAndAppendElement();
1441
+ }
1442
+ }
1443
+ render() {
1444
+ return html4` `;
1445
+ }
1446
+ };
1447
+ __decorateClass([
1448
+ property4()
1449
+ ], LuzmoIQEmbedAnswerComponent.prototype, "appServer", 2);
1450
+ __decorateClass([
1451
+ property4()
1452
+ ], LuzmoIQEmbedAnswerComponent.prototype, "apiHost", 2);
1453
+ __decorateClass([
1454
+ property4({ type: Object })
1455
+ ], LuzmoIQEmbedAnswerComponent.prototype, "options", 2);
1456
+ __decorateClass([
1457
+ property4()
1458
+ ], LuzmoIQEmbedAnswerComponent.prototype, "aiEndPoint", 2);
1459
+ __decorateClass([
1460
+ property4()
1461
+ ], LuzmoIQEmbedAnswerComponent.prototype, "authKey", 2);
1462
+ __decorateClass([
1463
+ property4()
1464
+ ], LuzmoIQEmbedAnswerComponent.prototype, "authToken", 2);
1465
+ __decorateClass([
1466
+ property4()
1467
+ ], LuzmoIQEmbedAnswerComponent.prototype, "messages", 2);
1468
+ __decorateClass([
1469
+ property4()
1470
+ ], LuzmoIQEmbedAnswerComponent.prototype, "version", 2);
1471
+ __decorateClass([
1472
+ property4()
1473
+ ], LuzmoIQEmbedAnswerComponent.prototype, "libVersion", 2);
1474
+ __decorateClass([
1475
+ property4()
1476
+ ], LuzmoIQEmbedAnswerComponent.prototype, "remoteEntryServer", 2);
1477
+ if (!customElements.get("luzmo-iq-embed-answer")) {
1478
+ customElements.define("luzmo-iq-embed-answer", LuzmoIQEmbedAnswerComponent);
1479
+ }
1480
+
1245
1481
  // libs/embed-libs/embed/src/lib/helper/json-schema-utils.ts
1246
1482
  var cachedSchemas = {};
1247
1483
  function addJSONSchemas(schemas) {
@@ -1302,6 +1538,8 @@ var luzmoRefParserOptions = {
1302
1538
  export {
1303
1539
  LuzmoEmbedDashboard,
1304
1540
  LuzmoEmbedVizItem,
1541
+ LuzmoIQEmbedAnswerComponent,
1542
+ LuzmoIQEmbedChatComponent,
1305
1543
  addJSONSchemas,
1306
1544
  fetchJSONSchema,
1307
1545
  getCachedJSONSchema,
@@ -32,6 +32,8 @@ var src_exports2 = {};
32
32
  __export(src_exports2, {
33
33
  LuzmoEmbedDashboard: () => LuzmoEmbedDashboard,
34
34
  LuzmoEmbedVizItem: () => LuzmoEmbedVizItem,
35
+ LuzmoIQEmbedAnswerComponent: () => LuzmoIQEmbedAnswerComponent,
36
+ LuzmoIQEmbedChatComponent: () => LuzmoIQEmbedChatComponent,
35
37
  addJSONSchemas: () => addJSONSchemas,
36
38
  fetchJSONSchema: () => fetchJSONSchema,
37
39
  getCachedJSONSchema: () => getCachedJSONSchema,
@@ -1295,18 +1297,27 @@ async function __federationMethodGetRemote(remoteName, componentName) {
1295
1297
  return __federationMethodEnsure(remoteName).then((remote) => remote.get(componentName).then((factory) => factory()));
1296
1298
  }
1297
1299
  async function loadLibrary(appServer, componentName = "DashboardApp") {
1298
- if (remotesMap[appServer]) {
1299
- return remotesMap[appServer].module;
1300
+ const remotesMapIndex = appServer + componentName;
1301
+ if (remotesMap[remotesMapIndex]) {
1302
+ return remotesMap[remotesMapIndex].module;
1300
1303
  }
1301
- remotesMap[appServer] = {
1302
- url: appServer?.startsWith("http://localhost") ? `${removeTrailingSlash(appServer)}/remoteEntry.mjs` : `${removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`,
1304
+ let url = `${removeTrailingSlash(appServer)}/remoteEntry.mjs`;
1305
+ if (!appServer.startsWith("http://localhost")) {
1306
+ if (componentName === "DashboardApp") {
1307
+ url = `${removeTrailingSlash(appServer)}/dashboard-app/remoteEntry.mjs`;
1308
+ } else if (componentName === "Component") {
1309
+ url = `${removeTrailingSlash(appServer)}/iq-components/remoteEntry.mjs`;
1310
+ }
1311
+ }
1312
+ remotesMap[remotesMapIndex] = {
1313
+ url,
1303
1314
  format: "esm",
1304
1315
  from: "vite",
1305
1316
  module: void 0
1306
1317
  };
1307
- const module2 = await __federationMethodGetRemote(appServer, `./${componentName}`);
1318
+ const module2 = await __federationMethodGetRemote(remotesMapIndex, `./${componentName}`);
1308
1319
  const wrappedModule = __federationMethodWrapDefault(module2, true);
1309
- remotesMap[appServer].module = wrappedModule;
1320
+ remotesMap[remotesMapIndex].module = wrappedModule;
1310
1321
  return wrappedModule;
1311
1322
  }
1312
1323
 
@@ -2004,7 +2015,7 @@ var se = e5(class extends i3 {
2004
2015
  });
2005
2016
 
2006
2017
  // libs/embed-libs/embed/package.json
2007
- var version = "6.1.9";
2018
+ var version = "6.2.1-beta.0";
2008
2019
 
2009
2020
  // libs/embed-libs/embed/src/lib/luzmo-service.ts
2010
2021
  var LuzmoService = class {
@@ -3008,10 +3019,10 @@ if (!customElements.get("luzmo-embed-dashboard")) {
3008
3019
  }
3009
3020
 
3010
3021
  // libs/embed-libs/embed/src/lib/viz-item/viz-item.base.ts
3011
- var dashboardContentsVersion = "0.1.90";
3022
+ var dashboardContentsVersion = "0.1.91";
3012
3023
  var LuzmoBaseVizItem = class extends h3 {
3013
3024
  constructor() {
3014
- super();
3025
+ super(...arguments);
3015
3026
  this.appServer = "https://app.luzmo.com";
3016
3027
  this.apiHost = "https://api.luzmo.com";
3017
3028
  this.slots = [];
@@ -3177,7 +3188,7 @@ __decorateClass([
3177
3188
  converter: (value) => {
3178
3189
  try {
3179
3190
  return JSON.parse(value);
3180
- } catch (exc) {
3191
+ } catch {
3181
3192
  return value;
3182
3193
  }
3183
3194
  }
@@ -3209,6 +3220,236 @@ if (!customElements.get("luzmo-embed-viz-item")) {
3209
3220
  customElements.define("luzmo-embed-viz-item", LuzmoEmbedVizItem);
3210
3221
  }
3211
3222
 
3223
+ // libs/embed-libs/embed/src/lib/luzmo-iq-components/luzmo-iq-chat.ts
3224
+ var inputMap = {
3225
+ aiEndpoint: "ai-endpoint",
3226
+ appServer: "app-server",
3227
+ apiHost: "api-host",
3228
+ options: "options",
3229
+ initialSuggestionsDatasetId: "initialSuggestionsDatasetId",
3230
+ authKey: "auth-key",
3231
+ authToken: "auth-token",
3232
+ version: "version",
3233
+ libVersion: "lib-version",
3234
+ aydHost: "ayd-host"
3235
+ };
3236
+ var LuzmoIQEmbedChatComponent = class extends h3 {
3237
+ constructor() {
3238
+ super(...arguments);
3239
+ this.appServer = "https://app.luzmo.com";
3240
+ this.apiHost = "https://api.luzmo.com";
3241
+ this.version = version + "-wc-luzmo";
3242
+ this.libVersion = version + "-wc-luzmo";
3243
+ this.remoteEntryServer = "http://localhost:4202/";
3244
+ this.aydHost = "https://ayd.luzmo.com/";
3245
+ }
3246
+ static {
3247
+ // Static styles to set host display to block, else it is not shown at all for some reason.
3248
+ this.styles = i`
3249
+ :host {
3250
+ display: block;
3251
+ width: 100%;
3252
+ height: 100%;
3253
+ }
3254
+ `;
3255
+ }
3256
+ createRenderRoot() {
3257
+ return this;
3258
+ }
3259
+ async firstUpdated(_changedProperties) {
3260
+ super.firstUpdated(_changedProperties);
3261
+ await loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
3262
+ this.createAndAppendElement();
3263
+ }
3264
+ createAndAppendElement() {
3265
+ if (!this.chartElement) {
3266
+ this.chartElement = document.createElement("luzmo-iq-chat-component");
3267
+ this.chartElement.addEventListener("load", (payload) => this.dispatchEvent(new CustomEvent("load", payload)));
3268
+ this.updateVizItemProperties();
3269
+ this.renderRoot.append(this.chartElement);
3270
+ }
3271
+ }
3272
+ updateVizItemProperties() {
3273
+ if (this.chartElement) {
3274
+ for (const key in inputMap) {
3275
+ const value = this[key];
3276
+ if (value) {
3277
+ const attributeValue = ["appServer", "apiHost", "aydHost"].includes(key) ? removeTrailingSlash(value) : value;
3278
+ this.chartElement.setAttribute(
3279
+ inputMap[key],
3280
+ typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
3281
+ );
3282
+ }
3283
+ }
3284
+ }
3285
+ }
3286
+ async updated(changedProperties) {
3287
+ if (this.chartElement) {
3288
+ for (const [propertyName] of changedProperties.entries()) {
3289
+ const mappedAttributeName = inputMap[propertyName] ?? propertyName;
3290
+ const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
3291
+ this.chartElement.setAttribute(mappedAttributeName, attributeValue);
3292
+ }
3293
+ } else {
3294
+ await loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
3295
+ this.createAndAppendElement();
3296
+ }
3297
+ }
3298
+ render() {
3299
+ return ke`
3300
+ <slot name="custom-chat-widget-content"></slot>
3301
+ `;
3302
+ }
3303
+ };
3304
+ __decorateClass([
3305
+ n4()
3306
+ ], LuzmoIQEmbedChatComponent.prototype, "appServer", 2);
3307
+ __decorateClass([
3308
+ n4()
3309
+ ], LuzmoIQEmbedChatComponent.prototype, "apiHost", 2);
3310
+ __decorateClass([
3311
+ n4({ type: Object })
3312
+ ], LuzmoIQEmbedChatComponent.prototype, "options", 2);
3313
+ __decorateClass([
3314
+ n4({ type: String })
3315
+ ], LuzmoIQEmbedChatComponent.prototype, "initialSuggestionsDatasetId", 2);
3316
+ __decorateClass([
3317
+ n4()
3318
+ ], LuzmoIQEmbedChatComponent.prototype, "aiEndpoint", 2);
3319
+ __decorateClass([
3320
+ n4()
3321
+ ], LuzmoIQEmbedChatComponent.prototype, "authKey", 2);
3322
+ __decorateClass([
3323
+ n4()
3324
+ ], LuzmoIQEmbedChatComponent.prototype, "authToken", 2);
3325
+ __decorateClass([
3326
+ n4()
3327
+ ], LuzmoIQEmbedChatComponent.prototype, "version", 2);
3328
+ __decorateClass([
3329
+ n4()
3330
+ ], LuzmoIQEmbedChatComponent.prototype, "libVersion", 2);
3331
+ __decorateClass([
3332
+ n4()
3333
+ ], LuzmoIQEmbedChatComponent.prototype, "remoteEntryServer", 2);
3334
+ __decorateClass([
3335
+ n4()
3336
+ ], LuzmoIQEmbedChatComponent.prototype, "aydHost", 2);
3337
+ if (!customElements.get("luzmo-iq-embed-chat")) {
3338
+ customElements.define("luzmo-iq-embed-chat", LuzmoIQEmbedChatComponent);
3339
+ }
3340
+
3341
+ // libs/embed-libs/embed/src/lib/luzmo-iq-components/luzmo-iq-answer.ts
3342
+ var inputMap2 = {
3343
+ aiEndPoint: "ai-end-point",
3344
+ appServer: "app-server",
3345
+ apiHost: "api-host",
3346
+ options: "options",
3347
+ authKey: "auth-key",
3348
+ authToken: "auth-token",
3349
+ version: "version",
3350
+ libVersion: "lib-version",
3351
+ messages: "messages"
3352
+ };
3353
+ var LuzmoIQEmbedAnswerComponent = class extends h3 {
3354
+ constructor() {
3355
+ super(...arguments);
3356
+ this.appServer = "https://app.luzmo.com";
3357
+ this.apiHost = "https://api.luzmo.com";
3358
+ this.version = version + "-wc-luzmo";
3359
+ this.libVersion = version + "-wc-luzmo";
3360
+ this.remoteEntryServer = "http://localhost:4202";
3361
+ }
3362
+ static {
3363
+ // Static styles to set host display to block, else it is not shown at all for some reason.
3364
+ this.styles = i`
3365
+ :host {
3366
+ display: block;
3367
+ width: 100%;
3368
+ height: 100%;
3369
+ }
3370
+ `;
3371
+ }
3372
+ createRenderRoot() {
3373
+ return this;
3374
+ }
3375
+ async firstUpdated(_changedProperties) {
3376
+ super.firstUpdated(_changedProperties);
3377
+ await loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
3378
+ this.createAndAppendElement();
3379
+ }
3380
+ createAndAppendElement() {
3381
+ if (!this.chartElement) {
3382
+ this.chartElement = document.createElement("luzmo-iq-answer-component");
3383
+ this.chartElement.addEventListener("addQuestion", (payload) => this.dispatchEvent(new CustomEvent("addQuestion", payload)));
3384
+ this.chartElement.addEventListener("addAnswer", (payload) => this.dispatchEvent(new CustomEvent("addAnswer", payload)));
3385
+ this.updateVizItemProperties();
3386
+ this.renderRoot.append(this.chartElement);
3387
+ }
3388
+ }
3389
+ updateVizItemProperties() {
3390
+ if (this.chartElement) {
3391
+ for (const key in inputMap2) {
3392
+ const value = this[key];
3393
+ if (value) {
3394
+ const attributeValue = ["appServer", "apiHost"].includes(key) ? removeTrailingSlash(value) : value;
3395
+ this.chartElement.setAttribute(
3396
+ inputMap2[key],
3397
+ typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
3398
+ );
3399
+ }
3400
+ }
3401
+ }
3402
+ }
3403
+ async updated(changedProperties) {
3404
+ if (this.chartElement) {
3405
+ for (const [propertyName] of changedProperties.entries()) {
3406
+ const mappedAttributeName = inputMap2[propertyName] ?? propertyName;
3407
+ const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
3408
+ this.chartElement.setAttribute(mappedAttributeName, attributeValue);
3409
+ }
3410
+ } else {
3411
+ await loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
3412
+ this.createAndAppendElement();
3413
+ }
3414
+ }
3415
+ render() {
3416
+ return ke` `;
3417
+ }
3418
+ };
3419
+ __decorateClass([
3420
+ n4()
3421
+ ], LuzmoIQEmbedAnswerComponent.prototype, "appServer", 2);
3422
+ __decorateClass([
3423
+ n4()
3424
+ ], LuzmoIQEmbedAnswerComponent.prototype, "apiHost", 2);
3425
+ __decorateClass([
3426
+ n4({ type: Object })
3427
+ ], LuzmoIQEmbedAnswerComponent.prototype, "options", 2);
3428
+ __decorateClass([
3429
+ n4()
3430
+ ], LuzmoIQEmbedAnswerComponent.prototype, "aiEndPoint", 2);
3431
+ __decorateClass([
3432
+ n4()
3433
+ ], LuzmoIQEmbedAnswerComponent.prototype, "authKey", 2);
3434
+ __decorateClass([
3435
+ n4()
3436
+ ], LuzmoIQEmbedAnswerComponent.prototype, "authToken", 2);
3437
+ __decorateClass([
3438
+ n4()
3439
+ ], LuzmoIQEmbedAnswerComponent.prototype, "messages", 2);
3440
+ __decorateClass([
3441
+ n4()
3442
+ ], LuzmoIQEmbedAnswerComponent.prototype, "version", 2);
3443
+ __decorateClass([
3444
+ n4()
3445
+ ], LuzmoIQEmbedAnswerComponent.prototype, "libVersion", 2);
3446
+ __decorateClass([
3447
+ n4()
3448
+ ], LuzmoIQEmbedAnswerComponent.prototype, "remoteEntryServer", 2);
3449
+ if (!customElements.get("luzmo-iq-embed-answer")) {
3450
+ customElements.define("luzmo-iq-embed-answer", LuzmoIQEmbedAnswerComponent);
3451
+ }
3452
+
3212
3453
  // libs/embed-libs/embed/src/lib/helper/json-schema-utils.ts
3213
3454
  var cachedSchemas = {};
3214
3455
  function addJSONSchemas(schemas) {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@luzmo/embed",
3
- "version": "6.1.9",
3
+ "version": "6.2.1-beta.0",
4
4
  "dependencies": {
5
5
  "lit": "3.1.2",
6
- "@luzmo/shared-embed": "5.1.7",
7
- "@luzmo/dashboard-contents-types": "1.0.4"
6
+ "@luzmo/shared-embed": "5.2.1",
7
+ "@luzmo/dashboard-contents-types": "1.0.6"
8
8
  },
9
9
  "type": "module",
10
10
  "keywords": [
@@ -20,5 +20,7 @@
20
20
  "chart",
21
21
  "cumul.io",
22
22
  "component"
23
- ]
23
+ ],
24
+ "module": "./index.js",
25
+ "types": "./src/index.d.ts"
24
26
  }
@@ -3,4 +3,6 @@ export type { LoadEvent, ChangedFiltersEvent, CustomEvent, ItemsRenderedEvent, E
3
3
  export { selectedDataUtils } from '@luzmo/shared-embed';
4
4
  export * from './lib/dashboard-component/dashboard-component';
5
5
  export * from './lib/viz-item/viz-item-component';
6
+ export * from './lib/luzmo-iq-components/luzmo-iq-chat';
7
+ export * from './lib/luzmo-iq-components/luzmo-iq-answer';
6
8
  export * from './lib/helper/json-schema-utils';
@@ -0,0 +1,22 @@
1
+ import { IQAnswerOptions, IQMessage } from '@luzmo/dashboard-contents-types';
2
+ import { LitElement, PropertyValues } from 'lit';
3
+ export declare class LuzmoIQEmbedAnswerComponent extends LitElement {
4
+ appServer?: string;
5
+ apiHost?: string;
6
+ options?: IQAnswerOptions;
7
+ aiEndPoint?: string;
8
+ authKey?: string;
9
+ authToken?: string;
10
+ messages: IQMessage[];
11
+ version?: string;
12
+ libVersion?: string;
13
+ remoteEntryServer: string;
14
+ chartElement: HTMLElement;
15
+ static styles: import("lit").CSSResult;
16
+ protected createRenderRoot(): HTMLElement | DocumentFragment;
17
+ protected firstUpdated(_changedProperties: PropertyValues): Promise<void>;
18
+ private createAndAppendElement;
19
+ private updateVizItemProperties;
20
+ updated(changedProperties: PropertyValues): Promise<void>;
21
+ protected render(): unknown;
22
+ }
@@ -0,0 +1,23 @@
1
+ import { IQChatOptions } from '@luzmo/dashboard-contents-types';
2
+ import { LitElement, PropertyValues } from 'lit';
3
+ export declare class LuzmoIQEmbedChatComponent extends LitElement {
4
+ appServer?: string;
5
+ apiHost?: string;
6
+ options?: IQChatOptions;
7
+ initialSuggestionsDatasetId?: string;
8
+ aiEndpoint?: string;
9
+ authKey?: string;
10
+ authToken?: string;
11
+ version?: string;
12
+ libVersion?: string;
13
+ remoteEntryServer: string;
14
+ aydHost: string;
15
+ chartElement: HTMLElement;
16
+ static styles: import("lit").CSSResult;
17
+ protected createRenderRoot(): HTMLElement | DocumentFragment;
18
+ protected firstUpdated(_changedProperties: PropertyValues): Promise<void>;
19
+ private createAndAppendElement;
20
+ private updateVizItemProperties;
21
+ updated(changedProperties: PropertyValues): Promise<void>;
22
+ protected render(): unknown;
23
+ }
@@ -1,6 +1,6 @@
1
1
  import { LitElement, PropertyValues } from 'lit';
2
2
  import * as SharedLib from '@luzmo/shared-embed';
3
- import type { VizItemType, VizItemSlots, FilterGroup, VizItemOptions } from '@luzmo/dashboard-contents-types';
3
+ import { VizItemType, FilterGroup, VizItemOptions, VizItemSlots } from '@luzmo/dashboard-contents-types';
4
4
  /**
5
5
  * The version of the dashboard contents that is linked to the current library.
6
6
  *
@@ -9,7 +9,7 @@ import type { VizItemType, VizItemSlots, FilterGroup, VizItemOptions } from '@lu
9
9
  * together with this dashboard contents version are passed to the dashboard app (https://app.luzmo.com/dashboard-app/remoteEntry.mjs)
10
10
  * and if needed the migration will be applied on the dashboard app level.
11
11
  */
12
- export declare const dashboardContentsVersion = "0.1.90";
12
+ export declare const dashboardContentsVersion = "0.1.91";
13
13
  type FunctionCall = [(...args: any) => any, any[]];
14
14
  interface LuzmoVizItemComponentInterface extends HTMLElement {
15
15
  options?: VizItemOptions;
@@ -54,7 +54,6 @@ export declare class LuzmoBaseVizItem extends LitElement implements LuzmoVizItem
54
54
  };
55
55
  postInitCallQueue: FunctionCall[];
56
56
  static styles: import("lit").CSSResult;
57
- constructor();
58
57
  protected createRenderRoot(): HTMLElement | DocumentFragment;
59
58
  canInitializeVizItem(): boolean;
60
59
  getFilters(): FilterGroup[];
File without changes
File without changes
File without changes