@luzmo/embed 6.1.9 → 6.2.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/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.0";
36
36
 
37
37
  // libs/embed-libs/embed/src/lib/luzmo-service.ts
38
38
  var LuzmoService = class {
@@ -1242,6 +1242,240 @@ 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
+ }
1326
+ };
1327
+ __decorateClass([
1328
+ property3()
1329
+ ], LuzmoIQEmbedChatComponent.prototype, "appServer", 2);
1330
+ __decorateClass([
1331
+ property3()
1332
+ ], LuzmoIQEmbedChatComponent.prototype, "apiHost", 2);
1333
+ __decorateClass([
1334
+ property3({ type: Object })
1335
+ ], LuzmoIQEmbedChatComponent.prototype, "options", 2);
1336
+ __decorateClass([
1337
+ property3({ type: String })
1338
+ ], LuzmoIQEmbedChatComponent.prototype, "initialSuggestionsDatasetId", 2);
1339
+ __decorateClass([
1340
+ property3()
1341
+ ], LuzmoIQEmbedChatComponent.prototype, "aiEndpoint", 2);
1342
+ __decorateClass([
1343
+ property3()
1344
+ ], LuzmoIQEmbedChatComponent.prototype, "authKey", 2);
1345
+ __decorateClass([
1346
+ property3()
1347
+ ], LuzmoIQEmbedChatComponent.prototype, "authToken", 2);
1348
+ __decorateClass([
1349
+ property3()
1350
+ ], LuzmoIQEmbedChatComponent.prototype, "version", 2);
1351
+ __decorateClass([
1352
+ property3()
1353
+ ], LuzmoIQEmbedChatComponent.prototype, "libVersion", 2);
1354
+ __decorateClass([
1355
+ property3()
1356
+ ], LuzmoIQEmbedChatComponent.prototype, "remoteEntryServer", 2);
1357
+ __decorateClass([
1358
+ property3()
1359
+ ], LuzmoIQEmbedChatComponent.prototype, "aydHost", 2);
1360
+ if (!customElements.get("luzmo-iq-embed-chat")) {
1361
+ customElements.define("luzmo-iq-embed-chat", LuzmoIQEmbedChatComponent);
1362
+ }
1363
+
1364
+ // libs/embed-libs/embed/src/lib/luzmo-iq-components/luzmo-iq-answer.ts
1365
+ import { property as property4 } from "lit/decorators.js";
1366
+ import { LitElement as LitElement4, html as html4, css as css4 } from "lit";
1367
+ import * as SharedLib5 from "@luzmo/shared-embed";
1368
+ var inputMap2 = {
1369
+ aiEndPoint: "ai-end-point",
1370
+ appServer: "app-server",
1371
+ apiHost: "api-host",
1372
+ options: "options",
1373
+ authKey: "auth-key",
1374
+ authToken: "auth-token",
1375
+ version: "version",
1376
+ libVersion: "lib-version",
1377
+ messages: "messages"
1378
+ };
1379
+ var LuzmoIQEmbedAnswerComponent = class extends LitElement4 {
1380
+ constructor() {
1381
+ super(...arguments);
1382
+ this.appServer = "https://app.luzmo.com";
1383
+ this.apiHost = "https://api.luzmo.com";
1384
+ this.version = version + "-wc-luzmo";
1385
+ this.libVersion = version + "-wc-luzmo";
1386
+ this.remoteEntryServer = "http://localhost:4202";
1387
+ }
1388
+ static {
1389
+ // Static styles to set host display to block, else it is not shown at all for some reason.
1390
+ this.styles = css4`
1391
+ :host {
1392
+ display: block;
1393
+ width: 100%;
1394
+ height: 100%;
1395
+ }
1396
+ `;
1397
+ }
1398
+ createRenderRoot() {
1399
+ return this;
1400
+ }
1401
+ async firstUpdated(_changedProperties) {
1402
+ super.firstUpdated(_changedProperties);
1403
+ await SharedLib5.loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
1404
+ this.createAndAppendElement();
1405
+ }
1406
+ createAndAppendElement() {
1407
+ if (!this.chartElement) {
1408
+ this.chartElement = document.createElement("luzmo-iq-answer-component");
1409
+ this.chartElement.addEventListener("addQuestion", (payload) => this.dispatchEvent(new CustomEvent("addQuestion", payload)));
1410
+ this.chartElement.addEventListener("addAnswer", (payload) => this.dispatchEvent(new CustomEvent("addAnswer", payload)));
1411
+ this.updateVizItemProperties();
1412
+ this.renderRoot.append(this.chartElement);
1413
+ }
1414
+ }
1415
+ updateVizItemProperties() {
1416
+ if (this.chartElement) {
1417
+ for (const key in inputMap2) {
1418
+ const value = this[key];
1419
+ if (value) {
1420
+ const attributeValue = ["appServer", "apiHost"].includes(key) ? SharedLib5.removeTrailingSlash(value) : value;
1421
+ this.chartElement.setAttribute(
1422
+ inputMap2[key],
1423
+ typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
1424
+ );
1425
+ }
1426
+ }
1427
+ }
1428
+ }
1429
+ async updated(changedProperties) {
1430
+ if (this.chartElement) {
1431
+ for (const [propertyName] of changedProperties.entries()) {
1432
+ const mappedAttributeName = inputMap2[propertyName] ?? propertyName;
1433
+ const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
1434
+ this.chartElement.setAttribute(mappedAttributeName, attributeValue);
1435
+ }
1436
+ } else {
1437
+ await SharedLib5.loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
1438
+ this.createAndAppendElement();
1439
+ }
1440
+ }
1441
+ render() {
1442
+ return html4` `;
1443
+ }
1444
+ };
1445
+ __decorateClass([
1446
+ property4()
1447
+ ], LuzmoIQEmbedAnswerComponent.prototype, "appServer", 2);
1448
+ __decorateClass([
1449
+ property4()
1450
+ ], LuzmoIQEmbedAnswerComponent.prototype, "apiHost", 2);
1451
+ __decorateClass([
1452
+ property4({ type: Object })
1453
+ ], LuzmoIQEmbedAnswerComponent.prototype, "options", 2);
1454
+ __decorateClass([
1455
+ property4()
1456
+ ], LuzmoIQEmbedAnswerComponent.prototype, "aiEndPoint", 2);
1457
+ __decorateClass([
1458
+ property4()
1459
+ ], LuzmoIQEmbedAnswerComponent.prototype, "authKey", 2);
1460
+ __decorateClass([
1461
+ property4()
1462
+ ], LuzmoIQEmbedAnswerComponent.prototype, "authToken", 2);
1463
+ __decorateClass([
1464
+ property4()
1465
+ ], LuzmoIQEmbedAnswerComponent.prototype, "messages", 2);
1466
+ __decorateClass([
1467
+ property4()
1468
+ ], LuzmoIQEmbedAnswerComponent.prototype, "version", 2);
1469
+ __decorateClass([
1470
+ property4()
1471
+ ], LuzmoIQEmbedAnswerComponent.prototype, "libVersion", 2);
1472
+ __decorateClass([
1473
+ property4()
1474
+ ], LuzmoIQEmbedAnswerComponent.prototype, "remoteEntryServer", 2);
1475
+ if (!customElements.get("luzmo-iq-embed-answer")) {
1476
+ customElements.define("luzmo-iq-embed-answer", LuzmoIQEmbedAnswerComponent);
1477
+ }
1478
+
1245
1479
  // libs/embed-libs/embed/src/lib/helper/json-schema-utils.ts
1246
1480
  var cachedSchemas = {};
1247
1481
  function addJSONSchemas(schemas) {
@@ -1302,6 +1536,8 @@ var luzmoRefParserOptions = {
1302
1536
  export {
1303
1537
  LuzmoEmbedDashboard,
1304
1538
  LuzmoEmbedVizItem,
1539
+ LuzmoIQEmbedAnswerComponent,
1540
+ LuzmoIQEmbedChatComponent,
1305
1541
  addJSONSchemas,
1306
1542
  fetchJSONSchema,
1307
1543
  getCachedJSONSchema,
@@ -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
+ }
@@ -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.0";
2008
2019
 
2009
2020
  // libs/embed-libs/embed/src/lib/luzmo-service.ts
2010
2021
  var LuzmoService = class {
@@ -3209,6 +3220,234 @@ 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
+ }
3301
+ };
3302
+ __decorateClass([
3303
+ n4()
3304
+ ], LuzmoIQEmbedChatComponent.prototype, "appServer", 2);
3305
+ __decorateClass([
3306
+ n4()
3307
+ ], LuzmoIQEmbedChatComponent.prototype, "apiHost", 2);
3308
+ __decorateClass([
3309
+ n4({ type: Object })
3310
+ ], LuzmoIQEmbedChatComponent.prototype, "options", 2);
3311
+ __decorateClass([
3312
+ n4({ type: String })
3313
+ ], LuzmoIQEmbedChatComponent.prototype, "initialSuggestionsDatasetId", 2);
3314
+ __decorateClass([
3315
+ n4()
3316
+ ], LuzmoIQEmbedChatComponent.prototype, "aiEndpoint", 2);
3317
+ __decorateClass([
3318
+ n4()
3319
+ ], LuzmoIQEmbedChatComponent.prototype, "authKey", 2);
3320
+ __decorateClass([
3321
+ n4()
3322
+ ], LuzmoIQEmbedChatComponent.prototype, "authToken", 2);
3323
+ __decorateClass([
3324
+ n4()
3325
+ ], LuzmoIQEmbedChatComponent.prototype, "version", 2);
3326
+ __decorateClass([
3327
+ n4()
3328
+ ], LuzmoIQEmbedChatComponent.prototype, "libVersion", 2);
3329
+ __decorateClass([
3330
+ n4()
3331
+ ], LuzmoIQEmbedChatComponent.prototype, "remoteEntryServer", 2);
3332
+ __decorateClass([
3333
+ n4()
3334
+ ], LuzmoIQEmbedChatComponent.prototype, "aydHost", 2);
3335
+ if (!customElements.get("luzmo-iq-embed-chat")) {
3336
+ customElements.define("luzmo-iq-embed-chat", LuzmoIQEmbedChatComponent);
3337
+ }
3338
+
3339
+ // libs/embed-libs/embed/src/lib/luzmo-iq-components/luzmo-iq-answer.ts
3340
+ var inputMap2 = {
3341
+ aiEndPoint: "ai-end-point",
3342
+ appServer: "app-server",
3343
+ apiHost: "api-host",
3344
+ options: "options",
3345
+ authKey: "auth-key",
3346
+ authToken: "auth-token",
3347
+ version: "version",
3348
+ libVersion: "lib-version",
3349
+ messages: "messages"
3350
+ };
3351
+ var LuzmoIQEmbedAnswerComponent = class extends h3 {
3352
+ constructor() {
3353
+ super(...arguments);
3354
+ this.appServer = "https://app.luzmo.com";
3355
+ this.apiHost = "https://api.luzmo.com";
3356
+ this.version = version + "-wc-luzmo";
3357
+ this.libVersion = version + "-wc-luzmo";
3358
+ this.remoteEntryServer = "http://localhost:4202";
3359
+ }
3360
+ static {
3361
+ // Static styles to set host display to block, else it is not shown at all for some reason.
3362
+ this.styles = i`
3363
+ :host {
3364
+ display: block;
3365
+ width: 100%;
3366
+ height: 100%;
3367
+ }
3368
+ `;
3369
+ }
3370
+ createRenderRoot() {
3371
+ return this;
3372
+ }
3373
+ async firstUpdated(_changedProperties) {
3374
+ super.firstUpdated(_changedProperties);
3375
+ await loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
3376
+ this.createAndAppendElement();
3377
+ }
3378
+ createAndAppendElement() {
3379
+ if (!this.chartElement) {
3380
+ this.chartElement = document.createElement("luzmo-iq-answer-component");
3381
+ this.chartElement.addEventListener("addQuestion", (payload) => this.dispatchEvent(new CustomEvent("addQuestion", payload)));
3382
+ this.chartElement.addEventListener("addAnswer", (payload) => this.dispatchEvent(new CustomEvent("addAnswer", payload)));
3383
+ this.updateVizItemProperties();
3384
+ this.renderRoot.append(this.chartElement);
3385
+ }
3386
+ }
3387
+ updateVizItemProperties() {
3388
+ if (this.chartElement) {
3389
+ for (const key in inputMap2) {
3390
+ const value = this[key];
3391
+ if (value) {
3392
+ const attributeValue = ["appServer", "apiHost"].includes(key) ? removeTrailingSlash(value) : value;
3393
+ this.chartElement.setAttribute(
3394
+ inputMap2[key],
3395
+ typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
3396
+ );
3397
+ }
3398
+ }
3399
+ }
3400
+ }
3401
+ async updated(changedProperties) {
3402
+ if (this.chartElement) {
3403
+ for (const [propertyName] of changedProperties.entries()) {
3404
+ const mappedAttributeName = inputMap2[propertyName] ?? propertyName;
3405
+ const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
3406
+ this.chartElement.setAttribute(mappedAttributeName, attributeValue);
3407
+ }
3408
+ } else {
3409
+ await loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
3410
+ this.createAndAppendElement();
3411
+ }
3412
+ }
3413
+ render() {
3414
+ return ke` `;
3415
+ }
3416
+ };
3417
+ __decorateClass([
3418
+ n4()
3419
+ ], LuzmoIQEmbedAnswerComponent.prototype, "appServer", 2);
3420
+ __decorateClass([
3421
+ n4()
3422
+ ], LuzmoIQEmbedAnswerComponent.prototype, "apiHost", 2);
3423
+ __decorateClass([
3424
+ n4({ type: Object })
3425
+ ], LuzmoIQEmbedAnswerComponent.prototype, "options", 2);
3426
+ __decorateClass([
3427
+ n4()
3428
+ ], LuzmoIQEmbedAnswerComponent.prototype, "aiEndPoint", 2);
3429
+ __decorateClass([
3430
+ n4()
3431
+ ], LuzmoIQEmbedAnswerComponent.prototype, "authKey", 2);
3432
+ __decorateClass([
3433
+ n4()
3434
+ ], LuzmoIQEmbedAnswerComponent.prototype, "authToken", 2);
3435
+ __decorateClass([
3436
+ n4()
3437
+ ], LuzmoIQEmbedAnswerComponent.prototype, "messages", 2);
3438
+ __decorateClass([
3439
+ n4()
3440
+ ], LuzmoIQEmbedAnswerComponent.prototype, "version", 2);
3441
+ __decorateClass([
3442
+ n4()
3443
+ ], LuzmoIQEmbedAnswerComponent.prototype, "libVersion", 2);
3444
+ __decorateClass([
3445
+ n4()
3446
+ ], LuzmoIQEmbedAnswerComponent.prototype, "remoteEntryServer", 2);
3447
+ if (!customElements.get("luzmo-iq-embed-answer")) {
3448
+ customElements.define("luzmo-iq-embed-answer", LuzmoIQEmbedAnswerComponent);
3449
+ }
3450
+
3212
3451
  // libs/embed-libs/embed/src/lib/helper/json-schema-utils.ts
3213
3452
  var cachedSchemas = {};
3214
3453
  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.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.0",
7
+ "@luzmo/dashboard-contents-types": "1.0.5"
8
8
  },
9
9
  "type": "module",
10
10
  "keywords": [
package/src/index.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ export type * from '@luzmo/dashboard-contents-types';
2
+ export type { LoadEvent, ChangedFiltersEvent, CustomEvent, ItemsRenderedEvent, ExportedEvent, DashboardActionEvent, SelectedDataInput, ExportType, ItemData, ExportDashboard, AccessibleDashboard, SetEditMode, SetSelectedData, VizItemPostMessageLoadEvent, VizItemPostMessageRenderedEvent, VizItemPostMessageExportedEvent, VizItemPostMessageChangedFiltersEvent, VizItemPostMessageCustomEventEvent } from '@luzmo/shared-embed';
3
+ export { selectedDataUtils } from '@luzmo/shared-embed';
4
+ export * from './lib/dashboard-component/dashboard-component';
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';
8
+ export * from './lib/helper/json-schema-utils';