@luzmo/embed 8.0.0 → 8.1.0-es2021
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +182 -145
- package/index.cjs +402 -326
- package/index.js +402 -326
- package/index.rn.cjs +329 -271
- package/index.rn.js +329 -271
- package/index.shared.cjs +329 -271
- package/index.shared.js +329 -271
- package/luzmo-embed.min.js +403 -327
- package/package.json +9 -3
- package/src/lib/dashboard/dashboard-base.d.ts +3 -3
- package/src/lib/iq-components/luzmo-iq-answer.d.ts +1 -1
- package/src/lib/iq-components/luzmo-iq-chat.d.ts +1 -1
- package/src/lib/luzmo-service.d.ts +1 -1
- package/src/lib/shared/helpers/default-parameters.d.ts +19 -2
- package/src/lib/shared/helpers/utils.d.ts +3 -3
- package/src/lib/shared/methods/export-dashboard.d.ts +1 -2
- package/src/lib/shared/methods/send-export-email.d.ts +3 -2
- package/src/lib/shared/models/common.model.d.ts +1 -1
- package/src/lib/shared/models/dashboard-context.model.d.ts +2 -0
- package/src/lib/shared/models/dashboard.model.d.ts +1 -2
- package/src/lib/shared/models/export.model.d.ts +3 -0
- package/src/lib/shared/models/index.d.ts +1 -0
- package/src/lib/viz-item/viz-item.base.d.ts +14 -5
package/index.js
CHANGED
|
@@ -371,41 +371,46 @@ var createIframeUrl = (dashboardContent) => {
|
|
|
371
371
|
// libs/embed-libs/embed/src/lib/shared/helpers/get-loader.ts
|
|
372
372
|
var getLoader = (dashboardComponent) => {
|
|
373
373
|
let errorMsg;
|
|
374
|
-
if (dashboardComponent.params
|
|
375
|
-
dashboardComponent.params
|
|
374
|
+
if (dashboardComponent.params?.error || (dashboardComponent.browserNotSupported?.length ?? 0) > 0) {
|
|
375
|
+
if (dashboardComponent.params) {
|
|
376
|
+
dashboardComponent.params.error = true;
|
|
377
|
+
}
|
|
376
378
|
if (dashboardComponent.browserNotSupported) {
|
|
377
379
|
errorMsg = "Browser is not supported.";
|
|
378
380
|
}
|
|
379
381
|
}
|
|
380
|
-
const
|
|
381
|
-
|
|
382
|
+
const language = dashboardComponent.params?.language;
|
|
383
|
+
const loadingMsg = (language ? translations_default.initializing[language] : void 0) || translations_default.initializing.en;
|
|
384
|
+
return dashboardComponent.browserNotSupported || dashboardComponent.params?.error ? { loadingMsg, errorMsg } : { loadingMsg, errorMsg: "" };
|
|
382
385
|
};
|
|
383
386
|
|
|
384
387
|
// libs/embed-libs/embed/src/lib/shared/helpers/promise-dispatch.ts
|
|
385
388
|
function resolvePromise(dashboardComponent, requestId, data) {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
+
const promises = dashboardComponent.promises;
|
|
390
|
+
if (promises?.[requestId]) {
|
|
391
|
+
promises[requestId].resolve(data);
|
|
392
|
+
delete promises[requestId];
|
|
389
393
|
}
|
|
390
394
|
}
|
|
391
395
|
function rejectPromise(dashboardComponent, requestId, data) {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
396
|
+
const promises = dashboardComponent.promises;
|
|
397
|
+
if (promises?.[requestId]) {
|
|
398
|
+
promises[requestId].reject(data);
|
|
399
|
+
delete promises[requestId];
|
|
395
400
|
}
|
|
396
401
|
}
|
|
397
402
|
|
|
398
403
|
// libs/embed-libs/embed/src/lib/shared/helpers/styles.ts
|
|
399
404
|
function containerStyles(dashboardComponent) {
|
|
400
405
|
const styles = {};
|
|
401
|
-
if (dashboardComponent.params
|
|
406
|
+
if (dashboardComponent.params?.loaderBackground && !dashboardComponent.iframeLoaded) {
|
|
402
407
|
styles.background = dashboardComponent.params.loaderBackground;
|
|
403
408
|
}
|
|
404
409
|
return styles;
|
|
405
410
|
}
|
|
406
411
|
function containerLoaderStyles(dashboardComponent) {
|
|
407
|
-
const height = dashboardComponent.params
|
|
408
|
-
const chartHeightDefined = dashboardComponent.params
|
|
412
|
+
const height = dashboardComponent.params?.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
413
|
+
const chartHeightDefined = dashboardComponent.params?.itemEmbedding && height !== "auto";
|
|
409
414
|
const display = dashboardComponent.iframeLoaded ? "none" : "";
|
|
410
415
|
return {
|
|
411
416
|
display,
|
|
@@ -413,8 +418,8 @@ function containerLoaderStyles(dashboardComponent) {
|
|
|
413
418
|
};
|
|
414
419
|
}
|
|
415
420
|
function loaderStyles(dashboardComponent) {
|
|
416
|
-
const background = dashboardComponent.params
|
|
417
|
-
if (dashboardComponent.params
|
|
421
|
+
const background = dashboardComponent.params?.loaderBackground || DEFAULT_PARAMETERS.loaderBackground;
|
|
422
|
+
if (dashboardComponent.params?.itemEmbedding) {
|
|
418
423
|
dashboardComponent.loaderSize = 24;
|
|
419
424
|
dashboardComponent.borderWidth = 4;
|
|
420
425
|
dashboardComponent.minHeight = 200;
|
|
@@ -443,11 +448,11 @@ function plStyles(dashboardComponent) {
|
|
|
443
448
|
} = DEFAULT_PARAMETERS;
|
|
444
449
|
const spinnerColorBorder = generateBorderStyle(
|
|
445
450
|
dashboardComponent.borderWidth,
|
|
446
|
-
dashboardComponent.params
|
|
451
|
+
dashboardComponent.params?.loaderSpinnerColor || defaultSpinnerColor
|
|
447
452
|
);
|
|
448
453
|
const spinnerBackgroundBorder = generateBorderStyle(
|
|
449
454
|
dashboardComponent.borderWidth,
|
|
450
|
-
dashboardComponent.params
|
|
455
|
+
dashboardComponent.params?.loaderSpinnerBackground || defaultSpinnerBackground
|
|
451
456
|
);
|
|
452
457
|
const size = `${dashboardComponent.loaderSize}px`;
|
|
453
458
|
return {
|
|
@@ -460,27 +465,28 @@ function plStyles(dashboardComponent) {
|
|
|
460
465
|
};
|
|
461
466
|
}
|
|
462
467
|
function lcStyles(dashboardComponent) {
|
|
463
|
-
const height = dashboardComponent.params
|
|
464
|
-
const chartHeightDefined = dashboardComponent.params
|
|
465
|
-
const getPaddingStr = (value) => `${(value - dashboardComponent.loaderSize - 32) / 2}px`;
|
|
466
|
-
const verticalPadding = dashboardComponent.params
|
|
468
|
+
const height = dashboardComponent.params?.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
469
|
+
const chartHeightDefined = dashboardComponent.params?.itemEmbedding && height !== "auto";
|
|
470
|
+
const getPaddingStr = (value) => `${((value ?? Number.NaN) - (dashboardComponent.loaderSize ?? Number.NaN) - 32) / 2}px`;
|
|
471
|
+
const verticalPadding = dashboardComponent.params?.itemId ? chartHeightDefined ? getPaddingStr(Number.parseInt(`${height}`, 10)) : getPaddingStr(dashboardComponent.minHeight) : "128px";
|
|
467
472
|
return {
|
|
468
473
|
padding: `${verticalPadding} 16px`
|
|
469
474
|
};
|
|
470
475
|
}
|
|
471
476
|
function calculateIframeStyles(dashboardComponent) {
|
|
472
|
-
const height = dashboardComponent.params
|
|
473
|
-
const width = dashboardComponent.params
|
|
474
|
-
|
|
477
|
+
const height = dashboardComponent.params?.itemDimensions?.height || DEFAULT_PARAMETERS.itemDimensions.height;
|
|
478
|
+
const width = dashboardComponent.params?.itemDimensions?.width || DEFAULT_PARAMETERS.itemDimensions.width;
|
|
479
|
+
const editMode = dashboardComponent.params?.editMode;
|
|
480
|
+
if (dashboardComponent.params?.itemEmbedding && height !== "auto") {
|
|
475
481
|
dashboardComponent.iframeHeight = `${height}px`;
|
|
476
|
-
} else if (dashboardComponent.params
|
|
482
|
+
} else if (dashboardComponent.params?.itemEmbedding) {
|
|
477
483
|
dashboardComponent.iframeHeight = "200px";
|
|
478
|
-
} else if (["editFull", "editLimited"].includes(
|
|
484
|
+
} else if (editMode != null && ["editFull", "editLimited"].includes(editMode)) {
|
|
479
485
|
dashboardComponent.iframeHeight = "100%";
|
|
480
486
|
} else {
|
|
481
487
|
dashboardComponent.iframeHeight = "400px";
|
|
482
488
|
}
|
|
483
|
-
dashboardComponent.iframeWidth = dashboardComponent.params
|
|
489
|
+
dashboardComponent.iframeWidth = dashboardComponent.params?.itemEmbedding && width !== "auto" ? `${width}px` : "100%";
|
|
484
490
|
const styles = {
|
|
485
491
|
height: dashboardComponent.iframeHeight,
|
|
486
492
|
width: dashboardComponent.iframeWidth
|
|
@@ -499,7 +505,7 @@ function calculateIframeStyles(dashboardComponent) {
|
|
|
499
505
|
|
|
500
506
|
// libs/embed-libs/embed/src/lib/shared/helpers/update-iframe-url.ts
|
|
501
507
|
var updateIframeUrl = (iframe, iframeUrl) => {
|
|
502
|
-
if (iframe?.contentWindow) {
|
|
508
|
+
if (iframe?.contentWindow && iframeUrl !== void 0) {
|
|
503
509
|
iframe.contentWindow.location.replace(iframeUrl);
|
|
504
510
|
}
|
|
505
511
|
};
|
|
@@ -508,7 +514,7 @@ var updateIframeUrl = (iframe, iframeUrl) => {
|
|
|
508
514
|
var selectedDataUtils = {
|
|
509
515
|
merge(...filters) {
|
|
510
516
|
return filters.reduce((acc, filter) => {
|
|
511
|
-
acc.and.push(...filter.and);
|
|
517
|
+
(acc.and ??= []).push(...filter.and ?? []);
|
|
512
518
|
return acc;
|
|
513
519
|
}, {
|
|
514
520
|
and: []
|
|
@@ -571,43 +577,46 @@ var selectedDataUtils = {
|
|
|
571
577
|
// libs/embed-libs/embed/src/lib/shared/methods/export-dashboard.ts
|
|
572
578
|
var exportDashboard = (dashboardComponent, iframe, format) => {
|
|
573
579
|
const requestId = uuidv4();
|
|
574
|
-
if (iframe?.contentWindow) {
|
|
575
|
-
|
|
576
|
-
{
|
|
577
|
-
action: "exportDashboard",
|
|
578
|
-
format: format || "png",
|
|
579
|
-
_version: dashboardComponent.libVersion,
|
|
580
|
-
requestId
|
|
581
|
-
},
|
|
582
|
-
"*"
|
|
583
|
-
);
|
|
584
|
-
return new Promise((resolve, reject) => {
|
|
585
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
586
|
-
setTimeout(() => {
|
|
587
|
-
if (dashboardComponent.promises[requestId]) {
|
|
588
|
-
const errorMessage = "exportDashboard request timed out.";
|
|
589
|
-
dashboardComponent.promises[requestId].reject(
|
|
590
|
-
new Error(errorMessage)
|
|
591
|
-
);
|
|
592
|
-
delete dashboardComponent.promises[requestId];
|
|
593
|
-
}
|
|
594
|
-
}, 12e5);
|
|
595
|
-
});
|
|
580
|
+
if (!iframe?.contentWindow) {
|
|
581
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
596
582
|
}
|
|
597
|
-
|
|
583
|
+
const { promises } = dashboardComponent;
|
|
584
|
+
if (!promises) {
|
|
585
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
586
|
+
}
|
|
587
|
+
iframe.contentWindow.postMessage(
|
|
588
|
+
{
|
|
589
|
+
action: "exportDashboard",
|
|
590
|
+
format: format || "png",
|
|
591
|
+
_version: dashboardComponent.libVersion,
|
|
592
|
+
requestId
|
|
593
|
+
},
|
|
594
|
+
"*"
|
|
595
|
+
);
|
|
596
|
+
return new Promise((resolve, reject) => {
|
|
597
|
+
promises[requestId] = { resolve, reject };
|
|
598
|
+
setTimeout(() => {
|
|
599
|
+
if (promises[requestId]) {
|
|
600
|
+
const errorMessage = "exportDashboard request timed out.";
|
|
601
|
+
promises[requestId].reject(new Error(errorMessage));
|
|
602
|
+
delete promises[requestId];
|
|
603
|
+
}
|
|
604
|
+
}, 12e5);
|
|
605
|
+
});
|
|
598
606
|
};
|
|
599
607
|
|
|
600
608
|
// libs/embed-libs/embed/src/lib/shared/methods/get-accessible-dashboards.ts
|
|
601
609
|
var getAccessibleDashboards = async (dashboardComponent) => {
|
|
602
610
|
await dashboardComponent.updateComplete;
|
|
603
|
-
if ((dashboardComponent.currentAuthKey ?? dashboardComponent.authKey) && (dashboardComponent.currentAuthToken ?? dashboardComponent.authToken)) {
|
|
611
|
+
if ((dashboardComponent.currentAuthKey ?? dashboardComponent.authKey) && (dashboardComponent.currentAuthToken ?? dashboardComponent.authToken) && dashboardComponent.params) {
|
|
612
|
+
const { params } = dashboardComponent;
|
|
604
613
|
const fetchUser = new Promise((resolve, reject) => {
|
|
605
614
|
void (() => {
|
|
606
615
|
try {
|
|
607
616
|
const responsePromise = window.fetch(
|
|
608
617
|
// With embedMode="webComponent" URLs remove the trailing slash, since the web component expects them to not have it.
|
|
609
618
|
// Fixes incorrect url with embedMode="webComponent"
|
|
610
|
-
`${addTrailingSlash(
|
|
619
|
+
`${addTrailingSlash(params.apiHost)}0.1.0/authorization`,
|
|
611
620
|
{
|
|
612
621
|
method: "POST",
|
|
613
622
|
mode: "cors",
|
|
@@ -652,136 +661,144 @@ var getAccessibleDashboards = async (dashboardComponent) => {
|
|
|
652
661
|
}
|
|
653
662
|
})();
|
|
654
663
|
});
|
|
655
|
-
return new Promise((resolve, reject) =>
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
data.rows
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
664
|
+
return new Promise((resolve, reject) => {
|
|
665
|
+
void (() => {
|
|
666
|
+
try {
|
|
667
|
+
fetchUser.then((authorizationData) => {
|
|
668
|
+
const responsePromise = window.fetch(
|
|
669
|
+
// With embedMode="webComponent" URLs remove the trailing slash, since the web component expects them to not have it.
|
|
670
|
+
// Fixes incorrect url with embedMode="webComponent"
|
|
671
|
+
`${addTrailingSlash(params.apiHost)}0.1.0/securable`,
|
|
672
|
+
{
|
|
673
|
+
method: "POST",
|
|
674
|
+
mode: "cors",
|
|
675
|
+
cache: "no-cache",
|
|
676
|
+
headers: { "Content-Type": "application/json" },
|
|
677
|
+
redirect: "follow",
|
|
678
|
+
body: JSON.stringify({
|
|
679
|
+
action: "get",
|
|
680
|
+
version: "0.1.0",
|
|
681
|
+
key: dashboardComponent.currentAuthKey ?? dashboardComponent.authKey,
|
|
682
|
+
token: dashboardComponent.currentAuthToken ?? dashboardComponent.authToken,
|
|
683
|
+
find: {
|
|
684
|
+
where: { type: "dashboard", is_variant: false },
|
|
685
|
+
attributes: ["id", "name", "modified_at"],
|
|
686
|
+
order: [["modified_at", "desc"]],
|
|
687
|
+
include: [
|
|
688
|
+
{ model: "Tag", attributes: ["tag"] },
|
|
689
|
+
{ model: "User", attributes: ["id", "name"] },
|
|
690
|
+
{
|
|
691
|
+
model: "Group",
|
|
692
|
+
attributes: ["id", "name", "public"]
|
|
693
|
+
},
|
|
694
|
+
{ model: "Integration", attributes: ["id", "name"] }
|
|
695
|
+
]
|
|
696
|
+
}
|
|
697
|
+
})
|
|
698
|
+
}
|
|
699
|
+
);
|
|
700
|
+
responsePromise.then((response) => response.json()).then((data) => {
|
|
701
|
+
const dashboardList = data.rows.length > 0 ? formatDashboardList(
|
|
702
|
+
data.rows,
|
|
703
|
+
authorizationData.integrationId,
|
|
704
|
+
authorizationData.user,
|
|
705
|
+
dashboardComponent
|
|
706
|
+
) : [];
|
|
707
|
+
resolve(dashboardList);
|
|
708
|
+
});
|
|
709
|
+
}).catch((error) => {
|
|
710
|
+
reject(error);
|
|
698
711
|
});
|
|
699
|
-
}
|
|
712
|
+
} catch (error) {
|
|
700
713
|
reject(error);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
}
|
|
705
|
-
})());
|
|
714
|
+
}
|
|
715
|
+
})();
|
|
716
|
+
});
|
|
706
717
|
}
|
|
707
718
|
throw new Error("No authKey or authToken found in the luzmo-dashboard component.");
|
|
708
719
|
};
|
|
709
720
|
|
|
710
721
|
// libs/embed-libs/embed/src/lib/shared/methods/get-dashboard-context.ts
|
|
711
722
|
var getDashboardContext = (dashboardComponent, iframe) => {
|
|
712
|
-
if (iframe?.contentWindow) {
|
|
713
|
-
|
|
714
|
-
iframe.contentWindow.postMessage(
|
|
715
|
-
{ action: "getDashboardContext", _version: dashboardComponent.libVersion, requestId },
|
|
716
|
-
"*"
|
|
717
|
-
);
|
|
718
|
-
return new Promise((resolve, reject) => {
|
|
719
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
720
|
-
setTimeout(() => {
|
|
721
|
-
if (dashboardComponent.promises[requestId]) {
|
|
722
|
-
const errorMessage = "getDashboardContext request timed out.";
|
|
723
|
-
dashboardComponent.promises[requestId].reject(
|
|
724
|
-
new Error(errorMessage)
|
|
725
|
-
);
|
|
726
|
-
delete dashboardComponent.promises[requestId];
|
|
727
|
-
}
|
|
728
|
-
}, 2e3);
|
|
729
|
-
});
|
|
723
|
+
if (!iframe?.contentWindow) {
|
|
724
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
730
725
|
}
|
|
731
|
-
|
|
726
|
+
const { promises } = dashboardComponent;
|
|
727
|
+
if (!promises) {
|
|
728
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
729
|
+
}
|
|
730
|
+
const requestId = uuidv4();
|
|
731
|
+
iframe.contentWindow.postMessage(
|
|
732
|
+
{ action: "getDashboardContext", _version: dashboardComponent.libVersion, requestId },
|
|
733
|
+
"*"
|
|
734
|
+
);
|
|
735
|
+
return new Promise((resolve, reject) => {
|
|
736
|
+
promises[requestId] = { resolve, reject };
|
|
737
|
+
setTimeout(() => {
|
|
738
|
+
if (promises[requestId]) {
|
|
739
|
+
const errorMessage = "getDashboardContext request timed out.";
|
|
740
|
+
promises[requestId].reject(new Error(errorMessage));
|
|
741
|
+
delete promises[requestId];
|
|
742
|
+
}
|
|
743
|
+
}, 2e3);
|
|
744
|
+
});
|
|
732
745
|
};
|
|
733
746
|
|
|
734
747
|
// libs/embed-libs/embed/src/lib/shared/methods/get-data.ts
|
|
735
748
|
var getData = (dashboardComponent, iframe, itemId) => {
|
|
736
|
-
if (iframe?.contentWindow) {
|
|
737
|
-
|
|
738
|
-
iframe.contentWindow.postMessage(
|
|
739
|
-
{
|
|
740
|
-
action: "getData",
|
|
741
|
-
id: itemId,
|
|
742
|
-
_version: dashboardComponent.libVersion,
|
|
743
|
-
requestId
|
|
744
|
-
},
|
|
745
|
-
"*"
|
|
746
|
-
);
|
|
747
|
-
return new Promise((resolve, reject) => {
|
|
748
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
749
|
-
setTimeout(() => {
|
|
750
|
-
if (dashboardComponent.promises[requestId]) {
|
|
751
|
-
const errorMessage = "getData request timed out.";
|
|
752
|
-
dashboardComponent.promises[requestId].reject(
|
|
753
|
-
new Error(errorMessage)
|
|
754
|
-
);
|
|
755
|
-
delete dashboardComponent.promises[requestId];
|
|
756
|
-
}
|
|
757
|
-
}, 2e3);
|
|
758
|
-
});
|
|
749
|
+
if (!iframe?.contentWindow) {
|
|
750
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
759
751
|
}
|
|
760
|
-
|
|
752
|
+
const { promises } = dashboardComponent;
|
|
753
|
+
if (!promises) {
|
|
754
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
755
|
+
}
|
|
756
|
+
const requestId = uuidv4();
|
|
757
|
+
iframe.contentWindow.postMessage(
|
|
758
|
+
{
|
|
759
|
+
action: "getData",
|
|
760
|
+
id: itemId,
|
|
761
|
+
_version: dashboardComponent.libVersion,
|
|
762
|
+
requestId
|
|
763
|
+
},
|
|
764
|
+
"*"
|
|
765
|
+
);
|
|
766
|
+
return new Promise((resolve, reject) => {
|
|
767
|
+
promises[requestId] = { resolve, reject };
|
|
768
|
+
setTimeout(() => {
|
|
769
|
+
if (promises[requestId]) {
|
|
770
|
+
const errorMessage = "getData request timed out.";
|
|
771
|
+
promises[requestId].reject(new Error(errorMessage));
|
|
772
|
+
delete promises[requestId];
|
|
773
|
+
}
|
|
774
|
+
}, 2e3);
|
|
775
|
+
});
|
|
761
776
|
};
|
|
762
777
|
|
|
763
778
|
// libs/embed-libs/embed/src/lib/shared/methods/get-filters.ts
|
|
764
779
|
var getFilters = (dashboardComponent, iframe) => {
|
|
765
|
-
if (iframe?.contentWindow) {
|
|
766
|
-
|
|
767
|
-
iframe.contentWindow.postMessage(
|
|
768
|
-
{ action: "getFilters", _version: dashboardComponent.libVersion, requestId },
|
|
769
|
-
"*"
|
|
770
|
-
);
|
|
771
|
-
return new Promise((resolve, reject) => {
|
|
772
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
773
|
-
setTimeout(() => {
|
|
774
|
-
if (dashboardComponent.promises[requestId]) {
|
|
775
|
-
const errorMessage = "getFilters request timed out.";
|
|
776
|
-
dashboardComponent.promises[requestId].reject(
|
|
777
|
-
new Error(errorMessage)
|
|
778
|
-
);
|
|
779
|
-
delete dashboardComponent.promises[requestId];
|
|
780
|
-
}
|
|
781
|
-
}, 2e3);
|
|
782
|
-
});
|
|
780
|
+
if (!iframe?.contentWindow) {
|
|
781
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
783
782
|
}
|
|
784
|
-
|
|
783
|
+
const { promises } = dashboardComponent;
|
|
784
|
+
if (!promises) {
|
|
785
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
786
|
+
}
|
|
787
|
+
const requestId = uuidv4();
|
|
788
|
+
iframe.contentWindow.postMessage(
|
|
789
|
+
{ action: "getFilters", _version: dashboardComponent.libVersion, requestId },
|
|
790
|
+
"*"
|
|
791
|
+
);
|
|
792
|
+
return new Promise((resolve, reject) => {
|
|
793
|
+
promises[requestId] = { resolve, reject };
|
|
794
|
+
setTimeout(() => {
|
|
795
|
+
if (promises[requestId]) {
|
|
796
|
+
const errorMessage = "getFilters request timed out.";
|
|
797
|
+
promises[requestId].reject(new Error(errorMessage));
|
|
798
|
+
delete promises[requestId];
|
|
799
|
+
}
|
|
800
|
+
}, 2e3);
|
|
801
|
+
});
|
|
785
802
|
};
|
|
786
803
|
|
|
787
804
|
// libs/embed-libs/embed/src/lib/shared/methods/get-insights.ts
|
|
@@ -789,6 +806,10 @@ var getInsights = (dashboardComponent, iframe, options = {}) => {
|
|
|
789
806
|
if (!iframe?.contentWindow) {
|
|
790
807
|
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
791
808
|
}
|
|
809
|
+
const { promises } = dashboardComponent;
|
|
810
|
+
if (!promises) {
|
|
811
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
812
|
+
}
|
|
792
813
|
const requestId = uuidv4();
|
|
793
814
|
iframe.contentWindow.postMessage(
|
|
794
815
|
{
|
|
@@ -800,11 +821,11 @@ var getInsights = (dashboardComponent, iframe, options = {}) => {
|
|
|
800
821
|
"*"
|
|
801
822
|
);
|
|
802
823
|
return new Promise((resolve, reject) => {
|
|
803
|
-
|
|
824
|
+
promises[requestId] = { resolve, reject };
|
|
804
825
|
setTimeout(() => {
|
|
805
|
-
if (
|
|
806
|
-
|
|
807
|
-
delete
|
|
826
|
+
if (promises[requestId]) {
|
|
827
|
+
promises[requestId].reject(new Error("getInsights request timed out."));
|
|
828
|
+
delete promises[requestId];
|
|
808
829
|
}
|
|
809
830
|
}, 6e4);
|
|
810
831
|
});
|
|
@@ -812,7 +833,7 @@ var getInsights = (dashboardComponent, iframe, options = {}) => {
|
|
|
812
833
|
|
|
813
834
|
// libs/embed-libs/embed/src/lib/shared/methods/refresh-data.ts
|
|
814
835
|
var refreshData = (dashboardComponent, iframe, itemId) => {
|
|
815
|
-
if (iframe) {
|
|
836
|
+
if (iframe?.contentWindow) {
|
|
816
837
|
iframe.contentWindow.postMessage(
|
|
817
838
|
{
|
|
818
839
|
action: "refreshData",
|
|
@@ -828,7 +849,7 @@ var refreshData = (dashboardComponent, iframe, itemId) => {
|
|
|
828
849
|
|
|
829
850
|
// libs/embed-libs/embed/src/lib/shared/methods/reload-dashboard.ts
|
|
830
851
|
var reloadDashboard = (dashboardComponent, iframe) => {
|
|
831
|
-
if (iframe) {
|
|
852
|
+
if (iframe?.contentWindow) {
|
|
832
853
|
iframe.contentWindow.postMessage(
|
|
833
854
|
{ action: "reloadDashboard", _version: dashboardComponent.libVersion },
|
|
834
855
|
"*"
|
|
@@ -840,7 +861,7 @@ var reloadDashboard = (dashboardComponent, iframe) => {
|
|
|
840
861
|
|
|
841
862
|
// libs/embed-libs/embed/src/lib/shared/methods/send-export-email.ts
|
|
842
863
|
var sendExportEmail = (dashboardComponent, iframe, type, subject, message) => {
|
|
843
|
-
if (iframe) {
|
|
864
|
+
if (iframe?.contentWindow) {
|
|
844
865
|
iframe.contentWindow.postMessage(
|
|
845
866
|
{
|
|
846
867
|
action: "sendExportEmail",
|
|
@@ -858,7 +879,7 @@ var sendExportEmail = (dashboardComponent, iframe, type, subject, message) => {
|
|
|
858
879
|
|
|
859
880
|
// libs/embed-libs/embed/src/lib/shared/methods/set-authorization.ts
|
|
860
881
|
var setAuthorization = (dashboardComponent, iframe, key, token) => {
|
|
861
|
-
if (iframe) {
|
|
882
|
+
if (iframe?.contentWindow) {
|
|
862
883
|
iframe.contentWindow.postMessage(
|
|
863
884
|
{
|
|
864
885
|
action: "setAuthorization",
|
|
@@ -875,92 +896,100 @@ var setAuthorization = (dashboardComponent, iframe, key, token) => {
|
|
|
875
896
|
|
|
876
897
|
// libs/embed-libs/embed/src/lib/shared/methods/set-edit-mode.ts
|
|
877
898
|
var setEditMode = (dashboardComponent, iframe, editMode) => {
|
|
878
|
-
if (iframe
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
_version: dashboardComponent.libVersion,
|
|
896
|
-
requestId
|
|
897
|
-
},
|
|
898
|
-
"*"
|
|
899
|
+
if (!iframe?.contentWindow) {
|
|
900
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
901
|
+
}
|
|
902
|
+
const { params, promises } = dashboardComponent;
|
|
903
|
+
if (!params || !promises) {
|
|
904
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
905
|
+
}
|
|
906
|
+
const requestId = uuidv4();
|
|
907
|
+
if (params.editMode === editMode) {
|
|
908
|
+
return Promise.reject(
|
|
909
|
+
new Error("editMode parameter is currently already set to " + editMode)
|
|
910
|
+
);
|
|
911
|
+
} else if (editMode !== "editFull" && editMode !== "editLimited" && editMode !== "view") {
|
|
912
|
+
return Promise.reject(
|
|
913
|
+
new Error(
|
|
914
|
+
"The editMode parameter must be one of the following values: 'editFull', 'editLimited' or 'view'."
|
|
915
|
+
)
|
|
899
916
|
);
|
|
900
|
-
return new Promise((resolve, reject) => {
|
|
901
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
902
|
-
});
|
|
903
917
|
}
|
|
904
|
-
|
|
918
|
+
iframe.contentWindow.postMessage(
|
|
919
|
+
{
|
|
920
|
+
action: "setEditMode",
|
|
921
|
+
editMode,
|
|
922
|
+
_version: dashboardComponent.libVersion,
|
|
923
|
+
requestId
|
|
924
|
+
},
|
|
925
|
+
"*"
|
|
926
|
+
);
|
|
927
|
+
return new Promise((resolve, reject) => {
|
|
928
|
+
promises[requestId] = { resolve, reject };
|
|
929
|
+
});
|
|
905
930
|
};
|
|
906
931
|
|
|
907
932
|
// libs/embed-libs/embed/src/lib/shared/methods/set-preview.ts
|
|
908
933
|
var setPreview = (dashboardComponent, iframe, preview) => {
|
|
909
|
-
if (iframe) {
|
|
910
|
-
|
|
911
|
-
iframe.contentWindow.postMessage(
|
|
912
|
-
{
|
|
913
|
-
action: "setPreview",
|
|
914
|
-
preview,
|
|
915
|
-
requestId,
|
|
916
|
-
_version: dashboardComponent.libVersion
|
|
917
|
-
},
|
|
918
|
-
"*"
|
|
919
|
-
);
|
|
920
|
-
return new Promise((resolve, reject) => {
|
|
921
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
922
|
-
setTimeout(() => {
|
|
923
|
-
if (dashboardComponent.promises[requestId]) {
|
|
924
|
-
const errorMessage = "setPreview request timed out.";
|
|
925
|
-
dashboardComponent.promises[requestId].reject(
|
|
926
|
-
new Error(errorMessage)
|
|
927
|
-
);
|
|
928
|
-
delete dashboardComponent.promises[requestId];
|
|
929
|
-
}
|
|
930
|
-
}, 2e3);
|
|
931
|
-
});
|
|
934
|
+
if (!iframe?.contentWindow) {
|
|
935
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
932
936
|
}
|
|
933
|
-
|
|
937
|
+
const { promises } = dashboardComponent;
|
|
938
|
+
if (!promises) {
|
|
939
|
+
return Promise.reject(new Error("Cannot retrieve contentWindow."));
|
|
940
|
+
}
|
|
941
|
+
const requestId = uuidv4();
|
|
942
|
+
iframe.contentWindow.postMessage(
|
|
943
|
+
{
|
|
944
|
+
action: "setPreview",
|
|
945
|
+
preview,
|
|
946
|
+
requestId,
|
|
947
|
+
_version: dashboardComponent.libVersion
|
|
948
|
+
},
|
|
949
|
+
"*"
|
|
950
|
+
);
|
|
951
|
+
return new Promise((resolve, reject) => {
|
|
952
|
+
promises[requestId] = { resolve, reject };
|
|
953
|
+
setTimeout(() => {
|
|
954
|
+
if (promises[requestId]) {
|
|
955
|
+
const errorMessage = "setPreview request timed out.";
|
|
956
|
+
promises[requestId].reject(new Error(errorMessage));
|
|
957
|
+
delete promises[requestId];
|
|
958
|
+
}
|
|
959
|
+
}, 2e3);
|
|
960
|
+
});
|
|
934
961
|
};
|
|
935
962
|
|
|
936
963
|
// libs/embed-libs/embed/src/lib/shared/methods/set-selected-data.ts
|
|
937
964
|
var setSelectedData = (dashboardComponent, iframe, itemId, filters) => {
|
|
938
|
-
if (iframe) {
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
filters,
|
|
945
|
-
_version: dashboardComponent.libVersion,
|
|
946
|
-
requestId
|
|
947
|
-
},
|
|
948
|
-
"*"
|
|
949
|
-
);
|
|
950
|
-
return new Promise((resolve, reject) => {
|
|
951
|
-
dashboardComponent.promises[requestId] = { resolve, reject };
|
|
952
|
-
setTimeout(() => {
|
|
953
|
-
if (dashboardComponent.promises[requestId]) {
|
|
954
|
-
const errorMessage = "setSelectedData request timed out.";
|
|
955
|
-
dashboardComponent.promises[requestId].reject(
|
|
956
|
-
new Error(errorMessage)
|
|
957
|
-
);
|
|
958
|
-
delete dashboardComponent.promises[requestId];
|
|
959
|
-
}
|
|
960
|
-
}, 2e3);
|
|
961
|
-
});
|
|
965
|
+
if (!iframe?.contentWindow) {
|
|
966
|
+
return Promise.reject();
|
|
967
|
+
}
|
|
968
|
+
const { promises } = dashboardComponent;
|
|
969
|
+
if (!promises) {
|
|
970
|
+
return Promise.reject();
|
|
962
971
|
}
|
|
963
|
-
|
|
972
|
+
const requestId = uuidv4();
|
|
973
|
+
iframe.contentWindow.postMessage(
|
|
974
|
+
{
|
|
975
|
+
action: "setSelectedData",
|
|
976
|
+
itemId,
|
|
977
|
+
filters,
|
|
978
|
+
_version: dashboardComponent.libVersion,
|
|
979
|
+
requestId
|
|
980
|
+
},
|
|
981
|
+
"*"
|
|
982
|
+
);
|
|
983
|
+
return new Promise((resolve, reject) => {
|
|
984
|
+
promises[requestId] = { resolve, reject };
|
|
985
|
+
setTimeout(() => {
|
|
986
|
+
if (promises[requestId]) {
|
|
987
|
+
const errorMessage = "setSelectedData request timed out.";
|
|
988
|
+
promises[requestId].reject(new Error(errorMessage));
|
|
989
|
+
delete promises[requestId];
|
|
990
|
+
}
|
|
991
|
+
}, 2e3);
|
|
992
|
+
});
|
|
964
993
|
};
|
|
965
994
|
|
|
966
995
|
// libs/embed-libs/embed/src/lib/shared/service/calculate-dimensions.ts
|
|
@@ -1006,6 +1035,9 @@ var _setCalculatedDimensions = (dashboardComponent) => {
|
|
|
1006
1035
|
for (const key of dashboardDimensionKeys) {
|
|
1007
1036
|
if (screenModes.includes(key)) {
|
|
1008
1037
|
const screenMode = EXTENTS.find((extent) => extent.mode === key);
|
|
1038
|
+
if (!screenMode) {
|
|
1039
|
+
continue;
|
|
1040
|
+
}
|
|
1009
1041
|
availableScreenModeExtents.push({
|
|
1010
1042
|
...screenMode,
|
|
1011
1043
|
height: dashboardComponent.dimensions[key][1] || 50
|
|
@@ -1060,24 +1092,27 @@ var _setCalculatedDimensions = (dashboardComponent) => {
|
|
|
1060
1092
|
),
|
|
1061
1093
|
screenModeExtentMinWidth
|
|
1062
1094
|
);
|
|
1063
|
-
currentHeight = screenModeExtent.height;
|
|
1095
|
+
currentHeight = screenModeExtent.height ?? 0;
|
|
1064
1096
|
}
|
|
1065
1097
|
}
|
|
1066
1098
|
}
|
|
1067
1099
|
}
|
|
1068
1100
|
} else {
|
|
1069
|
-
const
|
|
1070
|
-
height: chosenModeHeight,
|
|
1071
|
-
width: [chosenModeMinWidth, chosenModeMaxWidth]
|
|
1072
|
-
} = availableScreenModeExtents.find(
|
|
1101
|
+
const chosenModeExtent = availableScreenModeExtents.find(
|
|
1073
1102
|
(d) => d.mode === dashboardComponent.params.screenMode
|
|
1074
1103
|
);
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1104
|
+
if (chosenModeExtent) {
|
|
1105
|
+
const {
|
|
1106
|
+
height: chosenModeHeight,
|
|
1107
|
+
width: [chosenModeMinWidth, chosenModeMaxWidth]
|
|
1108
|
+
} = chosenModeExtent;
|
|
1109
|
+
currentMode = dashboardComponent.params.screenMode;
|
|
1110
|
+
currentWidth = Math.max(
|
|
1111
|
+
Math.min(chosenModeMaxWidth, dashboardComponent.containerWidth),
|
|
1112
|
+
chosenModeMinWidth
|
|
1113
|
+
);
|
|
1114
|
+
currentHeight = chosenModeHeight ?? 0;
|
|
1115
|
+
}
|
|
1081
1116
|
if (dashboardComponent.params.itemEmbedding) {
|
|
1082
1117
|
if (dashboardComponent.params.itemDimensions?.width && dashboardComponent.params.itemDimensions?.width !== "auto") {
|
|
1083
1118
|
currentWidth = Number.parseInt(
|
|
@@ -1097,7 +1132,7 @@ var _setCalculatedDimensions = (dashboardComponent) => {
|
|
|
1097
1132
|
const [lowestModeExtent] = availableScreenModeExtents;
|
|
1098
1133
|
currentMode = lowestModeExtent.mode;
|
|
1099
1134
|
currentWidth = lowestModeExtent.width[0];
|
|
1100
|
-
currentHeight = lowestModeExtent.height;
|
|
1135
|
+
currentHeight = lowestModeExtent.height ?? 0;
|
|
1101
1136
|
}
|
|
1102
1137
|
}
|
|
1103
1138
|
dashboardComponent.currentScreenMode = currentMode;
|
|
@@ -1159,6 +1194,9 @@ var _extendAndValidate = (dashboardContent) => {
|
|
|
1159
1194
|
"fixed",
|
|
1160
1195
|
"auto"
|
|
1161
1196
|
];
|
|
1197
|
+
if (!dashboardContent.params) {
|
|
1198
|
+
dashboardContent.params = {};
|
|
1199
|
+
}
|
|
1162
1200
|
for (const key of defaultKeys) {
|
|
1163
1201
|
if (dashboardContent.params[key] === null) {
|
|
1164
1202
|
delete dashboardContent.params[key];
|
|
@@ -1226,17 +1264,20 @@ var _extendAndValidate = (dashboardContent) => {
|
|
|
1226
1264
|
if (dashboardContent.params.screenMode && dashboardContent.params.screenMode !== "auto") {
|
|
1227
1265
|
dashboardContent.params.switchScreenModeOnResize = false;
|
|
1228
1266
|
}
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1267
|
+
const itemDimensions = dashboardContent.params.itemDimensions;
|
|
1268
|
+
if (itemDimensions) {
|
|
1269
|
+
if (itemDimensions.width !== "auto") {
|
|
1270
|
+
itemDimensions.width = Number.parseInt(
|
|
1271
|
+
`${itemDimensions.width}`.replace("px", ""),
|
|
1272
|
+
10
|
|
1273
|
+
) || "auto";
|
|
1274
|
+
}
|
|
1275
|
+
if (itemDimensions.height !== "auto") {
|
|
1276
|
+
itemDimensions.height = Number.parseInt(
|
|
1277
|
+
`${itemDimensions.height}`.replace("px", ""),
|
|
1278
|
+
10
|
|
1279
|
+
) || "auto";
|
|
1280
|
+
}
|
|
1240
1281
|
}
|
|
1241
1282
|
dashboardContent.params.itemEmbedding = !!dashboardContent.params.itemId;
|
|
1242
1283
|
if (dashboardContent.params.error || errorMessages.length > 0) {
|
|
@@ -1248,6 +1289,7 @@ var _extendAndValidate = (dashboardContent) => {
|
|
|
1248
1289
|
var libraryTypeToWebComponentTypeMapping = {
|
|
1249
1290
|
type: "type",
|
|
1250
1291
|
slots: "slots",
|
|
1292
|
+
inlineData: "inline-data",
|
|
1251
1293
|
options: "options",
|
|
1252
1294
|
appServer: "app-server",
|
|
1253
1295
|
apiHost: "api-host",
|
|
@@ -1378,7 +1420,7 @@ import { property, query, state } from "lit/decorators.js";
|
|
|
1378
1420
|
import { styleMap } from "lit/directives/style-map.js";
|
|
1379
1421
|
|
|
1380
1422
|
// libs/embed-libs/embed/package.json
|
|
1381
|
-
var version = "8.
|
|
1423
|
+
var version = "8.1.0";
|
|
1382
1424
|
|
|
1383
1425
|
// libs/embed-libs/embed/src/lib/utils/embed-error.utils.ts
|
|
1384
1426
|
function buildEmbedErrorDetail(errorMsg) {
|
|
@@ -1797,8 +1839,8 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
1797
1839
|
this.browserNotSupported = [];
|
|
1798
1840
|
this.libVersion = version + "-wc-luzmo";
|
|
1799
1841
|
this.isLibraryLoaded = false;
|
|
1800
|
-
this.currentAuthKey =
|
|
1801
|
-
this.currentAuthToken =
|
|
1842
|
+
this.currentAuthKey = void 0;
|
|
1843
|
+
this.currentAuthToken = void 0;
|
|
1802
1844
|
this.isInitCalled = false;
|
|
1803
1845
|
this.attributesMap = {
|
|
1804
1846
|
dashboardId: "dashboard-id",
|
|
@@ -1936,6 +1978,9 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
1936
1978
|
this.dashboardErrorMsg = "";
|
|
1937
1979
|
const appServer = this.params.appServer;
|
|
1938
1980
|
const libraryLoadId = ++this._webComponentLibraryLoadId;
|
|
1981
|
+
if (!appServer) {
|
|
1982
|
+
return;
|
|
1983
|
+
}
|
|
1939
1984
|
loadLibrary(appServer, dashboardRemote).then(async () => {
|
|
1940
1985
|
if (libraryLoadId !== this._webComponentLibraryLoadId || !this.isWebComponentViewMode() || this.params.appServer !== appServer) {
|
|
1941
1986
|
return;
|
|
@@ -2392,8 +2437,9 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
2392
2437
|
}
|
|
2393
2438
|
// Public methods
|
|
2394
2439
|
getData(itemId) {
|
|
2395
|
-
|
|
2396
|
-
|
|
2440
|
+
const dashboardReference = this.dashboardReference;
|
|
2441
|
+
if (this.isWebComponentViewMode() && dashboardReference) {
|
|
2442
|
+
return Promise.resolve().then(() => dashboardReference.getData(itemId));
|
|
2397
2443
|
}
|
|
2398
2444
|
if (!this.isWebComponentViewMode()) {
|
|
2399
2445
|
return getData(this, this.iframe, itemId);
|
|
@@ -2478,6 +2524,9 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
2478
2524
|
return getAccessibleDashboards(this);
|
|
2479
2525
|
}
|
|
2480
2526
|
addFilters(itemId, filters) {
|
|
2527
|
+
if (!this.dashboardReference) {
|
|
2528
|
+
return Promise.reject();
|
|
2529
|
+
}
|
|
2481
2530
|
return this.dashboardReference.addFilters(itemId, filters);
|
|
2482
2531
|
}
|
|
2483
2532
|
setEditMode(editMode) {
|
|
@@ -2490,7 +2539,7 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
2490
2539
|
editMode
|
|
2491
2540
|
});
|
|
2492
2541
|
}
|
|
2493
|
-
if (this.dashboardReference && ["editFull", "editLimited"].includes(editMode)) {
|
|
2542
|
+
if (this.dashboardReference && editMode && ["editFull", "editLimited"].includes(editMode)) {
|
|
2494
2543
|
this.editMode = editMode;
|
|
2495
2544
|
this.params.editMode = editMode;
|
|
2496
2545
|
this.initComponent();
|
|
@@ -2499,7 +2548,7 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
2499
2548
|
editMode
|
|
2500
2549
|
});
|
|
2501
2550
|
}
|
|
2502
|
-
if (this.isWebComponentViewMode() && this.dashboardReference) {
|
|
2551
|
+
if (this.isWebComponentViewMode() && this.dashboardReference && editMode) {
|
|
2503
2552
|
return this.dashboardReference.setEditMode(editMode);
|
|
2504
2553
|
}
|
|
2505
2554
|
if (!this.isWebComponentViewMode()) {
|
|
@@ -2514,7 +2563,7 @@ var LuzmoDashboard = class extends LitElement {
|
|
|
2514
2563
|
return setPreview(this, this.iframe, preview);
|
|
2515
2564
|
}
|
|
2516
2565
|
sendExportEmail(type, subject, message) {
|
|
2517
|
-
if (this.isWebComponentViewMode() && this.dashboardReference) {
|
|
2566
|
+
if (this.isWebComponentViewMode() && this.dashboardReference && type) {
|
|
2518
2567
|
return this.dashboardReference.sendExportEmail(type, subject, message);
|
|
2519
2568
|
} else if (!this.isWebComponentViewMode()) {
|
|
2520
2569
|
return sendExportEmail(this, this.iframe, type, subject, message);
|
|
@@ -2726,22 +2775,6 @@ var LuzmoBaseVizItem = class extends LitElement2 {
|
|
|
2726
2775
|
this.libVersion = version + "-wc-luzmo";
|
|
2727
2776
|
this.postInitCallQueue = [];
|
|
2728
2777
|
}
|
|
2729
|
-
static {
|
|
2730
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
2731
|
-
this.styles = css2`
|
|
2732
|
-
:host {
|
|
2733
|
-
display: block;
|
|
2734
|
-
width: 100%;
|
|
2735
|
-
height: 100%;
|
|
2736
|
-
}
|
|
2737
|
-
|
|
2738
|
-
luzmo-embed-viz-item {
|
|
2739
|
-
width: 100%;
|
|
2740
|
-
height: 1000%;
|
|
2741
|
-
display: block;
|
|
2742
|
-
}
|
|
2743
|
-
`;
|
|
2744
|
-
}
|
|
2745
2778
|
createRenderRoot() {
|
|
2746
2779
|
if (!this.style.display) {
|
|
2747
2780
|
this.style.display = "block";
|
|
@@ -2771,6 +2804,7 @@ var LuzmoBaseVizItem = class extends LitElement2 {
|
|
|
2771
2804
|
id: this.contextId ?? this.getAttribute("context-id") ?? this.id ?? this.itemId ?? "",
|
|
2772
2805
|
type: this.type,
|
|
2773
2806
|
slots,
|
|
2807
|
+
inlineData: this.inlineData,
|
|
2774
2808
|
options: this.options,
|
|
2775
2809
|
filters: typeof this.chartElement?.getContextFilters === "function" ? this.chartElement.getContextFilters() : typeof this.chartElement?.getFilters === "function" ? this.getFilters() : [],
|
|
2776
2810
|
datasetIds: collectVizItemDatasetIds(slots)
|
|
@@ -2833,18 +2867,31 @@ var LuzmoBaseVizItem = class extends LitElement2 {
|
|
|
2833
2867
|
});
|
|
2834
2868
|
this.chartElement.addEventListener("changedFilters", (payload) => {
|
|
2835
2869
|
this.dispatchEvent(new CustomEvent("changedFilters", payload));
|
|
2836
|
-
this.dispatchEvent(
|
|
2837
|
-
|
|
2838
|
-
|
|
2870
|
+
this.dispatchEvent(
|
|
2871
|
+
new CustomEvent("contextChanged", {
|
|
2872
|
+
detail: { data: { type: "contextChanged", context: this.getVizItemContext() } }
|
|
2873
|
+
})
|
|
2874
|
+
);
|
|
2839
2875
|
});
|
|
2840
|
-
this.chartElement.addEventListener(
|
|
2841
|
-
|
|
2876
|
+
this.chartElement.addEventListener(
|
|
2877
|
+
"exported",
|
|
2878
|
+
(payload) => this.dispatchEvent(new CustomEvent("exported", payload))
|
|
2879
|
+
);
|
|
2880
|
+
this.chartElement.addEventListener(
|
|
2881
|
+
"customEvent",
|
|
2882
|
+
(payload) => this.dispatchEvent(new CustomEvent("customEvent", payload))
|
|
2883
|
+
);
|
|
2842
2884
|
this.chartElement.addEventListener("error", (event) => {
|
|
2843
|
-
this.dispatchEvent(
|
|
2844
|
-
|
|
2845
|
-
|
|
2885
|
+
this.dispatchEvent(
|
|
2886
|
+
new CustomEvent("error", {
|
|
2887
|
+
detail: normalizeEmbedErrorDetail(event.detail)
|
|
2888
|
+
})
|
|
2889
|
+
);
|
|
2846
2890
|
});
|
|
2847
|
-
this.chartElement.addEventListener(
|
|
2891
|
+
this.chartElement.addEventListener(
|
|
2892
|
+
"authorizationExpired",
|
|
2893
|
+
(payload) => this.dispatchEvent(new CustomEvent("authorizationExpired", payload))
|
|
2894
|
+
);
|
|
2848
2895
|
this.updateVizItemProperties();
|
|
2849
2896
|
this.renderRoot.append(this.chartElement);
|
|
2850
2897
|
}
|
|
@@ -2867,8 +2914,21 @@ var LuzmoBaseVizItem = class extends LitElement2 {
|
|
|
2867
2914
|
if (this.chartElement) {
|
|
2868
2915
|
for (const [propertyName] of changedProperties.entries()) {
|
|
2869
2916
|
const mappedAttributeName = libraryTypeToWebComponentTypeMapping[propertyName] ?? propertyName;
|
|
2870
|
-
const
|
|
2871
|
-
|
|
2917
|
+
const value = this[propertyName];
|
|
2918
|
+
if (propertyName === "inlineData" && (value === void 0 || value === null)) {
|
|
2919
|
+
this.inlineData = void 0;
|
|
2920
|
+
this.chartElement.removeAttribute(mappedAttributeName);
|
|
2921
|
+
} else {
|
|
2922
|
+
const attributeValue = typeof value === "object" ? JSON.stringify(value) : value?.toString() ?? value;
|
|
2923
|
+
this.chartElement.setAttribute(mappedAttributeName, attributeValue);
|
|
2924
|
+
}
|
|
2925
|
+
}
|
|
2926
|
+
if (["inlineData", "options", "slots"].some((propertyName) => changedProperties.has(propertyName))) {
|
|
2927
|
+
this.dispatchEvent(
|
|
2928
|
+
new CustomEvent("contextChanged", {
|
|
2929
|
+
detail: { data: { type: "contextChanged", context: this.getVizItemContext() } }
|
|
2930
|
+
})
|
|
2931
|
+
);
|
|
2872
2932
|
}
|
|
2873
2933
|
} else {
|
|
2874
2934
|
if (this.canInitializeVizItem()) {
|
|
@@ -2878,9 +2938,23 @@ var LuzmoBaseVizItem = class extends LitElement2 {
|
|
|
2878
2938
|
}
|
|
2879
2939
|
}
|
|
2880
2940
|
render() {
|
|
2881
|
-
return html2
|
|
2941
|
+
return html2``;
|
|
2882
2942
|
}
|
|
2883
2943
|
};
|
|
2944
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
2945
|
+
LuzmoBaseVizItem.styles = css2`
|
|
2946
|
+
:host {
|
|
2947
|
+
display: block;
|
|
2948
|
+
width: 100%;
|
|
2949
|
+
height: 100%;
|
|
2950
|
+
}
|
|
2951
|
+
|
|
2952
|
+
luzmo-embed-viz-item {
|
|
2953
|
+
width: 100%;
|
|
2954
|
+
height: 1000%;
|
|
2955
|
+
display: block;
|
|
2956
|
+
}
|
|
2957
|
+
`;
|
|
2884
2958
|
__decorateClass([
|
|
2885
2959
|
property2()
|
|
2886
2960
|
], LuzmoBaseVizItem.prototype, "appServer", 2);
|
|
@@ -2890,6 +2964,9 @@ __decorateClass([
|
|
|
2890
2964
|
__decorateClass([
|
|
2891
2965
|
property2({ type: Array })
|
|
2892
2966
|
], LuzmoBaseVizItem.prototype, "slots", 2);
|
|
2967
|
+
__decorateClass([
|
|
2968
|
+
property2({ type: Object })
|
|
2969
|
+
], LuzmoBaseVizItem.prototype, "inlineData", 2);
|
|
2893
2970
|
__decorateClass([
|
|
2894
2971
|
property2({ type: Object })
|
|
2895
2972
|
], LuzmoBaseVizItem.prototype, "options", 2);
|
|
@@ -2911,6 +2988,9 @@ __decorateClass([
|
|
|
2911
2988
|
__decorateClass([
|
|
2912
2989
|
property2({
|
|
2913
2990
|
converter: (value) => {
|
|
2991
|
+
if (value == null) {
|
|
2992
|
+
return value;
|
|
2993
|
+
}
|
|
2914
2994
|
try {
|
|
2915
2995
|
return JSON.parse(value);
|
|
2916
2996
|
} catch {
|
|
@@ -2980,16 +3060,6 @@ var LuzmoIQEmbedChatComponent = class extends LitElement3 {
|
|
|
2980
3060
|
this.remoteEntryServer = "http://localhost:4202/";
|
|
2981
3061
|
this.aydHost = "https://ayd.luzmo.com/";
|
|
2982
3062
|
}
|
|
2983
|
-
static {
|
|
2984
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
2985
|
-
this.styles = css3`
|
|
2986
|
-
:host {
|
|
2987
|
-
display: block;
|
|
2988
|
-
width: 100%;
|
|
2989
|
-
height: 100%;
|
|
2990
|
-
}
|
|
2991
|
-
`;
|
|
2992
|
-
}
|
|
2993
3063
|
createRenderRoot() {
|
|
2994
3064
|
return this;
|
|
2995
3065
|
}
|
|
@@ -3067,6 +3137,14 @@ var LuzmoIQEmbedChatComponent = class extends LitElement3 {
|
|
|
3067
3137
|
observer.observe(embedChat, { childList: true, subtree: true });
|
|
3068
3138
|
}
|
|
3069
3139
|
};
|
|
3140
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
3141
|
+
LuzmoIQEmbedChatComponent.styles = css3`
|
|
3142
|
+
:host {
|
|
3143
|
+
display: block;
|
|
3144
|
+
width: 100%;
|
|
3145
|
+
height: 100%;
|
|
3146
|
+
}
|
|
3147
|
+
`;
|
|
3070
3148
|
__decorateClass([
|
|
3071
3149
|
property3()
|
|
3072
3150
|
], LuzmoIQEmbedChatComponent.prototype, "appServer", 2);
|
|
@@ -3143,16 +3221,6 @@ var LuzmoIQEmbedAnswerComponent = class extends LitElement4 {
|
|
|
3143
3221
|
this.libVersion = version + "-wc-luzmo";
|
|
3144
3222
|
this.remoteEntryServer = "http://localhost:4202";
|
|
3145
3223
|
}
|
|
3146
|
-
static {
|
|
3147
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
3148
|
-
this.styles = css4`
|
|
3149
|
-
:host {
|
|
3150
|
-
display: block;
|
|
3151
|
-
width: 100%;
|
|
3152
|
-
height: 100%;
|
|
3153
|
-
}
|
|
3154
|
-
`;
|
|
3155
|
-
}
|
|
3156
3224
|
createRenderRoot() {
|
|
3157
3225
|
return this;
|
|
3158
3226
|
}
|
|
@@ -3203,6 +3271,14 @@ var LuzmoIQEmbedAnswerComponent = class extends LitElement4 {
|
|
|
3203
3271
|
return html4` `;
|
|
3204
3272
|
}
|
|
3205
3273
|
};
|
|
3274
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
3275
|
+
LuzmoIQEmbedAnswerComponent.styles = css4`
|
|
3276
|
+
:host {
|
|
3277
|
+
display: block;
|
|
3278
|
+
width: 100%;
|
|
3279
|
+
height: 100%;
|
|
3280
|
+
}
|
|
3281
|
+
`;
|
|
3206
3282
|
__decorateClass([
|
|
3207
3283
|
property4()
|
|
3208
3284
|
], LuzmoIQEmbedAnswerComponent.prototype, "appServer", 2);
|