@luzmo/embed 6.1.1 → 6.1.2-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.
Files changed (43) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/index.cjs +262 -30
  3. package/index.d.ts +2 -0
  4. package/index.js +243 -15
  5. package/lib/ai-component/luzmo-ai-answer.d.ts +23 -0
  6. package/lib/ai-component/luzmo-ai-chat.d.ts +24 -0
  7. package/libs/dashboard-contents-types/src/index.d.ts +1 -0
  8. package/libs/dashboard-contents-types/src/lib/area-chart/area-chart-options.d.ts +1 -1
  9. package/libs/dashboard-contents-types/src/lib/bar-chart/bar-chart-options.d.ts +1 -1
  10. package/libs/dashboard-contents-types/src/lib/box-plot/box-plot-options.d.ts +1 -1
  11. package/libs/dashboard-contents-types/src/lib/bubble-chart/bubble-chart-options.d.ts +1 -1
  12. package/libs/dashboard-contents-types/src/lib/bullet-chart/bullet-chart-options.d.ts +1 -1
  13. package/libs/dashboard-contents-types/src/lib/column-chart/column-chart-options.d.ts +1 -1
  14. package/libs/dashboard-contents-types/src/lib/combination-chart/combination-chart-options.d.ts +1 -1
  15. package/libs/dashboard-contents-types/src/lib/conditional-number/conditional-number-options.d.ts +1 -1
  16. package/libs/dashboard-contents-types/src/lib/donut-chart/donut-chart-options.d.ts +1 -1
  17. package/libs/dashboard-contents-types/src/lib/evolution-number/evolution-number-options.d.ts +1 -1
  18. package/libs/dashboard-contents-types/src/lib/funnel-chart/funnel-chart-options.d.ts +1 -1
  19. package/libs/dashboard-contents-types/src/lib/line-chart/line-chart-options.d.ts +1 -1
  20. package/libs/dashboard-contents-types/src/lib/scatter-plot/scatter-plot-options.d.ts +1 -1
  21. package/libs/dashboard-contents-types/src/lib/search-filter/index.d.ts +3 -0
  22. package/libs/dashboard-contents-types/src/lib/search-filter/search-filter-options.d.ts +56 -0
  23. package/libs/dashboard-contents-types/src/lib/search-filter/search-filter-slots.d.ts +17 -0
  24. package/libs/dashboard-contents-types/src/lib/search-filter/search-filter.d.ts +23 -0
  25. package/libs/dashboard-contents-types/src/lib/shared/common.d.ts +1 -1
  26. package/libs/embed-libs/embed/src/index.d.ts +2 -0
  27. package/libs/embed-libs/embed/src/lib/ai-component/luzmo-ai-answer.d.ts +23 -0
  28. package/libs/embed-libs/embed/src/lib/ai-component/luzmo-ai-chat.d.ts +24 -0
  29. package/libs/embed-libs/shared-embed/src/index.common.d.ts +1 -0
  30. package/libs/embed-libs/shared-embed/src/lib/helpers/remote-federation.d.ts +1 -1
  31. package/libs/embed-libs/shared-embed/src/lib/models/ai-components.model.d.ts +128 -0
  32. package/luzmo-embed.min.js +649 -417
  33. package/package.json +2 -2
  34. package/src/index.d.ts +7 -0
  35. package/src/lib/ai-component/luzmo-ai-answer.d.ts +23 -0
  36. package/src/lib/ai-component/luzmo-ai-chat.d.ts +24 -0
  37. package/src/lib/dashboard-component/dashboard-base.d.ts +98 -0
  38. package/src/lib/dashboard-component/dashboard-component.d.ts +8 -0
  39. package/src/lib/dashboard-component/dashboard-styles.d.ts +1 -0
  40. package/src/lib/helper/event-bus-handler.d.ts +1 -0
  41. package/src/lib/luzmo-service.d.ts +6 -0
  42. package/src/lib/viz-item/viz-item-component.d.ts +4 -0
  43. package/src/lib/viz-item/viz-item.base.d.ts +73 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  All notable changes to this project will be documented in this file.
2
2
 
3
+ ## [6.1.2] - 2024-09-23
4
+
5
+ ### Bugfixes
6
+
7
+ - Web component now is only registered once, if already registered, the registration is skipped. (Fixes issue with libraries being included multiple times).
8
+
3
9
  ## [6.1.1] - 2024-09-09
4
10
 
5
11
  ### Chore
package/index.cjs CHANGED
@@ -41,6 +41,8 @@ var src_exports = {};
41
41
  __export(src_exports, {
42
42
  ColumnChartModes: () => ColumnChartModes,
43
43
  JSON_SCHEMAS: () => json_schemas_default,
44
+ LuzmoAIAnswerComponent: () => LuzmoAIAnswerComponent,
45
+ LuzmoEmbedAIChatComponent: () => LuzmoEmbedAIChatComponent,
44
46
  LuzmoEmbedDashboard: () => LuzmoEmbedDashboard,
45
47
  LuzmoEmbedVizItem: () => LuzmoEmbedVizItem,
46
48
  RegularTableSortingMode: () => RegularTableSortingMode,
@@ -54066,9 +54068,6 @@ var json_schemas_default = {
54066
54068
  // libs/embed-libs/embed/src/index.ts
54067
54069
  var import_shared_embed2 = require("@luzmo/shared-embed");
54068
54070
 
54069
- // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
54070
- var import_decorators2 = require("lit/decorators.js");
54071
-
54072
54071
  // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-base.ts
54073
54072
  var SharedLib2 = __toESM(require("@luzmo/shared-embed"), 1);
54074
54073
  var import_lit2 = require("lit");
@@ -54077,7 +54076,7 @@ var import_style_map = require("lit/directives/style-map.js");
54077
54076
  var import_shared_embed = require("@luzmo/shared-embed");
54078
54077
 
54079
54078
  // libs/embed-libs/embed/package.json
54080
- var version = "6.1.1";
54079
+ var version = "6.1.2-beta.0";
54081
54080
 
54082
54081
  // libs/embed-libs/embed/src/lib/luzmo-service.ts
54083
54082
  var LuzmoService = class {
@@ -55077,15 +55076,12 @@ __decorateClass([
55077
55076
  // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
55078
55077
  var LuzmoEmbedDashboard = class extends LuzmoDashboard {
55079
55078
  };
55080
- LuzmoEmbedDashboard = __decorateClass([
55081
- (0, import_decorators2.customElement)("luzmo-embed-dashboard")
55082
- ], LuzmoEmbedDashboard);
55083
-
55084
- // libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
55085
- var import_decorators4 = require("lit/decorators.js");
55079
+ if (!customElements.get("luzmo-embed-dashboard")) {
55080
+ customElements.define("luzmo-embed-dashboard", LuzmoEmbedDashboard);
55081
+ }
55086
55082
 
55087
55083
  // libs/embed-libs/embed/src/lib/viz-item/viz-item.base.ts
55088
- var import_decorators3 = require("lit/decorators.js");
55084
+ var import_decorators2 = require("lit/decorators.js");
55089
55085
  var import_lit3 = require("lit");
55090
55086
  var import_ajv = __toESM(require("ajv"), 1);
55091
55087
  var import_ajv_formats = __toESM(require("ajv-formats"), 1);
@@ -55258,34 +55254,34 @@ var LuzmoBaseVizItem = class extends import_lit3.LitElement {
55258
55254
  }
55259
55255
  };
55260
55256
  __decorateClass([
55261
- (0, import_decorators3.property)()
55257
+ (0, import_decorators2.property)()
55262
55258
  ], LuzmoBaseVizItem.prototype, "appServer", 2);
55263
55259
  __decorateClass([
55264
- (0, import_decorators3.property)()
55260
+ (0, import_decorators2.property)()
55265
55261
  ], LuzmoBaseVizItem.prototype, "apiHost", 2);
55266
55262
  __decorateClass([
55267
- (0, import_decorators3.property)({ type: Array })
55263
+ (0, import_decorators2.property)({ type: Array })
55268
55264
  ], LuzmoBaseVizItem.prototype, "slots", 2);
55269
55265
  __decorateClass([
55270
- (0, import_decorators3.property)({ type: Object })
55266
+ (0, import_decorators2.property)({ type: Object })
55271
55267
  ], LuzmoBaseVizItem.prototype, "options", 2);
55272
55268
  __decorateClass([
55273
- (0, import_decorators3.property)()
55269
+ (0, import_decorators2.property)()
55274
55270
  ], LuzmoBaseVizItem.prototype, "type", 2);
55275
55271
  __decorateClass([
55276
- (0, import_decorators3.property)()
55272
+ (0, import_decorators2.property)()
55277
55273
  ], LuzmoBaseVizItem.prototype, "authKey", 2);
55278
55274
  __decorateClass([
55279
- (0, import_decorators3.property)()
55275
+ (0, import_decorators2.property)()
55280
55276
  ], LuzmoBaseVizItem.prototype, "authToken", 2);
55281
55277
  __decorateClass([
55282
- (0, import_decorators3.property)()
55278
+ (0, import_decorators2.property)()
55283
55279
  ], LuzmoBaseVizItem.prototype, "version", 2);
55284
55280
  __decorateClass([
55285
- (0, import_decorators3.property)()
55281
+ (0, import_decorators2.property)()
55286
55282
  ], LuzmoBaseVizItem.prototype, "contextId", 2);
55287
55283
  __decorateClass([
55288
- (0, import_decorators3.property)({
55284
+ (0, import_decorators2.property)({
55289
55285
  converter: (value) => {
55290
55286
  try {
55291
55287
  return JSON.parse(value);
@@ -55296,34 +55292,270 @@ __decorateClass([
55296
55292
  })
55297
55293
  ], LuzmoBaseVizItem.prototype, "canFilter", 2);
55298
55294
  __decorateClass([
55299
- (0, import_decorators3.property)({ type: Array })
55295
+ (0, import_decorators2.property)({ type: Array })
55300
55296
  ], LuzmoBaseVizItem.prototype, "filters", 2);
55301
55297
  __decorateClass([
55302
- (0, import_decorators3.property)()
55298
+ (0, import_decorators2.property)()
55303
55299
  ], LuzmoBaseVizItem.prototype, "dashboardId", 2);
55304
55300
  __decorateClass([
55305
- (0, import_decorators3.property)()
55301
+ (0, import_decorators2.property)()
55306
55302
  ], LuzmoBaseVizItem.prototype, "itemId", 2);
55307
55303
  __decorateClass([
55308
- (0, import_decorators3.property)({ type: Object })
55304
+ (0, import_decorators2.property)({ type: Object })
55309
55305
  ], LuzmoBaseVizItem.prototype, "selectedData", 2);
55310
55306
  __decorateClass([
55311
- (0, import_decorators3.property)()
55307
+ (0, import_decorators2.property)()
55312
55308
  ], LuzmoBaseVizItem.prototype, "dashboardContentsVersion", 2);
55313
55309
  __decorateClass([
55314
- (0, import_decorators3.property)()
55310
+ (0, import_decorators2.property)()
55315
55311
  ], LuzmoBaseVizItem.prototype, "libVersion", 2);
55316
55312
 
55317
55313
  // libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
55318
55314
  var LuzmoEmbedVizItem = class extends LuzmoBaseVizItem {
55319
55315
  };
55320
- LuzmoEmbedVizItem = __decorateClass([
55321
- (0, import_decorators4.customElement)("luzmo-embed-viz-item")
55322
- ], LuzmoEmbedVizItem);
55316
+ if (!customElements.get("luzmo-embed-viz-item")) {
55317
+ customElements.define("luzmo-embed-viz-item", LuzmoEmbedVizItem);
55318
+ }
55319
+
55320
+ // libs/embed-libs/embed/src/lib/ai-component/luzmo-ai-chat.ts
55321
+ var import_decorators3 = require("lit/decorators.js");
55322
+ var import_lit4 = require("lit");
55323
+ var SharedLib4 = __toESM(require("@luzmo/shared-embed"), 1);
55324
+ var inputMap = {
55325
+ "aiEndpoint": "ai-endpoint",
55326
+ appServer: "app-server",
55327
+ apiHost: "api-host",
55328
+ options: "options",
55329
+ datasets: "datasets",
55330
+ authKey: "auth-key",
55331
+ authToken: "auth-token",
55332
+ version: "version",
55333
+ libVersion: "lib-version",
55334
+ aydHost: "ayd-host"
55335
+ };
55336
+ var LuzmoEmbedAIChatComponent = class extends import_lit4.LitElement {
55337
+ constructor() {
55338
+ super();
55339
+ this.appServer = "https://app.luzmo.com";
55340
+ this.apiHost = "https://api.luzmo.com";
55341
+ this.version = version + "-wc-luzmo";
55342
+ this.libVersion = version + "-wc-luzmo";
55343
+ this.remoteEntryServer = "http://localhost:4202/";
55344
+ this.aydHost = "https://ayd.luzmo.com/";
55345
+ }
55346
+ static {
55347
+ // Static styles to set host display to block, else it is not shown at all for some reason.
55348
+ this.styles = import_lit4.css`
55349
+ :host {
55350
+ display: block;
55351
+ width: 100%;
55352
+ height: 100%;
55353
+ }
55354
+ `;
55355
+ }
55356
+ createRenderRoot() {
55357
+ return this;
55358
+ }
55359
+ async firstUpdated(_changedProperties) {
55360
+ super.firstUpdated(_changedProperties);
55361
+ await SharedLib4.loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
55362
+ this.createAndAppendElement();
55363
+ }
55364
+ createAndAppendElement() {
55365
+ if (!this.chartElement) {
55366
+ this.chartElement = document.createElement("luzmo-ai-chart-generator-component");
55367
+ this.chartElement.addEventListener("load", (payload) => this.dispatchEvent(new CustomEvent("load", payload)));
55368
+ this.updateVizItemProperties();
55369
+ this.renderRoot.append(this.chartElement);
55370
+ }
55371
+ }
55372
+ updateVizItemProperties() {
55373
+ if (this.chartElement) {
55374
+ for (const key in inputMap) {
55375
+ const value = this[key];
55376
+ if (value) {
55377
+ const attributeValue = ["appServer", "apiHost", "aydHost"].includes(key) ? SharedLib4.removeTrailingSlash(value) : value;
55378
+ this.chartElement.setAttribute(
55379
+ inputMap[key],
55380
+ typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
55381
+ );
55382
+ }
55383
+ }
55384
+ }
55385
+ }
55386
+ async updated(changedProperties) {
55387
+ if (this.chartElement) {
55388
+ for (const [propertyName] of changedProperties.entries()) {
55389
+ const mappedAttributeName = inputMap[propertyName] ?? propertyName;
55390
+ const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
55391
+ this.chartElement.setAttribute(mappedAttributeName, attributeValue);
55392
+ }
55393
+ } else {
55394
+ await SharedLib4.loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
55395
+ this.createAndAppendElement();
55396
+ }
55397
+ }
55398
+ render() {
55399
+ return import_lit4.html` `;
55400
+ }
55401
+ };
55402
+ __decorateClass([
55403
+ (0, import_decorators3.property)()
55404
+ ], LuzmoEmbedAIChatComponent.prototype, "appServer", 2);
55405
+ __decorateClass([
55406
+ (0, import_decorators3.property)()
55407
+ ], LuzmoEmbedAIChatComponent.prototype, "apiHost", 2);
55408
+ __decorateClass([
55409
+ (0, import_decorators3.property)({ type: Object })
55410
+ ], LuzmoEmbedAIChatComponent.prototype, "options", 2);
55411
+ __decorateClass([
55412
+ (0, import_decorators3.property)({ type: Array })
55413
+ ], LuzmoEmbedAIChatComponent.prototype, "datasets", 2);
55414
+ __decorateClass([
55415
+ (0, import_decorators3.property)()
55416
+ ], LuzmoEmbedAIChatComponent.prototype, "aiEndpoint", 2);
55417
+ __decorateClass([
55418
+ (0, import_decorators3.property)()
55419
+ ], LuzmoEmbedAIChatComponent.prototype, "authKey", 2);
55420
+ __decorateClass([
55421
+ (0, import_decorators3.property)()
55422
+ ], LuzmoEmbedAIChatComponent.prototype, "authToken", 2);
55423
+ __decorateClass([
55424
+ (0, import_decorators3.property)()
55425
+ ], LuzmoEmbedAIChatComponent.prototype, "version", 2);
55426
+ __decorateClass([
55427
+ (0, import_decorators3.property)()
55428
+ ], LuzmoEmbedAIChatComponent.prototype, "libVersion", 2);
55429
+ __decorateClass([
55430
+ (0, import_decorators3.property)()
55431
+ ], LuzmoEmbedAIChatComponent.prototype, "remoteEntryServer", 2);
55432
+ __decorateClass([
55433
+ (0, import_decorators3.property)()
55434
+ ], LuzmoEmbedAIChatComponent.prototype, "aydHost", 2);
55435
+ if (!customElements.get("luzmo-embed-ai-chat")) {
55436
+ customElements.define("luzmo-embed-ai-chat", LuzmoEmbedAIChatComponent);
55437
+ }
55438
+
55439
+ // libs/embed-libs/embed/src/lib/ai-component/luzmo-ai-answer.ts
55440
+ var import_decorators4 = require("lit/decorators.js");
55441
+ var import_lit5 = require("lit");
55442
+ var SharedLib5 = __toESM(require("@luzmo/shared-embed"), 1);
55443
+ var inputMap2 = {
55444
+ "aiEndPoint": "ai-end-point",
55445
+ appServer: "app-server",
55446
+ apiHost: "api-host",
55447
+ options: "options",
55448
+ authKey: "auth-key",
55449
+ authToken: "auth-token",
55450
+ version: "version",
55451
+ libVersion: "lib-version",
55452
+ messages: "messages"
55453
+ };
55454
+ var LuzmoAIAnswerComponent = class extends import_lit5.LitElement {
55455
+ constructor() {
55456
+ super();
55457
+ this.appServer = "https://app.luzmo.com";
55458
+ this.apiHost = "https://api.luzmo.com";
55459
+ this.version = version + "-wc-luzmo";
55460
+ this.libVersion = version + "-wc-luzmo";
55461
+ this.remoteEntryServer = "http://localhost:4202";
55462
+ }
55463
+ static {
55464
+ // Static styles to set host display to block, else it is not shown at all for some reason.
55465
+ this.styles = import_lit5.css`
55466
+ :host {
55467
+ display: block;
55468
+ width: 100%;
55469
+ height: 100%;
55470
+ }
55471
+ `;
55472
+ }
55473
+ createRenderRoot() {
55474
+ return this;
55475
+ }
55476
+ async firstUpdated(_changedProperties) {
55477
+ super.firstUpdated(_changedProperties);
55478
+ await SharedLib5.loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
55479
+ this.createAndAppendElement();
55480
+ }
55481
+ createAndAppendElement() {
55482
+ if (!this.chartElement) {
55483
+ this.chartElement = document.createElement("luzmo-ai-answer-component");
55484
+ this.chartElement.addEventListener("addQuestion", (payload) => this.dispatchEvent(new CustomEvent("addQuestion", payload)));
55485
+ this.chartElement.addEventListener("addAnswer", (payload) => this.dispatchEvent(new CustomEvent("addAnswer", payload)));
55486
+ this.updateVizItemProperties();
55487
+ this.renderRoot.append(this.chartElement);
55488
+ }
55489
+ }
55490
+ updateVizItemProperties() {
55491
+ if (this.chartElement) {
55492
+ for (const key in inputMap2) {
55493
+ const value = this[key];
55494
+ if (value) {
55495
+ const attributeValue = ["appServer", "apiHost"].includes(key) ? SharedLib5.removeTrailingSlash(value) : value;
55496
+ this.chartElement.setAttribute(
55497
+ inputMap2[key],
55498
+ typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
55499
+ );
55500
+ }
55501
+ }
55502
+ }
55503
+ }
55504
+ async updated(changedProperties) {
55505
+ if (this.chartElement) {
55506
+ for (const [propertyName] of changedProperties.entries()) {
55507
+ const mappedAttributeName = inputMap2[propertyName] ?? propertyName;
55508
+ const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
55509
+ this.chartElement.setAttribute(mappedAttributeName, attributeValue);
55510
+ }
55511
+ } else {
55512
+ await SharedLib5.loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
55513
+ this.createAndAppendElement();
55514
+ }
55515
+ }
55516
+ render() {
55517
+ return import_lit5.html` `;
55518
+ }
55519
+ };
55520
+ __decorateClass([
55521
+ (0, import_decorators4.property)()
55522
+ ], LuzmoAIAnswerComponent.prototype, "appServer", 2);
55523
+ __decorateClass([
55524
+ (0, import_decorators4.property)()
55525
+ ], LuzmoAIAnswerComponent.prototype, "apiHost", 2);
55526
+ __decorateClass([
55527
+ (0, import_decorators4.property)({ type: Object })
55528
+ ], LuzmoAIAnswerComponent.prototype, "options", 2);
55529
+ __decorateClass([
55530
+ (0, import_decorators4.property)()
55531
+ ], LuzmoAIAnswerComponent.prototype, "aiEndPoint", 2);
55532
+ __decorateClass([
55533
+ (0, import_decorators4.property)()
55534
+ ], LuzmoAIAnswerComponent.prototype, "authKey", 2);
55535
+ __decorateClass([
55536
+ (0, import_decorators4.property)()
55537
+ ], LuzmoAIAnswerComponent.prototype, "authToken", 2);
55538
+ __decorateClass([
55539
+ (0, import_decorators4.property)()
55540
+ ], LuzmoAIAnswerComponent.prototype, "messages", 2);
55541
+ __decorateClass([
55542
+ (0, import_decorators4.property)()
55543
+ ], LuzmoAIAnswerComponent.prototype, "version", 2);
55544
+ __decorateClass([
55545
+ (0, import_decorators4.property)()
55546
+ ], LuzmoAIAnswerComponent.prototype, "libVersion", 2);
55547
+ __decorateClass([
55548
+ (0, import_decorators4.property)()
55549
+ ], LuzmoAIAnswerComponent.prototype, "remoteEntryServer", 2);
55550
+ if (!customElements.get("luzmo-embed-ai-answer")) {
55551
+ customElements.define("luzmo-embed-ai-answer", LuzmoAIAnswerComponent);
55552
+ }
55323
55553
  // Annotate the CommonJS export names for ESM import in node:
55324
55554
  0 && (module.exports = {
55325
55555
  ColumnChartModes,
55326
55556
  JSON_SCHEMAS,
55557
+ LuzmoAIAnswerComponent,
55558
+ LuzmoEmbedAIChatComponent,
55327
55559
  LuzmoEmbedDashboard,
55328
55560
  LuzmoEmbedVizItem,
55329
55561
  RegularTableSortingMode,
package/index.d.ts CHANGED
@@ -3,3 +3,5 @@ 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/ai-component/luzmo-ai-chat';
7
+ export * from './lib/ai-component/luzmo-ai-answer';
package/index.js CHANGED
@@ -54028,11 +54028,6 @@ var json_schemas_default = {
54028
54028
  // libs/embed-libs/embed/src/index.ts
54029
54029
  import { selectedDataUtils } from "@luzmo/shared-embed";
54030
54030
 
54031
- // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
54032
- import {
54033
- customElement
54034
- } from "lit/decorators.js";
54035
-
54036
54031
  // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-base.ts
54037
54032
  import * as SharedLib2 from "@luzmo/shared-embed";
54038
54033
  import {
@@ -54052,7 +54047,7 @@ import {
54052
54047
  } from "@luzmo/shared-embed";
54053
54048
 
54054
54049
  // libs/embed-libs/embed/package.json
54055
- var version = "6.1.1";
54050
+ var version = "6.1.2-beta.0";
54056
54051
 
54057
54052
  // libs/embed-libs/embed/src/lib/luzmo-service.ts
54058
54053
  var LuzmoService = class {
@@ -55052,12 +55047,9 @@ __decorateClass([
55052
55047
  // libs/embed-libs/embed/src/lib/dashboard-component/dashboard-component.ts
55053
55048
  var LuzmoEmbedDashboard = class extends LuzmoDashboard {
55054
55049
  };
55055
- LuzmoEmbedDashboard = __decorateClass([
55056
- customElement("luzmo-embed-dashboard")
55057
- ], LuzmoEmbedDashboard);
55058
-
55059
- // libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
55060
- import { customElement as customElement2 } from "lit/decorators.js";
55050
+ if (!customElements.get("luzmo-embed-dashboard")) {
55051
+ customElements.define("luzmo-embed-dashboard", LuzmoEmbedDashboard);
55052
+ }
55061
55053
 
55062
55054
  // libs/embed-libs/embed/src/lib/viz-item/viz-item.base.ts
55063
55055
  import { property as property2 } from "lit/decorators.js";
@@ -55292,12 +55284,248 @@ __decorateClass([
55292
55284
  // libs/embed-libs/embed/src/lib/viz-item/viz-item-component.ts
55293
55285
  var LuzmoEmbedVizItem = class extends LuzmoBaseVizItem {
55294
55286
  };
55295
- LuzmoEmbedVizItem = __decorateClass([
55296
- customElement2("luzmo-embed-viz-item")
55297
- ], LuzmoEmbedVizItem);
55287
+ if (!customElements.get("luzmo-embed-viz-item")) {
55288
+ customElements.define("luzmo-embed-viz-item", LuzmoEmbedVizItem);
55289
+ }
55290
+
55291
+ // libs/embed-libs/embed/src/lib/ai-component/luzmo-ai-chat.ts
55292
+ import { property as property3 } from "lit/decorators.js";
55293
+ import { LitElement as LitElement3, html as html3, css as css3 } from "lit";
55294
+ import * as SharedLib4 from "@luzmo/shared-embed";
55295
+ var inputMap = {
55296
+ "aiEndpoint": "ai-endpoint",
55297
+ appServer: "app-server",
55298
+ apiHost: "api-host",
55299
+ options: "options",
55300
+ datasets: "datasets",
55301
+ authKey: "auth-key",
55302
+ authToken: "auth-token",
55303
+ version: "version",
55304
+ libVersion: "lib-version",
55305
+ aydHost: "ayd-host"
55306
+ };
55307
+ var LuzmoEmbedAIChatComponent = class extends LitElement3 {
55308
+ constructor() {
55309
+ super();
55310
+ this.appServer = "https://app.luzmo.com";
55311
+ this.apiHost = "https://api.luzmo.com";
55312
+ this.version = version + "-wc-luzmo";
55313
+ this.libVersion = version + "-wc-luzmo";
55314
+ this.remoteEntryServer = "http://localhost:4202/";
55315
+ this.aydHost = "https://ayd.luzmo.com/";
55316
+ }
55317
+ static {
55318
+ // Static styles to set host display to block, else it is not shown at all for some reason.
55319
+ this.styles = css3`
55320
+ :host {
55321
+ display: block;
55322
+ width: 100%;
55323
+ height: 100%;
55324
+ }
55325
+ `;
55326
+ }
55327
+ createRenderRoot() {
55328
+ return this;
55329
+ }
55330
+ async firstUpdated(_changedProperties) {
55331
+ super.firstUpdated(_changedProperties);
55332
+ await SharedLib4.loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
55333
+ this.createAndAppendElement();
55334
+ }
55335
+ createAndAppendElement() {
55336
+ if (!this.chartElement) {
55337
+ this.chartElement = document.createElement("luzmo-ai-chart-generator-component");
55338
+ this.chartElement.addEventListener("load", (payload) => this.dispatchEvent(new CustomEvent("load", payload)));
55339
+ this.updateVizItemProperties();
55340
+ this.renderRoot.append(this.chartElement);
55341
+ }
55342
+ }
55343
+ updateVizItemProperties() {
55344
+ if (this.chartElement) {
55345
+ for (const key in inputMap) {
55346
+ const value = this[key];
55347
+ if (value) {
55348
+ const attributeValue = ["appServer", "apiHost", "aydHost"].includes(key) ? SharedLib4.removeTrailingSlash(value) : value;
55349
+ this.chartElement.setAttribute(
55350
+ inputMap[key],
55351
+ typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
55352
+ );
55353
+ }
55354
+ }
55355
+ }
55356
+ }
55357
+ async updated(changedProperties) {
55358
+ if (this.chartElement) {
55359
+ for (const [propertyName] of changedProperties.entries()) {
55360
+ const mappedAttributeName = inputMap[propertyName] ?? propertyName;
55361
+ const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
55362
+ this.chartElement.setAttribute(mappedAttributeName, attributeValue);
55363
+ }
55364
+ } else {
55365
+ await SharedLib4.loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
55366
+ this.createAndAppendElement();
55367
+ }
55368
+ }
55369
+ render() {
55370
+ return html3` `;
55371
+ }
55372
+ };
55373
+ __decorateClass([
55374
+ property3()
55375
+ ], LuzmoEmbedAIChatComponent.prototype, "appServer", 2);
55376
+ __decorateClass([
55377
+ property3()
55378
+ ], LuzmoEmbedAIChatComponent.prototype, "apiHost", 2);
55379
+ __decorateClass([
55380
+ property3({ type: Object })
55381
+ ], LuzmoEmbedAIChatComponent.prototype, "options", 2);
55382
+ __decorateClass([
55383
+ property3({ type: Array })
55384
+ ], LuzmoEmbedAIChatComponent.prototype, "datasets", 2);
55385
+ __decorateClass([
55386
+ property3()
55387
+ ], LuzmoEmbedAIChatComponent.prototype, "aiEndpoint", 2);
55388
+ __decorateClass([
55389
+ property3()
55390
+ ], LuzmoEmbedAIChatComponent.prototype, "authKey", 2);
55391
+ __decorateClass([
55392
+ property3()
55393
+ ], LuzmoEmbedAIChatComponent.prototype, "authToken", 2);
55394
+ __decorateClass([
55395
+ property3()
55396
+ ], LuzmoEmbedAIChatComponent.prototype, "version", 2);
55397
+ __decorateClass([
55398
+ property3()
55399
+ ], LuzmoEmbedAIChatComponent.prototype, "libVersion", 2);
55400
+ __decorateClass([
55401
+ property3()
55402
+ ], LuzmoEmbedAIChatComponent.prototype, "remoteEntryServer", 2);
55403
+ __decorateClass([
55404
+ property3()
55405
+ ], LuzmoEmbedAIChatComponent.prototype, "aydHost", 2);
55406
+ if (!customElements.get("luzmo-embed-ai-chat")) {
55407
+ customElements.define("luzmo-embed-ai-chat", LuzmoEmbedAIChatComponent);
55408
+ }
55409
+
55410
+ // libs/embed-libs/embed/src/lib/ai-component/luzmo-ai-answer.ts
55411
+ import { property as property4 } from "lit/decorators.js";
55412
+ import { LitElement as LitElement4, html as html4, css as css4 } from "lit";
55413
+ import * as SharedLib5 from "@luzmo/shared-embed";
55414
+ var inputMap2 = {
55415
+ "aiEndPoint": "ai-end-point",
55416
+ appServer: "app-server",
55417
+ apiHost: "api-host",
55418
+ options: "options",
55419
+ authKey: "auth-key",
55420
+ authToken: "auth-token",
55421
+ version: "version",
55422
+ libVersion: "lib-version",
55423
+ messages: "messages"
55424
+ };
55425
+ var LuzmoAIAnswerComponent = class extends LitElement4 {
55426
+ constructor() {
55427
+ super();
55428
+ this.appServer = "https://app.luzmo.com";
55429
+ this.apiHost = "https://api.luzmo.com";
55430
+ this.version = version + "-wc-luzmo";
55431
+ this.libVersion = version + "-wc-luzmo";
55432
+ this.remoteEntryServer = "http://localhost:4202";
55433
+ }
55434
+ static {
55435
+ // Static styles to set host display to block, else it is not shown at all for some reason.
55436
+ this.styles = css4`
55437
+ :host {
55438
+ display: block;
55439
+ width: 100%;
55440
+ height: 100%;
55441
+ }
55442
+ `;
55443
+ }
55444
+ createRenderRoot() {
55445
+ return this;
55446
+ }
55447
+ async firstUpdated(_changedProperties) {
55448
+ super.firstUpdated(_changedProperties);
55449
+ await SharedLib5.loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
55450
+ this.createAndAppendElement();
55451
+ }
55452
+ createAndAppendElement() {
55453
+ if (!this.chartElement) {
55454
+ this.chartElement = document.createElement("luzmo-ai-answer-component");
55455
+ this.chartElement.addEventListener("addQuestion", (payload) => this.dispatchEvent(new CustomEvent("addQuestion", payload)));
55456
+ this.chartElement.addEventListener("addAnswer", (payload) => this.dispatchEvent(new CustomEvent("addAnswer", payload)));
55457
+ this.updateVizItemProperties();
55458
+ this.renderRoot.append(this.chartElement);
55459
+ }
55460
+ }
55461
+ updateVizItemProperties() {
55462
+ if (this.chartElement) {
55463
+ for (const key in inputMap2) {
55464
+ const value = this[key];
55465
+ if (value) {
55466
+ const attributeValue = ["appServer", "apiHost"].includes(key) ? SharedLib5.removeTrailingSlash(value) : value;
55467
+ this.chartElement.setAttribute(
55468
+ inputMap2[key],
55469
+ typeof attributeValue === "object" ? JSON.stringify(attributeValue) : attributeValue
55470
+ );
55471
+ }
55472
+ }
55473
+ }
55474
+ }
55475
+ async updated(changedProperties) {
55476
+ if (this.chartElement) {
55477
+ for (const [propertyName] of changedProperties.entries()) {
55478
+ const mappedAttributeName = inputMap2[propertyName] ?? propertyName;
55479
+ const attributeValue = typeof this[propertyName] === "object" ? JSON.stringify(this[propertyName]) : this[propertyName]?.toString() ?? this[propertyName];
55480
+ this.chartElement.setAttribute(mappedAttributeName, attributeValue);
55481
+ }
55482
+ } else {
55483
+ await SharedLib5.loadLibrary(this.appServer.startsWith("http://localhost") ? this.remoteEntryServer : this.appServer, "Component");
55484
+ this.createAndAppendElement();
55485
+ }
55486
+ }
55487
+ render() {
55488
+ return html4` `;
55489
+ }
55490
+ };
55491
+ __decorateClass([
55492
+ property4()
55493
+ ], LuzmoAIAnswerComponent.prototype, "appServer", 2);
55494
+ __decorateClass([
55495
+ property4()
55496
+ ], LuzmoAIAnswerComponent.prototype, "apiHost", 2);
55497
+ __decorateClass([
55498
+ property4({ type: Object })
55499
+ ], LuzmoAIAnswerComponent.prototype, "options", 2);
55500
+ __decorateClass([
55501
+ property4()
55502
+ ], LuzmoAIAnswerComponent.prototype, "aiEndPoint", 2);
55503
+ __decorateClass([
55504
+ property4()
55505
+ ], LuzmoAIAnswerComponent.prototype, "authKey", 2);
55506
+ __decorateClass([
55507
+ property4()
55508
+ ], LuzmoAIAnswerComponent.prototype, "authToken", 2);
55509
+ __decorateClass([
55510
+ property4()
55511
+ ], LuzmoAIAnswerComponent.prototype, "messages", 2);
55512
+ __decorateClass([
55513
+ property4()
55514
+ ], LuzmoAIAnswerComponent.prototype, "version", 2);
55515
+ __decorateClass([
55516
+ property4()
55517
+ ], LuzmoAIAnswerComponent.prototype, "libVersion", 2);
55518
+ __decorateClass([
55519
+ property4()
55520
+ ], LuzmoAIAnswerComponent.prototype, "remoteEntryServer", 2);
55521
+ if (!customElements.get("luzmo-embed-ai-answer")) {
55522
+ customElements.define("luzmo-embed-ai-answer", LuzmoAIAnswerComponent);
55523
+ }
55298
55524
  export {
55299
55525
  ColumnChartModes,
55300
55526
  json_schemas_default as JSON_SCHEMAS,
55527
+ LuzmoAIAnswerComponent,
55528
+ LuzmoEmbedAIChatComponent,
55301
55529
  LuzmoEmbedDashboard,
55302
55530
  LuzmoEmbedVizItem,
55303
55531
  RegularTableSortingMode,